@devix-tecnologia/directus-extension-mapgrid 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +5 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{useCollection as t,useSync as e,defineLayout as
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*/!function(t){var e="1.9.4";function n(t){var e,n,i,o;for(n=1,i=arguments.length;n<i;n++)for(e in o=arguments[n])t[e]=o[e];return t}var i=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function o(t,e){var n=Array.prototype.slice;if(t.bind)return t.bind.apply(t,n.call(arguments,1));var i=n.call(arguments,2);return function(){return t.apply(e,i.length?i.concat(n.call(arguments)):arguments)}}var r=0;function s(t){return"_leaflet_id"in t||(t._leaflet_id=++r),t._leaflet_id}function a(t,e,n){var i,o,r,s;return s=function(){i=!1,o&&(r.apply(n,o),o=!1)},r=function(){i?o=arguments:(t.apply(n,arguments),setTimeout(s,e),i=!0)},r}function l(t,e,n){var i=e[1],o=e[0],r=i-o;return t===i&&n?t:((t-o)%r+r)%r+o}function h(){return!1}function u(t,e){if(!1===e)return t;var n=Math.pow(10,void 0===e?6:e);return Math.round(t*n)/n}function c(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function d(t){return c(t).split(/\s+/)}function p(t,e){for(var n in Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?i(t.options):{}),e)t.options[n]=e[n];return t.options}function _(t,e,n){var i=[];for(var o in t)i.push(encodeURIComponent(n?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+i.join("&")}var f=/\{ *([\w_ -]+) *\}/g;function m(t,e){return t.replace(f,(function(t,n){var i=e[n];if(void 0===i)throw new Error("No value provided for variable "+t);return"function"==typeof i&&(i=i(e)),i}))}var g=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function v(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}var y="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function x(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var b=0;function w(t){var e=+new Date,n=Math.max(0,16-(e-b));return b=e+n,window.setTimeout(t,n)}var P=window.requestAnimationFrame||x("RequestAnimationFrame")||w,T=window.cancelAnimationFrame||x("CancelAnimationFrame")||x("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function z(t,e,n){if(!n||P!==w)return P.call(window,o(t,e));t.call(e)}function M(t){t&&T.call(window,t)}var k={__proto__:null,extend:n,create:i,bind:o,get lastId(){return r},stamp:s,throttle:a,wrapNum:l,falseFn:h,formatNum:u,trim:c,splitWords:d,setOptions:p,getParamString:_,template:m,isArray:g,indexOf:v,emptyImageUrl:y,requestFn:P,cancelFn:T,requestAnimFrame:z,cancelAnimFrame:M};function C(){}function S(t){if("undefined"!=typeof L&&L&&L.Mixin){t=g(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}C.extend=function(t){var e=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},o=e.__super__=this.prototype,r=i(o);for(var s in r.constructor=e,e.prototype=r,this)Object.prototype.hasOwnProperty.call(this,s)&&"prototype"!==s&&"__super__"!==s&&(e[s]=this[s]);return t.statics&&n(e,t.statics),t.includes&&(S(t.includes),n.apply(null,[r].concat(t.includes))),n(r,t),delete r.statics,delete r.includes,r.options&&(r.options=o.options?i(o.options):{},n(r.options,t.options)),r._initHooks=[],r.callInitHooks=function(){if(!this._initHooksCalled){o.callInitHooks&&o.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=r._initHooks.length;t<e;t++)r._initHooks[t].call(this)}},e},C.include=function(t){var e=this.prototype.options;return n(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},C.mergeOptions=function(t){return n(this.prototype.options,t),this},C.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),n="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};var A={on:function(t,e,n){if("object"==typeof t)for(var i in t)this._on(i,t[i],e);else for(var o=0,r=(t=d(t)).length;o<r;o++)this._on(t[o],e,n);return this},off:function(t,e,n){if(arguments.length)if("object"==typeof t)for(var i in t)this._off(i,t[i],e);else{t=d(t);for(var o=1===arguments.length,r=0,s=t.length;r<s;r++)o?this._off(t[r]):this._off(t[r],e,n)}else delete this._events;return this},_on:function(t,e,n,i){if("function"==typeof e){if(!1===this._listens(t,e,n)){n===this&&(n=void 0);var o={fn:e,ctx:n};i&&(o.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(o)}}else console.warn("wrong listener type: "+typeof e)},_off:function(t,e,n){var i,o,r;if(this._events&&(i=this._events[t]))if(1!==arguments.length)if("function"==typeof e){var s=this._listens(t,e,n);if(!1!==s){var a=i[s];this._firingCount&&(a.fn=h,this._events[t]=i=i.slice()),i.splice(s,1)}}else console.warn("wrong listener type: "+typeof e);else{if(this._firingCount)for(o=0,r=i.length;o<r;o++)i[o].fn=h;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var o=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var r=this._events[t];if(r){this._firingCount=this._firingCount+1||1;for(var s=0,a=r.length;s<a;s++){var l=r[s],h=l.fn;l.once&&this.off(t,h,l.ctx),h.call(l.ctx||this,o)}this._firingCount--}}return i&&this._propagateEvent(o),this},listens:function(t,e,n,i){"string"!=typeof t&&console.warn('"string" type argument expected');var o=e;"function"!=typeof e&&(i=!!e,o=void 0,n=void 0);var r=this._events&&this._events[t];if(r&&r.length&&!1!==this._listens(t,o,n))return!0;if(i)for(var s in this._eventParents)if(this._eventParents[s].listens(t,e,n,i))return!0;return!1},_listens:function(t,e,n){if(!this._events)return!1;var i=this._events[t]||[];if(!e)return!!i.length;n===this&&(n=void 0);for(var o=0,r=i.length;o<r;o++)if(i[o].fn===e&&i[o].ctx===n)return o;return!1},once:function(t,e,n){if("object"==typeof t)for(var i in t)this._on(i,t[i],e,!0);else for(var o=0,r=(t=d(t)).length;o<r;o++)this._on(t[o],e,n,!0);return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[s(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[s(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};A.addEventListener=A.on,A.removeEventListener=A.clearAllEventListeners=A.off,A.addOneTimeEventListener=A.once,A.fireEvent=A.fire,A.hasEventListeners=A.listens;var E=C.extend(A);function Z(t,e,n){this.x=n?Math.round(t):t,this.y=n?Math.round(e):e}var O=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function I(t,e,n){return t instanceof Z?t:g(t)?new Z(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new Z(t.x,t.y):new Z(t,e,n)}function B(t,e){if(t)for(var n=e?[t,e]:t,i=0,o=n.length;i<o;i++)this.extend(n[i])}function R(t,e){return!t||t instanceof B?t:new B(t,e)}function N(t,e){if(t)for(var n=e?[t,e]:t,i=0,o=n.length;i<o;i++)this.extend(n[i])}function D(t,e){return t instanceof N?t:new N(t,e)}function j(t,e,n){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==n&&(this.alt=+n)}function W(t,e,n){return t instanceof j?t:g(t)&&"object"!=typeof t[0]?3===t.length?new j(t[0],t[1],t[2]):2===t.length?new j(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new j(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new j(t,e,n)}Z.prototype={clone:function(){return new Z(this.x,this.y)},add:function(t){return this.clone()._add(I(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(I(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new Z(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new Z(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=O(this.x),this.y=O(this.y),this},distanceTo:function(t){var e=(t=I(t)).x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)},equals:function(t){return(t=I(t)).x===this.x&&t.y===this.y},contains:function(t){return t=I(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+u(this.x)+", "+u(this.y)+")"}},B.prototype={extend:function(t){var e,n;if(!t)return this;if(t instanceof Z||"number"==typeof t[0]||"x"in t)e=n=I(t);else if(e=(t=R(t)).min,n=t.max,!e||!n)return this;return this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)):(this.min=e.clone(),this.max=n.clone()),this},getCenter:function(t){return I((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return I(this.min.x,this.max.y)},getTopRight:function(){return I(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,n;return(t="number"==typeof t[0]||t instanceof Z?I(t):R(t))instanceof B?(e=t.min,n=t.max):e=n=t,e.x>=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=R(t);var e=this.min,n=this.max,i=t.min,o=t.max,r=o.x>=e.x&&i.x<=n.x,s=o.y>=e.y&&i.y<=n.y;return r&&s},overlaps:function(t){t=R(t);var e=this.min,n=this.max,i=t.min,o=t.max,r=o.x>e.x&&i.x<n.x,s=o.y>e.y&&i.y<n.y;return r&&s},isValid:function(){return!(!this.min||!this.max)},pad:function(t){var e=this.min,n=this.max,i=Math.abs(e.x-n.x)*t,o=Math.abs(e.y-n.y)*t;return R(I(e.x-i,e.y-o),I(n.x+i,n.y+o))},equals:function(t){return!!t&&(t=R(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight()))}},N.prototype={extend:function(t){var e,n,i=this._southWest,o=this._northEast;if(t instanceof j)e=t,n=t;else{if(!(t instanceof N))return t?this.extend(W(t)||D(t)):this;if(e=t._southWest,n=t._northEast,!e||!n)return this}return i||o?(i.lat=Math.min(e.lat,i.lat),i.lng=Math.min(e.lng,i.lng),o.lat=Math.max(n.lat,o.lat),o.lng=Math.max(n.lng,o.lng)):(this._southWest=new j(e.lat,e.lng),this._northEast=new j(n.lat,n.lng)),this},pad:function(t){var e=this._southWest,n=this._northEast,i=Math.abs(e.lat-n.lat)*t,o=Math.abs(e.lng-n.lng)*t;return new N(new j(e.lat-i,e.lng-o),new j(n.lat+i,n.lng+o))},getCenter:function(){return new j((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new j(this.getNorth(),this.getWest())},getSouthEast:function(){return new j(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof j||"lat"in t?W(t):D(t);var e,n,i=this._southWest,o=this._northEast;return t instanceof N?(e=t.getSouthWest(),n=t.getNorthEast()):e=n=t,e.lat>=i.lat&&n.lat<=o.lat&&e.lng>=i.lng&&n.lng<=o.lng},intersects:function(t){t=D(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),o=t.getNorthEast(),r=o.lat>=e.lat&&i.lat<=n.lat,s=o.lng>=e.lng&&i.lng<=n.lng;return r&&s},overlaps:function(t){t=D(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),o=t.getNorthEast(),r=o.lat>e.lat&&i.lat<n.lat,s=o.lng>e.lng&&i.lng<n.lng;return r&&s},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=D(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},j.prototype={equals:function(t,e){return!!t&&(t=W(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))},toString:function(t){return"LatLng("+u(this.lat,t)+", "+u(this.lng,t)+")"},distanceTo:function(t){return U.distance(this,W(t))},wrap:function(){return U.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return D([this.lat-e,this.lng-n],[this.lat+e,this.lng+n])},clone:function(){return new j(this.lat,this.lng,this.alt)}};var H,F={latLngToPoint:function(t,e){var n=this.projection.project(t),i=this.scale(e);return this.transformation._transform(n,i)},pointToLatLng:function(t,e){var n=this.scale(e),i=this.transformation.untransform(t,n);return this.projection.unproject(i)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,n=this.scale(t);return new B(this.transformation.transform(e.min,n),this.transformation.transform(e.max,n))},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?l(t.lng,this.wrapLng,!0):t.lng;return new j(this.wrapLat?l(t.lat,this.wrapLat,!0):t.lat,e,t.alt)},wrapLatLngBounds:function(t){var e=t.getCenter(),n=this.wrapLatLng(e),i=e.lat-n.lat,o=e.lng-n.lng;if(0===i&&0===o)return t;var r=t.getSouthWest(),s=t.getNorthEast();return new N(new j(r.lat-i,r.lng-o),new j(s.lat-i,s.lng-o))}},U=n({},F,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var n=Math.PI/180,i=t.lat*n,o=e.lat*n,r=Math.sin((e.lat-t.lat)*n/2),s=Math.sin((e.lng-t.lng)*n/2),a=r*r+Math.cos(i)*Math.cos(o)*s*s,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*l}}),V=6378137,q={R:V,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,t.lat),-n),o=Math.sin(i*e);return new Z(this.R*t.lng*e,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var e=180/Math.PI;return new j((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(H=V*Math.PI,new B([-H,-H],[H,H]))};function G(t,e,n,i){if(g(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=n,this._d=i}function Y(t,e,n,i){return new G(t,e,n,i)}G.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new Z((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var K=n({},U,{code:"EPSG:3857",projection:q,transformation:function(){var t=.5/(Math.PI*q.R);return Y(t,.5,-t,.5)}()}),J=n({},K,{code:"EPSG:900913"});function X(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,e){var n,i,o,r,s,a,l="";for(n=0,o=t.length;n<o;n++){for(i=0,r=(s=t[n]).length;i<r;i++)l+=(i?"L":"M")+(a=s[i]).x+" "+a.y;l+=e?Nt.svg?"z":"x":""}return l||"M0 0"}var $,tt=document.documentElement.style,et="ActiveXObject"in window,nt=et&&!document.addEventListener,it="msLaunchUri"in navigator&&!("documentMode"in document),ot=Rt("webkit"),rt=Rt("android"),st=Rt("android 2")||Rt("android 3"),at=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),lt=rt&&Rt("Google")&&at<537&&!("AudioNode"in window),ht=!!window.opera,ut=!it&&Rt("chrome"),ct=Rt("gecko")&&!ot&&!ht&&!et,dt=!ut&&Rt("safari"),pt=Rt("phantom"),_t="OTransition"in tt,ft=0===navigator.platform.indexOf("Win"),mt=et&&"transition"in tt,gt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,vt="MozPerspective"in tt,yt=!window.L_DISABLE_3D&&(mt||gt||vt)&&!_t&&!pt,xt="undefined"!=typeof orientation||Rt("mobile"),bt=xt&&ot,wt=xt&>,Pt=!window.PointerEvent&&window.MSPointerEvent,Lt=!(!window.PointerEvent&&!Pt),Tt="ontouchstart"in window||!!window.TouchEvent,zt=!window.L_NO_TOUCH&&(Tt||Lt),Mt=xt&&ht,kt=xt&&ct,Ct=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,St=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",h,e),window.removeEventListener("testPassiveEventSupport",h,e)}catch(t){}return t}(),At=!!document.createElement("canvas").getContext,Et=!(!document.createElementNS||!X("svg").createSVGRect),Zt=!!Et&&(($=document.createElement("div")).innerHTML="<svg/>","http://www.w3.org/2000/svg"===($.firstChild&&$.firstChild.namespaceURI)),Ot=!Et&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),It=0===navigator.platform.indexOf("Mac"),Bt=0===navigator.platform.indexOf("Linux");function Rt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var Nt={ie:et,ielt9:nt,edge:it,webkit:ot,android:rt,android23:st,androidStock:lt,opera:ht,chrome:ut,gecko:ct,safari:dt,phantom:pt,opera12:_t,win:ft,ie3d:mt,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:xt,mobileWebkit:bt,mobileWebkit3d:wt,msPointer:Pt,pointer:Lt,touch:zt,touchNative:Tt,mobileOpera:Mt,mobileGecko:kt,retina:Ct,passiveEvents:St,canvas:At,svg:Et,vml:Ot,inlineSvg:Zt,mac:It,linux:Bt},Dt=Nt.msPointer?"MSPointerDown":"pointerdown",jt=Nt.msPointer?"MSPointerMove":"pointermove",Wt=Nt.msPointer?"MSPointerUp":"pointerup",Ht=Nt.msPointer?"MSPointerCancel":"pointercancel",Ft={touchstart:Dt,touchmove:jt,touchend:Wt,touchcancel:Ht},Ut={touchstart:te,touchmove:$t,touchend:$t,touchcancel:$t},Vt={},qt=!1;function Gt(t,e,n){return"touchstart"===e&&Qt(),Ut[e]?(n=Ut[e].bind(this,n),t.addEventListener(Ft[e],n,!1),n):(console.warn("wrong event specified:",e),h)}function Yt(t,e,n){Ft[e]?t.removeEventListener(Ft[e],n,!1):console.warn("wrong event specified:",e)}function Kt(t){Vt[t.pointerId]=t}function Jt(t){Vt[t.pointerId]&&(Vt[t.pointerId]=t)}function Xt(t){delete Vt[t.pointerId]}function Qt(){qt||(document.addEventListener(Dt,Kt,!0),document.addEventListener(jt,Jt,!0),document.addEventListener(Wt,Xt,!0),document.addEventListener(Ht,Xt,!0),qt=!0)}function $t(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var n in e.touches=[],Vt)e.touches.push(Vt[n]);e.changedTouches=[e],t(e)}}function te(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Ke(e),$t(t,e)}function ee(t){var e,n,i={};for(n in t)e=t[n],i[n]=e&&e.bind?e.bind(t):e;return t=i,i.type="dblclick",i.detail=2,i.isTrusted=!1,i._simulated=!0,i}var ne=200;function ie(t,e){t.addEventListener("dblclick",e);var n,i=0;function o(t){if(1===t.detail){if("mouse"!==t.pointerType&&(!t.sourceCapabilities||t.sourceCapabilities.firesTouchEvents)){var o=Xe(t);if(!o.some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))||o.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))){var r=Date.now();r-i<=ne?2==++n&&e(ee(t)):n=1,i=r}}}else n=t.detail}return t.addEventListener("click",o),{dblclick:e,simDblclick:o}}function oe(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var re,se,ae,le,he,ue=Me(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ce=Me(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),de="webkitTransition"===ce||"OTransition"===ce?ce+"End":"transitionend";function pe(t){return"string"==typeof t?document.getElementById(t):t}function _e(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var i=document.defaultView.getComputedStyle(t,null);n=i?i[e]:null}return"auto"===n?null:n}function fe(t,e,n){var i=document.createElement(t);return i.className=e||"",n&&n.appendChild(i),i}function me(t){var e=t.parentNode;e&&e.removeChild(t)}function ge(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function ve(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ye(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function xe(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=Le(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)}function be(t,e){if(void 0!==t.classList)for(var n=d(e),i=0,o=n.length;i<o;i++)t.classList.add(n[i]);else if(!xe(t,e)){var r=Le(t);Pe(t,(r?r+" ":"")+e)}}function we(t,e){void 0!==t.classList?t.classList.remove(e):Pe(t,c((" "+Le(t)+" ").replace(" "+e+" "," ")))}function Pe(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function Le(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function Te(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&ze(t,e)}function ze(t,e){var n=!1,i="DXImageTransform.Microsoft.Alpha";try{n=t.filters.item(i)}catch(t){if(1===e)return}e=Math.round(100*e),n?(n.Enabled=100!==e,n.Opacity=e):t.style.filter+=" progid:"+i+"(opacity="+e+")"}function Me(t){for(var e=document.documentElement.style,n=0;n<t.length;n++)if(t[n]in e)return t[n];return!1}function ke(t,e,n){var i=e||new Z(0,0);t.style[ue]=(Nt.ie3d?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)")+(n?" scale("+n+")":"")}function Ce(t,e){t._leaflet_pos=e,Nt.any3d?ke(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Se(t){return t._leaflet_pos||new Z(0,0)}if("onselectstart"in document)re=function(){De(window,"selectstart",Ke)},se=function(){We(window,"selectstart",Ke)};else{var Ae=Me(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);re=function(){if(Ae){var t=document.documentElement.style;ae=t[Ae],t[Ae]="none"}},se=function(){Ae&&(document.documentElement.style[Ae]=ae,ae=void 0)}}function Ee(){De(window,"dragstart",Ke)}function Ze(){We(window,"dragstart",Ke)}function Oe(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Ie(),le=t,he=t.style.outlineStyle,t.style.outlineStyle="none",De(window,"keydown",Ie))}function Ie(){le&&(le.style.outlineStyle=he,le=void 0,he=void 0,We(window,"keydown",Ie))}function Be(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Re(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Ne={__proto__:null,TRANSFORM:ue,TRANSITION:ce,TRANSITION_END:de,get:pe,getStyle:_e,create:fe,remove:me,empty:ge,toFront:ve,toBack:ye,hasClass:xe,addClass:be,removeClass:we,setClass:Pe,getClass:Le,setOpacity:Te,testProp:Me,setTransform:ke,setPosition:Ce,getPosition:Se,get disableTextSelection(){return re},get enableTextSelection(){return se},disableImageDrag:Ee,enableImageDrag:Ze,preventOutline:Oe,restoreOutline:Ie,getSizedParentNode:Be,getScale:Re};function De(t,e,n,i){if(e&&"object"==typeof e)for(var o in e)Ue(t,o,e[o],n);else for(var r=0,s=(e=d(e)).length;r<s;r++)Ue(t,e[r],n,i);return this}var je="_leaflet_events";function We(t,e,n,i){if(1===arguments.length)He(t),delete t[je];else if(e&&"object"==typeof e)for(var o in e)Ve(t,o,e[o],n);else if(e=d(e),2===arguments.length)He(t,(function(t){return-1!==v(e,t)}));else for(var r=0,s=e.length;r<s;r++)Ve(t,e[r],n,i);return this}function He(t,e){for(var n in t[je]){var i=n.split(/\d/)[0];e&&!e(i)||Ve(t,i,null,null,n)}}var Fe={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Ue(t,e,n,i){var o=e+s(n)+(i?"_"+s(i):"");if(t[je]&&t[je][o])return this;var r=function(e){return n.call(i||t,e||window.event)},a=r;!Nt.touchNative&&Nt.pointer&&0===e.indexOf("touch")?r=Gt(t,e,r):Nt.touch&&"dblclick"===e?r=ie(t,r):"addEventListener"in t?"touchstart"===e||"touchmove"===e||"wheel"===e||"mousewheel"===e?t.addEventListener(Fe[e]||e,r,!!Nt.passiveEvents&&{passive:!1}):"mouseenter"===e||"mouseleave"===e?(r=function(e){e=e||window.event,en(t,e)&&a(e)},t.addEventListener(Fe[e],r,!1)):t.addEventListener(e,a,!1):t.attachEvent("on"+e,r),t[je]=t[je]||{},t[je][o]=r}function Ve(t,e,n,i,o){o=o||e+s(n)+(i?"_"+s(i):"");var r=t[je]&&t[je][o];if(!r)return this;!Nt.touchNative&&Nt.pointer&&0===e.indexOf("touch")?Yt(t,e,r):Nt.touch&&"dblclick"===e?oe(t,r):"removeEventListener"in t?t.removeEventListener(Fe[e]||e,r,!1):t.detachEvent("on"+e,r),t[je][o]=null}function qe(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function Ge(t){return Ue(t,"wheel",qe),this}function Ye(t){return De(t,"mousedown touchstart dblclick contextmenu",qe),t._leaflet_disable_click=!0,this}function Ke(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Je(t){return Ke(t),qe(t),this}function Xe(t){if(t.composedPath)return t.composedPath();for(var e=[],n=t.target;n;)e.push(n),n=n.parentNode;return e}function Qe(t,e){if(!e)return new Z(t.clientX,t.clientY);var n=Re(e),i=n.boundingClientRect;return new Z((t.clientX-i.left)/n.x-e.clientLeft,(t.clientY-i.top)/n.y-e.clientTop)}var $e=Nt.linux&&Nt.chrome?window.devicePixelRatio:Nt.mac?3*window.devicePixelRatio:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function tn(t){return Nt.edge?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/$e:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}function en(t,e){var n=e.relatedTarget;if(!n)return!0;try{for(;n&&n!==t;)n=n.parentNode}catch(t){return!1}return n!==t}var nn={__proto__:null,on:De,off:We,stopPropagation:qe,disableScrollPropagation:Ge,disableClickPropagation:Ye,preventDefault:Ke,stop:Je,getPropagationPath:Xe,getMousePosition:Qe,getWheelDelta:tn,isExternalTarget:en,addListener:De,removeListener:We},on=E.extend({run:function(t,e,n,i){this.stop(),this._el=t,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(i||.5,.2),this._startPos=Se(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=z(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,n=1e3*this._duration;e<n?this._runFrame(this._easeOut(e/n),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var n=this._startPos.add(this._offset.multiplyBy(t));e&&n._round(),Ce(this._el,n),this.fire("step")},_complete:function(){M(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),rn=E.extend({options:{crs:K,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=p(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=o(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(W(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ce&&Nt.any3d&&!Nt.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),De(this._proxy,de,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){return e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(W(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i&&(void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan)),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(t,e,i.pan&&i.pan.noMoveStart),this)},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(Nt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(Nt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,n){var i=this.getZoomScale(e),o=this.getSize().divideBy(2),r=(t instanceof Z?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/i),s=this.containerPointToLatLng(o.add(r));return this.setView(s,e,{zoom:n})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():D(t);var n=I(e.paddingTopLeft||e.padding||[0,0]),i=I(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,n.add(i));if((o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var r=i.subtract(n).divideBy(2),s=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(s.add(a).divideBy(2).add(r),o),zoom:o}},fitBounds:function(t,e){if(!(t=D(t)).isValid())throw new Error("Bounds are not valid.");var n=this._getBoundsCenterZoom(t,e);return this.setView(n.center,n.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(e=e||{},!(t=I(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new on,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){be(this._mapPane,"leaflet-pan-anim");var n=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,n,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,n){if(!1===(n=n||{}).animate||!Nt.any3d)return this.setView(t,e,n);this._stop();var i=this.project(this.getCenter()),o=this.project(t),r=this.getSize(),s=this._zoom;t=W(t),e=void 0===e?s:e;var a=Math.max(r.x,r.y),l=a*this.getZoomScale(s,e),h=o.distanceTo(i)||1,u=1.42,c=u*u;function d(t){var e=(l*l-a*a+(t?-1:1)*c*c*h*h)/(2*(t?l:a)*c*h),n=Math.sqrt(e*e+1)-e;return n<1e-9?-18:Math.log(n)}function p(t){return(Math.exp(t)-Math.exp(-t))/2}function _(t){return(Math.exp(t)+Math.exp(-t))/2}function f(t){return p(t)/_(t)}var m=d(0);function g(t){return a*(_(m)/_(m+u*t))}function v(t){return a*(_(m)*f(m+u*t)-p(m))/c}function y(t){return 1-Math.pow(1-t,1.5)}var x=Date.now(),b=(d(1)-m)/u,w=n.duration?1e3*n.duration:1e3*b*.8;function P(){var n=(Date.now()-x)/w,r=y(n)*b;n<=1?(this._flyToFrame=z(P,this),this._move(this.unproject(i.add(o.subtract(i).multiplyBy(v(r)/h)),s),this.getScaleZoom(a/g(r),s),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),P.call(this),this},flyToBounds:function(t,e){var n=this._getBoundsCenterZoom(t,e);return this.flyTo(n.center,n.zoom,e)},setMaxBounds:function(t){return t=D(t),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),t.isValid()?(this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter(),i=this._limitCenter(n,this._zoom,D(t));return n.equals(i)||this.panTo(i,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=I((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=I(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),r=this.project(t),s=this.getPixelBounds(),a=R([s.min.add(n),s.max.subtract(i)]),l=a.getSize();if(!a.contains(r)){this._enforcingBounds=!0;var h=r.subtract(a.getCenter()),u=a.extend(r).getSize().subtract(l);o.x+=h.x<0?-u.x:u.x,o.y+=h.y<0?-u.y:u.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),r=e.divideBy(2).round(),s=i.divideBy(2).round(),a=r.subtract(s);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=o(this._handleGeolocationResponse,this),i=o(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){if(this._container._leaflet_id){var e=t.code,n=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+n+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=new j(t.coords.latitude,t.coords.longitude),n=e.toBounds(2*t.coords.accuracy),i=this._locateOptions;if(i.setView){var o=this.getBoundsZoom(n);this.setView(e,i.maxZoom?Math.min(o,i.maxZoom):o)}var r={latlng:e,bounds:n,timestamp:t.timestamp};for(var s in t.coords)"number"==typeof t.coords[s]&&(r[s]=t.coords[s]);this.fire("locationfound",r)}},addHandler:function(t,e){if(!e)return this;var n=this[t]=new e(this);return this._handlers.push(n),this.options[t]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),me(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(M(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)me(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var n=fe("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane);return t&&(this._panes[t]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new N(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=D(t),n=I(n||[0,0]);var i=this.getZoom()||0,o=this.getMinZoom(),r=this.getMaxZoom(),s=t.getNorthWest(),a=t.getSouthEast(),l=this.getSize().subtract(n),h=R(this.project(a,i),this.project(s,i)).getSize(),u=Nt.any3d?this.options.zoomSnap:1,c=l.x/h.x,d=l.y/h.y,p=e?Math.max(c,d):Math.min(c,d);return i=this.getScaleZoom(p,i),u&&(i=Math.round(i/(u/100))*(u/100),i=e?Math.ceil(i/u)*u:Math.floor(i/u)*u),Math.max(o,Math.min(r,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new Z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var n=this._getTopLeftPoint(t,e);return new B(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;e=void 0===e?this._zoom:e;var i=n.zoom(t*n.scale(e));return isNaN(i)?1/0:i},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(W(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(I(t),e)},layerPointToLatLng:function(t){var e=I(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(W(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(W(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(D(t))},distance:function(t,e){return this.options.crs.distance(W(t),W(e))},containerPointToLayerPoint:function(t){return I(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return I(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(I(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t)))},mouseEventToContainerPoint:function(t){return Qe(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=pe(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");De(e,"scroll",this._onScroll,this),this._containerId=s(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&Nt.any3d,be(t,"leaflet-container"+(Nt.touch?" leaflet-touch":"")+(Nt.retina?" leaflet-retina":"")+(Nt.ielt9?" leaflet-oldie":"")+(Nt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=_e(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Ce(this._mapPane,new Z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(be(t.markerPane,"leaflet-zoom-hide"),be(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,n){Ce(this._mapPane,new Z(0,0));var i=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var o=this._zoom!==e;this._moveStart(o,n)._move(t,e)._moveEnd(o),this.fire("viewreset"),i&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n,i){void 0===e&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),i?n&&n.pinch&&this.fire("zoom",n):((o||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return M(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){Ce(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[s(this._container)]=this;var e=t?We:De;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),Nt.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){M(this._resizeRequest),this._resizeRequest=z((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],o="mouseout"===e||"mouseover"===e,r=t.target||t.srcElement,a=!1;r;){if((n=this._targets[s(r)])&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){a=!0;break}if(n&&n.listens(e,!0)){if(o&&!en(r,t))break;if(i.push(n),o)break}if(r===this._container)break;r=r.parentNode}return i.length||a||o||!this.listens(e,!0)||(i=[this]),i},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e=t.target||t.srcElement;if(!(!this._loaded||e._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(e))){var n=t.type;"mousedown"===n&&Oe(e),this._fireDOMEvent(t,n)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var o=n({},t);o.type="preclick",this._fireDOMEvent(o,o.type,i)}var r=this._findEventTargets(t,e);if(i){for(var s=[],a=0;a<i.length;a++)i[a].listens(e,!0)&&s.push(i[a]);r=s.concat(r)}if(r.length){"contextmenu"===e&&Ke(t);var l=r[0],h={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var u=l.getLatLng&&(!l._radius||l._radius<=10);h.containerPoint=u?this.latLngToContainerPoint(l.getLatLng()):this.mouseEventToContainerPoint(t),h.layerPoint=this.containerPointToLayerPoint(h.containerPoint),h.latlng=u?l.getLatLng():this.layerPointToLatLng(h.layerPoint)}for(a=0;a<r.length;a++)if(r[a].fire(e,h,!0),h.originalEvent._stopped||!1===r[a].options.bubblingMouseEvents&&-1!==v(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return Se(this._mapPane)||new Z(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var n=this.getSize()._divideBy(2);return this.project(t,e)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return this.project(t,e)._subtract(i)},_latLngBoundsToNewLayerBounds:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return R([this.project(t.getSouthWest(),e)._subtract(i),this.project(t.getNorthWest(),e)._subtract(i),this.project(t.getSouthEast(),e)._subtract(i),this.project(t.getNorthEast(),e)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,n){if(!n)return t;var i=this.project(t,e),o=this.getSize().divideBy(2),r=new B(i.subtract(o),i.add(o)),s=this._getBoundsOffset(r,n,e);return Math.abs(s.x)<=1&&Math.abs(s.y)<=1?t:this.unproject(i.add(s),e)},_limitOffset:function(t,e){if(!e)return t;var n=this.getPixelBounds(),i=new B(n.min.add(t),n.max.add(t));return t.add(this._getBoundsOffset(i,e))},_getBoundsOffset:function(t,e,n){var i=R(this.project(e.getNorthEast(),n),this.project(e.getSouthWest(),n)),o=i.min.subtract(t.min),r=i.max.subtract(t.max);return new Z(this._rebound(o.x,-r.x),this._rebound(o.y,-r.y))},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),n=this.getMaxZoom(),i=Nt.any3d?this.options.zoomSnap:1;return i&&(t=Math.round(t/i)*i),Math.max(e,Math.min(n,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){we(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var n=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(n)||(this.panBy(n,e),0))},_createAnimProxy:function(){var t=this._proxy=fe("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",(function(t){var e=ue,n=this._proxy.style[e];ke(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),n===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()}),this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){me(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();ke(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,n){if(this._animatingZoom)return!0;if(n=n||{},!this._zoomAnimated||!1===n.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/i);return!(!0!==n.animate&&!this.getSize().contains(o)||(z((function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(t,e,!0)}),this),0))},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,be(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&we(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function sn(t,e){return new rn(t,e)}var an=C.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition(),i=t._controlCorners[n];return be(e,"leaflet-control"),-1!==n.indexOf("bottom")?i.insertBefore(e,i.firstChild):i.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(me(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),ln=function(t){return new an(t)};rn.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",n=this._controlContainer=fe("div",e+"control-container",this._container);function i(i,o){var r=e+i+" "+e+o;t[i+o]=fe("div",r,n)}i("top","left"),i("top","right"),i("bottom","left"),i("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)me(this._controlCorners[t]);me(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var hn=an.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,n,i){return n<i?-1:i<n?1:0}},initialize:function(t,e,n){for(var i in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,t)this._addLayer(t[i],i);for(i in e)this._addLayer(e[i],i,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return an.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(s(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){be(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(be(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):we(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return we(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=fe("div",t),n=this.options.collapsed;e.setAttribute("aria-haspopup",!0),Ye(e),Ge(e);var i=this._section=fe("section",t+"-list");n&&(this._map.on("click",this.collapse,this),De(e,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var o=this._layersLink=fe("a",t+"-toggle",e);o.href="#",o.title="Layers",o.setAttribute("role","button"),De(o,{keydown:function(t){13===t.keyCode&&this._expandSafely()},click:function(t){Ke(t),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=fe("div",t+"-base",i),this._separator=fe("div",t+"-separator",i),this._overlaysList=fe("div",t+"-overlays",i),e.appendChild(i)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&s(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,n){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:n}),this.options.sortLayers&&this._layers.sort(o((function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)}),this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;ge(this._baseLayersList),ge(this._overlaysList),this._layerControlInputs=[];var t,e,n,i,o=0;for(n=0;n<this._layers.length;n++)i=this._layers[n],this._addItem(i),e=e||i.overlay,t=t||!i.overlay,o+=i.overlay?0:1;return this.options.hideSingleBase&&(t=t&&o>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(s(t.target)),n=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;n&&this._map.fire(n,e)},_createRadioElement:function(t,e){var n='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",i=document.createElement("div");return i.innerHTML=n,i.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers_"+s(this),i),this._layerControlInputs.push(e),e.layerId=s(t.layer),De(e,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var r=document.createElement("span");return n.appendChild(r),r.appendChild(e),r.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){if(!this._preventClick){var t,e,n=this._layerControlInputs,i=[],o=[];this._handlingClick=!0;for(var r=n.length-1;r>=0;r--)t=n[r],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||o.push(e);for(r=0;r<o.length;r++)this._map.hasLayer(o[r])&&this._map.removeLayer(o[r]);for(r=0;r<i.length;r++)this._map.hasLayer(i[r])||this._map.addLayer(i[r]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t,e,n=this._layerControlInputs,i=this._map.getZoom(),o=n.length-1;o>=0;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&i<e.options.minZoom||void 0!==e.options.maxZoom&&i>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,De(t,"click",Ke),this.expand();var e=this;setTimeout((function(){We(t,"click",Ke),e._preventClick=!1}))}}),un=function(t,e,n){return new hn(t,e,n)},cn=an.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=fe("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,o){var r=fe("a",n,i);return r.innerHTML=t,r.href="#",r.title=e,r.setAttribute("role","button"),r.setAttribute("aria-label",e),Ye(r),De(r,"click",Je),De(r,"click",o,this),De(r,"click",this._refocusOnMap,this),r},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";we(this._zoomInButton,e),we(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(be(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(be(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});rn.mergeOptions({zoomControl:!0}),rn.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new cn,this.addControl(this.zoomControl))}));var dn=function(t){return new cn(t)},pn=an.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",n=fe("div",e),i=this.options;return this._addScales(i,e+"-line",n),t.on(i.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),n},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=fe("div",e,n)),t.imperial&&(this._iScale=fe("div",e,n))},_update:function(){var t=this._map,e=t.getSize().y/2,n=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(n)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),n=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,n,e/t)},_updateImperial:function(t){var e,n,i,o=3.2808399*t;o>5280?(e=o/5280,n=this._getRoundNum(e),this._updateScale(this._iScale,n+" mi",n/e)):(i=this._getRoundNum(o),this._updateScale(this._iScale,i+" ft",i/o))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),n=t/e;return e*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}}),_n=function(t){return new pn(t)},fn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',mn=an.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Nt.inlineSvg?fn+" ":"")+"Leaflet</a>"},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=fe("div","leaflet-control-attribution"),Ye(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var n=[];this.options.prefix&&n.push(this.options.prefix),t.length&&n.push(t.join(", ")),this._container.innerHTML=n.join(' <span aria-hidden="true">|</span> ')}}});rn.mergeOptions({attributionControl:!0}),rn.addInitHook((function(){this.options.attributionControl&&(new mn).addTo(this)}));var gn=function(t){return new mn(t)};an.Layers=hn,an.Zoom=cn,an.Scale=pn,an.Attribution=mn,ln.layers=un,ln.zoom=dn,ln.scale=_n,ln.attribution=gn;var vn=C.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});vn.addTo=function(t,e){return t.addHandler(e,this),this};var yn={Events:A},xn=Nt.touch?"touchstart mousedown":"mousedown",bn=E.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){p(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(De(this._dragStartTarget,xn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(bn._dragging===this&&this.finishDrag(!0),We(this._dragStartTarget,xn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!xe(this._element,"leaflet-zoom-anim")))if(t.touches&&1!==t.touches.length)bn._dragging===this&&this.finishDrag();else if(!(bn._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(bn._dragging=this,this._preventOutline&&Oe(this._element),Ee(),re(),this._moving))){this.fire("down");var e=t.touches?t.touches[0]:t,n=Be(this._element);this._startPoint=new Z(e.clientX,e.clientY),this._startPos=Se(this._element),this._parentScale=Re(n);var i="mousedown"===t.type;De(document,i?"mousemove":"touchmove",this._onMove,this),De(document,i?"mouseup":"touchend touchcancel",this._onUp,this)}},_onMove:function(t){if(this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,n=new Z(e.clientX,e.clientY)._subtract(this._startPoint);(n.x||n.y)&&(Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,Ke(t),this._moved||(this.fire("dragstart"),this._moved=!0,be(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),be(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=t,this._updatePosition()))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),Ce(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){we(document.body,"leaflet-dragging"),this._lastTarget&&(we(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),We(document,"mousemove touchmove",this._onMove,this),We(document,"mouseup touchend touchcancel",this._onUp,this),Ze(),se();var e=this._moved&&this._moving;this._moving=!1,bn._dragging=!1,e&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function wn(t,e,n){var i,o,r,s,a,l,h,u,c,d=[1,4,2,8];for(o=0,h=t.length;o<h;o++)t[o]._code=In(t[o],e);for(s=0;s<4;s++){for(u=d[s],i=[],o=0,r=(h=t.length)-1;o<h;r=o++)a=t[o],l=t[r],a._code&u?l._code&u||((c=On(l,a,u,e,n))._code=In(c,e),i.push(c)):(l._code&u&&((c=On(l,a,u,e,n))._code=In(c,e),i.push(c)),i.push(a));t=i}return t}function Pn(t,e){var n,i,o,r,s,a,l,h,u;if(!t||0===t.length)throw new Error("latlngs not passed");Nn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var c=W([0,0]),d=D(t);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(c=Ln(t));var p=t.length,_=[];for(n=0;n<p;n++){var f=W(t[n]);_.push(e.project(W([f.lat-c.lat,f.lng-c.lng])))}for(a=l=h=0,n=0,i=p-1;n<p;i=n++)o=_[n],r=_[i],s=o.y*r.x-r.y*o.x,l+=(o.x+r.x)*s,h+=(o.y+r.y)*s,a+=3*s;u=0===a?_[0]:[l/a,h/a];var m=e.unproject(I(u));return W([m.lat+c.lat,m.lng+c.lng])}function Ln(t){for(var e=0,n=0,i=0,o=0;o<t.length;o++){var r=W(t[o]);e+=r.lat,n+=r.lng,i++}return W([e/i,n/i])}var Tn,zn={__proto__:null,clipPolygon:wn,polygonCenter:Pn,centroid:Ln};function Mn(t,e){if(!e||!t.length)return t.slice();var n=e*e;return t=Sn(t=En(t,n),n)}function kn(t,e,n){return Math.sqrt(Rn(t,e,n,!0))}function Cn(t,e,n){return Rn(t,e,n)}function Sn(t,e){var n=t.length,i=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(n);i[0]=i[n-1]=1,An(t,i,e,0,n-1);var o,r=[];for(o=0;o<n;o++)i[o]&&r.push(t[o]);return r}function An(t,e,n,i,o){var r,s,a,l=0;for(s=i+1;s<=o-1;s++)(a=Rn(t[s],t[i],t[o],!0))>l&&(r=s,l=a);l>n&&(e[r]=1,An(t,e,n,i,r),An(t,e,n,r,o))}function En(t,e){for(var n=[t[0]],i=1,o=0,r=t.length;i<r;i++)Bn(t[i],t[o])>e&&(n.push(t[i]),o=i);return o<r-1&&n.push(t[r-1]),n}function Zn(t,e,n,i,o){var r,s,a,l=i?Tn:In(t,n),h=In(e,n);for(Tn=h;;){if(!(l|h))return[t,e];if(l&h)return!1;a=In(s=On(t,e,r=l||h,n,o),n),r===l?(t=s,l=a):(e=s,h=a)}}function On(t,e,n,i,o){var r,s,a=e.x-t.x,l=e.y-t.y,h=i.min,u=i.max;return 8&n?(r=t.x+a*(u.y-t.y)/l,s=u.y):4&n?(r=t.x+a*(h.y-t.y)/l,s=h.y):2&n?(r=u.x,s=t.y+l*(u.x-t.x)/a):1&n&&(r=h.x,s=t.y+l*(h.x-t.x)/a),new Z(r,s,o)}function In(t,e){var n=0;return t.x<e.min.x?n|=1:t.x>e.max.x&&(n|=2),t.y<e.min.y?n|=4:t.y>e.max.y&&(n|=8),n}function Bn(t,e){var n=e.x-t.x,i=e.y-t.y;return n*n+i*i}function Rn(t,e,n,i){var o,r=e.x,s=e.y,a=n.x-r,l=n.y-s,h=a*a+l*l;return h>0&&((o=((t.x-r)*a+(t.y-s)*l)/h)>1?(r=n.x,s=n.y):o>0&&(r+=a*o,s+=l*o)),a=t.x-r,l=t.y-s,i?a*a+l*l:new Z(r,s)}function Nn(t){return!g(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function Dn(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Nn(t)}function jn(t,e){var n,i,o,r,s,a,l,h;if(!t||0===t.length)throw new Error("latlngs not passed");Nn(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var u=W([0,0]),c=D(t);c.getNorthWest().distanceTo(c.getSouthWest())*c.getNorthEast().distanceTo(c.getNorthWest())<1700&&(u=Ln(t));var d=t.length,p=[];for(n=0;n<d;n++){var _=W(t[n]);p.push(e.project(W([_.lat-u.lat,_.lng-u.lng])))}for(n=0,i=0;n<d-1;n++)i+=p[n].distanceTo(p[n+1])/2;if(0===i)h=p[0];else for(n=0,r=0;n<d-1;n++)if(s=p[n],a=p[n+1],(r+=o=s.distanceTo(a))>i){l=(r-i)/o,h=[a.x-l*(a.x-s.x),a.y-l*(a.y-s.y)];break}var f=e.unproject(I(h));return W([f.lat+u.lat,f.lng+u.lng])}var Wn={__proto__:null,simplify:Mn,pointToSegmentDistance:kn,closestPointOnSegment:Cn,clipSegment:Zn,_getEdgeIntersection:On,_getBitCode:In,_sqClosestPointOnSegment:Rn,isFlat:Nn,_flat:Dn,polylineCenter:jn},Hn={project:function(t){return new Z(t.lng,t.lat)},unproject:function(t){return new j(t.y,t.x)},bounds:new B([-180,-90],[180,90])},Fn={R:6378137,R_MINOR:6356752.314245179,bounds:new B([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,n=this.R,i=t.lat*e,o=this.R_MINOR/n,r=Math.sqrt(1-o*o),s=r*Math.sin(i),a=Math.tan(Math.PI/4-i/2)/Math.pow((1-s)/(1+s),r/2);return i=-n*Math.log(Math.max(a,1e-10)),new Z(t.lng*e*n,i)},unproject:function(t){for(var e,n=180/Math.PI,i=this.R,o=this.R_MINOR/i,r=Math.sqrt(1-o*o),s=Math.exp(-t.y/i),a=Math.PI/2-2*Math.atan(s),l=0,h=.1;l<15&&Math.abs(h)>1e-7;l++)e=r*Math.sin(a),e=Math.pow((1-e)/(1+e),r/2),a+=h=Math.PI/2-2*Math.atan(s*e)-a;return new j(a*n,t.x*n/i)}},Un={__proto__:null,LonLat:Hn,Mercator:Fn,SphericalMercator:q},Vn=n({},U,{code:"EPSG:3395",projection:Fn,transformation:function(){var t=.5/(Math.PI*Fn.R);return Y(t,.5,-t,.5)}()}),qn=n({},U,{code:"EPSG:4326",projection:Hn,transformation:Y(1/180,1,-1/180,.5)}),Gn=n({},F,{projection:Hn,transformation:Y(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var n=e.lng-t.lng,i=e.lat-t.lat;return Math.sqrt(n*n+i*i)},infinite:!0});F.Earth=U,F.EPSG3395=Vn,F.EPSG3857=K,F.EPSG900913=J,F.EPSG4326=qn,F.Simple=Gn;var Yn=E.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[s(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[s(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var n=this.getEvents();e.on(n,this),this.once("remove",(function(){e.off(n,this)}),this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});rn.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=s(t);return this._layers[e]||(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var e=s(t);return this._layers[e]?(this._loaded&&t.onRemove(this),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return s(t)in this._layers},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},_addLayers:function(t){for(var e=0,n=(t=t?g(t)?t:[t]:[]).length;e<n;e++)this.addLayer(t[e])},_addZoomLimit:function(t){isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[s(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=s(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,n=this._getZoomSpan();for(var i in this._zoomBoundLayers){var o=this._zoomBoundLayers[i].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),e=void 0===o.maxZoom?e:Math.max(e,o.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,n!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Kn=Yn.extend({initialize:function(t,e){var n,i;if(p(this,e),this._layers={},t)for(n=0,i=t.length;n<i;n++)this.addLayer(t[n])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return("number"==typeof t?t:this.getLayerId(t))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,n,i=Array.prototype.slice.call(arguments,1);for(e in this._layers)(n=this._layers[e])[t]&&n[t].apply(n,i);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return s(t)}}),Jn=function(t,e){return new Kn(t,e)},Xn=Kn.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Kn.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Kn.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new N;for(var e in this._layers){var n=this._layers[e];t.extend(n.getBounds?n.getBounds():n.getLatLng())}return t}}),Qn=function(t,e){return new Xn(t,e)},$n=C.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){p(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var n=this._getIconUrl(t);if(!n){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var i=this._createImg(n,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(i,t),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),i},_setIconStyles:function(t,e){var n=this.options,i=n[e+"Size"];"number"==typeof i&&(i=[i,i]);var o=I(i),r=I("shadow"===e&&n.shadowAnchor||n.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(n.className||""),r&&(t.style.marginLeft=-r.x+"px",t.style.marginTop=-r.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return Nt.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function ti(t){return new $n(t)}var ei=$n.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return"string"!=typeof ei.imagePath&&(ei.imagePath=this._detectIconPath()),(this.options.imagePath||ei.imagePath)+$n.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var e=function(t,e,n){var i=e.exec(t);return i&&i[n]};return(t=e(t,/^url\((['"])?(.+)\1\)$/,2))&&e(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=fe("div","leaflet-default-icon-path",document.body),e=_e(t,"background-image")||_e(t,"backgroundImage");if(document.body.removeChild(t),e=this._stripUrl(e))return e;var n=document.querySelector('link[href$="leaflet.css"]');return n?n.href.substring(0,n.href.length-11-1):""}}),ni=vn.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new bn(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),be(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&we(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,n=e._map,i=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,r=Se(e._icon),s=n.getPixelBounds(),a=n.getPixelOrigin(),l=R(s.min._subtract(a).add(o),s.max._subtract(a).subtract(o));if(!l.contains(r)){var h=I((Math.max(l.max.x,r.x)-l.max.x)/(s.max.x-l.max.x)-(Math.min(l.min.x,r.x)-l.min.x)/(s.min.x-l.min.x),(Math.max(l.max.y,r.y)-l.max.y)/(s.max.y-l.max.y)-(Math.min(l.min.y,r.y)-l.min.y)/(s.min.y-l.min.y)).multiplyBy(i);n.panBy(h,{animate:!1}),this._draggable._newPos._add(h),this._draggable._startPos._add(h),Ce(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=z(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(M(this._panRequest),this._panRequest=z(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,n=e._shadow,i=Se(e._icon),o=e._map.layerPointToLatLng(i);n&&Ce(n,i),e._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){M(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),ii=Yn.extend({options:{icon:new ei,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){p(this,e),this._latlng=W(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=W(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),n=t.icon.createIcon(this._icon),i=!1;n!==this._icon&&(this._icon&&this._removeIcon(),i=!0,t.title&&(n.title=t.title),"IMG"===n.tagName&&(n.alt=t.alt||"")),be(n,e),t.keyboard&&(n.tabIndex="0",n.setAttribute("role","button")),this._icon=n,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&De(n,"focus",this._panOnFocus,this);var o=t.icon.createShadow(this._shadow),r=!1;o!==this._shadow&&(this._removeShadow(),r=!0),o&&(be(o,e),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&r&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&We(this._icon,"focus",this._panOnFocus,this),me(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&me(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&Ce(this._icon,t),this._shadow&&Ce(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(be(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),ni)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new ni(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&Te(this._icon,t),this._shadow&&Te(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t=this._map;if(t){var e=this.options.icon.options,n=e.iconSize?I(e.iconSize):I(0,0),i=e.iconAnchor?I(e.iconAnchor):I(0,0);t.panInside(this._latlng,{paddingTopLeft:i,paddingBottomRight:n.subtract(i)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function oi(t,e){return new ii(t,e)}var ri=Yn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return p(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),si=ri.extend({options:{fill:!0,radius:10},initialize:function(t,e){p(this,e),this._latlng=W(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=W(t),this.redraw(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return ri.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,n=this._clickTolerance(),i=[t+n,e+n];this._pxBounds=new B(this._point.subtract(i),this._point.add(i))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function ai(t,e){return new si(t,e)}var li=si.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),p(this,e),this._latlng=W(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new N(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:ri.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,n=this._map,i=n.options.crs;if(i.distance===U.distance){var o=Math.PI/180,r=this._mRadius/U.R/o,s=n.project([e+r,t]),a=n.project([e-r,t]),l=s.add(a).divideBy(2),h=n.unproject(l).lat,u=Math.acos((Math.cos(r*o)-Math.sin(e*o)*Math.sin(h*o))/(Math.cos(e*o)*Math.cos(h*o)))/o;(isNaN(u)||0===u)&&(u=r/Math.cos(Math.PI/180*e)),this._point=l.subtract(n.getPixelOrigin()),this._radius=isNaN(u)?0:l.x-n.project([h,t-u]).x,this._radiusY=l.y-s.y}else{var c=i.unproject(i.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(c).x}this._updateBounds()}});function hi(t,e,n){return new li(t,e,n)}var ui=ri.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){p(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,n,i=1/0,o=null,r=Rn,s=0,a=this._parts.length;s<a;s++)for(var l=this._parts[s],h=1,u=l.length;h<u;h++){var c=r(t,e=l[h-1],n=l[h],!0);c<i&&(i=c,o=r(t,e,n))}return o&&(o.distance=Math.sqrt(i)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return jn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=W(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new N,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return Nn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],n=Nn(t),i=0,o=t.length;i<o;i++)n?(e[i]=W(t[i]),this._bounds.extend(e[i])):e[i]=this._convertLatLngs(t[i]);return e},_project:function(){var t=new B;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new Z(t,t);this._rawPxBounds&&(this._pxBounds=new B([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]))},_projectLatlngs:function(t,e,n){var i,o,r=t[0]instanceof j,s=t.length;if(r){for(o=[],i=0;i<s;i++)o[i]=this._map.latLngToLayerPoint(t[i]),n.extend(o[i]);e.push(o)}else for(i=0;i<s;i++)this._projectLatlngs(t[i],e,n)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,n,i,o,r,s,a,l=this._parts;for(e=0,i=0,o=this._rings.length;e<o;e++)for(n=0,r=(a=this._rings[e]).length;n<r-1;n++)(s=Zn(a[n],a[n+1],t,n,!0))&&(l[i]=l[i]||[],l[i].push(s[0]),s[1]===a[n+1]&&n!==r-2||(l[i].push(s[1]),i++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,n=0,i=t.length;n<i;n++)t[n]=Mn(t[n],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var n,i,o,r,s,a,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,r=this._parts.length;n<r;n++)for(i=0,o=(s=(a=this._parts[n]).length)-1;i<s;o=i++)if((e||0!==i)&&kn(t,a[o],a[i])<=l)return!0;return!1}});function ci(t,e){return new ui(t,e)}ui._flat=Dn;var di=ui.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Pn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var e=ui.prototype._convertLatLngs.call(this,t),n=e.length;return n>=2&&e[0]instanceof j&&e[0].equals(e[n-1])&&e.pop(),e},_setLatLngs:function(t){ui.prototype._setLatLngs.call(this,t),Nn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Nn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,n=new Z(e,e);if(t=new B(t.min.subtract(n),t.max.add(n)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var i,o=0,r=this._rings.length;o<r;o++)(i=wn(this._rings[o],t,!0)).length&&this._parts.push(i)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,n,i,o,r,s,a,l,h=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(r=0,s=(l=(e=this._parts[o]).length)-1;r<l;s=r++)n=e[r],i=e[s],n.y>t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(h=!h);return h||ui.prototype._containsPoint.call(this,t,!0)}});function pi(t,e){return new di(t,e)}var _i=Xn.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,o=g(t)?t:t.features;if(o){for(e=0,n=o.length;e<n;e++)((i=o[e]).geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var r=this.options;if(r.filter&&!r.filter(t))return this;var s=fi(t,r);return s?(s.feature=wi(t),s.defaultOptions=s.options,this.resetStyle(s),r.onEachFeature&&r.onEachFeature(t,s),this.addLayer(s)):this},resetStyle:function(t){return void 0===t?this.eachLayer(this.resetStyle,this):(t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(t){return this.eachLayer((function(e){this._setLayerStyle(e,t)}),this)},_setLayerStyle:function(t,e){t.setStyle&&("function"==typeof e&&(e=e(t.feature)),t.setStyle(e))}});function fi(t,e){var n,i,o,r,s="Feature"===t.type?t.geometry:t,a=s?s.coordinates:null,l=[],h=e&&e.pointToLayer,u=e&&e.coordsToLatLng||gi;if(!a&&!s)return null;switch(s.type){case"Point":return mi(h,t,n=u(a),e);case"MultiPoint":for(o=0,r=a.length;o<r;o++)n=u(a[o]),l.push(mi(h,t,n,e));return new Xn(l);case"LineString":case"MultiLineString":return i=vi(a,"LineString"===s.type?0:1,u),new ui(i,e);case"Polygon":case"MultiPolygon":return i=vi(a,"Polygon"===s.type?1:2,u),new di(i,e);case"GeometryCollection":for(o=0,r=s.geometries.length;o<r;o++){var c=fi({geometry:s.geometries[o],type:"Feature",properties:t.properties},e);c&&l.push(c)}return new Xn(l);case"FeatureCollection":for(o=0,r=s.features.length;o<r;o++){var d=fi(s.features[o],e);d&&l.push(d)}return new Xn(l);default:throw new Error("Invalid GeoJSON object.")}}function mi(t,e,n,i){return t?t(e,n):new ii(n,i&&i.markersInheritOptions&&i)}function gi(t){return new j(t[1],t[0],t[2])}function vi(t,e,n){for(var i,o=[],r=0,s=t.length;r<s;r++)i=e?vi(t[r],e-1,n):(n||gi)(t[r]),o.push(i);return o}function yi(t,e){return void 0!==(t=W(t)).alt?[u(t.lng,e),u(t.lat,e),u(t.alt,e)]:[u(t.lng,e),u(t.lat,e)]}function xi(t,e,n,i){for(var o=[],r=0,s=t.length;r<s;r++)o.push(e?xi(t[r],Nn(t[r])?0:e-1,n,i):yi(t[r],i));return!e&&n&&o.length>0&&o.push(o[0].slice()),o}function bi(t,e){return t.feature?n({},t.feature,{geometry:e}):wi(e)}function wi(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var Pi={toGeoJSON:function(t){return bi(this,{type:"Point",coordinates:yi(this.getLatLng(),t)})}};function Li(t,e){return new _i(t,e)}ii.include(Pi),li.include(Pi),si.include(Pi),ui.include({toGeoJSON:function(t){var e=!Nn(this._latlngs);return bi(this,{type:(e?"Multi":"")+"LineString",coordinates:xi(this._latlngs,e?1:0,!1,t)})}}),di.include({toGeoJSON:function(t){var e=!Nn(this._latlngs),n=e&&!Nn(this._latlngs[0]),i=xi(this._latlngs,n?2:e?1:0,!0,t);return e||(i=[i]),bi(this,{type:(n?"Multi":"")+"Polygon",coordinates:i})}}),Kn.include({toMultiPoint:function(t){var e=[];return this.eachLayer((function(n){e.push(n.toGeoJSON(t).geometry.coordinates)})),bi(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var n="GeometryCollection"===e,i=[];return this.eachLayer((function(e){if(e.toGeoJSON){var o=e.toGeoJSON(t);if(n)i.push(o.geometry);else{var r=wi(o);"FeatureCollection"===r.type?i.push.apply(i,r.features):i.push(r)}}})),n?bi(this,{geometries:i,type:"GeometryCollection"}):{type:"FeatureCollection",features:i}}});var Ti=Li,zi=Yn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,n){this._url=t,this._bounds=D(e),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(be(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){me(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&ve(this._image),this},bringToBack:function(){return this._map&&ye(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=D(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:fe("img");be(e,"leaflet-image-layer"),this._zoomAnimated&&be(e,"leaflet-zoom-animated"),this.options.className&&be(e,this.options.className),e.onselectstart=h,e.onmousemove=h,e.onload=o(this.fire,this,"load"),e.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;ke(this._image,n,e)},_reset:function(){var t=this._image,e=new B(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=e.getSize();Ce(t,e.min),t.style.width=n.x+"px",t.style.height=n.y+"px"},_updateOpacity:function(){Te(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Mi=function(t,e,n){return new zi(t,e,n)},ki=zi.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:fe("video");if(be(e,"leaflet-image-layer"),this._zoomAnimated&&be(e,"leaflet-zoom-animated"),this.options.className&&be(e,this.options.className),e.onselectstart=h,e.onmousemove=h,e.onloadeddata=o(this.fire,this,"load"),t){for(var n=e.getElementsByTagName("source"),i=[],r=0;r<n.length;r++)i.push(n[r].src);this._url=n.length>0?i:[e.src]}else{g(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted,e.playsInline=!!this.options.playsInline;for(var s=0;s<this._url.length;s++){var a=fe("source");a.src=this._url[s],e.appendChild(a)}}}});function Ci(t,e,n){return new ki(t,e,n)}var Si=zi.extend({_initImage:function(){var t=this._image=this._url;be(t,"leaflet-image-layer"),this._zoomAnimated&&be(t,"leaflet-zoom-animated"),this.options.className&&be(t,this.options.className),t.onselectstart=h,t.onmousemove=h}});function Ai(t,e,n){return new Si(t,e,n)}var Ei=Yn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,e){t&&(t instanceof j||g(t))?(this._latlng=W(t),p(this,e)):(p(this,t),this._source=e),this.options.content&&(this._content=this.options.content)},openOn:function(t){return(t=arguments.length?t:this._source._map).hasLayer(this)||t.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(t){return this._map?this.close():(arguments.length?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t._map)),this},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&Te(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&Te(this._container,1),this.bringToFront(),this.options.interactive&&(be(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(Te(this._container,0),this._removeTimeout=setTimeout(o(me,void 0,this._container),200)):me(this._container),this.options.interactive&&(we(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=W(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&ve(this._container),this},bringToBack:function(){return this._map&&ye(this._container),this},_prepareOpen:function(t){var e=this._source;if(!e._map)return!1;if(e instanceof Xn){e=null;var n=this._source._layers;for(var i in n)if(n[i]._map){e=n[i];break}if(!e)return!1;this._source=e}if(!t)if(e.getCenter)t=e.getCenter();else if(e.getLatLng)t=e.getLatLng();else{if(!e.getBounds)throw new Error("Unable to get source layer LatLng.");t=e.getBounds().getCenter()}return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=I(this.options.offset),n=this._getAnchor();this._zoomAnimated?Ce(this._container,t.add(n)):e=e.add(t).add(n);var i=this._containerBottom=-e.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=i+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}});rn.include({_initOverlay:function(t,e,n,i){var o=e;return o instanceof t||(o=new t(i).setContent(e)),n&&o.setLatLng(n),o}}),Yn.include({_initOverlay:function(t,e,n,i){var o=n;return o instanceof t?(p(o,i),o._source=this):(o=e&&!i?e:new t(i,this)).setContent(n),o}});var Zi=Ei.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return!(t=arguments.length?t:this._source._map).hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,Ei.prototype.openOn.call(this,t)},onAdd:function(t){Ei.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof ri||this._source.on("preclick",qe))},onRemove:function(t){Ei.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof ri||this._source.off("preclick",qe))},getEvents:function(){var t=Ei.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_initLayout:function(){var t="leaflet-popup",e=this._container=fe("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),n=this._wrapper=fe("div",t+"-content-wrapper",e);if(this._contentNode=fe("div",t+"-content",n),Ye(e),Ge(this._contentNode),De(e,"contextmenu",qe),this._tipContainer=fe("div",t+"-tip-container",e),this._tip=fe("div",t+"-tip",this._tipContainer),this.options.closeButton){var i=this._closeButton=fe("a",t+"-close-button",e);i.setAttribute("role","button"),i.setAttribute("aria-label","Close popup"),i.href="#close",i.innerHTML='<span aria-hidden="true">×</span>',De(i,"click",(function(t){Ke(t),this.close()}),this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var n=t.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),e.width=n+1+"px",e.whiteSpace="",e.height="";var i=t.offsetHeight,o=this.options.maxHeight,r="leaflet-popup-scrolled";o&&i>o?(e.height=o+"px",be(t,r)):we(t,r),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),n=this._getAnchor();Ce(this._container,e.add(n))},_adjustPan:function(){if(this.options.autoPan)if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning)this._autopanning=!1;else{var t=this._map,e=parseInt(_e(this._container,"marginBottom"),10)||0,n=this._container.offsetHeight+e,i=this._containerWidth,o=new Z(this._containerLeft,-n-this._containerBottom);o._add(Se(this._container));var r=t.layerPointToContainerPoint(o),s=I(this.options.autoPanPadding),a=I(this.options.autoPanPaddingTopLeft||s),l=I(this.options.autoPanPaddingBottomRight||s),h=t.getSize(),u=0,c=0;r.x+i+l.x>h.x&&(u=r.x+i-h.x+l.x),r.x-u-a.x<0&&(u=r.x-a.x),r.y+n+l.y>h.y&&(c=r.y+n-h.y+l.y),r.y-c-a.y<0&&(c=r.y-a.y),(u||c)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([u,c]))}},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Oi=function(t,e){return new Zi(t,e)};rn.mergeOptions({closePopupOnClick:!0}),rn.include({openPopup:function(t,e,n){return this._initOverlay(Zi,t,e,n).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),Yn.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Zi,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof Xn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(this._popup&&this._map){Je(t);var e=t.layer||t.target;this._popup._source!==e||e instanceof ri?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Ii=Ei.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Ei.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Ei.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Ei.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=fe("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+s(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,n,i=this._map,o=this._container,r=i.latLngToContainerPoint(i.getCenter()),s=i.layerPointToContainerPoint(t),a=this.options.direction,l=o.offsetWidth,h=o.offsetHeight,u=I(this.options.offset),c=this._getAnchor();"top"===a?(e=l/2,n=h):"bottom"===a?(e=l/2,n=0):"center"===a?(e=l/2,n=h/2):"right"===a?(e=0,n=h/2):"left"===a?(e=l,n=h/2):s.x<r.x?(a="right",e=0,n=h/2):(a="left",e=l+2*(u.x+c.x),n=h/2),t=t.subtract(I(e,n,!0)).add(u).add(c),we(o,"leaflet-tooltip-right"),we(o,"leaflet-tooltip-left"),we(o,"leaflet-tooltip-top"),we(o,"leaflet-tooltip-bottom"),be(o,"leaflet-tooltip-"+a),Ce(o,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&Te(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return I(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Bi=function(t,e){return new Ii(t,e)};rn.include({openTooltip:function(t,e,n){return this._initOverlay(Ii,t,e,n).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),Yn.include({bindTooltip:function(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Ii,this._tooltip,t,e),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[e](n),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof Xn||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(t){var e="function"==typeof t.getElement&&t.getElement();e&&(De(e,"focus",(function(){this._tooltip._source=t,this.openTooltip()}),this),De(e,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var e="function"==typeof t.getElement&&t.getElement();e&&e.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){if(this._tooltip&&this._map)if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var e=this;this._map.once("moveend",(function(){e._openOnceFlag=!1,e._openTooltip(t)}))}else this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,n,i=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(e),i=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(i)}});var Ri=$n.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),n=this.options;if(n.html instanceof Element?(ge(e),e.appendChild(n.html)):e.innerHTML=!1!==n.html?n.html:"",n.bgPos){var i=I(n.bgPos);e.style.backgroundPosition=-i.x+"px "+-i.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Ni(t){return new Ri(t)}$n.Default=ei;var Di=Yn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Nt.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){p(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),me(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(ve(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ye(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var t=this._clampZoom(this._map.getZoom());t!==this._tileZoom&&(this._tileZoom=t,this._updateLevels()),this._update()}return this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=a(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof Z?t:new Z(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,n=this.getPane().children,i=-t(-1/0,1/0),o=0,r=n.length;o<r;o++)e=n[o].style.zIndex,n[o]!==this._container&&e&&(i=t(i,+e));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Nt.ielt9){Te(this._container,this.options.opacity);var t=+new Date,e=!1,n=!1;for(var i in this._tiles){var o=this._tiles[i];if(o.current&&o.loaded){var r=Math.min(1,(t-o.loaded)/200);Te(o.el,r),r<1?e=!0:(o.active?n=!0:this._onOpaqueTile(o),o.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),e&&(M(this._fadeFrame),this._fadeFrame=z(this._updateOpacity,this))}},_onOpaqueTile:h,_initContainer:function(){this._container||(this._container=fe("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===t?(this._levels[n].el.style.zIndex=e-Math.abs(t-n),this._onUpdateLevel(n)):(me(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var i=this._levels[t],o=this._map;return i||((i=this._levels[t]={}).el=fe("div","leaflet-tile-container leaflet-zoom-animated",this._container),i.el.style.zIndex=e,i.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),i.zoom=t,this._setZoomTransform(i,o.getCenter(),o.getZoom()),h(i.el.offsetWidth),this._onCreateLevel(i)),this._level=i,i}},_onUpdateLevel:h,_onRemoveLevel:h,_onCreateLevel:h,_pruneTiles:function(){if(this._map){var t,e,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var i=e.coords;this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)me(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,n,i){var o=Math.floor(t/2),r=Math.floor(e/2),s=n-1,a=new Z(+o,+r);a.z=+s;var l=this._tileCoordsToKey(a),h=this._tiles[l];return h&&h.active?(h.retain=!0,!0):(h&&h.loaded&&(h.retain=!0),s>i&&this._retainParent(o,r,s,i))},_retainChildren:function(t,e,n,i){for(var o=2*t;o<2*t+2;o++)for(var r=2*e;r<2*e+2;r++){var s=new Z(o,r);s.z=n+1;var a=this._tileCoordsToKey(s),l=this._tiles[a];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),n+1<i&&this._retainChildren(o,r,n+1,i))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,n,i){var o=Math.round(e);o=void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom?void 0:this._clampZoom(o);var r=this.options.updateWhenZooming&&o!==this._tileZoom;i&&!r||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var n in this._levels)this._setZoomTransform(this._levels[n],t,e)},_setZoomTransform:function(t,e,n){var i=this._map.getZoomScale(n,t.zoom),o=t.origin.multiplyBy(i).subtract(this._map._getNewPixelOrigin(e,n)).round();Nt.any3d?ke(t.el,o,i):Ce(t.el,o)},_resetGrid:function(){var t=this._map,e=t.options.crs,n=this._tileSize=this.getTileSize(),i=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],i).x/n.x),Math.ceil(t.project([0,e.wrapLng[1]],i).x/n.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],i).y/n.x),Math.ceil(t.project([e.wrapLat[1],0],i).y/n.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,n=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),i=e.getZoomScale(n,this._tileZoom),o=e.project(t,this._tileZoom).floor(),r=e.getSize().divideBy(2*i);return new B(o.subtract(r),o.add(r))},_update:function(t){var e=this._map;if(e){var n=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var i=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(i),r=o.getCenter(),s=[],a=this.options.keepBuffer,l=new B(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var h in this._tiles){var u=this._tiles[h].coords;u.z===this._tileZoom&&l.contains(new Z(u.x,u.y))||(this._tiles[h].current=!1)}if(Math.abs(n-this._tileZoom)>1)this._setView(t,n);else{for(var c=o.min.y;c<=o.max.y;c++)for(var d=o.min.x;d<=o.max.x;d++){var p=new Z(d,c);if(p.z=this._tileZoom,this._isValidTile(p)){var _=this._tiles[this._tileCoordsToKey(p)];_?_.current=!0:s.push(p)}}if(s.sort((function(t,e){return t.distanceTo(r)-e.distanceTo(r)})),0!==s.length){this._loading||(this._loading=!0,this.fire("loading"));var f=document.createDocumentFragment();for(d=0;d<s.length;d++)this._addTile(s[d],f);this._level.el.appendChild(f)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var n=this._globalTileRange;if(!e.wrapLng&&(t.x<n.min.x||t.x>n.max.x)||!e.wrapLat&&(t.y<n.min.y||t.y>n.max.y))return!1}if(!this.options.bounds)return!0;var i=this._tileCoordsToBounds(t);return D(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n),o=i.add(n);return[e.unproject(i,t.z),e.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),n=new N(e[0],e[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),n=new Z(+e[0],+e[1]);return n.z=+e[2],n},_removeTile:function(t){var e=this._tiles[t];e&&(me(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){be(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=h,t.onmousemove=h,Nt.ielt9&&this.options.opacity<1&&Te(t,this.options.opacity)},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),r=this.createTile(this._wrapCoords(t),o(this._tileReady,this,t));this._initTile(r),this.createTile.length<2&&z(o(this._tileReady,this,t,null,r)),Ce(r,n),this._tiles[i]={el:r,coords:t,current:!0},e.appendChild(r),this.fire("tileloadstart",{tile:r,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(Te(n.el,0),M(this._fadeFrame),this._fadeFrame=z(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(be(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Nt.ielt9||!this._map._fadeAnimated?z(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new Z(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new B(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function ji(t){return new Di(t)}var Wi=Di.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=p(this,e)).detectRetina&&Nt.retina&&e.maxZoom>0?(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom=Math.min(e.maxZoom,e.minZoom+1)):(e.zoomOffset++,e.maxZoom=Math.max(e.minZoom,e.maxZoom-1)),e.minZoom=Math.max(0,e.minZoom)):e.zoomReverse?e.minZoom=Math.min(e.maxZoom,e.minZoom):e.maxZoom=Math.max(e.minZoom,e.maxZoom),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var n=document.createElement("img");return De(n,"load",o(this._tileOnLoad,this,e,n)),De(n,"error",o(this._tileOnError,this,e,n)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),"string"==typeof this.options.referrerPolicy&&(n.referrerPolicy=this.options.referrerPolicy),n.alt="",n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:Nt.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return m(this._url,n(e,this.options))},_tileOnLoad:function(t,e){Nt.ielt9?setTimeout(o(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,n){var i=this.options.errorTileUrl;i&&e.getAttribute("src")!==i&&(e.src=i),t(n,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom;return this.options.zoomReverse&&(t=e-t),t+this.options.zoomOffset},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=h,e.onerror=h,!e.complete)){e.src=y;var n=this._tiles[t].coords;me(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:n})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",y),Di.prototype._removeTile.call(this,t)},_tileReady:function(t,e,n){if(this._map&&(!n||n.getAttribute("src")!==y))return Di.prototype._tileReady.call(this,t,e,n)}});function Hi(t,e){return new Wi(t,e)}var Fi=Wi.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var o in e)o in this.options||(i[o]=e[o]);var r=(e=p(this,e)).detectRetina&&Nt.retina?2:1,s=this.getTileSize();i.width=s.x*r,i.height=s.y*r,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,Wi.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),n=this._crs,i=R(n.project(e[0]),n.project(e[1])),o=i.min,r=i.max,s=(this._wmsVersion>=1.3&&this._crs===qn?[o.y,o.x,r.y,r.x]:[o.x,o.y,r.x,r.y]).join(","),a=Wi.prototype.getTileUrl.call(this,t);return a+_(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+s},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});function Ui(t,e){return new Fi(t,e)}Wi.WMS=Fi,Hi.wms=Ui;var Vi=Yn.extend({options:{padding:.1},initialize:function(t){p(this,t),s(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),be(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var n=this._map.getZoomScale(e,this._zoom),i=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),r=i.multiplyBy(-n).add(o).subtract(this._map._getNewPixelOrigin(t,e));Nt.any3d?ke(this._container,r,n):Ce(this._container,r)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),n=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new B(n,n.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qi=Vi.extend({options:{tolerance:0},getEvents:function(){var t=Vi.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Vi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");De(t,"mousemove",this._onMouseMove,this),De(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),De(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){M(this._redrawRequest),delete this._ctx,me(this._container),We(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){Vi.prototype._update.call(this);var t=this._bounds,e=this._container,n=t.getSize(),i=Nt.retina?2:1;Ce(e,t.min),e.width=i*n.x,e.height=i*n.y,e.style.width=n.x+"px",e.style.height=n.y+"px",Nt.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Vi.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[s(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,n=e.next,i=e.prev;n?n.prev=i:this._drawLast=i,i?i.next=n:this._drawFirst=n,delete t._order,delete this._layers[s(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,n,i=t.options.dashArray.split(/[, ]+/),o=[];for(n=0;n<i.length;n++){if(e=Number(i[n]),isNaN(e))return;o.push(e)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||z(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new B,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var n=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var i=this._drawFirst;i;i=i.next)t=i.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var n,i,o,r,s=t._parts,a=s.length,l=this._ctx;if(a){for(l.beginPath(),n=0;n<a;n++){for(i=0,o=s[n].length;i<o;i++)r=s[n][i],l[i?"lineTo":"moveTo"](r.x,r.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,n=this._ctx,i=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||i)/i;1!==o&&(n.save(),n.scale(1,o)),n.beginPath(),n.arc(e.x,e.y/o,i,0,2*Math.PI,!1),1!==o&&n.restore(),this._fillStroke(n,t)}},_fillStroke:function(t,e){var n=e.options;n.fill&&(t.globalAlpha=n.fillOpacity,t.fillStyle=n.fillColor||n.color,t.fill(n.fillRule||"evenodd")),n.stroke&&0!==n.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=n.opacity,t.lineWidth=n.weight,t.strokeStyle=n.color,t.lineCap=n.lineCap,t.lineJoin=n.lineJoin,t.stroke())},_onClick:function(t){for(var e,n,i=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(i)&&("click"!==t.type&&"preclick"!==t.type||!this._map._draggableMoved(e))&&(n=e);this._fireEvent(!!n&&[n],t)},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(we(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var n,i,r=this._drawFirst;r;r=r.next)(n=r.layer).options.interactive&&n._containsPoint(e)&&(i=n);i!==this._hoveredLayer&&(this._handleMouseOut(t),i&&(be(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseover"),this._hoveredLayer=i)),this._fireEvent(!!this._hoveredLayer&&[this._hoveredLayer],t),this._mouseHoverThrottled=!0,setTimeout(o((function(){this._mouseHoverThrottled=!1}),this),32)}},_fireEvent:function(t,e,n){this._map._fireDOMEvent(e,n||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;n&&(n.prev=i,i?i.next=n:n&&(this._drawFirst=n),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;i&&(i.next=n,n?n.prev=i:i&&(this._drawLast=i),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function Gi(t){return Nt.canvas?new qi(t):null}var Yi=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Ki={_initContainer:function(){this._container=fe("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Vi.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Yi("shape");be(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Yi("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[s(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;me(e),t.removeInteractiveTarget(e),delete this._layers[s(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,o=t._container;o.stroked=!!i.stroke,o.filled=!!i.fill,i.stroke?(e||(e=t._stroke=Yi("stroke")),o.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=g(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(o.removeChild(e),t._stroke=null),i.fill?(n||(n=t._fill=Yi("fill")),o.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(o.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){ve(t._container)},_bringToBack:function(t){ye(t._container)}},Ji=Nt.vml?Yi:X,Xi=Vi.extend({_initContainer:function(){this._container=Ji("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ji("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){me(this._container),We(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!this._map._animatingZoom||!this._bounds){Vi.prototype._update.call(this);var t=this._bounds,e=t.getSize(),n=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),Ce(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Ji("path");t.options.className&&be(e,t.options.className),t.options.interactive&&be(e,"leaflet-interactive"),this._updateStyle(t),this._layers[s(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){me(t._path),t.removeInteractiveTarget(t._path),delete this._layers[s(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,n=t.options;e&&(n.stroke?(e.setAttribute("stroke",n.color),e.setAttribute("stroke-opacity",n.opacity),e.setAttribute("stroke-width",n.weight),e.setAttribute("stroke-linecap",n.lineCap),e.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?e.setAttribute("stroke-dasharray",n.dashArray):e.removeAttribute("stroke-dasharray"),n.dashOffset?e.setAttribute("stroke-dashoffset",n.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),n.fill?(e.setAttribute("fill",n.fillColor||n.color),e.setAttribute("fill-opacity",n.fillOpacity),e.setAttribute("fill-rule",n.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Q(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i="a"+n+","+(Math.max(Math.round(t._radiusY),1)||n)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+i+2*n+",0 "+i+2*-n+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){ve(t._path)},_bringToBack:function(t){ye(t._path)}});function Qi(t){return Nt.svg||Nt.vml?new Xi(t):null}Nt.vml&&Xi.include(Ki),rn.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Gi(t)||Qi(t)}});var $i=di.extend({initialize:function(t,e){di.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=D(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function to(t,e){return new $i(t,e)}Xi.create=Ji,Xi.pointsToPath=Q,_i.geometryToLayer=fi,_i.coordsToLatLng=gi,_i.coordsToLatLngs=vi,_i.latLngToCoords=yi,_i.latLngsToCoords=xi,_i.getFeature=bi,_i.asFeature=wi,rn.mergeOptions({boxZoom:!0});var eo=vn.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){De(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){We(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){me(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),re(),Ee(),this._startPoint=this._map.mouseEventToContainerPoint(t),De(document,{contextmenu:Je,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=fe("div","leaflet-zoom-box",this._container),be(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new B(this._point,this._startPoint),n=e.getSize();Ce(this._box,e.min),this._box.style.width=n.x+"px",this._box.style.height=n.y+"px"},_finish:function(){this._moved&&(me(this._box),we(this._container,"leaflet-crosshair")),se(),Ze(),We(document,{contextmenu:Je,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var e=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});rn.addInitHook("addHandler","boxZoom",eo),rn.mergeOptions({doubleClickZoom:!0});var no=vn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta,o=t.originalEvent.shiftKey?n-i:n+i;"center"===e.options.doubleClickZoom?e.setZoom(o):e.setZoomAround(t.containerPoint,o)}});rn.addInitHook("addHandler","doubleClickZoom",no),rn.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var io=vn.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new bn(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}be(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){we(this._map._container,"leaflet-grab"),we(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=D(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,o=(i-e+n)%t+e-n,r=(i+e+n)%t-e-n,s=Math.abs(o+n)<Math.abs(r+n)?o:r;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=s},_onDragEnd:function(t){var e=this._map,n=e.options,i=!n.inertia||t.noInertia||this._times.length<2;if(e.fire("dragend",t),i)e.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),r=(this._lastTime-this._times[0])/1e3,s=n.easeLinearity,a=o.multiplyBy(s/r),l=a.distanceTo([0,0]),h=Math.min(n.inertiaMaxSpeed,l),u=a.multiplyBy(h/l),c=h/(n.inertiaDeceleration*s),d=u.multiplyBy(-c/2).round();d.x||d.y?(d=e._limitOffset(d,e.options.maxBounds),z((function(){e.panBy(d,{duration:c,easeLinearity:s,noMoveStart:!0,animate:!0})}))):e.fire("moveend")}}});rn.addInitHook("addHandler","dragging",io),rn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var oo=vn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),De(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),We(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,n=t.scrollTop||e.scrollTop,i=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(i,n)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,n,i=this._panKeys={},o=this.keyCodes;for(e=0,n=o.left.length;e<n;e++)i[o.left[e]]=[-1*t,0];for(e=0,n=o.right.length;e<n;e++)i[o.right[e]]=[t,0];for(e=0,n=o.down.length;e<n;e++)i[o.down[e]]=[0,t];for(e=0,n=o.up.length;e<n;e++)i[o.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,n,i=this._zoomKeys={},o=this.keyCodes;for(e=0,n=o.zoomIn.length;e<n;e++)i[o.zoomIn[e]]=t;for(e=0,n=o.zoomOut.length;e<n;e++)i[o.zoomOut[e]]=-t},_addHooks:function(){De(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){We(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,n=t.keyCode,i=this._map;if(n in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(e=this._panKeys[n],t.shiftKey&&(e=I(e).multiplyBy(3)),i.options.maxBounds&&(e=i._limitOffset(I(e),i.options.maxBounds)),i.options.worldCopyJump){var o=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(e)));i.panTo(o)}else i.panBy(e)}else if(n in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}Je(t)}}});rn.addInitHook("addHandler","keyboard",oo),rn.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var ro=vn.extend({addHooks:function(){De(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){We(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=tn(t),n=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var i=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(o(this._performZoom,this),i),Je(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),n=this._map.options.zoomSnap||0;t._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(i))))/Math.LN2,r=n?Math.ceil(o/n)*n:o,s=t._limitZoom(e+(this._delta>0?r:-r))-e;this._delta=0,this._startTime=null,s&&("center"===t.options.scrollWheelZoom?t.setZoom(e+s):t.setZoomAround(this._lastMousePos,e+s))}});rn.addInitHook("addHandler","scrollWheelZoom",ro);var so=600;rn.mergeOptions({tapHold:Nt.touchNative&&Nt.safari&&Nt.mobile,tapTolerance:15});var ao=vn.extend({addHooks:function(){De(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){We(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),1===t.touches.length){var e=t.touches[0];this._startPos=this._newPos=new Z(e.clientX,e.clientY),this._holdTimeout=setTimeout(o((function(){this._cancel(),this._isTapValid()&&(De(document,"touchend",Ke),De(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))}),this),so),De(document,"touchend touchcancel contextmenu",this._cancel,this),De(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){We(document,"touchend",Ke),We(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),We(document,"touchend touchcancel contextmenu",this._cancel,this),We(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new Z(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var n=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});n._simulated=!0,e.target.dispatchEvent(n)}});rn.addInitHook("addHandler","tapHold",ao),rn.mergeOptions({touchZoom:Nt.touch,bounceAtZoomLimits:!0});var lo=vn.extend({addHooks:function(){be(this._map._container,"leaflet-touch-zoom"),De(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){we(this._map._container,"leaflet-touch-zoom"),We(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(n.add(i)._divideBy(2))),this._startDist=n.distanceTo(i),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),De(document,"touchmove",this._onTouchMove,this),De(document,"touchend touchcancel",this._onTouchEnd,this),Ke(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]),r=n.distanceTo(i)/this._startDist;if(this._zoom=e.getScaleZoom(r,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&r<1||this._zoom>e.getMaxZoom()&&r>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===r)return}else{var s=n._add(i)._divideBy(2)._subtract(this._centerPoint);if(1===r&&0===s.x&&0===s.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),M(this._animRequest);var a=o(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=z(a,this,!0),Ke(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,M(this._animRequest),We(document,"touchmove",this._onTouchMove,this),We(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});rn.addInitHook("addHandler","touchZoom",lo),rn.BoxZoom=eo,rn.DoubleClickZoom=no,rn.Drag=io,rn.Keyboard=oo,rn.ScrollWheelZoom=ro,rn.TapHold=ao,rn.TouchZoom=lo,t.Bounds=B,t.Browser=Nt,t.CRS=F,t.Canvas=qi,t.Circle=li,t.CircleMarker=si,t.Class=C,t.Control=an,t.DivIcon=Ri,t.DivOverlay=Ei,t.DomEvent=nn,t.DomUtil=Ne,t.Draggable=bn,t.Evented=E,t.FeatureGroup=Xn,t.GeoJSON=_i,t.GridLayer=Di,t.Handler=vn,t.Icon=$n,t.ImageOverlay=zi,t.LatLng=j,t.LatLngBounds=N,t.Layer=Yn,t.LayerGroup=Kn,t.LineUtil=Wn,t.Map=rn,t.Marker=ii,t.Mixin=yn,t.Path=ri,t.Point=Z,t.PolyUtil=zn,t.Polygon=di,t.Polyline=ui,t.Popup=Zi,t.PosAnimation=on,t.Projection=Un,t.Rectangle=$i,t.Renderer=Vi,t.SVG=Xi,t.SVGOverlay=Si,t.TileLayer=Wi,t.Tooltip=Ii,t.Transformation=G,t.Util=k,t.VideoOverlay=ki,t.bind=o,t.bounds=R,t.canvas=Gi,t.circle=hi,t.circleMarker=ai,t.control=ln,t.divIcon=Ni,t.extend=n,t.featureGroup=Qn,t.geoJSON=Li,t.geoJson=Ti,t.gridLayer=ji,t.icon=ti,t.imageOverlay=Mi,t.latLng=W,t.latLngBounds=D,t.layerGroup=Jn,t.map=sn,t.marker=oi,t.point=I,t.polygon=pi,t.polyline=ci,t.popup=Oi,t.rectangle=to,t.setOptions=p,t.stamp=s,t.svg=Qi,t.svgOverlay=Ai,t.tileLayer=Hi,t.tooltip=Bi,t.transformation=Y,t.version=e,t.videoOverlay=Ci;var ho=window.L;t.noConflict=function(){return window.L=ho,this},window.L=t}(w.exports);var P=b(w.exports),T=[],z=[];function M(t,e){if(t&&"undefined"!=typeof document){var n,i=!0===e.prepend?"prepend":"append",o=!0===e.singleTag,r="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(o){var s=T.indexOf(r);-1===s&&(s=T.push(r)-1,z[s]={}),n=z[s]&&z[s][i]?z[s][i]:z[s][i]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),o=0;o<n.length;o++)t.setAttribute(n[o],e.attributes[n[o]]);var s="prepend"===i?"afterbegin":"beforeend";return r.insertAdjacentElement(s,t),t}}M('/* required styles */\r\n\r\n.leaflet-pane,\r\n.leaflet-tile,\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow,\r\n.leaflet-tile-container,\r\n.leaflet-pane > svg,\r\n.leaflet-pane > canvas,\r\n.leaflet-zoom-box,\r\n.leaflet-image-layer,\r\n.leaflet-layer {\r\n\tposition: absolute;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\t}\r\n.leaflet-container {\r\n\toverflow: hidden;\r\n\t}\r\n.leaflet-tile,\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow {\r\n\t-webkit-user-select: none;\r\n\t -moz-user-select: none;\r\n\t user-select: none;\r\n\t -webkit-user-drag: none;\r\n\t}\r\n/* Prevents IE11 from highlighting tiles in blue */\r\n.leaflet-tile::selection {\r\n\tbackground: transparent;\r\n}\r\n/* Safari renders non-retina tile on retina better with this, but Chrome is worse */\r\n.leaflet-safari .leaflet-tile {\r\n\timage-rendering: -webkit-optimize-contrast;\r\n\t}\r\n/* hack that prevents hw layers "stretching" when loading new tiles */\r\n.leaflet-safari .leaflet-tile-container {\r\n\twidth: 1600px;\r\n\theight: 1600px;\r\n\t-webkit-transform-origin: 0 0;\r\n\t}\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow {\r\n\tdisplay: block;\r\n\t}\r\n/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */\r\n/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */\r\n.leaflet-container .leaflet-overlay-pane svg {\r\n\tmax-width: none !important;\r\n\tmax-height: none !important;\r\n\t}\r\n.leaflet-container .leaflet-marker-pane img,\r\n.leaflet-container .leaflet-shadow-pane img,\r\n.leaflet-container .leaflet-tile-pane img,\r\n.leaflet-container img.leaflet-image-layer,\r\n.leaflet-container .leaflet-tile {\r\n\tmax-width: none !important;\r\n\tmax-height: none !important;\r\n\twidth: auto;\r\n\tpadding: 0;\r\n\t}\r\n\r\n.leaflet-container img.leaflet-tile {\r\n\t/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */\r\n\tmix-blend-mode: plus-lighter;\r\n}\r\n\r\n.leaflet-container.leaflet-touch-zoom {\r\n\t-ms-touch-action: pan-x pan-y;\r\n\ttouch-action: pan-x pan-y;\r\n\t}\r\n.leaflet-container.leaflet-touch-drag {\r\n\t-ms-touch-action: pinch-zoom;\r\n\t/* Fallback for FF which doesn\'t support pinch-zoom */\r\n\ttouch-action: none;\r\n\ttouch-action: pinch-zoom;\r\n}\r\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\r\n\t-ms-touch-action: none;\r\n\ttouch-action: none;\r\n}\r\n.leaflet-container {\r\n\t-webkit-tap-highlight-color: transparent;\r\n}\r\n.leaflet-container a {\r\n\t-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\r\n}\r\n.leaflet-tile {\r\n\tfilter: inherit;\r\n\tvisibility: hidden;\r\n\t}\r\n.leaflet-tile-loaded {\r\n\tvisibility: inherit;\r\n\t}\r\n.leaflet-zoom-box {\r\n\twidth: 0;\r\n\theight: 0;\r\n\t-moz-box-sizing: border-box;\r\n\t box-sizing: border-box;\r\n\tz-index: 800;\r\n\t}\r\n/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\r\n.leaflet-overlay-pane svg {\r\n\t-moz-user-select: none;\r\n\t}\r\n\r\n.leaflet-pane { z-index: 400; }\r\n\r\n.leaflet-tile-pane { z-index: 200; }\r\n.leaflet-overlay-pane { z-index: 400; }\r\n.leaflet-shadow-pane { z-index: 500; }\r\n.leaflet-marker-pane { z-index: 600; }\r\n.leaflet-tooltip-pane { z-index: 650; }\r\n.leaflet-popup-pane { z-index: 700; }\r\n\r\n.leaflet-map-pane canvas { z-index: 100; }\r\n.leaflet-map-pane svg { z-index: 200; }\r\n\r\n.leaflet-vml-shape {\r\n\twidth: 1px;\r\n\theight: 1px;\r\n\t}\r\n.lvml {\r\n\tbehavior: url(#default#VML);\r\n\tdisplay: inline-block;\r\n\tposition: absolute;\r\n\t}\r\n\r\n\r\n/* control positioning */\r\n\r\n.leaflet-control {\r\n\tposition: relative;\r\n\tz-index: 800;\r\n\tpointer-events: visiblePainted; /* IE 9-10 doesn\'t have auto */\r\n\tpointer-events: auto;\r\n\t}\r\n.leaflet-top,\r\n.leaflet-bottom {\r\n\tposition: absolute;\r\n\tz-index: 1000;\r\n\tpointer-events: none;\r\n\t}\r\n.leaflet-top {\r\n\ttop: 0;\r\n\t}\r\n.leaflet-right {\r\n\tright: 0;\r\n\t}\r\n.leaflet-bottom {\r\n\tbottom: 0;\r\n\t}\r\n.leaflet-left {\r\n\tleft: 0;\r\n\t}\r\n.leaflet-control {\r\n\tfloat: left;\r\n\tclear: both;\r\n\t}\r\n.leaflet-right .leaflet-control {\r\n\tfloat: right;\r\n\t}\r\n.leaflet-top .leaflet-control {\r\n\tmargin-top: 10px;\r\n\t}\r\n.leaflet-bottom .leaflet-control {\r\n\tmargin-bottom: 10px;\r\n\t}\r\n.leaflet-left .leaflet-control {\r\n\tmargin-left: 10px;\r\n\t}\r\n.leaflet-right .leaflet-control {\r\n\tmargin-right: 10px;\r\n\t}\r\n\r\n\r\n/* zoom and fade animations */\r\n\r\n.leaflet-fade-anim .leaflet-popup {\r\n\topacity: 0;\r\n\t-webkit-transition: opacity 0.2s linear;\r\n\t -moz-transition: opacity 0.2s linear;\r\n\t transition: opacity 0.2s linear;\r\n\t}\r\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\r\n\topacity: 1;\r\n\t}\r\n.leaflet-zoom-animated {\r\n\t-webkit-transform-origin: 0 0;\r\n\t -ms-transform-origin: 0 0;\r\n\t transform-origin: 0 0;\r\n\t}\r\nsvg.leaflet-zoom-animated {\r\n\twill-change: transform;\r\n}\r\n\r\n.leaflet-zoom-anim .leaflet-zoom-animated {\r\n\t-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\r\n\t -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\r\n\t transition: transform 0.25s cubic-bezier(0,0,0.25,1);\r\n\t}\r\n.leaflet-zoom-anim .leaflet-tile,\r\n.leaflet-pan-anim .leaflet-tile {\r\n\t-webkit-transition: none;\r\n\t -moz-transition: none;\r\n\t transition: none;\r\n\t}\r\n\r\n.leaflet-zoom-anim .leaflet-zoom-hide {\r\n\tvisibility: hidden;\r\n\t}\r\n\r\n\r\n/* cursors */\r\n\r\n.leaflet-interactive {\r\n\tcursor: pointer;\r\n\t}\r\n.leaflet-grab {\r\n\tcursor: -webkit-grab;\r\n\tcursor: -moz-grab;\r\n\tcursor: grab;\r\n\t}\r\n.leaflet-crosshair,\r\n.leaflet-crosshair .leaflet-interactive {\r\n\tcursor: crosshair;\r\n\t}\r\n.leaflet-popup-pane,\r\n.leaflet-control {\r\n\tcursor: auto;\r\n\t}\r\n.leaflet-dragging .leaflet-grab,\r\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\r\n.leaflet-dragging .leaflet-marker-draggable {\r\n\tcursor: move;\r\n\tcursor: -webkit-grabbing;\r\n\tcursor: -moz-grabbing;\r\n\tcursor: grabbing;\r\n\t}\r\n\r\n/* marker & overlays interactivity */\r\n.leaflet-marker-icon,\r\n.leaflet-marker-shadow,\r\n.leaflet-image-layer,\r\n.leaflet-pane > svg path,\r\n.leaflet-tile-container {\r\n\tpointer-events: none;\r\n\t}\r\n\r\n.leaflet-marker-icon.leaflet-interactive,\r\n.leaflet-image-layer.leaflet-interactive,\r\n.leaflet-pane > svg path.leaflet-interactive,\r\nsvg.leaflet-image-layer.leaflet-interactive path {\r\n\tpointer-events: visiblePainted; /* IE 9-10 doesn\'t have auto */\r\n\tpointer-events: auto;\r\n\t}\r\n\r\n/* visual tweaks */\r\n\r\n.leaflet-container {\r\n\tbackground: #ddd;\r\n\toutline-offset: 1px;\r\n\t}\r\n.leaflet-container a {\r\n\tcolor: #0078A8;\r\n\t}\r\n.leaflet-zoom-box {\r\n\tborder: 2px dotted #38f;\r\n\tbackground: rgba(255,255,255,0.5);\r\n\t}\r\n\r\n\r\n/* general typography */\r\n.leaflet-container {\r\n\tfont-family: "Helvetica Neue", Arial, Helvetica, sans-serif;\r\n\tfont-size: 12px;\r\n\tfont-size: 0.75rem;\r\n\tline-height: 1.5;\r\n\t}\r\n\r\n\r\n/* general toolbar styles */\r\n\r\n.leaflet-bar {\r\n\tbox-shadow: 0 1px 5px rgba(0,0,0,0.65);\r\n\tborder-radius: 4px;\r\n\t}\r\n.leaflet-bar a {\r\n\tbackground-color: #fff;\r\n\tborder-bottom: 1px solid #ccc;\r\n\twidth: 26px;\r\n\theight: 26px;\r\n\tline-height: 26px;\r\n\tdisplay: block;\r\n\ttext-align: center;\r\n\ttext-decoration: none;\r\n\tcolor: black;\r\n\t}\r\n.leaflet-bar a,\r\n.leaflet-control-layers-toggle {\r\n\tbackground-position: 50% 50%;\r\n\tbackground-repeat: no-repeat;\r\n\tdisplay: block;\r\n\t}\r\n.leaflet-bar a:hover,\r\n.leaflet-bar a:focus {\r\n\tbackground-color: #f4f4f4;\r\n\t}\r\n.leaflet-bar a:first-child {\r\n\tborder-top-left-radius: 4px;\r\n\tborder-top-right-radius: 4px;\r\n\t}\r\n.leaflet-bar a:last-child {\r\n\tborder-bottom-left-radius: 4px;\r\n\tborder-bottom-right-radius: 4px;\r\n\tborder-bottom: none;\r\n\t}\r\n.leaflet-bar a.leaflet-disabled {\r\n\tcursor: default;\r\n\tbackground-color: #f4f4f4;\r\n\tcolor: #bbb;\r\n\t}\r\n\r\n.leaflet-touch .leaflet-bar a {\r\n\twidth: 30px;\r\n\theight: 30px;\r\n\tline-height: 30px;\r\n\t}\r\n.leaflet-touch .leaflet-bar a:first-child {\r\n\tborder-top-left-radius: 2px;\r\n\tborder-top-right-radius: 2px;\r\n\t}\r\n.leaflet-touch .leaflet-bar a:last-child {\r\n\tborder-bottom-left-radius: 2px;\r\n\tborder-bottom-right-radius: 2px;\r\n\t}\r\n\r\n/* zoom control */\r\n\r\n.leaflet-control-zoom-in,\r\n.leaflet-control-zoom-out {\r\n\tfont: bold 18px \'Lucida Console\', Monaco, monospace;\r\n\ttext-indent: 1px;\r\n\t}\r\n\r\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\r\n\tfont-size: 22px;\r\n\t}\r\n\r\n\r\n/* layers control */\r\n\r\n.leaflet-control-layers {\r\n\tbox-shadow: 0 1px 5px rgba(0,0,0,0.4);\r\n\tbackground: #fff;\r\n\tborder-radius: 5px;\r\n\t}\r\n.leaflet-control-layers-toggle {\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);\r\n\twidth: 36px;\r\n\theight: 36px;\r\n\t}\r\n.leaflet-retina .leaflet-control-layers-toggle {\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);\r\n\tbackground-size: 26px 26px;\r\n\t}\r\n.leaflet-touch .leaflet-control-layers-toggle {\r\n\twidth: 44px;\r\n\theight: 44px;\r\n\t}\r\n.leaflet-control-layers .leaflet-control-layers-list,\r\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\r\n\tdisplay: none;\r\n\t}\r\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\r\n\tdisplay: block;\r\n\tposition: relative;\r\n\t}\r\n.leaflet-control-layers-expanded {\r\n\tpadding: 6px 10px 6px 6px;\r\n\tcolor: #333;\r\n\tbackground: #fff;\r\n\t}\r\n.leaflet-control-layers-scrollbar {\r\n\toverflow-y: scroll;\r\n\toverflow-x: hidden;\r\n\tpadding-right: 5px;\r\n\t}\r\n.leaflet-control-layers-selector {\r\n\tmargin-top: 2px;\r\n\tposition: relative;\r\n\ttop: 1px;\r\n\t}\r\n.leaflet-control-layers label {\r\n\tdisplay: block;\r\n\tfont-size: 13px;\r\n\tfont-size: 1.08333em;\r\n\t}\r\n.leaflet-control-layers-separator {\r\n\theight: 0;\r\n\tborder-top: 1px solid #ddd;\r\n\tmargin: 5px -10px 5px -6px;\r\n\t}\r\n\r\n/* Default icon URLs */\r\n.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=);\r\n\t}\r\n\r\n\r\n/* attribution and scale controls */\r\n\r\n.leaflet-container .leaflet-control-attribution {\r\n\tbackground: #fff;\r\n\tbackground: rgba(255, 255, 255, 0.8);\r\n\tmargin: 0;\r\n\t}\r\n.leaflet-control-attribution,\r\n.leaflet-control-scale-line {\r\n\tpadding: 0 5px;\r\n\tcolor: #333;\r\n\tline-height: 1.4;\r\n\t}\r\n.leaflet-control-attribution a {\r\n\ttext-decoration: none;\r\n\t}\r\n.leaflet-control-attribution a:hover,\r\n.leaflet-control-attribution a:focus {\r\n\ttext-decoration: underline;\r\n\t}\r\n.leaflet-attribution-flag {\r\n\tdisplay: inline !important;\r\n\tvertical-align: baseline !important;\r\n\twidth: 1em;\r\n\theight: 0.6669em;\r\n\t}\r\n.leaflet-left .leaflet-control-scale {\r\n\tmargin-left: 5px;\r\n\t}\r\n.leaflet-bottom .leaflet-control-scale {\r\n\tmargin-bottom: 5px;\r\n\t}\r\n.leaflet-control-scale-line {\r\n\tborder: 2px solid #777;\r\n\tborder-top: none;\r\n\tline-height: 1.1;\r\n\tpadding: 2px 5px 1px;\r\n\twhite-space: nowrap;\r\n\t-moz-box-sizing: border-box;\r\n\t box-sizing: border-box;\r\n\tbackground: rgba(255, 255, 255, 0.8);\r\n\ttext-shadow: 1px 1px #fff;\r\n\t}\r\n.leaflet-control-scale-line:not(:first-child) {\r\n\tborder-top: 2px solid #777;\r\n\tborder-bottom: none;\r\n\tmargin-top: -2px;\r\n\t}\r\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\r\n\tborder-bottom: 2px solid #777;\r\n\t}\r\n\r\n.leaflet-touch .leaflet-control-attribution,\r\n.leaflet-touch .leaflet-control-layers,\r\n.leaflet-touch .leaflet-bar {\r\n\tbox-shadow: none;\r\n\t}\r\n.leaflet-touch .leaflet-control-layers,\r\n.leaflet-touch .leaflet-bar {\r\n\tborder: 2px solid rgba(0,0,0,0.2);\r\n\tbackground-clip: padding-box;\r\n\t}\r\n\r\n\r\n/* popup */\r\n\r\n.leaflet-popup {\r\n\tposition: absolute;\r\n\ttext-align: center;\r\n\tmargin-bottom: 20px;\r\n\t}\r\n.leaflet-popup-content-wrapper {\r\n\tpadding: 1px;\r\n\ttext-align: left;\r\n\tborder-radius: 12px;\r\n\t}\r\n.leaflet-popup-content {\r\n\tmargin: 13px 24px 13px 20px;\r\n\tline-height: 1.3;\r\n\tfont-size: 13px;\r\n\tfont-size: 1.08333em;\r\n\tmin-height: 1px;\r\n\t}\r\n.leaflet-popup-content p {\r\n\tmargin: 17px 0;\r\n\tmargin: 1.3em 0;\r\n\t}\r\n.leaflet-popup-tip-container {\r\n\twidth: 40px;\r\n\theight: 20px;\r\n\tposition: absolute;\r\n\tleft: 50%;\r\n\tmargin-top: -1px;\r\n\tmargin-left: -20px;\r\n\toverflow: hidden;\r\n\tpointer-events: none;\r\n\t}\r\n.leaflet-popup-tip {\r\n\twidth: 17px;\r\n\theight: 17px;\r\n\tpadding: 1px;\r\n\r\n\tmargin: -10px auto 0;\r\n\tpointer-events: auto;\r\n\r\n\t-webkit-transform: rotate(45deg);\r\n\t -moz-transform: rotate(45deg);\r\n\t -ms-transform: rotate(45deg);\r\n\t transform: rotate(45deg);\r\n\t}\r\n.leaflet-popup-content-wrapper,\r\n.leaflet-popup-tip {\r\n\tbackground: white;\r\n\tcolor: #333;\r\n\tbox-shadow: 0 3px 14px rgba(0,0,0,0.4);\r\n\t}\r\n.leaflet-container a.leaflet-popup-close-button {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tborder: none;\r\n\ttext-align: center;\r\n\twidth: 24px;\r\n\theight: 24px;\r\n\tfont: 16px/24px Tahoma, Verdana, sans-serif;\r\n\tcolor: #757575;\r\n\ttext-decoration: none;\r\n\tbackground: transparent;\r\n\t}\r\n.leaflet-container a.leaflet-popup-close-button:hover,\r\n.leaflet-container a.leaflet-popup-close-button:focus {\r\n\tcolor: #585858;\r\n\t}\r\n.leaflet-popup-scrolled {\r\n\toverflow: auto;\r\n\t}\r\n\r\n.leaflet-oldie .leaflet-popup-content-wrapper {\r\n\t-ms-zoom: 1;\r\n\t}\r\n.leaflet-oldie .leaflet-popup-tip {\r\n\twidth: 24px;\r\n\tmargin: 0 auto;\r\n\r\n\t-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";\r\n\tfilter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\r\n\t}\r\n\r\n.leaflet-oldie .leaflet-control-zoom,\r\n.leaflet-oldie .leaflet-control-layers,\r\n.leaflet-oldie .leaflet-popup-content-wrapper,\r\n.leaflet-oldie .leaflet-popup-tip {\r\n\tborder: 1px solid #999;\r\n\t}\r\n\r\n\r\n/* div icon */\r\n\r\n.leaflet-div-icon {\r\n\tbackground: #fff;\r\n\tborder: 1px solid #666;\r\n\t}\r\n\r\n\r\n/* Tooltip */\r\n/* Base styles for the element that has a tooltip */\r\n.leaflet-tooltip {\r\n\tposition: absolute;\r\n\tpadding: 6px;\r\n\tbackground-color: #fff;\r\n\tborder: 1px solid #fff;\r\n\tborder-radius: 3px;\r\n\tcolor: #222;\r\n\twhite-space: nowrap;\r\n\t-webkit-user-select: none;\r\n\t-moz-user-select: none;\r\n\t-ms-user-select: none;\r\n\tuser-select: none;\r\n\tpointer-events: none;\r\n\tbox-shadow: 0 1px 3px rgba(0,0,0,0.4);\r\n\t}\r\n.leaflet-tooltip.leaflet-interactive {\r\n\tcursor: pointer;\r\n\tpointer-events: auto;\r\n\t}\r\n.leaflet-tooltip-top:before,\r\n.leaflet-tooltip-bottom:before,\r\n.leaflet-tooltip-left:before,\r\n.leaflet-tooltip-right:before {\r\n\tposition: absolute;\r\n\tpointer-events: none;\r\n\tborder: 6px solid transparent;\r\n\tbackground: transparent;\r\n\tcontent: "";\r\n\t}\r\n\r\n/* Directions */\r\n\r\n.leaflet-tooltip-bottom {\r\n\tmargin-top: 6px;\r\n}\r\n.leaflet-tooltip-top {\r\n\tmargin-top: -6px;\r\n}\r\n.leaflet-tooltip-bottom:before,\r\n.leaflet-tooltip-top:before {\r\n\tleft: 50%;\r\n\tmargin-left: -6px;\r\n\t}\r\n.leaflet-tooltip-top:before {\r\n\tbottom: 0;\r\n\tmargin-bottom: -12px;\r\n\tborder-top-color: #fff;\r\n\t}\r\n.leaflet-tooltip-bottom:before {\r\n\ttop: 0;\r\n\tmargin-top: -12px;\r\n\tmargin-left: -6px;\r\n\tborder-bottom-color: #fff;\r\n\t}\r\n.leaflet-tooltip-left {\r\n\tmargin-left: -6px;\r\n}\r\n.leaflet-tooltip-right {\r\n\tmargin-left: 6px;\r\n}\r\n.leaflet-tooltip-left:before,\r\n.leaflet-tooltip-right:before {\r\n\ttop: 50%;\r\n\tmargin-top: -6px;\r\n\t}\r\n.leaflet-tooltip-left:before {\r\n\tright: 0;\r\n\tmargin-right: -12px;\r\n\tborder-left-color: #fff;\r\n\t}\r\n.leaflet-tooltip-right:before {\r\n\tleft: 0;\r\n\tmargin-left: -12px;\r\n\tborder-right-color: #fff;\r\n\t}\r\n\r\n/* Printing */\r\n\r\n@media print {\r\n\t/* Prevent printers from removing background-images of controls. */\r\n\t.leaflet-control {\r\n\t\t-webkit-print-color-adjust: exact;\r\n\t\tprint-color-adjust: exact;\r\n\t\t}\r\n\t}\r\n',{});M("\n.directus-table-layout[data-v-2d4d7c89] {\n height: calc(100vh - 120px);\n display: flex;\n flex-direction: column;\n padding: 16px;\n position: relative;\n}\n.layout-container[data-v-2d4d7c89] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n}\n.map-container[data-v-2d4d7c89] {\n height: 50vh;\n min-height: 300px;\n width: 100%;\n border-radius: 8px;\n overflow: hidden;\n border: 1px solid var(--background-normal-alt);\n z-index: 1;\n}\n.table-container[data-v-2d4d7c89] {\n flex: 1;\n overflow-y: auto;\n background: var(--theme--background);\n border-radius: 8px;\n border: 1px solid var(--background-normal-alt);\n}\n.table-header[data-v-2d4d7c89] {\n display: flex;\n position: sticky;\n top: 0;\n background-color: var(--theme--background);\n z-index: 1;\n}\n.table-header-item[data-v-2d4d7c89] {\n flex: 1;\n padding: 12px 16px;\n font-weight: 600;\n background-color: var(--color-primary-light);\n color: var(--color-primary-dark);\n border-bottom: 2px solid var(--background-normal-alt);\n text-transform: uppercase;\n font-size: 12px;\n}\n.table-row[data-v-2d4d7c89] {\n display: flex;\n border-bottom: 1px solid var(--background-normal-alt);\n cursor: pointer;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: background-color 0.2s ease;\n}\n.table-row[data-v-2d4d7c89]:hover {\n background-color: var(--theme--primary-background);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);\n}\n.table-cell[data-v-2d4d7c89] {\n flex: 1;\n padding: 12px 16px;\n}\n.reset-map-btn[data-v-2d4d7c89] {\n position: absolute;\n top: 20px;\n right: 20px;\n background-color: var(--theme--primary);\n color: white;\n border: none;\n padding: 10px 16px;\n border-radius: 8px;\n font-size: 14px;\n cursor: pointer;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);\n transition: background-color 0.3s;\n z-index: 29;\n}\n.reset-map-btn[data-v-2d4d7c89]:hover {\n background-color: var(--theme--primary-background);\n}\n.reset-map-btn[data-v-2d4d7c89]:focus {\n outline: none;\n}\n\n/* Marker popup styles */\n.marker-popup {\n padding: 8px;\n text-align: center;\n}\n.leaflet-popup-content-wrapper {\n border-radius: 8px;\n}\n.custom-map-marker {\n background: transparent;\n border: none;\n}\n.no-items-message[data-v-2d4d7c89] {\n padding: 16px;\n text-align: center;\n color: var(--theme--foreground-subdued);\n}\n.loading-container[data-v-2d4d7c89] {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n}\n",{});var k=(t,e)=>{const n=t.__vccOpts||t;for(const[t,i]of e)n[t]=i;return n};const C={class:"directus-table-layout"},S={key:0,class:"loading-container"},A={key:1,class:"layout-container"},E={class:"table-container"},Z={class:"table-header"},O=["onClick"],I={key:2,class:"no-items-message"};var B=k({__name:"layout",props:{items:{type:Array,required:!0,default:()=>[]},loading:{type:Boolean,default:!1},collection:{type:String,required:!0},fields:{type:Array,required:!0},layoutOptions:{type:Object,default:()=>({})}},setup(t){const e=t;x();const n=o(null),i=o(null),v=o(new Map),y=r((()=>[e.layoutOptions.coluna1,e.layoutOptions.coluna2,e.layoutOptions.coluna3,e.layoutOptions.coluna4,e.layoutOptions.coluna5].filter(Boolean).map((t=>({text:t,value:t}))))),b=e.layoutOptions.geolocation,w=()=>{i.value&&(v.value.forEach((t=>{t.remove()})),v.value.clear(),e.items.forEach((t=>{const n=t[b]?.coordinates;if(!n||!Array.isArray(n)||2!==n.length)return void console.warn(`Invalid coordinates for item ${t.id}:`,n);const[o,r]=n;if(L(r,o))try{const n=P.marker([r,o],{icon:P.divIcon({className:"custom-map-marker",html:'\n <div class="marker-inner" style="\n width: 30px;\n height: 30px;\n background-color: var(--theme--primary);\n border-radius: 50%;\n border: 2px solid white;\n box-shadow: 0 2px 4px rgba(0,0,0,0.3);\n "></div>\n ',iconSize:[30,30],iconAnchor:[15,15],popupAnchor:[0,-15]})}).addTo(i.value).bindPopup(`\n <div class="marker-popup">\n <strong>${t[e.layoutOptions.title]||"Select a field as title"}</strong>\n </div>\n `);v.value.set(t.id,n)}catch(e){console.error(`Error creating marker for item ${t.id}:`,e)}else console.warn(`Invalid latitude/longitude for item ${t.id}: ${r}, ${o}`)})))},L=(t,e)=>"number"==typeof t&&"number"==typeof e&&t>=-90&&t<=90&&e>=-180&&e<=180&&!isNaN(t)&&!isNaN(e);s((()=>e.items),w,{deep:!0}),a((()=>{i.value||n.value&&!i.value&&(i.value=P.map(n.value).setView([-19.62932325271675,-40.32739397081107],7),P.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(i.value),setTimeout((()=>{i.value?.invalidateSize()}),100)),w();window.addEventListener("resize",(()=>{i.value?.invalidateSize()}))})),l((()=>{v.value.forEach((t=>t.remove())),i.value&&i.value.remove(),window.removeEventListener("resize",resizeHandler)}));const T=()=>{if(i.value){const t=[-19.62932325271675,-40.32739397081107],e=7;i.value.setView(t,e,{animate:!0,duration:.5})}};return(e,o)=>{const r=h("loader");return u(),c("div",C,[t.loading?(u(),c("div",S,[d(r)])):(u(),c("div",A,[p("div",{class:"map-container",ref_key:"mapContainer",ref:n,id:"map"},null,512),p("div",E,[i.value?(u(),c("button",{key:0,class:"reset-map-btn",onClick:T},"Reset view")):_("v-if",!0),p("div",Z,[(u(!0),c(f,null,m(y.value,(t=>(u(),c("div",{key:t.value,class:"table-header-item"},g(t.text),1)))),128))]),t.items.length>0?(u(!0),c(f,{key:1},m(t.items,(t=>(u(),c("div",{key:t.id,class:"table-row item-lista",onClick:e=>(t=>{const e=t[b]?.coordinates;if(!e||!i.value)return;const[n,o]=e;L(o,n)&&(i.value.stop(),i.value.setView([o,n],15,{animate:!0,duration:.5,easeLinearity:1,noMoveStart:!0}),setTimeout((()=>{i.value?.setView([o,n],15,{animate:!1});const e=v.value.get(t.id);e&&e.openPopup()}),100))})(t)},[(u(!0),c(f,null,m(y.value,(e=>(u(),c("div",{key:e.value,class:"table-cell"},g(((t,e)=>{if(!t||!e)return"";if(!t.hasOwnProperty(e))return console.warn(`Field "${e}" not found in item:`,t),"";const n=t[e];return null==n?"":n})(t,e.value)),1)))),128))],8,O)))),128)):(u(),c("div",I,"Nenhum item encontrado."))])]))])}}},[["__scopeId","data-v-2d4d7c89"],["__file","layout.vue"]]),R=v({name:"Options",props:{collection:{type:String,required:!0},layoutOptions:{type:Object,required:!0},fieldsInCollection:{type:Array,required:!0},title:{type:String,default:null},geolocation:{type:String,default:null},coluna1:{type:String,default:null},coluna2:{type:String,default:null},coluna3:{type:String,default:null},coluna4:{type:String,default:null},coluna5:{type:String,default:null}},emits:["update:layoutOptions","update:geolocation","update:title","update:coluna1","update:coluna2","update:coluna3","update:coluna4","update:coluna5"],setup(n,{emit:i}){const{collection:o}=y(n),s=t(o),a=e(n,"title",i),l=e(n,"geolocation",i),h=e(n,"coluna1",i),u=e(n,"coluna2",i),c=e(n,"coluna3",i),d=e(n,"coluna4",i),p=e(n,"coluna5",i),_=e(n,"layoutOptions",i);return{iconTemplateWritable:r({get(){var t;return null==(t=_.value)?void 0:t.iconTemplate},set(t){_.value=Object.assign({},_.value,{iconTemplate:t})}}),headerTemplateWritable:r({get(){var t;return null==(t=_.value)?void 0:t.headerTemplate},set(t){_.value=Object.assign({},_.value,{headerTemplate:t})}}),cardContentTemplateWritable:r({get(){var t;return null==(t=_.value)?void 0:t.cardContentTemplate},set(t){_.value=Object.assign({},_.value,{cardContentTemplate:t})}}),camposSelecao:r((()=>s.fields.value.filter((t=>{var e;return"map"===(null==(e=t.meta)?void 0:e.interface)})))),title:a,geolocation:l,coluna1:h,coluna2:u,coluna3:c,coluna4:d,coluna5:p}}});M("\n.options-container[data-v-9f6608be] {\n padding: 16px;\n width: 100%;\n display: block;\n}\n.field[data-v-9f6608be] {\n margin-bottom: 16px;\n width: 100%;\n display: block;\n}\n.type-label[data-v-9f6608be] {\n font-weight: bold;\n margin-bottom: 4px;\n}\n",{});const N={class:"field"},D={class:"field"},j={class:"field"},W={class:"field"},H={class:"field"},F={class:"field"},U={class:"field"};var V=n({id:"mapgrid",name:"MapGrid",icon:"map",component:B,slots:{options:k(R,[["render",function(t,e,n,i,o,r){const s=h("v-select");return u(),c(f,null,[p("div",N,[e[7]||(e[7]=p("div",{class:"type-label"},"Title Pin Map",-1)),d(s,{modelValue:t.title,"onUpdate:modelValue":e[0]||(e[0]=e=>t.title=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),p("div",D,[e[8]||(e[8]=p("div",{class:"type-label"},"Geolocation",-1)),d(s,{modelValue:t.geolocation,"onUpdate:modelValue":e[1]||(e[1]=e=>t.geolocation=e),collection:t.collection,items:[{name:"---",field:null},...t.camposSelecao],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),_(" Coluna 1 "),p("div",j,[e[9]||(e[9]=p("div",{class:"type-label"},"Col 1",-1)),d(s,{modelValue:t.coluna1,"onUpdate:modelValue":e[2]||(e[2]=e=>t.coluna1=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),_(" Coluna 2 "),p("div",W,[e[10]||(e[10]=p("div",{class:"type-label"},"Col 2",-1)),d(s,{modelValue:t.coluna2,"onUpdate:modelValue":e[3]||(e[3]=e=>t.coluna2=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),_(" Coluna 3 "),p("div",H,[e[11]||(e[11]=p("div",{class:"type-label"},"Col 3",-1)),d(s,{modelValue:t.coluna3,"onUpdate:modelValue":e[4]||(e[4]=e=>t.coluna3=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),_(" Coluna 4 "),p("div",F,[e[12]||(e[12]=p("div",{class:"type-label"},"Col 4",-1)),d(s,{modelValue:t.coluna4,"onUpdate:modelValue":e[5]||(e[5]=e=>t.coluna4=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),_(" Coluna 5 "),p("div",U,[e[13]||(e[13]=p("div",{class:"type-label"},"Col 5",-1)),d(s,{modelValue:t.coluna5,"onUpdate:modelValue":e[6]||(e[6]=e=>t.coluna5=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])])],64)}],["__scopeId","data-v-9f6608be"],["__file","options.vue"]]),sidebar:()=>{},actions:()=>{}},setup(n,{emit:o}){const s=e(n,"layoutOptions",o),a=e(n,"layoutQuery",o),{collection:l,filter:h,search:u}=y(n),{fields:c}=t(l),{sort:d,limit:p,page:_,fields:f}=function(){const t=r((()=>{var t;return(null==(t=a.value)?void 0:t.page)||1})),e=r((()=>{var t;return(null==(t=a.value)?void 0:t.limit)||25})),n=r((()=>{var t;return(null==(t=a.value)?void 0:t.sort)||[]})),i=r((()=>c.value?c.value.map((t=>t.field)):[]));return{sort:n,limit:e,page:t,fields:i}}(),{title:m,geolocation:g,coluna1:v,coluna2:x,coluna3:b,coluna4:w,coluna5:P}=function(){const t=h("title",void 0),e=h("geolocation",void 0),n=h("coluna1",void 0),i=h("coluna2",void 0),o=h("coluna3",void 0),a=h("coluna4",void 0),l=h("coluna5",void 0);return{title:t,geolocation:e,coluna1:n,coluna2:i,coluna3:o,coluna4:a,coluna5:l};function h(t,e){return r({get(){var n;return void 0!==(null==(n=s.value)?void 0:n[t])?s.value[t]:e},set(e){s.value={...s.value,[t]:e}}})}}(),{items:L,loading:T,error:z,totalPages:M,itemCount:k,totalCount:C}=i(l,{sort:d,limit:p,page:_,fields:f,filter:h,search:u});return{items:L,loading:T,error:z,totalPages:M,itemCount:k,totalCount:C,page:_,limit:p,fields:f,fieldsInCollection:c,title:m,geolocation:g,coluna1:v,coluna2:x,coluna3:b,coluna4:w,coluna5:P}}});export{V as default};
|
|
1
|
+
import{useCollection as t,useSync as e,defineLayout as i,useItems as r}from"@directus/extensions-sdk";import{ref as n,onMounted as o,watch as a,resolveComponent as s,openBlock as l,createElementBlock as c,createElementVNode as h,createVNode as u,withCtx as p,Fragment as d,renderList as f,toDisplayString as m,withModifiers as g,computed as _,defineComponent as y,toRefs as v,createCommentVNode as x}from"vue";import{useRouter as b}from"vue-router";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function w(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var T={exports:{}};
|
|
2
|
+
/**
|
|
3
|
+
* MapLibre GL JS
|
|
4
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.1.0/LICENSE.txt
|
|
5
|
+
*/T.exports=function(){var t={},e={};function i(i,r,n){if(e[i]=n,"index"===i){var o="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",a={};return e.shared(a),e.index(t,a),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),t}}i("shared",["exports"],(function(t){function e(t,e,i,r){return new(i||(i=Promise))((function(n,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((r=r.apply(t,e||[])).next())}))}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,n;function o(){if(n)return r;function t(t,e){this.x=t,this.y=e}return n=1,r=t,t.prototype={clone:function(){return new t(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},t.convert=function(e){return e instanceof t?e:Array.isArray(e)?new t(e[0],e[1]):e},r}"function"==typeof SuppressedError&&SuppressedError;var a,s,l=i(o()),c=function(){if(s)return a;function t(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}return s=1,a=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var a=0,s=1;for(i=t,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-t)<e));r++)t>n?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},a}(),h=i(c);let u,p;function d(){return null==u&&(u="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),u}function f(){if(null==p&&(p=!1,d())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<t*t;i++){const r=4*i;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%t,Math.floor(i/t),1,1)}const i=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&i[e]!==e){p=!0;break}}}return p||!1}var m,g=1e-6,_="undefined"!=typeof Float32Array?Float32Array:Array;function y(){var t=new _(9);return _!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function v(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function x(){var t=new _(3);return _!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function b(t,e,i){var r=new _(3);return r[0]=t,r[1]=e,r[2]=i,r}function w(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,t}function T(){var t=new _(4);return _!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function C(){var t=new _(2);return _!=Float32Array&&(t[0]=0,t[1]=0),t}function P(t,e){var i=new _(2);return i[0]=t,i[1]=e,i}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),x(),m=new _(4),_!=Float32Array&&(m[0]=0,m[1]=0,m[2]=0,m[3]=0),x(),b(1,0,0),b(0,1,0),T(),T(),y(),C();const M=8192;function S(t,e,i){return e*(M/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function I(t,e){return(t%e+e)%e}function E(t,e,i){return t*(1-i)+e*i}function z(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}function A(t,e,i,r){const n=new h(t,e,i,r);return t=>n.solve(t)}const k=A(.25,.1,.25,1);function D(t,e,i){return Math.min(i,Math.max(e,t))}function R(t,e,i){const r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function L(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let B=1;function F(t,e,i){const r={};for(const i in t)r[i]=e.call(this,t[i],i,t);return r}function O(t,e,i){const r={};for(const i in t)e.call(this,t[i],i,t)&&(r[i]=t[i]);return r}function j(t){return Array.isArray(t)?t.map(j):"object"==typeof t&&t?F(t,j):t}const V={};function N(t){V[t]||("undefined"!=typeof console&&console.warn(t),V[t]=!0)}function q(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Z(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let U=null;function G(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const $="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function H(t,i,r,n,o){return e(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const a=null==e?void 0:e.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield e.copyTo(l,function(t,e,i,r,n){const o=4*Math.max(1,0),a=(Math.max(0,i)-i)*r*4+o,s=4*r,l=Math.max(0,e),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,i+n)-c},layout:[{offset:a,stride:s}]}}(t,i,r,n,o)),s)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}}))}let X,W;function K(t){return t/Math.PI*180}const Y="AbortError";function J(){return new Error(Y)}const Q={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function tt(t){return Q.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const et="global-dispatcher";class it extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}const rt=()=>Z(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,nt=function(t,i){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=tt(t.url);if(e)return e(t,i);if(Z(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:et},i)}if(!(/^file:/.test(r=t.url)||/^file:/.test(rt())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,i){return e(this,void 0,void 0,(function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:rt(),signal:i.signal});let r,n;"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{r=yield fetch(e)}catch(e){throw new it(0,e.message,t.url,new Blob)}if(!r.ok){const e=yield r.blob();throw new it(r.status,r.statusText,t.url,e)}n="arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text();const o=yield n;if(i.signal.aborted)throw J();return{data:o,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}))}(t,i);if(Z(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:et},i)}var r;return function(t,e){return new Promise(((i,r)=>{var n;const o=new XMLHttpRequest;o.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(o.responseType="arraybuffer");for(const e in t.headers)o.setRequestHeader(e,t.headers[e]);"json"===t.type&&(o.responseType="text",(null===(n=t.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===t.credentials,o.onerror=()=>{r(new Error(o.statusText))},o.onload=()=>{if(!e.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let e=o.response;if("json"===t.type)try{e=JSON.parse(o.response)}catch(t){return void r(t)}i({data:e,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const e=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});r(new it(o.status,o.statusText,t.url,e))}},e.signal.addEventListener("abort",(()=>{o.abort(),r(J())})),o.send(t.body)}))}(t,i)};function ot(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function at(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function st(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class lt{constructor(t,e={}){L(this,e),this.type=t}}class ct extends lt{constructor(t,e={}){super("error",L({error:t},e))}}class ht{on(t,e){return this._listeners=this._listeners||{},at(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return st(t,e,this._listeners),st(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},at(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new lt(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of r)st(i,e,this._oneTimeListeners),e.call(this,t);const n=this._eventedParent;n&&(L(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(t))}else t instanceof ct&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var ut={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{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:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},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"}}};const pt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function dt(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return pt.forEach((t=>{t in e&&(i[t]=e[t])})),i}function ft(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!ft(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!ft(t[i],e[i]))return!1;return!0}return t===e}function mt(t,e){t.push(e)}function gt(t,e,i){mt(i,{command:"addSource",args:[t,e[t]]})}function _t(t,e,i){mt(e,{command:"removeSource",args:[t]}),i[t]=!0}function yt(t,e,i,r){_t(t,i,r),gt(t,e,i)}function vt(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!ft(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!ft(t[i][r],e[i][r]))return!1;return!0}function xt(t,e,i,r,n,o){t=t||{},e=e||{};for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&(ft(t[a],e[a])||i.push({command:o,args:[r,a,e[a],n]}));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&!Object.prototype.hasOwnProperty.call(t,a)&&(ft(t[a],e[a])||i.push({command:o,args:[r,a,e[a],n]}))}function bt(t){return t.id}function wt(t,e){return t[e.id]=e,t}class Tt{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function Ct(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class Pt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Mt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new Mt(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const St={kind:"null"},It={kind:"number"},Et={kind:"string"},zt={kind:"boolean"},At={kind:"color"},kt={kind:"projectionDefinition"},Dt={kind:"object"},Rt={kind:"value"},Lt={kind:"collator"},Bt={kind:"formatted"},Ft={kind:"padding"},Ot={kind:"resolvedImage"},jt={kind:"variableAnchorOffsetCollection"};function Vt(t,e){return{kind:"array",itemType:t,N:e}}function Nt(t){if("array"===t.kind){const e=Nt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const qt=[St,It,Et,zt,At,kt,Bt,Dt,Vt(Rt),Ft,Ot,jt];function Zt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Zt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of qt)if(!Zt(t,e))return null}return`Expected ${Nt(t)} but found ${Nt(e)} instead.`}function Ut(t,e){return e.some((e=>e.kind===t.kind))}function Gt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function $t(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Ht=.96422,Xt=.82521,Wt=4/29,Kt=6/29,Yt=3*Kt*Kt,Jt=Kt*Kt*Kt,Qt=Math.PI/180,te=180/Math.PI;function ee(t){return(t%=360)<0&&(t+=360),t}function ie([t,e,i,r]){let n,o;const a=ne((.2225045*(t=re(t))+.7168786*(e=re(e))+.0606169*(i=re(i)))/1);t===e&&e===i?n=o=a:(n=ne((.4360747*t+.3850649*e+.1430804*i)/Ht),o=ne((.0139322*t+.0971045*e+.7141733*i)/Xt));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),r]}function re(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ne(t){return t>Jt?Math.pow(t,1/3):t/Yt+Wt}function oe([t,e,i,r]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(i)?n:n-i/200;return n=1*se(n),o=Ht*se(o),a=Xt*se(a),[ae(3.1338561*o-1.6168667*n-.4906146*a),ae(-.9787684*o+1.9161415*n+.033454*a),ae(.0719453*o-.2289914*n+1.4052427*a),r]}function ae(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function se(t){return t>Kt?t*t*t:Yt*(t-Wt)}function le(t){return parseInt(t.padEnd(2,t),16)/255}function ce(t,e){return he(e?t/100:t,0,1)}function he(t,e,i){return Math.min(Math.max(e,t),i)}function ue(t){return!t.some(Number.isNaN)}const pe={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]};function de(t,e,i){return t+i*(e-t)}function fe(t,e,i){return t.map(((t,r)=>de(t,e[r],i)))}class me{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof me)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=pe[t];if(e){const[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[le(t.slice(i,i+=e)),le(t.slice(i,i+=e)),le(t.slice(i,i+=e)),le(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,r,n,o,a,s,l,c,h,u,p]=e,d=[n||" ",s||" ",h].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const t=[r,a,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[he(+i/e,0,1),he(+o/e,0,1),he(+l/e,0,1),u?ce(+u,p):1];if(ue(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,r,n,o,a,s,l,c]=i,h=[r||" ",o||" ",s].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){const t=[+e,he(+n,0,100),he(+a,0,100),l?ce(+l,c):1];if(ue(t))return function([t,e,i,r]){function n(r){const n=(r+t/30)%12,o=e*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return t=ee(t),e/=100,i/=100,[n(0),n(8),n(4),r]}(t)}}}(t);return e?new me(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,r,n]=ie(t),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?ee(Math.atan2(r,i)*te):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ie(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((t=>Math.round(255*t))).join(",")},${r})`}static interpolate(t,e,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,a]=fe(t.rgb,e.rgb,i);return new me(r,n,o,a,!1)}case"hcl":{const[r,n,o,a]=t.hcl,[s,l,c,h]=e.hcl;let u,p;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?u=NaN:(u=s,1!==o&&0!==o||(p=l)):(u=r,1!==c&&0!==c||(p=n));else{let t=s-r;s>r&&t>180?t-=360:s<r&&r-s>180&&(t+=360),u=r+i*t}const[d,f,m,g]=function([t,e,i,r]){return t=isNaN(t)?0:t*Qt,oe([i,Math.cos(t)*e,Math.sin(t)*e,r])}([u,null!=p?p:de(n,l,i),de(o,c,i),de(a,h,i)]);return new me(d,f,m,g,!1)}case"lab":{const[r,n,o,a]=oe(fe(t.lab,e.lab,i));return new me(r,n,o,a,!1)}}}}me.black=new me(0,0,0,1),me.white=new me(1,1,1,1),me.transparent=new me(0,0,0,0),me.red=new me(1,0,0,1);class ge{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const _e=["bottom","center","top"];class ye{constructor(t,e,i,r,n,o){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class ve{constructor(t){this.sections=t}static fromString(t){return new ve([new ye(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof ve?t:ve.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class xe{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof xe)return t;if("number"==typeof t)return new xe([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new xe(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new xe(fe(t.values,e.values,i))}}class be{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const we=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Te{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Te)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],r=t[e+1];if("string"!=typeof i||!we.has(i))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new Te(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){const r=t.values,n=e.values;if(r.length!==n.length)throw new be(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const o=[];for(let t=0;t<r.length;t+=2){if(r[t]!==n[t])throw new be(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${r[t]}, to[${t}]: ${n[t]}`);o.push(r[t]);const[e,a]=r[t+1],[s,l]=n[t+1];o.push([de(e,s,i),de(a,l,i)])}return new Te(o)}}class Ce{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ce({name:t,available:!1}):null}}class Pe{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new Pe(t,e,i)}static parse(t){return t instanceof Pe?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new Pe(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new Pe(t.from,t.to,t.transition):"string"==typeof t?new Pe(t,t,1):void 0}}function Me(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Se(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Pe||t instanceof me||t instanceof ge||t instanceof ve||t instanceof xe||t instanceof Te||t instanceof Ce)return!0;if(Array.isArray(t)){for(const e of t)if(!Se(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Se(t[e]))return!1;return!0}return!1}function Ie(t){if(null===t)return St;if("string"==typeof t)return Et;if("boolean"==typeof t)return zt;if("number"==typeof t)return It;if(t instanceof me)return At;if(t instanceof Pe)return kt;if(t instanceof ge)return Lt;if(t instanceof ve)return Bt;if(t instanceof xe)return Ft;if(t instanceof Te)return jt;if(t instanceof Ce)return Ot;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Ie(e);if(i){if(i===t)continue;i=Rt;break}i=t}return Vt(i||Rt,e)}return Dt}function Ee(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof me||t instanceof Pe||t instanceof ve||t instanceof xe||t instanceof Te||t instanceof Ce?t.toString():JSON.stringify(t)}class ze{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Se(t[1]))return e.error("invalid value");const i=t[1];let r=Ie(i);const n=e.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new ze(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ae={string:Et,number:It,boolean:zt,object:Dt};class ke{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const n=t[0];if("array"===n){let n,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Ae)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);n=Ae[i],r++}else n=Rt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],r++}i=Vt(n,o)}else{if(!Ae[n])throw new Error(`Types doesn't contain name = ${n}`);i=Ae[n]}const o=[];for(;r<t.length;r++){const i=e.parse(t[r],r,Rt);if(!i)return null;o.push(i)}return new ke(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Zt(this.type,Ie(i)))return i;if(e===this.args.length-1)throw new be(`Expected value to be of type ${Nt(this.type)}, but found ${Nt(Ie(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const De={"to-boolean":zt,"to-color":At,"to-number":It,"to-string":Et};class Re{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!De[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=De[i],n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],i,Rt);if(!r)return null;n.push(r)}return new Re(r,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const r of this.args){if(e=r.evaluate(t),i=null,e instanceof me)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Me(e[0],e[1],e[2],e[3]),!i))return new me(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new be(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const r=xe.parse(e);if(r)return r}throw new be(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const r=Te.parse(e);if(r)return r}throw new be(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new be(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return ve.fromString(Ee(this.args[0].evaluate(t)));case"resolvedImage":return Ce.fromString(Ee(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ee(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Le=["Unknown","Point","LineString","Polygon"];class Be{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?"number"==typeof this.feature.type?Le[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(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=me.parse(t)),e}}class Fe{constructor(t,e,i=[],r,n=new Mt,o=[]){this.registry=t,this.path=i,this.key=i.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(t,e,i){return"assert"===i?new ke(e,[t]):"coerce"===i?new Re(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,n=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("projectionDefinition"!==t.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==t.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(t,n))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof ze)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new Be;try{r=new ze(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const r="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new Fe(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new Pt(i,t))}checkSubtype(t,e){const i=Zt(t,e);return i&&this.error(i),i}}class Oe{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let r=1;r<t.length-1;r+=2){const n=t[r];if("string"!=typeof n)return e.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=e.parse(t[r+1],r+1);if(!o)return null;i.push([n,o])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new Oe(i,r):null}outputDefined(){return this.result.outputDefined()}}class je{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new je(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ve{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,It),r=e.parse(t[2],2,Vt(e.expectedType||Rt));return i&&r?new Ve(r.type.itemType,i,r):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new be(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new be(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new be(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ne{constructor(t,e){this.type=zt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Rt),r=e.parse(t[2],2,Rt);return i&&r?Ut(i.type,[zt,Et,It,St,Rt])?new Ne(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Nt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Gt(e,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${Nt(Ie(e))} instead.`);if(!Gt(i,["string","array"]))throw new be(`Expected second argument to be of type array or string, but found ${Nt(Ie(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class qe{constructor(t,e,i){this.type=It,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Rt),r=e.parse(t[2],2,Rt);if(!i||!r)return null;if(!Ut(i.type,[zt,Et,It,St,Rt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Nt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,It);return n?new qe(i,r,n):null}return new qe(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Gt(e,["boolean","string","number","null"]))throw new be(`Expected first argument to be of type boolean, string, number or null, but found ${Nt(Ie(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),Gt(i,["string"])){const t=i.indexOf(e,r);return-1===t?-1:[...i.slice(0,t)].length}if(Gt(i,["array"]))return i.indexOf(e,r);throw new be(`Expected second argument to be of type array or string, but found ${Nt(Ie(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ze{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n={},o=[];for(let a=2;a<t.length-1;a+=2){let s=t[a];const l=t[a+1];Array.isArray(s)||(s=[s]);const c=e.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Ie(t)))return null}else i=Ie(t);if(void 0!==n[String(t)])return c.error("Branch labels must be unique.");n[String(t)]=o.length}const h=e.parse(l,a,r);if(!h)return null;r=r||h.type,o.push(h)}const a=e.parse(t[1],1,Rt);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,r);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(i,a.type)?null:new Ze(i,r,a,n,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(Ie(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Ue{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let n=1;n<t.length-1;n+=2){const o=e.parse(t[n],n,zt);if(!o)return null;const a=e.parse(t[n+1],n+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}const n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new Ue(i,r,n)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Ge{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,Rt),r=e.parse(t[2],2,It);if(!i||!r)return null;if(!Ut(i.type,[Vt(Rt),Et,Rt]))return e.error(`Expected first argument to be of type array or string, but found ${Nt(i.type)} instead`);if(4===t.length){const n=e.parse(t[3],3,It);return n?new Ge(i.type,i,r,n):null}return new Ge(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),Gt(e,["string"]))return[...e].slice(i,r).join("");if(Gt(e,["array"]))return e.slice(i,r);throw new be(`Expected first argument to be of type array or string, but found ${Nt(Ie(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function $e(t,e){const i=t.length-1;let r,n,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=t[s],n=t[s+1],r<=e){if(s===i||e<n)return s;o=s+1}else{if(!(r>e))throw new be("Input is not a number.");a=s-1}return 0}class He{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,It);if(!i)return null;const r=[];let n=null;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],a=t[i+1],s=i,l=i+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(r.length&&r[r.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(a,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new He(n,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[$e(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var We,Ke,Ye=function(){if(Ke)return We;function t(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}return Ke=1,We=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var n=this.sampleCurveX(i)-t;if(Math.abs(n)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var a=0,s=1;for(i=t,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-t)<e));r++)t>n?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},We}(),Je=Xe(Ye);class Qe{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of n)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let n=0;if("exponential"===t.name)n=ti(e,t.base,i,r);else if("linear"===t.name)n=ti(e,1,i,r);else if("cubic-bezier"===t.name){const o=t.controlPoints;n=new Je(o[0],o[1],o[2],o[3]).solve(ti(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,It),!n)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=At:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],r=o[t+1],n=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=e.parse(r,l,s);if(!c)return null;s=s||c.type,a.push([i,c])}return $t(s,It)||$t(s,kt)||$t(s,At)||$t(s,Ft)||$t(s,jt)||$t(s,Vt(It))?new Qe(s,i,r,n,a):e.error(`Type ${Nt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);const o=$e(e,r),a=Qe.interpolationFactor(this.interpolation,r,e[o],e[o+1]),s=i[o].evaluate(t),l=i[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return de(s,l,a);case"color":return me.interpolate(s,l,a);case"padding":return xe.interpolate(s,l,a);case"variableAnchorOffsetCollection":return Te.interpolate(s,l,a);case"array":return fe(s,l,a);case"projectionDefinition":return Pe.interpolate(s,l,a)}case"interpolate-hcl":return me.interpolate(s,l,a,"hcl");case"interpolate-lab":return me.interpolate(s,l,a,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ti(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}const ei={color:me.interpolate,number:de,padding:xe.interpolate,variableAnchorOffsetCollection:Te.interpolate,array:fe};class ii{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of t.slice(1)){const t=e.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");const o=r&&n.some((t=>Zt(r,t.type)));return new ii(o?Rt:i,n)}evaluate(t){let e,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ce&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function ri(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function ni(t,e,i,r){return 0===r.compare(e,i)}function oi(t,e,i){const r="=="!==t&&"!="!==t;return class n{constructor(t,e,i){this.type=zt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let o=e.parse(t[1],1,Rt);if(!o)return null;if(!ri(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${Nt(o.type)}'.`);let a=e.parse(t[2],2,Rt);if(!a)return null;if(!ri(i,a.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${Nt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${Nt(o.type)}' and '${Nt(a.type)}'.`);r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new ke(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new ke(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,Lt),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const e=Ie(o),i=Ie(a);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new be(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Ie(o),i=Ie(a);if("string"!==t.kind||"string"!==i.kind)return e(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):e(n,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ai=oi("==",(function(t,e,i){return e===i}),ni),si=oi("!=",(function(t,e,i){return e!==i}),(function(t,e,i,r){return!ni(0,e,i,r)})),li=oi("<",(function(t,e,i){return e<i}),(function(t,e,i,r){return r.compare(e,i)<0})),ci=oi(">",(function(t,e,i){return e>i}),(function(t,e,i,r){return r.compare(e,i)>0})),hi=oi("<=",(function(t,e,i){return e<=i}),(function(t,e,i,r){return r.compare(e,i)<=0})),ui=oi(">=",(function(t,e,i){return e>=i}),(function(t,e,i,r){return r.compare(e,i)>=0}));class pi{constructor(t,e,i){this.type=Lt,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,zt);if(!r)return null;const n=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,zt);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,Et),!o)?null:new pi(r,n,o)}evaluate(t){return new ge(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class di{constructor(t,e,i,r,n){this.type=Et,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,It);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,Et),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,Et),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,It),!a))return null;let s=null;return r["max-fraction-digits"]&&(s=e.parse(r["max-fraction-digits"],1,It),!s)?null:new di(i,n,o,a,s)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class fi{constructor(t){this.type=Bt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,It),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,Vt(Et)),!i))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,At),!a))return null;let s=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!_e.includes(o["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(s=e.parse(o["vertical-align"],1,Et),!s)return null}const l=r[r.length-1];l.scale=t,l.font=i,l.textColor=a,l.verticalAlign=s}else{const o=e.parse(t[i],1,Rt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new fi(r)}evaluate(t){return new ve(this.sections.map((e=>{const i=e.content.evaluate(t);return Ie(i)===Ot?new ye("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new ye(Ee(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class mi{constructor(t){this.type=Ot,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,Et);return i?new mi(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Ce.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class gi{constructor(t){this.type=It,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${Nt(i.type)} instead.`):new gi(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new be(`Expected value to be of type string or array, but found ${Nt(Ie(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const _i=8192;function yi(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*_i),Math.round(r*n*_i)]}function vi(t,e){const i=Math.pow(2,e.z);return[(n=(t[0]/_i+e.x)/i,360*n-180),(r=(t[1]/_i+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function xi(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function bi(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function wi(t,e,i){const r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],a=t[1]-i[1];return r*a-o*n==0&&r*o<=0&&n*a<=0}function Ti(t,e,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]&&!(!Ei(t,e,i,r)||!Ei(i,r,t,e));var n,o}function Ci(t,e,i){for(const r of i)for(let i=0;i<r.length-1;++i)if(Ti(t,e,r[i],r[i+1]))return!0;return!1}function Pi(t,e,i=!1){let r=!1;for(const s of e)for(let e=0;e<s.length-1;e++){if(wi(t,s[e],s[e+1]))return i;(o=s[e])[1]>(n=t)[1]!=(a=s[e+1])[1]>n[1]&&n[0]<(a[0]-o[0])*(n[1]-o[1])/(a[1]-o[1])+o[0]&&(r=!r)}var n,o,a;return r}function Mi(t,e){for(const i of e)if(Pi(t,i))return!0;return!1}function Si(t,e){for(const i of t)if(!Pi(i,e))return!1;for(let i=0;i<t.length-1;++i)if(Ci(t[i],t[i+1],e))return!1;return!0}function Ii(t,e){for(const i of e)if(Si(t,i))return!0;return!1}function Ei(t,e,i,r){const n=r[0]-i[0],o=r[1]-i[1],a=(t[0]-i[0])*o-n*(t[1]-i[1]),s=(e[0]-i[0])*o-n*(e[1]-i[1]);return a>0&&s<0||a<0&&s>0}function zi(t,e,i){const r=[];for(let n=0;n<t.length;n++){const o=[];for(let r=0;r<t[n].length;r++){const a=yi(t[n][r],i);xi(e,a),o.push(a)}r.push(o)}return r}function Ai(t,e,i){const r=[];for(let n=0;n<t.length;n++){const o=zi(t[n],e,i);r.push(o)}return r}function ki(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){const e=.5*r;let n=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===n&&(n=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=n}xi(e,t)}function Di(t,e,i,r){const n=Math.pow(2,r.z)*_i,o=[r.x*_i,r.y*_i],a=[];for(const r of t)for(const t of r){const r=[t.x+o[0],t.y+o[1]];ki(r,e,i,n),a.push(r)}return a}function Ri(t,e,i,r){const n=Math.pow(2,r.z)*_i,o=[r.x*_i,r.y*_i],a=[];for(const i of t){const t=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];xi(e,i),t.push(i)}a.push(t)}if(e[2]-e[0]<=n/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const r of t)ki(r,e,i,n)}var s;return a}class Li{constructor(t,e){this.type=zt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Se(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:r}=i.geometry;"Polygon"===e&&t.push(r),"MultiPolygon"===e&&t.push(...r)}if(t.length)return new Li(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Li(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Li(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=zi(e.coordinates,r,n),a=Di(t.geometry(),i,r,n);if(!bi(i,r))return!1;for(const t of a)if(!Pi(t,o))return!1}if("MultiPolygon"===e.type){const o=Ai(e.coordinates,r,n),a=Di(t.geometry(),i,r,n);if(!bi(i,r))return!1;for(const t of a)if(!Mi(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===e.type){const o=zi(e.coordinates,r,n),a=Ri(t.geometry(),i,r,n);if(!bi(i,r))return!1;for(const t of a)if(!Si(t,o))return!1}if("MultiPolygon"===e.type){const o=Ai(e.coordinates,r,n),a=Ri(t.geometry(),i,r,n);if(!bi(i,r))return!1;for(const t of a)if(!Ii(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Bi=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1);const o=r+1;if(o<this.length&&i(e[o],e[r])<0&&(r=o),i(e[r],n)>=0)break;e[t]=e[r],t=r}e[t]=n}};function Fi(t,e,i=0,r=t.length-1,n=ji){for(;r>i;){if(r-i>600){const o=r-i+1,a=e-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Fi(t,e,Math.max(i,Math.floor(e-a*l/o+c)),Math.min(r,Math.floor(e+(o-a)*l/o+c)),n)}const o=t[e];let a=i,s=r;for(Oi(t,i,e),n(t[r],o)>0&&Oi(t,i,r);a<s;){for(Oi(t,a,s),a++,s--;n(t[a],o)<0;)a++;for(;n(t[s],o)>0;)s--}0===n(t[i],o)?Oi(t,i,s):(s++,Oi(t,s,r)),s<=e&&(i=s+1),e<=s&&(r=s-1)}}function Oi(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function ji(t,e){return t<e?-1:t>e?1:0}function Vi(t,e){if(t.length<=1)return[t];const i=[];let r,n;for(const e of t){const t=qi(e);0!==t&&(e.area=Math.abs(t),void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e]):r.push(e))}if(r&&i.push(r),e>1)for(let t=0;t<i.length;t++)i[t].length<=e||(Fi(i[t],e,1,i[t].length-1,Ni),i[t]=i[t].slice(0,e));return i}function Ni(t,e){return e.area-t.area}function qi(t){let e=0;for(let i,r,n=0,o=t.length,a=o-1;n<o;a=n++)i=t[n],r=t[a],e+=(r.x-i.x)*(i.y+r.y);return e}const Zi=1/298.257223563,Ui=Zi*(2-Zi),Gi=Math.PI/180;class $i{constructor(t){const e=6378.137*Gi*1e3,i=Math.cos(t*Gi),r=1/(1-Ui*(1-i*i)),n=Math.sqrt(r);this.kx=e*n*i,this.ky=e*n*r*(1-Ui)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,n,o,a=1/0;for(let s=0;s<t.length-1;s++){let l=t[s][0],c=t[s][1],h=this.wrap(t[s+1][0]-l)*this.kx,u=(t[s+1][1]-c)*this.ky,p=0;0===h&&0===u||(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),p>1?(l=t[s+1][0],c=t[s+1][1]):p>0&&(l+=h/this.kx*p,c+=u/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const d=h*h+u*u;d<a&&(a=d,i=l,r=c,n=s,o=p)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Hi(t,e){return e[0]-t[0]}function Xi(t){return t[1]-t[0]+1}function Wi(t,e){return t[1]>=t[0]&&t[1]<e}function Ki(t,e){if(t[0]>t[1])return[null,null];const i=Xi(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function Yi(t,e){if(!Wi(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)xi(i,t[r]);return i}function Ji(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)xi(e,t);return e}function Qi(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function tr(t,e,i){if(!Qi(t)||!Qi(e))return NaN;let r=0,n=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),i.distance([0,0],[r,n])}function er(t,e,i){const r=i.pointOnLine(e,t);return i.distance(t,r.point)}function ir(t,e,i,r,n){const o=Math.min(er(t,[i,r],n),er(e,[i,r],n)),a=Math.min(er(i,[t,e],n),er(r,[t,e],n));return Math.min(o,a)}function rr(t,e,i,r,n){if(!Wi(e,t.length)||!Wi(r,i.length))return 1/0;let o=1/0;for(let a=e[0];a<e[1];++a){const e=t[a],s=t[a+1];for(let t=r[0];t<r[1];++t){const r=i[t],a=i[t+1];if(Ti(e,s,r,a))return 0;o=Math.min(o,ir(e,s,r,a,n))}}return o}function nr(t,e,i,r,n){if(!Wi(e,t.length)||!Wi(r,i.length))return NaN;let o=1/0;for(let a=e[0];a<=e[1];++a)for(let e=r[0];e<=r[1];++e)if(o=Math.min(o,n.distance(t[a],i[e])),0===o)return o;return o}function or(t,e,i){if(Pi(t,e,!0))return 0;let r=1/0;for(const n of e){const e=n[0],o=n[n.length-1];if(e!==o&&(r=Math.min(r,er(t,[o,e],i)),0===r))return r;const a=i.pointOnLine(n,t);if(r=Math.min(r,i.distance(t,a.point)),0===r)return r}return r}function ar(t,e,i,r){if(!Wi(e,t.length))return NaN;for(let r=e[0];r<=e[1];++r)if(Pi(t[r],i,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(const t of i)for(let i=0,o=t.length,s=o-1;i<o;s=i++){const o=t[s],l=t[i];if(Ti(e,a,o,l))return 0;n=Math.min(n,ir(e,a,o,l,r))}}return n}function sr(t,e){for(const i of t)for(const t of i)if(Pi(t,e,!0))return!0;return!1}function lr(t,e,i,r=1/0){const n=Ji(t),o=Ji(e);if(r!==1/0&&tr(n,o,i)>=r)return r;if(bi(n,o)){if(sr(t,e))return 0}else if(sr(e,t))return 0;let a=1/0;for(const r of t)for(let t=0,n=r.length,o=n-1;t<n;o=t++){const n=r[o],s=r[t];for(const t of e)for(let e=0,r=t.length,o=r-1;e<r;o=e++){const r=t[o],l=t[e];if(Ti(n,s,r,l))return 0;a=Math.min(a,ir(n,s,r,l,i))}}return a}function cr(t,e,i,r,n,o){if(!o)return;const a=tr(Yi(r,o),n,i);a<e&&t.push([a,o,[0,0]])}function hr(t,e,i,r,n,o,a){if(!o||!a)return;const s=tr(Yi(r,o),Yi(n,a),i);s<e&&t.push([s,o,a])}function ur(t,e,i,r,n=1/0){let o=Math.min(r.distance(t[0],i[0][0]),n);if(0===o)return o;const a=new Bi([[0,[0,t.length-1],[0,0]]],Hi),s=Ji(i);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=e?50:100;if(Xi(l)<=c){if(!Wi(l,t.length))return NaN;if(e){const e=ar(t,l,i,r);if(isNaN(e)||0===e)return e;o=Math.min(o,e)}else for(let e=l[0];e<=l[1];++e){const n=or(t[e],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=Ki(l,e);cr(a,o,r,t,s,i[0]),cr(a,o,r,t,s,i[1])}}return o}function pr(t,e,i,r,n,o=1/0){let a=Math.min(o,n.distance(t[0],i[0]));if(0===a)return a;const s=new Bi([[0,[0,t.length-1],[0,i.length-1]]],Hi);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],h=e?50:100,u=r?50:100;if(Xi(l)<=h&&Xi(c)<=u){if(!Wi(l,t.length)&&Wi(c,i.length))return NaN;let o;if(e&&r)o=rr(t,l,i,c,n),a=Math.min(a,o);else if(e&&!r){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(o=er(i[t],e,n),a=Math.min(a,o),0===a)return a}else if(!e&&r){const e=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=er(t[i],e,n),a=Math.min(a,o),0===a)return a}else o=nr(t,l,i,c,n),a=Math.min(a,o)}else{const o=Ki(l,e),h=Ki(c,r);hr(s,a,n,t,i,o[0],h[0]),hr(s,a,n,t,i,o[0],h[1]),hr(s,a,n,t,i,o[1],h[0]),hr(s,a,n,t,i,o[1],h[1])}}return a}function dr(t){return"MultiPolygon"===t.type?t.coordinates.map((t=>({type:"Polygon",coordinates:t}))):"MultiLineString"===t.type?t.coordinates.map((t=>({type:"LineString",coordinates:t}))):"MultiPoint"===t.type?t.coordinates.map((t=>({type:"Point",coordinates:t}))):[t]}class fr{constructor(t,e){this.type=It,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Se(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new fr(e,e.features.map((t=>dr(t.geometry))).flat());if("Feature"===e.type)return new fr(e,dr(e.geometry));if("type"in e&&"coordinates"in e)return new fr(e,dr(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),r=i.flat().map((e=>vi([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const n=new $i(r[0][1]);let o=1/0;for(const t of e){switch(t.type){case"Point":o=Math.min(o,pr(r,!1,[t.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,pr(r,!1,t.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ur(r,!1,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),r=i.flat().map((e=>vi([e.x,e.y],t.canonical)));if(0===i.length)return NaN;const n=new $i(r[0][1]);let o=1/0;for(const t of e){switch(t.type){case"Point":o=Math.min(o,pr(r,!0,[t.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,pr(r,!0,t.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ur(r,!0,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const r=Vi(i,0).map((e=>e.map((e=>e.map((e=>vi([e.x,e.y],t.canonical))))))),n=new $i(r[0][0][0][1]);let o=1/0;for(const t of e)for(const e of r){switch(t.type){case"Point":o=Math.min(o,ur([t.coordinates],!1,e,n,o));break;case"LineString":o=Math.min(o,ur(t.coordinates,!0,e,n,o));break;case"Polygon":o=Math.min(o,lr(e,t.coordinates,n,o))}if(0===o)return o}return o}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const mr={"==":ai,"!=":si,">":ci,"<":li,">=":ui,"<=":hi,array:ke,at:Ve,boolean:ke,case:Ue,coalesce:ii,collator:pi,format:fi,image:mi,in:Ne,"index-of":qe,interpolate:Qe,"interpolate-hcl":Qe,"interpolate-lab":Qe,length:gi,let:Oe,literal:ze,match:Ze,number:ke,"number-format":di,object:ke,slice:Ge,step:He,string:ke,"to-boolean":Re,"to-color":Re,"to-number":Re,"to-string":Re,var:je,within:Li,distance:fr};class gr{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],r=gr.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let s=null;for(const[r,o]of a){s=new Fe(e.registry,br,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],n=Array.isArray(r)?r[e-1]:r.type,o=s.parse(i,1+a.length,n);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(r)&&r.length!==a.length)s.error(`Expected ${r.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(r)?r[t]:r.type,i=a[t];s.concat(t+1).checkSubtype(e,i.type)}if(0===s.errors.length)return new gr(i,n,o,a)}}if(1===a.length)e.errors.push(...s.errors);else{const i=(a.length?a:o).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(Nt).join(", ")})`:`(${Nt(e.type)}...)`;var e})).join(" | "),r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],1+r.length);if(!n)return null;r.push(Nt(n.type))}e.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(t,e){gr.definitions=e;for(const i in e)t[i]=gr}}function _r(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);const o=n?n.evaluate(t):1,a=Me(e,i,r,o);if(a)throw new be(a);return new me(e/255,i/255,r/255,o,!1)}function yr(t,e){return t in e}function vr(t,e){const i=e[t];return void 0===i?null:i}function xr(t){return{type:t}}function br(t){if(t instanceof je)return br(t.boundExpression);if(t instanceof gr&&"error"===t.name)return!1;if(t instanceof pi)return!1;if(t instanceof Li)return!1;if(t instanceof fr)return!1;const e=t instanceof Re||t instanceof ke;let i=!0;return t.eachChild((t=>{i=e?i&&br(t):i&&t instanceof ze})),!!i&&wr(t)&&Cr(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function wr(t){if(t instanceof gr){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Li)return!1;if(t instanceof fr)return!1;let e=!0;return t.eachChild((t=>{e&&!wr(t)&&(e=!1)})),e}function Tr(t){if(t instanceof gr&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Tr(t)&&(e=!1)})),e}function Cr(t,e){if(t instanceof gr&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Cr(t,e)&&(i=!1)})),i}function Pr(t){return{result:"success",value:t}}function Mr(t){return{result:"error",value:t}}function Sr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Ir(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Er(t){return!!t.expression&&t.expression.interpolated}function zr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ar(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function kr(t){return t}function Dr(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],n=r||!(r||void 0!==t.property),o=t.type||(Er(e)?"exponential":"interval");if(i||"padding"===e.type){const r=i?me.parse:xe.parse;(t=Ct({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],r(t[1])]))),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(a=t.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${t.colorSpace}"`);var a;let s,l,c;if("exponential"===o)s=Fr;else if("interval"===o)s=Br;else if("categorical"===o){s=Lr,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=Or}if(r){const i={},r=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const t of r)n.push([i[t].zoom,Dr(i[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:Qe.interpolationFactor.bind(void 0,o),zoomStops:n.map((t=>t[0])),evaluate:({zoom:i},r)=>Fr({stops:n,base:t.base},e,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Qe.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>s(t,e,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[t.property]:void 0;return void 0===n?Rr(t.default,e.default):s(t,e,n,l,c)}}}function Rr(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Lr(t,e,i,r,n){return Rr(typeof i===n?r[i]:void 0,t.default,e.default)}function Br(t,e,i){if("number"!==zr(i))return Rr(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const n=$e(t.stops.map((t=>t[0])),i);return t.stops[n][1]}function Fr(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==zr(i))return Rr(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=$e(t.stops.map((t=>t[0])),i),a=function(t,e,i,r){const n=r-i,o=t-i;return 0===n?0:1===e?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],c=ei[e.type]||kr;return"function"==typeof s.evaluate?{evaluate(...e){const i=s.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return c(i,r,a,t.colorSpace)}}:c(s,l,a,t.colorSpace)}function Or(t,e,i){switch(e.type){case"color":i=me.parse(i);break;case"formatted":i=ve.fromString(i.toString());break;case"resolvedImage":i=Ce.fromString(i.toString());break;case"padding":i=xe.parse(i);break;default:zr(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return Rr(i,t.default,e.default)}gr.register(mr,{error:[{kind:"error"},[Et],(t,[e])=>{throw new be(e.evaluate(t))}],typeof:[Et,[Rt],(t,[e])=>Nt(Ie(e.evaluate(t)))],"to-rgba":[Vt(It,4),[At],(t,[e])=>{const[i,r,n,o]=e.evaluate(t).rgb;return[255*i,255*r,255*n,o]}],rgb:[At,[It,It,It],_r],rgba:[At,[It,It,It,It],_r],has:{type:zt,overloads:[[[Et],(t,[e])=>yr(e.evaluate(t),t.properties())],[[Et,Dt],(t,[e,i])=>yr(e.evaluate(t),i.evaluate(t))]]},get:{type:Rt,overloads:[[[Et],(t,[e])=>vr(e.evaluate(t),t.properties())],[[Et,Dt],(t,[e,i])=>vr(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Rt,[Et],(t,[e])=>vr(e.evaluate(t),t.featureState||{})],properties:[Dt,[],t=>t.properties()],"geometry-type":[Et,[],t=>t.geometryType()],id:[Rt,[],t=>t.id()],zoom:[It,[],t=>t.globals.zoom],"heatmap-density":[It,[],t=>t.globals.heatmapDensity||0],"line-progress":[It,[],t=>t.globals.lineProgress||0],accumulated:[Rt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[It,xr(It),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[It,xr(It),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:It,overloads:[[[It,It],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[It],(t,[e])=>-e.evaluate(t)]]},"/":[It,[It,It],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[It,[It,It],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[It,[],()=>Math.LN2],pi:[It,[],()=>Math.PI],e:[It,[],()=>Math.E],"^":[It,[It,It],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[It,[It],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[It,[It],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[It,[It],(t,[e])=>Math.log(e.evaluate(t))],log2:[It,[It],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[It,[It],(t,[e])=>Math.sin(e.evaluate(t))],cos:[It,[It],(t,[e])=>Math.cos(e.evaluate(t))],tan:[It,[It],(t,[e])=>Math.tan(e.evaluate(t))],asin:[It,[It],(t,[e])=>Math.asin(e.evaluate(t))],acos:[It,[It],(t,[e])=>Math.acos(e.evaluate(t))],atan:[It,[It],(t,[e])=>Math.atan(e.evaluate(t))],min:[It,xr(It),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[It,xr(It),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[It,[It],(t,[e])=>Math.abs(e.evaluate(t))],round:[It,[It],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[It,[It],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[It,[It],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[zt,[Et,Rt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[zt,[Rt],(t,[e])=>t.id()===e.value],"filter-type-==":[zt,[Et],(t,[e])=>t.geometryType()===e.value],"filter-<":[zt,[Et,Rt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[zt,[Rt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[zt,[Et,Rt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[zt,[Rt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[zt,[Et,Rt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[zt,[Rt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[zt,[Et,Rt],(t,[e,i])=>{const r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[zt,[Rt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[zt,[Rt],(t,[e])=>e.value in t.properties()],"filter-has-id":[zt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[zt,[Vt(Et)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[zt,[Vt(Rt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[zt,[Et,Vt(Rt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[zt,[Et,Vt(Rt)],(t,[e,i])=>function(t,e,i,r){for(;i<=r;){const n=i+r>>1;if(e[n]===t)return!0;e[n]>t?r=n-1:i=n+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:zt,overloads:[[[zt,zt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[xr(zt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:zt,overloads:[[[zt,zt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[xr(zt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[zt,[zt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[zt,[Et],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Et,[Et],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Et,[Et],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Et,xr(Rt),(t,e)=>e.map((e=>Ee(e.evaluate(t)))).join("")],"resolved-locale":[Et,[Lt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class jr{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new Be,this._defaultValue=e?"color"===(i=e).type&&Ar(i.default)?new me(0,0,0,0):"color"===i.type?me.parse(i.default)||null:"padding"===i.type?xe.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Te.parse(i.default)||null:"projectionDefinition"===i.type?Pe.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new be(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Vr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in mr}function Nr(t,e){const i=new Fe(mr,br,[],e?function(t){const e={color:At,string:Et,number:It,enum:Et,boolean:zt,formatted:Bt,padding:Ft,projectionDefinition:kt,resolvedImage:Ot,variableAnchorOffsetCollection:jt};return"array"===t.type?Vt(e[t.value]||Rt,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?Pr(new jr(r,e)):Mr(i.errors)}class qr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Tr(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}}class Zr{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Tr(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?Qe.interpolationFactor(this.interpolationType,t,e,i):0}}function Ur(t,e){const i=Nr(t,e);if("error"===i.result)return i;const r=i.value.expression,n=wr(r);if(!n&&!Sr(e))return Mr([new Pt("","data expressions not supported")]);const o=Cr(r,["zoom"]);if(!o&&!Ir(e))return Mr([new Pt("","zoom expressions not supported")]);const a=$r(r);return a||o?a instanceof Pt?Mr([a]):a instanceof Qe&&!Er(e)?Mr([new Pt("",'"interpolate" expressions cannot be used with this property')]):Pr(a?new Zr(n?"camera":"composite",i.value,a.labels,a instanceof Qe?a.interpolation:void 0):new qr(n?"constant":"source",i.value)):Mr([new Pt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Gr{constructor(t,e){this._parameters=t,this._specification=e,Ct(this,Dr(this._parameters,this._specification))}static deserialize(t){return new Gr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function $r(t){let e=null;if(t instanceof Oe)e=$r(t.result);else if(t instanceof ii){for(const i of t.args)if(e=$r(i),e)break}else(t instanceof He||t instanceof Qe)&&t.input instanceof gr&&"zoom"===t.input.name&&(e=t);return e instanceof Pt||t.eachChild((t=>{const i=$r(t);i instanceof Pt?e=i:!e&&i?e=new Pt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Pt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Hr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Hr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Xr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Wr(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Hr(t)||(t=Jr(t));const e=Nr(t,Xr);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,r)=>e.value.evaluate(t,i,{},r),needGeometry:Yr(t)}}function Kr(t,e){return t<e?-1:t>e?1:0}function Yr(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(Yr(t[e]))return!0;return!1}function Jr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Qr(t[1],t[2],"=="):"!="===e?rn(Qr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Qr(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Jr))):"all"===e?["all"].concat(t.slice(1).map(Jr)):"none"===e?["all"].concat(t.slice(1).map(Jr).map(rn)):"in"===e?tn(t[1],t.slice(2)):"!in"===e?rn(tn(t[1],t.slice(2))):"has"===e?en(t[1]):"!has"!==e||rn(en(t[1]));var i}function Qr(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function tn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Kr)]]:["filter-in-small",t,["literal",e]]}}function en(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function rn(t){return["!",t]}function nn(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${nn(i)},`;return`${e}]`}const i=Object.keys(t).sort();let r="{";for(let e=0;e<i.length;e++)r+=`${JSON.stringify(i[e])}:${nn(t[i[e]])},`;return`${r}}`}function on(t){let e="";for(const i of pt)e+=`/${nn(t[i])}`;return e}function an(t){const e=t.value;return e?[new Tt(t.key,e,"constants have been deprecated as of v8")]:[]}function sn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function ln(t){if(Array.isArray(t))return t.map(ln);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=ln(t[i]);return e}return sn(t)}function cn(t){const e=t.key,i=t.value,r=t.valueSpec||{},n=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec;let l=[];const c=zr(i);if("object"!==c)return[new Tt(e,i,`object expected, ${c} found`)];for(const t in i){const c=t.split(".")[0],h=r[c]||r["*"];let u;if(n[c])u=n[c];else if(r[c])u=s;else if(n["*"])u=n["*"];else{if(!r["*"]){l.push(new Tt(e,i[t],`unknown property "${t}"`));continue}u=s}l=l.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:h,style:o,styleSpec:a,object:i,objectKey:t,validateSpec:s},i))}for(const t in r)n[t]||r[t].required&&void 0===r[t].default&&void 0===i[t]&&l.push(new Tt(e,i,`missing required property "${t}"`));return l}function hn(t){const e=t.value,i=t.valueSpec,r=t.style,n=t.styleSpec,o=t.key,a=t.arrayElementValidator||t.validateSpec;if("array"!==zr(e))return[new Tt(o,e,`array expected, ${zr(e)} found`)];if(i.length&&e.length!==i.length)return[new Tt(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new Tt(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let s={type:i.value,values:i.values};n.$version<7&&(s.function=i.function),"object"===zr(i.value)&&(s=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(a({array:e,arrayIndex:i,value:e[i],valueSpec:s,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${o}[${i}]`}));return l}function un(t){const e=t.key,i=t.value,r=t.valueSpec;let n=zr(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new Tt(e,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new Tt(e,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new Tt(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function pn(t){const e=t.valueSpec,i=sn(t.value.type);let r,n,o,a={};const s="categorical"!==i&&void 0===t.value.property,l=!s,c="array"===zr(t.value.stops)&&"array"===zr(t.value.stops[0])&&"object"===zr(t.value.stops[0][0]),h=cn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new Tt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(hn({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===zr(r)&&0===r.length&&e.push(new Tt(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&h.push(new Tt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new Tt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!Er(t.valueSpec)&&h.push(new Tt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!Sr(t.valueSpec)?h.push(new Tt(t.key,t.value,"property functions not supported")):s&&!Ir(t.valueSpec)&&h.push(new Tt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new Tt(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const r=t.value,s=t.key;if("array"!==zr(r))return[new Tt(s,r,`array expected, ${zr(r)} found`)];if(2!==r.length)return[new Tt(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==zr(r[0]))return[new Tt(s,r,`object expected, ${zr(r[0])} found`)];if(void 0===r[0].zoom)return[new Tt(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new Tt(s,r,"object stop key must have value")];if(o&&o>sn(r[0].zoom))return[new Tt(s,r[0].zoom,"stop zoom values must appear in ascending order")];sn(r[0].zoom)!==o&&(o=sn(r[0].zoom),n=void 0,a={}),i=i.concat(cn({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:un,value:p}}))}else i=i.concat(p({key:`${s}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return Vr(ln(r[1]))?i.concat([new Tt(`${s}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const s=zr(t.value),l=sn(t.value),c=null!==t.value?t.value:o;if(r){if(s!==r)return[new Tt(t.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Tt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let r=`number expected, ${s} found`;return Sr(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Tt(t.key,c,r)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==n&&l<n?[new Tt(t.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in a?[new Tt(t.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Tt(t.key,c,`integer expected, found ${l}`)]}}function dn(t){const e=("property"===t.expressionContext?Ur:Nr)(ln(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new Tt(`${t.key}${e.key}`,t.value,e.message)));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new Tt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!Tr(i))return[new Tt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Tr(i))return[new Tt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Cr(i,["zoom","feature-state"]))return[new Tt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!wr(i))return[new Tt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fn(t){const e=t.key,i=t.value,r=t.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(sn(i))&&n.push(new Tt(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(sn(i))&&n.push(new Tt(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function mn(t){return Hr(ln(t.value))?dn(Ct({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):gn(t)}function gn(t){const e=t.value,i=t.key;if("array"!==zr(e))return[new Tt(i,e,`array expected, ${zr(e)} found`)];const r=t.styleSpec;let n,o=[];if(e.length<1)return[new Tt(i,e,"filter array must have at least 1 element")];switch(o=o.concat(fn({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),sn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===sn(e[1])&&o.push(new Tt(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new Tt(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=zr(e[1]),"string"!==n&&o.push(new Tt(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a<e.length;a++)n=zr(e[a]),"$type"===sn(e[1])?o=o.concat(fn({key:`${i}[${a}]`,value:e[a],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Tt(`${i}[${a}]`,e[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)o=o.concat(gn({key:`${i}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=zr(e[1]),2!==e.length?o.push(new Tt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Tt(`${i}[1]`,e[1],`string expected, ${n} found`))}return o}function _n(t,e){const i=t.key,r=t.validateSpec,n=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:a,valueSpec:o.transition,style:n,styleSpec:o});const h=t.valueSpec||l[s];if(!h)return[new Tt(i,a,`unknown property "${s}"`)];let u;if("string"===zr(a)&&Sr(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(a)))return[new Tt(i,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&p.push(new Tt(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Ar(ln(a))&&"identity"===sn(a.type)&&p.push(new Tt(i,a,'"text-font" does not support identity functions'))),p.concat(r({key:t.key,value:a,valueSpec:h,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function yn(t){return _n(t,"paint")}function vn(t){return _n(t,"layout")}function xn(t){let e=[];const i=t.value,r=t.key,n=t.style,o=t.styleSpec;i.type||i.ref||e.push(new Tt(r,i,'either "type" or "ref" is required'));let a=sn(i.type);const s=sn(i.ref);if(i.id){const o=sn(i.id);for(let a=0;a<t.arrayIndex;a++){const t=n.layers[a];sn(t.id)===o&&e.push(new Tt(r,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in i&&e.push(new Tt(r,i[t],`"${t}" is prohibited for ref layers`))})),n.layers.forEach((e=>{sn(e.id)===s&&(t=e)})),t?t.ref?e.push(new Tt(r,i.ref,"ref cannot reference another ref layer")):a=sn(t.type):e.push(new Tt(r,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const t=n.sources&&n.sources[i.source],o=t&&sn(t.type);t?"vector"===o&&"raster"===a?e.push(new Tt(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a?e.push(new Tt(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?e.push(new Tt(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new Tt(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new Tt(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Tt(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new Tt(r,i.source,`source "${i.source}" not found`))}else e.push(new Tt(r,i,'missing required property "source"'));return e=e.concat(cn({key:r,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:mn,layout:t=>cn({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>vn(Ct({layerType:a},t))}}),paint:t=>cn({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>yn(Ct({layerType:a},t))}})}})),e}function bn(t){const e=t.value,i=t.key,r=zr(e);return"string"!==r?[new Tt(i,e,`string expected, ${r} found`)]:[]}const wn={promoteId:function({key:t,value:e}){if("string"===zr(e))return bn({key:t,value:e});{const i=[];for(const r in e)i.push(...bn({key:`${t}.${r}`,value:e[r]}));return i}}};function Tn(t){const e=t.value,i=t.key,r=t.styleSpec,n=t.style,o=t.validateSpec;if(!e.type)return[new Tt(i,e,'"type" is required')];const a=sn(e.type);let s;switch(a){case"vector":case"raster":return s=cn({key:i,value:e,valueSpec:r[`source_${a.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:wn,validateSpec:o}),s;case"raster-dem":return s=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",r=t.value,n=t.styleSpec,o=n.source_raster_dem,a=t.style;let s=[];const l=zr(r);if(void 0===r)return s;if("object"!==l)return s.push(new Tt("source_raster_dem",r,`object expected, ${l} found`)),s;const c="custom"===sn(r.encoding),h=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in r)!c&&h.includes(e)?s.push(new Tt(e,r[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):o[e]?s=s.concat(t.validateSpec({key:e,value:r[e],valueSpec:o[e],validateSpec:t.validateSpec,style:a,styleSpec:n})):s.push(new Tt(e,r[e],`unknown property "${e}"`));return s}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:o}),s;case"geojson":if(s=cn({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:wn}),e.cluster)for(const t in e.clusterProperties){const[r,n]=e.clusterProperties[t],a="string"==typeof r?[r,["accumulated"],["get",t]]:r;s.push(...dn({key:`${i}.${t}.map`,value:n,validateSpec:o,expressionContext:"cluster-map"})),s.push(...dn({key:`${i}.${t}.reduce`,value:a,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return cn({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return cn({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new Tt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return fn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:r})}}function Cn(t){const e=t.value,i=t.styleSpec,r=i.light,n=t.style;let o=[];const a=zr(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Tt("light",e,`object expected, ${a} found`)]),o;for(const a in e){const s=a.match(/^(.*)-transition$/);o=o.concat(s&&r[s[1]]&&r[s[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new Tt(a,e[a],`unknown property "${a}"`)])}return o}function Pn(t){const e=t.value,i=t.styleSpec,r=i.sky,n=t.style,o=zr(e);if(void 0===e)return[];if("object"!==o)return[new Tt("sky",e,`object expected, ${o} found`)];let a=[];for(const o in e)a=a.concat(r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],style:n,styleSpec:i}):[new Tt(o,e[o],`unknown property "${o}"`)]);return a}function Mn(t){const e=t.value,i=t.styleSpec,r=i.terrain,n=t.style;let o=[];const a=zr(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new Tt("terrain",e,`object expected, ${a} found`)]),o;for(const a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new Tt(a,e[a],`unknown property "${a}"`)]);return o}function Sn(t){let e=[];const i=t.value,r=t.key;if(Array.isArray(i)){const n=[],o=[];for(const a in i)i[a].id&&n.includes(i[a].id)&&e.push(new Tt(r,i,`all the sprites' ids must be unique, but ${i[a].id} is duplicated`)),n.push(i[a].id),i[a].url&&o.includes(i[a].url)&&e.push(new Tt(r,i,`all the sprites' URLs must be unique, but ${i[a].url} is duplicated`)),o.push(i[a].url),e=e.concat(cn({key:`${r}[${a}]`,value:i[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return bn({key:r,value:i})}const In={"*":()=>[],array:hn,boolean:function(t){const e=t.value,i=t.key,r=zr(e);return"boolean"!==r?[new Tt(i,e,`boolean expected, ${r} found`)]:[]},number:un,color:function(t){const e=t.key,i=t.value,r=zr(i);return"string"!==r?[new Tt(e,i,`color expected, ${r} found`)]:me.parse(String(i))?[]:[new Tt(e,i,`color expected, "${i}" found`)]},constants:an,enum:fn,filter:mn,function:pn,layer:xn,object:cn,source:Tn,light:Cn,sky:Pn,terrain:Mn,projection:function(t){const e=t.value,i=t.styleSpec,r=i.projection,n=t.style,o=zr(e);if(void 0===e)return[];if("object"!==o)return[new Tt("projection",e,`object expected, ${o} found`)];let a=[];for(const o in e)a=a.concat(r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],style:n,styleSpec:i}):[new Tt(o,e[o],`unknown property "${o}"`)]);return a},projectionDefinition:function(t){const e=t.key;let i=t.value;i=i instanceof String?i.valueOf():i;const r=zr(i);return"array"!==r||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(i)||function(t){return!!["interpolate","step","literal"].includes(t[0])}(i)?["array","string"].includes(r)?[]:[new Tt(e,i,`projection expected, invalid type "${r}" found`)]:[new Tt(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:bn,formatted:function(t){return 0===bn(t).length?[]:dn(t)},resolvedImage:function(t){return 0===bn(t).length?[]:dn(t)},padding:function(t){const e=t.key,i=t.value;if("array"===zr(i)){if(i.length<1||i.length>4)return[new Tt(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o<i.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:r}));return n}return un({key:e,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,r=zr(i),n=t.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new Tt(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let r=0;r<i.length;r+=2)o=o.concat(fn({key:`${e}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(hn({key:`${e}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return o},sprite:Sn};function En(t){const e=t.value,i=t.valueSpec,r=t.styleSpec;return t.validateSpec=En,i.expression&&Ar(sn(e))?pn(t):i.expression&&Vr(ln(e))?dn(t):i.type&&In[i.type]?In[i.type](t):cn(Ct({},t,{valueSpec:i.type?r[i.type]:i}))}function zn(t){const e=t.value,i=t.key,r=bn(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new Tt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new Tt(i,e,'"glyphs" url must include a "{range}" token'))),r}function An(t,e=ut){let i=[];return i=i.concat(En({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:En,objectElementValidators:{glyphs:zn,"*":()=>[]}})),t.constants&&(i=i.concat(an({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:En}))),Dn(i)}function kn(t){return function(e){return t({...e,validateSpec:En})}}function Dn(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function Rn(t){return function(...e){return Dn(t.apply(this,e))}}An.source=Rn(kn(Tn)),An.sprite=Rn(kn(Sn)),An.glyphs=Rn(kn(zn)),An.light=Rn(kn(Cn)),An.sky=Rn(kn(Pn)),An.terrain=Rn(kn(Mn)),An.layer=Rn(kn(xn)),An.filter=Rn(kn(mn)),An.paintProperty=Rn(kn(yn)),An.layoutProperty=Rn(kn(vn));const Ln=An,Bn=Ln.light,Fn=Ln.sky,On=Ln.paintProperty,jn=Ln.layoutProperty;function Vn(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new ct(new Error(r.message))),i=!0;return i}class Nn{constructor(t,e,i){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(e=n[1])+2*(i=n[2]);for(let t=0;t<this.d*this.d;t++){const e=n[3+t],i=n[3+t+1];r.push(e===i?null:n.subarray(e,i))}const o=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,o){this.cells[n].push(o)}query(t,e,i,r,n){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=i&&a<=r&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,i,r,this._queryCell,o,{},n),o}}_queryCell(t,e,i,r,n,o,a,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===a[u]){const l=4*u;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(a[u]=!0,o.push(n[u])):a[u]=!1}}}}_forEachCell(t,e,i,r,n,o,a,s){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&n.call(this,t,e,i,r,c,o,a,s))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let e=0;e<t.length;e++){const i=t[e];r[3+e]=n,r.set(i,n),n+=i.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new Nn(t.buffer)}}const qn={};function Zn(t,e,i={}){if(qn[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),qn[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Zn("Object",Object),Zn("TransferableGridIndex",Nn),Zn("Color",me),Zn("Error",Error),Zn("AJAXError",it),Zn("ResolvedImage",Ce),Zn("StylePropertyFunction",Gr),Zn("StyleExpression",jr,{omit:["_evaluator"]}),Zn("ZoomDependentExpression",Zr),Zn("ZoomConstantExpression",qr),Zn("CompoundExpression",gr,{omit:["_evaluate"]});for(const t in mr)mr[t]._classRegistryKey||Zn(`Expression_${t}`,mr[t]);function Un(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Gn(t){return t.$name||t.constructor._classRegistryKey}function $n(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=Gn(t);return!(!e||"Object"===e)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||Un(t)||G(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Hn(t,e){if($n(t))return(Un(t)||G(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const r of t)i.push(Hn(r,e));return i}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const i=Gn(t);if(!i)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!qn[i])throw new Error(`${i} is not registered.`);const{klass:r}=qn[i],n=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in t){if(!t.hasOwnProperty(r))continue;if(qn[i].omit.indexOf(r)>=0)continue;const o=t[r];n[r]=qn[i].shallow.indexOf(r)>=0?o:Hn(o,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function Xn(t){if($n(t))return t;if(Array.isArray(t))return t.map(Xn);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=Gn(t)||"Object";if(!qn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=qn[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const n=t[i];r[i]=qn[e].shallow.indexOf(i)>=0?n:Xn(n)}return r}class Wn{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const Kn={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Yn(t){for(const e of t)if(ro(e.charCodeAt(0)))return!0;return!1}function Jn(t){for(const e of t)if(!eo(e.charCodeAt(0)))return!1;return!0}function Qn(t){const e=t.map((t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}})).filter((t=>t));return new RegExp(e.join("|"),"u")}const to=Qn(["Arab","Dupl","Mong","Ougr","Syrc"]);function eo(t){return!to.test(String.fromCodePoint(t))}const io=Qn(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ro(t){return!(746!==t&&747!==t&&(t<4352||!(Kn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Kn["CJK Compatibility"](t)||Kn["CJK Strokes"](t)||!(!Kn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Kn["Enclosed CJK Letters and Months"](t)||Kn["Ideographic Description Characters"](t)||Kn.Kanbun(t)||Kn.Katakana(t)&&12540!==t||!(!Kn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Kn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Kn["Vertical Forms"](t)||Kn["Yijing Hexagram Symbols"](t)||/\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\p{sc=Hang}/u.test(String.fromCodePoint(t))||io.test(String.fromCodePoint(t)))))}function no(t){return!(ro(t)||function(t){return!!(Kn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Kn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Kn["Letterlike Symbols"](t)||Kn["Number Forms"](t)||Kn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Kn["Control Pictures"](t)&&9251!==t||Kn["Optical Character Recognition"](t)||Kn["Enclosed Alphanumerics"](t)||Kn["Geometric Shapes"](t)||Kn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Kn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Kn["CJK Symbols and Punctuation"](t)||Kn.Katakana(t)||Kn["Private Use Area"](t)||Kn["CJK Compatibility Forms"](t)||Kn["Small Form Variants"](t)||Kn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}const oo=Qn(["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 ao(t){return oo.test(String.fromCodePoint(t))}function so(t,e){return!(!e&&ao(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Kn.Khmer(t))}function lo(t){for(const e of t)if(ao(e.charCodeAt(0)))return!0;return!1}const co=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(co.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,i){return e(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;const e=t.pluginURL,r=new Promise((t=>{this.loadScriptResolve=t}));i(e);const n=new Promise((t=>setTimeout((()=>t()),this.TIMEOUT)));if(yield Promise.race([r,n]),this.isParsed()){const t={pluginStatus:"loaded",pluginURL:e};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)}))}};class ho{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Wn,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!so(i.charCodeAt(0),e))return!1;return!0}(t,"loaded"===co.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class uo{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ar(t))return new Gr(t,e);if(Vr(t)){const i=Ur(t,e);if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=me.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?i=Te.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(i=Pe.parse(t)):i=xe.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class po{constructor(t){this.property=t,this.value=new uo(t,void 0)}transitioned(t,e){return new mo(this.property,this.value,e,L({},t.transition,this.transition),t.now)}untransitioned(){return new mo(this.property,this.value,null,{},0)}}class fo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return j(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new po(this._values[t].property)),this._values[t].value=new uo(this._values[t].property,null===e?void 0:j(e))}getTransition(t){return j(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new po(this._values[t].property)),this._values[t].transition=j(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const i=new go(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new go(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class mo{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(t,e,i);{const a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),n,z(a))}}return n}}class go{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new vo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class _o{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return j(this._values[t].value)}setValue(t,e){this._values[t]=new uo(this._values[t].property,null===e?void 0:j(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new vo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class yo{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class vo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class xo{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const r=ei[this.specification.type];return r?r(t,e,i):t}}class bo{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new yo(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new yo(this,{kind:"constant",value:void 0},t.parameters);const r=ei[this.specification.type];if(r){const n=r(t.value.value,e.value.value,i);return new yo(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,o){return"constant"===t.kind?t.value:t.evaluate(e,i,r,n,o)}}class wo extends bo{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new yo(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r),o="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,e);return new yo(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new yo(this,{kind:"constant",value:i},e)}return new yo(this,t.expression,e)}evaluate(t,e,i,r,n,o){if("source"===t.kind){const a=t.evaluate(e,i,r,n,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class To{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new ho(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ho(Math.floor(e.zoom),e)),t.expression.evaluate(new ho(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Co{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class Po{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new uo(i,void 0),n=this.defaultTransitionablePropertyValues[e]=new po(i);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}Zn("DataDrivenProperty",bo),Zn("DataConstantProperty",xo),Zn("CrossFadedDataDrivenProperty",wo),Zn("CrossFadedProperty",To),Zn("ColorRampProperty",Co);const Mo="-transition";class So extends ht{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new _o(e.layout)),e.paint)){this._transitionablePaint=new fo(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vo(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(jn,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(Mo)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(On,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(Mo))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),O(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,r,n={}){return(!n||!1!==n.validate)&&Vn(this,t.call(Ln,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:ut,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof yo&&Sr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Io={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Eo{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class zo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ao(t,e=1){let i=0,r=0;return{members:t.map((t=>{const n=Io[t.type].BYTES_PER_ELEMENT,o=i=ko(i,Math.max(e,n)),a=t.components||1;return r=Math.max(r,n),i+=n*a,{name:t.name,type:t.type,components:a,offset:o}})),size:ko(i,Math.max(r,e)),alignment:e}}function ko(t,e){return Math.ceil(t/e)*e}class Do extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}Do.prototype.bytesPerElement=4,Zn("StructArrayLayout2i4",Do);class Ro extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}Ro.prototype.bytesPerElement=6,Zn("StructArrayLayout3i6",Ro);class Lo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t}}Lo.prototype.bytesPerElement=8,Zn("StructArrayLayout4i8",Lo);class Bo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}Bo.prototype.bytesPerElement=12,Zn("StructArrayLayout2i4i12",Bo);class Fo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}Fo.prototype.bytesPerElement=8,Zn("StructArrayLayout2i4ub8",Fo);class Oo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Oo.prototype.bytesPerElement=8,Zn("StructArrayLayout2f8",Oo);class jo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,n,o,a,s,l,c)}emplace(t,e,i,r,n,o,a,s,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=n,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}jo.prototype.bytesPerElement=20,Zn("StructArrayLayout10ui20",jo);class Vo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,a,s,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,o,a,s,l,c,h,u)}emplace(t,e,i,r,n,o,a,s,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}Vo.prototype.bytesPerElement=24,Zn("StructArrayLayout4i4ui4i24",Vo);class No extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}No.prototype.bytesPerElement=12,Zn("StructArrayLayout3f12",No);class qo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}qo.prototype.bytesPerElement=4,Zn("StructArrayLayout1ul4",qo);class Zo extends zo{_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(t,e,i,r,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,o,a,s,l)}emplace(t,e,i,r,n,o,a,s,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=o,this.int16[h+5]=a,this.uint32[u+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}Zo.prototype.bytesPerElement=20,Zn("StructArrayLayout6i1ul2ui20",Zo);class Uo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,t}}Uo.prototype.bytesPerElement=12,Zn("StructArrayLayout2i2i2i12",Uo);class Go extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=n,this.int16[s+7]=o,t}}Go.prototype.bytesPerElement=16,Zn("StructArrayLayout2f1f2i16",Go);class $o extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,a){const s=16*t,l=4*t,c=8*t;return this.uint8[s+0]=e,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=a,t}}$o.prototype.bytesPerElement=16,Zn("StructArrayLayout2ub2f2i16",$o);class Ho extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}Ho.prototype.bytesPerElement=6,Zn("StructArrayLayout3ui6",Ho);class Xo extends zo{_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(t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g)}emplace(t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_){const y=24*t,v=12*t,x=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[v+7]=u,this.float32[v+8]=p,this.uint8[x+36]=d,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[v+10]=g,this.int16[y+22]=_,t}}Xo.prototype.bytesPerElement=48,Zn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Xo);class Wo extends zo{_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(t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,v,x,b,w,T,C,P,M,S){const I=this.length;return this.resize(I+1),this.emplace(I,t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,v,x,b,w,T,C,P,M,S)}emplace(t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,v,x,b,w,T,C,P,M,S,I){const E=32*t,z=16*t;return this.int16[E+0]=e,this.int16[E+1]=i,this.int16[E+2]=r,this.int16[E+3]=n,this.int16[E+4]=o,this.int16[E+5]=a,this.int16[E+6]=s,this.int16[E+7]=l,this.uint16[E+8]=c,this.uint16[E+9]=h,this.uint16[E+10]=u,this.uint16[E+11]=p,this.uint16[E+12]=d,this.uint16[E+13]=f,this.uint16[E+14]=m,this.uint16[E+15]=g,this.uint16[E+16]=_,this.uint16[E+17]=y,this.uint16[E+18]=v,this.uint16[E+19]=x,this.uint16[E+20]=b,this.uint16[E+21]=w,this.uint16[E+22]=T,this.uint32[z+12]=C,this.float32[z+13]=P,this.float32[z+14]=M,this.uint16[E+30]=S,this.uint16[E+31]=I,t}}Wo.prototype.bytesPerElement=64,Zn("StructArrayLayout8i15ui1ul2f2ui64",Wo);class Ko extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ko.prototype.bytesPerElement=4,Zn("StructArrayLayout1f4",Ko);class Yo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Yo.prototype.bytesPerElement=12,Zn("StructArrayLayout1ui2f12",Yo);class Jo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}Jo.prototype.bytesPerElement=8,Zn("StructArrayLayout1ul2ui8",Jo);class Qo extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}Qo.prototype.bytesPerElement=4,Zn("StructArrayLayout2ui4",Qo);class ta extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}ta.prototype.bytesPerElement=2,Zn("StructArrayLayout1ui2",ta);class ea extends zo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t}}ea.prototype.bytesPerElement=16,Zn("StructArrayLayout4f16",ea);class ia extends Eo{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 l(this.anchorPointX,this.anchorPointY)}}ia.prototype.size=20;class ra extends Zo{get(t){return new ia(this,t)}}Zn("CollisionBoxArray",ra);class na extends Eo{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}na.prototype.size=48;class oa extends Xo{get(t){return new na(this,t)}}Zn("PlacedSymbolArray",oa);class aa extends Eo{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}aa.prototype.size=64;class sa extends Wo{get(t){return new aa(this,t)}}Zn("SymbolInstanceArray",sa);class la extends Ko{getoffsetX(t){return this.float32[1*t+0]}}Zn("GlyphOffsetArray",la);class ca extends Ro{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Zn("SymbolLineVertexArray",ca);class ha extends Eo{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]}}ha.prototype.size=12;class ua extends Yo{get(t){return new ha(this,t)}}Zn("TextAnchorOffsetArray",ua);class pa extends Eo{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]}}pa.prototype.size=8;class da extends Jo{get(t){return new pa(this,t)}}Zn("FeatureIndexArray",da);class fa extends Do{}class ma extends Do{}class ga extends Do{}class _a extends Bo{}class ya extends Fo{}class va extends Oo{}class xa extends jo{}class ba extends Vo{}class wa extends No{}class Ta extends qo{}class Ca extends Uo{}class Pa extends $o{}class Ma extends Ho{}class Sa extends Qo{}const Ia=Ao([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ea}=Ia;class za{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,i,r){const n=this.segments[this.segments.length-1];return t>za.MAX_VERTEX_ARRAY_LENGTH&&N(`Max vertices per segment is ${za.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${za.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>za.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(e,i,r):n}createNewSegment(t,e,i){const r={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(t,e,i){return this.prepareSegment(0,t,e,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new za([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Aa(t,e){return 256*(t=D(Math.floor(t),0,255))+D(Math.floor(e),0,255)}za.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Zn("SegmentVector",za);const ka=Ao([{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 Da,Ra,La,Ba={exports:{}},Fa={exports:{}},Oa={exports:{}},ja=function(){if(La)return Ba.exports;La=1;var t=(Da||(Da=1,Fa.exports=function(t,e){var i,r,n,o,a,s,l,c;for(r=t.length-(i=3&t.length),n=e,a=3432918353,s=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=t.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),Fa.exports),e=(Ra||(Ra=1,Oa.exports=function(t,e){for(var i,r=t.length,n=e^r,o=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&t.charCodeAt(o+2))<<16;case 2:n^=(255&t.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),Oa.exports);return Ba.exports=t,Ba.exports.murmur3=t,Ba.exports.murmur2=e,Ba.exports}(),Va=i(ja);class Na{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(qa(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=qa(t);let i=0,r=this.ids.length-1;for(;i<r;){const t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}const n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return Za(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new Na;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function qa(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Va(String(t))}function Za(t,e,i,r){for(;i<r;){const n=t[i+r>>1];let o=i-1,a=r+1;for(;;){do{o++}while(t[o]<n);do{a--}while(t[a]>n);if(o>=a)break;Ua(t,o,a),Ua(e,3*o,3*a),Ua(e,3*o+1,3*a+1),Ua(e,3*o+2,3*a+2)}a-i<r-a?(Za(t,e,i,a),i=a+1):(Za(t,e,a+1,r),r=a)}}function Ua(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}Zn("FeaturePositionMap",Na);class Ga{constructor(t,e){this.gl=t.gl,this.location=e}}class $a extends Ga{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ha extends Ga{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Xa extends Ga{constructor(t,e){super(t,e),this.current=me.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Wa=new Float32Array(16);function Ka(t){return[Aa(255*t.r,255*t.g),Aa(255*t.b,255*t.a)]}class Ya{constructor(t,e,i){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Xa(t,e):new $a(t,e)}}class Ja{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&t.set(n)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Ha(t,e):new $a(t,e)}}class Qa{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,n){const o=this.paintVertexArray.length,a=this.expression.evaluate(new ho(0),e,{},r,[],n);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,n)}_setPaintValue(t,e,i){if("color"===this.type){const r=Ka(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ts{constructor(t,e,i,r,n,o){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,i,r,n){const o=this.expression.evaluate(new ho(this.zoom),e,{},r,[],n),a=this.expression.evaluate(new ho(this.zoom+1),e,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,n,o)}_setPaintValue(t,e,i,r){if("color"===this.type){const n=Ka(i),o=Ka(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=D(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new $a(t,e)}}class es{constructor(t,e,i,r,n,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(t,e,i,r){if(!r||!i)return;const{min:n,mid:o,max:a}=i,s=r[n],l=r[o],c=r[a];if(s&&l&&c)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ka.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ka.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class is{constructor(t,e,i){this.binders={},this._buffers=[];const r=[];for(const n in t.paint._values){if(!i(n))continue;const o=t.paint.get(n);if(!(o instanceof yo&&Sr(o.property.specification)))continue;const a=ns(n,t.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===s.kind)this.binders[n]=u?new Ja(s.value,a):new Ya(s.value,a,l),r.push(`/u_${n}`);else if("source"===s.kind||u){const i=os(n,l,"source");this.binders[n]=u?new es(s,l,c,e,i,t.id):new Qa(s,a,l,i),r.push(`/a_${n}`)}else{const t=os(n,l,"composite");this.binders[n]=new ts(s,a,l,c,e,t),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Qa||e instanceof ts?e.maxValue:0}populatePaintArrays(t,e,i,r,n){for(const o in this.binders){const a=this.binders[o];(a instanceof Qa||a instanceof ts||a instanceof es)&&a.populatePaintArray(t,e,i,r,n)}}setConstantPatternPositions(t,e){for(const i in this.binders){const r=this.binders[i];r instanceof Ja&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Qa||l instanceof ts||l instanceof es)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,s,t[a],n),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Ya||i instanceof Ja)&&t.push(...i.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Qa||i instanceof ts)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof es)for(let e=0;e<ka.members.length;e++)t.push(ka.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Ya||i instanceof Ja||i instanceof ts)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Ya||n instanceof Ja||n instanceof ts)for(const o of n.uniformNames)if(e[o]){const a=n.getBinding(t,e[o],o);i.push({name:o,property:r,binding:a})}}return i}setUniforms(t,e,i,r){for(const{name:t,property:n,binding:o}of e)this.binders[n].setUniform(o,r,i.get(n),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof es){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof Qa||i instanceof ts)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof Qa||i instanceof ts||i instanceof es)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Qa||e instanceof ts||e instanceof es)&&e.destroy()}}}class rs{constructor(t,e,i=()=>!0){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new is(r,e,i);this.needsUpload=!1,this._featureMap=new Na,this._bufferOffset=0}populatePaintArrays(t,e,i,r,n,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,r,n,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function ns(t,e){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"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function os(t,e,i){const r={color:{source:Oo,composite:ea},number:{source:Ko,composite:Oo}},n=function(t){return{"line-pattern":{source:xa,composite:xa},"fill-pattern":{source:xa,composite:xa},"fill-extrusion-pattern":{source:xa,composite:xa}}[t]}(t);return n&&n[i]||r[e][i]}Zn("ConstantBinder",Ya),Zn("CrossFadedConstantBinder",Ja),Zn("SourceExpressionBinder",Qa),Zn("CrossFadedCompositeBinder",es),Zn("CompositeExpressionBinder",ts),Zn("ProgramConfiguration",is,{omit:["_buffers"]}),Zn("ProgramConfigurationSet",rs);const as=Math.pow(2,14)-1,ss=-as-1;function ls(t){const e=M/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const r=i[t];for(let t=0;t<r.length;t++){const i=r[t],n=Math.round(i.x*e),o=Math.round(i.y*e);i.x=D(n,ss,as),i.y=D(o,ss,as),(n<i.x||n>i.x+1||o<i.y||o>i.y+1)&&N("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function cs(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ls(t):[]}}const hs=-32768;function us(t,e,i,r,n){t.emplaceBack(hs+8*e+r,hs+8*i+n)}class ps{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ma,this.indexArray=new Ma,this.segments=new za,this.programConfigurations=new rs(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const r=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===r.type;if("circle"===r.type){const t=r;o=t.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===t.paint.get("circle-pitch-alignment")}const l=s?e.subdivisionGranularity.circle:1;for(const{feature:e,id:r,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=cs(e,t);if(!this.layers[0]._featureFilter.filter(new ho(this.zoom),c,i))continue;const h=a?o.evaluate(c,{},i):void 0,u={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:ls(e),patterns:{},sortKey:h};n.push(u)}a&&n.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:a}=r,s=t[o].feature;this.addFeature(r,n,o,i,l),e.featureIndex.insert(s,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ea),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const a=o.length;for(const i of e)for(const e of i){const i=e.x,r=e.y;if(i<0||i>=M||r<0||r>=M)continue;const n=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,t.sortKey),s=n.vertexLength;for(let t=0;t<a;t++)for(let e=0;e<a;e++)us(this.layoutVertexArray,i,r,o[e],o[t]);for(let t=0;t<a-1;t++)for(let e=0;e<a-1;e++){const i=s+t*a+e,r=s+(t+1)*a+e;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}n.vertexLength+=a*a,n.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)}}function ds(t,e){for(let i=0;i<t.length;i++)if(ws(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ws(t,e[i]))return!0;return!!_s(t,e)}function fs(t,e,i){return!!ws(t,e)||!!vs(e,t,i)}function ms(t,e){if(1===t.length)return bs(e,t[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<r.length;e++)if(ws(t,r[e]))return!0}for(let i=0;i<t.length;i++)if(bs(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(_s(t,e[i]))return!0;return!1}function gs(t,e,i){if(t.length>1){if(_s(t,e))return!0;for(let r=0;r<e.length;r++)if(vs(e[r],t,i))return!0}for(let r=0;r<t.length;r++)if(vs(t[r],e,i))return!0;return!1}function _s(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)if(ys(r,n,e[t],e[t+1]))return!0}return!1}function ys(t,e,i,r){return q(t,i,r)!==q(e,i,r)&&q(t,e,i)!==q(t,e,r)}function vs(t,e,i){const r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let i=1;i<e.length;i++)if(xs(t,e[i-1],e[i])<r)return!0;return!1}function xs(t,e,i){const r=e.distSqr(i);if(0===r)return t.distSqr(e);const n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function bs(t,e){let i,r,n,o=!1;for(let a=0;a<t.length;a++){i=t[a];for(let t=0,a=i.length-1;t<i.length;a=t++)r=i[t],n=i[a],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function ws(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const o=t[r],a=t[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function Ts(t,e,i){const r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;const o=q(t,e,i[0]);return o!==q(t,e,i[1])||o!==q(t,e,i[2])||o!==q(t,e,i[3])}function Cs(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Ps(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ms(t,e,i,r,n){if(!e[0]&&!e[1])return t;const o=l.convert(e)._mult(n);"viewport"===i&&o._rotate(-r);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}let Ss,Is;Zn("CircleBucket",ps,{omit:["layers"]});var Es={get paint(){return Is=Is||new Po({"circle-radius":new bo(ut.paint_circle["circle-radius"]),"circle-color":new bo(ut.paint_circle["circle-color"]),"circle-blur":new bo(ut.paint_circle["circle-blur"]),"circle-opacity":new bo(ut.paint_circle["circle-opacity"]),"circle-translate":new xo(ut.paint_circle["circle-translate"]),"circle-translate-anchor":new xo(ut.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new xo(ut.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new xo(ut.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new bo(ut.paint_circle["circle-stroke-width"]),"circle-stroke-color":new bo(ut.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new bo(ut.paint_circle["circle-stroke-opacity"])})},get layout(){return Ss=Ss||new Po({"circle-sort-key":new bo(ut.layout_circle["circle-sort-key"])})}};class zs extends So{constructor(t){super(t,Es)}createBucket(t){return new ps(t)}queryRadius(t){const e=t;return Cs("circle-radius",this,e)+Cs("circle-stroke-width",this,e)+Ps(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:a}){const s=Ms(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),l=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c="map"===this.paint.get("circle-pitch-alignment"),h=c?s:function(t,e){return t.map((t=>As(t,e)))}(s,a),u=c?l*o:l;for(const t of r)for(const e of t){const t=c?e:As(e,a);let i=u;const r=w([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r[3]/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=n.cameraToCenterDistance/r[3]),fs(h,t,i))return!0}return!1}}function As(t,e){const i=w([],[t.x,t.y,0,1],e);return new l(i[0]/i[3],i[1]/i[3])}class ks extends ps{}let Ds;Zn("HeatmapBucket",ks,{omit:["layers"]});var Rs={get paint(){return Ds=Ds||new Po({"heatmap-radius":new bo(ut.paint_heatmap["heatmap-radius"]),"heatmap-weight":new bo(ut.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new xo(ut.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Co(ut.paint_heatmap["heatmap-color"]),"heatmap-opacity":new xo(ut.paint_heatmap["heatmap-opacity"])})}};function Ls(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function Bs(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;const n=Ls({},{width:e,height:i},r);Fs(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function Fs(t,e,i,r,n,o){if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((i.y+l)*t.width+i.x)*o,h=((r.y+l)*e.width+r.x)*o;for(let t=0;t<n.width*o;t++)s[h+t]=a[c+t]}return e}class Os{constructor(t,e){Ls(this,t,1,e)}resize(t){Bs(this,t,1)}clone(){return new Os({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Fs(t,e,i,r,n,1)}}class js{constructor(t,e){Ls(this,t,4,e)}resize(t){Bs(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new js({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Fs(t,e,i,r,n,4)}}function Vs(t){const e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new js({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(i,r,o)=>{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);n.data[i+r+0]=Math.floor(255*a.r/a.a),n.data[i+r+1]=Math.floor(255*a.g/a.a),n.data[i+r+2]=Math.floor(255*a.b/a.a),n.data[i+r+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,n=0;e<r;++e,n+=4*i)for(let r=0,a=0;r<i;r++,a+=4){const s=r/(i-1),{start:l,end:c}=t.clips[e];o(n,a,l*(1-s)+c*s)}else for(let t=0,e=0;t<i;t++,e+=4)o(0,e,t/(i-1));return n}Zn("AlphaImage",Os),Zn("RGBAImage",js);const Ns="big-fb";class qs extends So{createBucket(t){return new ks(t)}constructor(t){super(t,Rs),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Vs({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ns)&&this.heatmapFbos.delete(Ns)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let Zs;var Us={get paint(){return Zs=Zs||new Po({"hillshade-illumination-direction":new xo(ut.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new xo(ut.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new xo(ut.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new xo(ut.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new xo(ut.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new xo(ut.paint_hillshade["hillshade-accent-color"])})}};class Gs extends So{constructor(t){super(t,Us)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const $s=Ao([{name:"a_pos",components:2,type:"Int16"}],4),{members:Hs}=$s;function Xs(t,e,i){const r=i.patternDependencies;let n=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(n=!0);const o=e.constantOr(null);o&&(n=!0,r[o.to]=!0,r[o.from]=!0)}return n}function Ws(t,e,i,r,n){const o=n.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},i,{},n.availableImages),s=e.evaluate({zoom:r},i,{},n.availableImages),l=e.evaluate({zoom:r+1},i,{},n.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[t]=!0,o[s]=!0,o[l]=!0,i.patterns[a.id]={min:t,mid:s,max:l}}}return i}function Ks(t,e,i,r,n){let o;if(n===function(t,e,i,r){let n=0;for(let o=e,a=i-r;o<i;o+=r)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,i,r)>0)for(let n=e;n<i;n+=r)o=yl(n/r|0,t[n],t[n+1],o);else for(let n=i-r;n>=e;n-=r)o=yl(n/r|0,t[n],t[n+1],o);return o&&pl(o,o.next)&&(vl(o),o=o.next),o}function Ys(t,e){if(!t)return t;e||(e=t);let i,r=t;do{if(i=!1,r.steiner||!pl(r,r.next)&&0!==ul(r.prev,r,r.next))r=r.next;else{if(vl(r),r=e=r.prev,r===r.next)break;i=!0}}while(i||r!==e);return e}function Js(t,e,i,r,n,o,a){if(!t)return;!a&&o&&function(t,e,i,r){let n=t;do{0===n.z&&(n.z=al(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let e,i=1;do{let r,n=t;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let t=0;t<i&&(s++,a=a.nextZ,a);t++);let l=i;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(r=n,n=n.nextZ,s--):(r=a,a=a.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=a}o.nextZ=null,i*=2}while(e>1)}(n)}(t,r,n,o);let s=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(o?tl(t,r,n,o):Qs(t))e.push(l.i,t.i,c.i),vl(t),t=c.next,s=c.next;else if((t=c)===s){a?1===a?Js(t=el(Ys(t),e),e,i,r,n,o,2):2===a&&il(t,e,i,r,n,o):Js(Ys(t),e,i,r,n,o,1);break}}}function Qs(t){const e=t.prev,i=t,r=t.next;if(ul(e,i,r)>=0)return!1;const n=e.x,o=i.x,a=r.x,s=e.y,l=i.y,c=r.y,h=Math.min(n,o,a),u=Math.min(s,l,c),p=Math.max(n,o,a),d=Math.max(s,l,c);let f=r.next;for(;f!==e;){if(f.x>=h&&f.x<=p&&f.y>=u&&f.y<=d&&cl(n,s,o,l,a,c,f.x,f.y)&&ul(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function tl(t,e,i,r){const n=t.prev,o=t,a=t.next;if(ul(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,h=n.y,u=o.y,p=a.y,d=Math.min(s,l,c),f=Math.min(h,u,p),m=Math.max(s,l,c),g=Math.max(h,u,p),_=al(d,f,e,i,r),y=al(m,g,e,i,r);let v=t.prevZ,x=t.nextZ;for(;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&cl(s,h,l,u,c,p,v.x,v.y)&&ul(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&x!==a&&cl(s,h,l,u,c,p,x.x,x.y)&&ul(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&cl(s,h,l,u,c,p,v.x,v.y)&&ul(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&x!==a&&cl(s,h,l,u,c,p,x.x,x.y)&&ul(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function el(t,e){let i=t;do{const r=i.prev,n=i.next.next;!pl(r,n)&&dl(r,i,i.next,n)&&gl(r,n)&&gl(n,r)&&(e.push(r.i,i.i,n.i),vl(i),vl(i.next),i=t=n),i=i.next}while(i!==t);return Ys(i)}function il(t,e,i,r,n,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&hl(a,t)){let s=_l(a,t);return a=Ys(a,a.next),s=Ys(s,s.next),Js(a,e,i,r,n,o,0),void Js(s,e,i,r,n,o,0)}t=t.next}a=a.next}while(a!==t)}function rl(t,e){let i=t.x-e.x;return 0===i&&(i=t.y-e.y,0===i)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function nl(t,e){const i=function(t,e){let i=e;const r=t.x,n=t.y;let o,a=-1/0;if(pl(t,i))return i;do{if(pl(t,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const t=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=r&&t>a&&(a=t,o=i.x<i.next.x?i:i.next,t===r))return o}i=i.next}while(i!==e);if(!o)return null;const s=o,l=o.x,c=o.y;let h=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&ll(n<c?r:a,n,l,c,n<c?a:r,n,i.x,i.y)){const e=Math.abs(n-i.y)/(r-i.x);gl(i,t)&&(e<h||e===h&&(i.x>o.x||i.x===o.x&&ol(o,i)))&&(o=i,h=e)}i=i.next}while(i!==s);return o}(t,e);if(!i)return e;const r=_l(i,t);return Ys(r,r.next),Ys(i,i.next)}function ol(t,e){return ul(t.prev,t,e.prev)<0&&ul(e.next,t,t.next)<0}function al(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function sl(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ll(t,e,i,r,n,o,a,s){return(n-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(r-s)>=(i-a)*(e-s)&&(i-a)*(o-s)>=(n-a)*(r-s)}function cl(t,e,i,r,n,o,a,s){return!(t===a&&e===s)&&ll(t,e,i,r,n,o,a,s)}function hl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&dl(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(gl(t,e)&&gl(e,t)&&function(t,e){let i=t,r=!1;const n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(ul(t.prev,t,e.prev)||ul(t,e.prev,e))||pl(t,e)&&ul(t.prev,t,t.next)>0&&ul(e.prev,e,e.next)>0)}function ul(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function pl(t,e){return t.x===e.x&&t.y===e.y}function dl(t,e,i,r){const n=ml(ul(t,e,i)),o=ml(ul(t,e,r)),a=ml(ul(i,r,t)),s=ml(ul(i,r,e));return n!==o&&a!==s||!(0!==n||!fl(t,i,e))||!(0!==o||!fl(t,r,e))||!(0!==a||!fl(i,t,r))||!(0!==s||!fl(i,e,r))}function fl(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ml(t){return t>0?1:t<0?-1:0}function gl(t,e){return ul(t.prev,t,t.next)<0?ul(t,e,t.next)>=0&&ul(t,t.prev,e)>=0:ul(t,e,t.prev)<0||ul(t,t.next,e)<0}function _l(t,e){const i=xl(t.i,t.x,t.y),r=xl(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function yl(t,e,i,r){const n=xl(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function vl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function xl(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class bl{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class wl{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}wl.noSubdivision=new wl({fill:new bl(0,0),line:new bl(0,0),tile:new bl(0,0),stencil:new bl(0,0),circle:1}),Zn("SubdivisionGranularityExpression",bl),Zn("SubdivisionGranularitySetting",wl);const Tl=-32768,Cl=32767;class Pl{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=M/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|(e+=32768)}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const i=0|Math.round(t),r=0|Math.round(e),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const i=[];for(let r=0;r<e.length;r+=3){const n=e[r],o=e[r+1],a=e[r+2],s=t[2*n],l=t[2*n+1];(t[2*o]-s)*(t[2*a+1]-l)-(t[2*o+1]-l)*(t[2*a]-s)>0?(i.push(n),i.push(a),i.push(o)):(i.push(n),i.push(o),i.push(a))}return i}(this._vertexBuffer,t);const e=[],i=t.length;for(let r=0;r<i;r+=3){const i=[t[r+0],t[r+1],t[r+2]],n=[this._vertexBuffer[2*t[r+0]+0],this._vertexBuffer[2*t[r+0]+1],this._vertexBuffer[2*t[r+1]+0],this._vertexBuffer[2*t[r+1]+1],this._vertexBuffer[2*t[r+2]+0],this._vertexBuffer[2*t[r+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=n[2*t],i=n[2*t+1];o=Math.min(o,e),s=Math.max(s,e),a=Math.min(a,i),l=Math.max(l,i)}if(o===s||a===l)continue;const c=Math.floor(o/this._granularityCellSize),h=Math.ceil(s/this._granularityCellSize),u=Math.floor(a/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(c!==h||u!==p)for(let t=u;t<p;t++){const r=this._scanlineGenerateVertexRingForCellRow(t,n,i);Il(this._vertexBuffer,r,e)}else e.push(...i)}return e}_scanlineGenerateVertexRingForCellRow(t,e,i){const r=t*this._granularityCellSize,n=r+this._granularityCellSize,o=[];for(let t=0;t<3;t++){const a=e[2*t],s=e[2*t+1],l=e[2*(t+1)%6],c=e[(2*(t+1)+1)%6],h=e[2*(t+2)%6],u=e[(2*(t+2)+1)%6],p=l-a,d=c-s,f=0===p,m=0===d,g=(r-s)/d,_=(n-s)/d,y=Math.min(g,_),v=Math.max(g,_);if(!m&&(y>=1||v<=0)||m&&(s<r||s>n)){c>=r&&c<=n&&o.push(i[(t+1)%3]);continue}!m&&y>0&&o.push(this._vertexToIndex(a+p*y,s+d*y));const x=a+p*Math.max(y,0),b=a+p*Math.min(v,1);f||this._generateIntraEdgeVertices(o,a,s,l,c,x,b),!m&&v<1&&o.push(this._vertexToIndex(a+p*v,s+d*v)),(m||c>=r&&c<=n)&&o.push(i[(t+1)%3]),!m&&(c<=r||c>=n)&&this._generateInterEdgeVertices(o,a,s,l,c,h,u,b,r,n)}return o}_generateIntraEdgeVertices(t,e,i,r,n,o,a){const s=r-e,l=n-i,c=0===l,h=c?Math.min(e,r):Math.min(o,a),u=c?Math.max(e,r):Math.max(o,a),p=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(u/this._granularityCellSize)-1;if(c?e<r:o<a)for(let r=p;r<=d;r++){const n=r*this._granularityCellSize;t.push(this._vertexToIndex(n,i+l*(n-e)/s))}else for(let r=d;r>=p;r--){const n=r*this._granularityCellSize;t.push(this._vertexToIndex(n,i+l*(n-e)/s))}}_generateInterEdgeVertices(t,e,i,r,n,o,a,s,l,c){const h=n-i,u=o-r,p=a-n,d=(l-n)/p,f=(c-n)/p,m=Math.min(d,f),g=Math.max(d,f),_=r+u*m;let y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,x=s<_;const b=0===p;if(b&&(a===l||a===c))return;if(b||m>=1||g<=0){const t=i-a,r=o+(e-o)*Math.min((l-a)/t,(c-a)/t);y=Math.floor(Math.min(r,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(r,s)/this._granularityCellSize)-1,x=s<r}const w=h>0?c:l;if(x)for(let e=y;e<=v;e++)t.push(this._vertexToIndex(e*this._granularityCellSize,w));else for(let e=v;e>=y;e--)t.push(this._vertexToIndex(e*this._granularityCellSize,w))}_generateOutline(t){const e=[];for(const i of t){const t=Sl(i,this._granularity,!0),r=this._pointArrayToIndices(t),n=[];for(let t=1;t<r.length;t++)n.push(r[t-1]),n.push(r[t]);e.push(n)}return e}_handlePoles(t){let e=!1,i=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(e||i)&&this._fillPoles(t,e,i)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const i=t[e+1];i===Tl&&(t[e+1]=-32767),i===Cl&&(t[e+1]=32766)}}_generatePoleQuad(t,e,i,r,n,o){r>n!=(o===Tl)?(t.push(e),t.push(i),t.push(this._vertexToIndex(r,o)),t.push(i),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(r,o))):(t.push(i),t.push(e),t.push(this._vertexToIndex(r,o)),t.push(this._vertexToIndex(n,o)),t.push(i),t.push(this._vertexToIndex(r,o)))}_fillPoles(t,e,i){const r=this._vertexBuffer,n=M,o=t.length;for(let a=2;a<o;a+=3){const o=t[a-2],s=t[a-1],l=t[a],c=r[2*o],h=r[2*o+1],u=r[2*s],p=r[2*s+1],d=r[2*l],f=r[2*l+1];e&&(0===h&&0===p&&this._generatePoleQuad(t,o,s,c,u,Tl),0===p&&0===f&&this._generatePoleQuad(t,s,l,u,d,Tl),0===f&&0===h&&this._generatePoleQuad(t,l,o,d,c,Tl)),i&&(h===n&&p===n&&this._generatePoleQuad(t,o,s,c,u,Cl),p===n&&f===n&&this._generatePoleQuad(t,s,l,u,d,Cl),f===n&&h===n&&this._generatePoleQuad(t,l,o,d,c,Cl))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:i,holeIndices:r}=function(t){const e=[],i=[];for(const r of t)if(0!==r.length){r!==t[0]&&e.push(i.length/2);for(let t=0;t<r.length;t++)i.push(r[t].x),i.push(r[t].y)}return{flattened:i,holeIndices:e}}(t);let n;this._initializeVertices(i);try{const t=function(t,e,i=2){const r=e&&e.length,n=r?e[0]*i:t.length;let o=Ks(t,0,n,i,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(r&&(o=function(t,e,i,r){const n=[];for(let i=0,o=e.length;i<o;i++){const a=Ks(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1);a===a.next&&(a.steiner=!0),n.push(sl(a))}n.sort(rl);for(let t=0;t<n.length;t++)i=nl(n[t],i);return i}(t,e,o,i)),t.length>80*i){s=1/0,l=1/0;let e=-1/0,r=-1/0;for(let o=i;o<n;o+=i){const i=t[o],n=t[o+1];i<s&&(s=i),n<l&&(l=n),i>e&&(e=i),n>r&&(r=n)}c=Math.max(e-s,r-l),c=0!==c?32767/c:0}return Js(o,a,i,s,l,c,0),a}(i,r),e=this._convertIndices(i,t);n=this._subdivideTrianglesScanline(e)}catch(t){console.error(t)}let o=[];return e&&(o=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(t,e){const i=[];for(let r=0;r<e.length;r++)i.push(this._vertexToIndex(t[2*e[r]],t[2*e[r]+1]));return i}_pointArrayToIndices(t){const e=[];for(let i=0;i<t.length;i++){const r=t[i];e.push(this._vertexToIndex(r.x,r.y))}return e}}function Ml(t,e,i,r=!0){return new Pl(i,e).subdividePolygonInternal(t,r)}function Sl(t,e,i=!1){if(!t||t.length<1)return[];if(t.length<2)return[];const r=t[0],n=t[t.length-1],o=i&&(r.x!==n.x||r.y!==n.y);if(e<2)return o?[...t,t[0]]:[...t];const a=Math.floor(M/e),s=[];s.push(new l(t[0].x,t[0].y));const c=t.length,h=o?c:c-1;for(let e=0;e<h;e++){const i=t[e],r=e<c-1?t[e+1]:t[0],n=i.x,o=i.y,h=r.x,u=r.y,p=n!==h,d=o!==u;if(!p&&!d)continue;const f=h-n,m=u-o,g=Math.abs(f),_=Math.abs(m);let y=n,v=o;for(;;){const t=f>0?(Math.floor(y/a)+1)*a:(Math.ceil(y/a)-1)*a,e=m>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,i=Math.abs(y-t),r=Math.abs(v-e),n=Math.abs(y-h),o=Math.abs(v-u),c=p?i/g:Number.POSITIVE_INFINITY,x=d?r/_:Number.POSITIVE_INFINITY;if((n<=i||!p)&&(o<=r||!d))break;if(c<x&&p||!d){y=t,v+=m*c;const e=new l(y,Math.round(v));s[s.length-1].x===e.x&&s[s.length-1].y===e.y||s.push(e)}else{y+=f*x,v=e;const t=new l(Math.round(y),v);s[s.length-1].x===t.x&&s[s.length-1].y===t.y||s.push(t)}}const x=new l(h,u);s[s.length-1].x===x.x&&s[s.length-1].y===x.y||s.push(x)}return s}function Il(t,e,i){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let r=0,n=t[2*e[0]];for(let i=1;i<e.length;i++){const o=t[2*e[i]];o<n&&(n=o,r=i)}const o=e.length;let a=r,s=(a+1)%o;for(;;){const r=a-1>=0?a-1:o-1,n=(s+1)%o,l=t[2*e[r]],c=t[2*e[n]],h=t[2*e[a]],u=t[2*e[a]+1],p=t[2*e[s]+1];let d=!1;if(l<c)d=!0;else if(l>c)d=!1;else{const i=p-u,o=-(t[2*e[s]]-h),a=u<p?1:-1;((l-h)*i+(t[2*e[r]+1]-u)*o)*a>((c-h)*i+(t[2*e[n]+1]-u)*o)*a&&(d=!0)}if(d){const t=e[r],n=e[a],l=e[s];t!==n&&t!==l&&n!==l&&i.push(l,n,t),a--,a<0&&(a=o-1)}else{const t=e[n],r=e[a],l=e[s];t!==r&&t!==l&&r!==l&&i.push(l,r,t),s++,s>=o&&(s=0)}if(r===n)break}}function El(t,e,i,r,n,o,a,s,l){const c=n.length/2,h=a&&s&&l;if(c<za.MAX_VERTEX_ARRAY_LENGTH){const u=e.prepareSegment(c,i,r),p=u.vertexLength;for(let t=0;t<o.length;t+=3)r.emplaceBack(p+o[t],p+o[t+1],p+o[t+2]);let d,f;u.vertexLength+=c,u.primitiveLength+=o.length/3,h&&(f=a.prepareSegment(c,i,s),d=f.vertexLength,f.vertexLength+=c);for(let e=0;e<n.length;e+=2)t(n[e],n[e+1]);if(h)for(let t=0;t<l.length;t++){const e=l[t];for(let t=1;t<e.length;t+=2)s.emplaceBack(d+e[t-1],d+e[t]);f.primitiveLength+=e.length/2}}else!function(t,e,i,r,n,o){const a=[];for(let t=0;t<r.length/2;t++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,i),h=c.vertexLength;for(let u=2;u<n.length;u+=3){const p=n[u-2],d=n[u-1],f=n[u];let m=a[p]<l,g=a[d]<l,_=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>za.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,i),l=s.count,m=!0,g=!0,_=!0,h=0);const y=zl(a,r,o,s,p,m,c),v=zl(a,r,o,s,d,g,c),x=zl(a,r,o,s,f,_,c);i.emplaceBack(h+y-l,h+v-l,h+x-l),c.primitiveLength++}}(e,i,r,n,o,t),h&&function(t,e,i,r,n,o){const a=[];for(let t=0;t<r.length/2;t++)a.push(-1);const s={count:0};let l=0,c=t.getOrCreateLatestSegment(e,i),h=c.vertexLength;for(let u=0;u<n.length;u++){const p=n[u];for(let d=1;d<n[u].length;d+=2){const n=p[d-1],u=p[d];let f=a[n]<l,m=a[u]<l;c.vertexLength+((f?1:0)+(m?1:0))>za.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(e,i),l=s.count,f=!0,m=!0,h=0);const g=zl(a,r,o,s,n,f,c),_=zl(a,r,o,s,u,m,c);i.emplaceBack(h+g-l,h+_-l),c.primitiveLength++}}}(a,i,s,n,l,t),e.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function zl(t,e,i,r,n,o,a){if(o){const o=r.count;return i(e[2*n],e[2*n+1]),t[n]=r.count,r.count++,a.vertexLength++,o}return t[n]}class Al{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ga,this.indexArray=new Ma,this.indexArray2=new Sa,this.programConfigurations=new rs(t.layers,t.zoom),this.segments=new za,this.segments2=new za,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Xs("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=cs(a,t);if(!this.layers[0]._featureFilter.filter(new ho(this.zoom),h,i))continue;const u=n?r.evaluate(h,{},i,e.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:ls(a),patterns:{},sortKey:u};o.push(p)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const t=Ws("fill",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,o,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Hs),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,i,r,n,o){for(const t of Vi(e,500)){const e=Ml(t,r,o.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;El(((t,e)=>{i.emplaceBack(t,e)}),this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}}let kl,Dl;Zn("FillBucket",Al,{omit:["layers","patternFeatures"]});var Rl={get paint(){return Dl=Dl||new Po({"fill-antialias":new xo(ut.paint_fill["fill-antialias"]),"fill-opacity":new bo(ut.paint_fill["fill-opacity"]),"fill-color":new bo(ut.paint_fill["fill-color"]),"fill-outline-color":new bo(ut.paint_fill["fill-outline-color"]),"fill-translate":new xo(ut.paint_fill["fill-translate"]),"fill-translate-anchor":new xo(ut.paint_fill["fill-translate-anchor"]),"fill-pattern":new wo(ut.paint_fill["fill-pattern"])})},get layout(){return kl=kl||new Po({"fill-sort-key":new bo(ut.layout_fill["fill-sort-key"])})}};class Ll extends So{constructor(t){super(t,Rl)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Al(t)}queryRadius(){return Ps(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:i,pixelsToTileUnits:r}){return ms(Ms(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),e)}isTileClipped(){return!0}}const Bl=Ao([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fl=Ao([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Ol}=Bl;var jl,Vl,Nl,ql,Zl,Ul,Gl,$l={};function Hl(){if(Vl)return jl;Vl=1;var t=o();function e(t,e,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(i,this,e)}function i(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function r(t){for(var e,i,r=0,n=0,o=t.length,a=o-1;n<o;a=n++)r+=((i=t[a]).x-(e=t[n]).x)*(e.y+i.y);return r}return jl=e,e.types=["Unknown","Point","LineString","Polygon"],e.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var i,r=e.readVarint()+e.pos,n=1,o=0,a=0,s=0,l=[];e.pos<r;){if(o<=0){var c=e.readVarint();n=7&c,o=c>>3}if(o--,1===n||2===n)a+=e.readSVarint(),s+=e.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new t(a,s));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},e.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(n+=t.readSVarint())<a&&(a=n),n>s&&(s=n),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,c]},e.prototype.toGeoJSON=function(t,i,n){var o,a,s=this.extent*Math.pow(2,n),l=this.extent*t,c=this.extent*i,h=this.loadGeometry(),u=e.types[this.type];function p(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+c)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(o=0;o<h.length;o++)d[o]=h[o][0];p(h=d);break;case 2:for(o=0;o<h.length;o++)p(h[o]);break;case 3:for(h=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,o=[],a=0;a<e;a++){var s=r(t[a]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(i&&o.push(i),i=[t[a]]):i.push(t[a]))}return i&&o.push(i),o}(h),o=0;o<h.length;o++)for(a=0;a<h[o].length;a++)p(h[o][a])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f},jl}function Xl(){if(ql)return Nl;ql=1;var t=Hl();function e(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(i,this,e),this.length=this._features.length}function i(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}return Nl=e,e.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var i=this._pbf.readVarint()+this._pbf.pos;return new t(this._pbf,i,this.extent,this._keys,this._values)},Nl}function Wl(){return Gl||(Gl=1,$l.VectorTile=function(){if(Ul)return Zl;Ul=1;var t=Xl();function e(e,i,r){if(3===e){var n=new t(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return Zl=function(t,i){this.layers=t.readFields(e,{},i)},Zl}(),$l.VectorTileFeature=Hl(),$l.VectorTileLayer=Xl()),$l}var Kl=i(Wl());const Yl=Kl.VectorTileFeature.types,Jl=Math.pow(2,13);function Ql(t,e,i,r,n,o,a,s){t.emplaceBack(e,i,2*Math.floor(r*Jl)+a,n*Jl*2,o*Jl*2,Math.round(s))}class tc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new _a,this.centroidVertexArray=new fa,this.indexArray=new Ma,this.programConfigurations=new rs(t.layers,t.zoom),this.segments=new za,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=Xs("fill-extrusion",this.layers,e);for(const{feature:r,id:n,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=cs(r,t);if(!this.layers[0]._featureFilter.filter(new ho(this.zoom),s,i))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:t?s.geometry:ls(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Ws("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,i,{},e.subdivisionGranularity),e.featureIndex.insert(r,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,i){for(const r of this.features){const{geometry:n}=r;this.addFeature(r,n,r.index,e,i,t.subdivisionGranularity)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ol),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Fl.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n,o){for(const i of Vi(e,500)){const e={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(e,r,t,i,o);const a=this.layoutVertexArray.length-n,s=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<a;t++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}processPolygon(t,e,i,r,n){if(r.length<1)return;if(rc(r[0]))return;for(const e of r)0!==e.length&&ec(t,e);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(e.z),s="Polygon"===Yl[i.type];for(const t of r){if(0===t.length)continue;if(rc(t))continue;const e=Sl(t,a,s);this._generateSideFaces(e,o)}if(!s)return;const l=Ml(r,e,a,!1),c=this.layoutVertexArray;El(((t,e)=>{Ql(c,t,e,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let i=0;for(let r=1;r<t.length;r++){const n=t[r],o=t[r-1];if(ic(n,o))continue;e.segment.vertexLength+4>za.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const a=n.sub(o)._perp()._unit(),s=o.dist(n);i+s>32768&&(i=0),Ql(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,i),Ql(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,i),i+=s,Ql(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,i),Ql(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,i);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function ec(t,e){for(let i=0;i<e.length;i++){const r=e[i];i===e.length-1&&e[0].x===r.x&&e[0].y===r.y||(t.x+=r.x,t.y+=r.y,t.sampleCount++)}}function ic(t,e){return t.x===e.x&&(t.x<0||t.x>M)||t.y===e.y&&(t.y<0||t.y>M)}function rc(t){return t.every((t=>t.x<0))||t.every((t=>t.x>M))||t.every((t=>t.y<0))||t.every((t=>t.y>M))}let nc;Zn("FillExtrusionBucket",tc,{omit:["layers","features"]});var oc={get paint(){return nc=nc||new Po({"fill-extrusion-opacity":new xo(ut["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new bo(ut["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new xo(ut["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new xo(ut["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wo(ut["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new bo(ut["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new bo(ut["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new xo(ut["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ac extends So{constructor(t){super(t,oc)}createBucket(t){return new tc(t)}queryRadius(){return Ps(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:a}){const s=Ms(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(e,i),h=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(t,e){const i=[];for(const r of t){const t=[r.x,r.y,0,1];w(t,t,e),i.push(new l(t[0]/t[3],t[1]/t[3]))}return i}(s,a),p=function(t,e,i,r){const n=[],o=[],a=r[8]*e,s=r[9]*e,c=r[10]*e,h=r[11]*e,u=r[8]*i,p=r[9]*i,d=r[10]*i,f=r[11]*i;for(const e of t){const t=[],i=[];for(const n of e){const e=n.x,o=n.y,m=r[0]*e+r[4]*o+r[12],g=r[1]*e+r[5]*o+r[13],_=r[2]*e+r[6]*o+r[14],y=r[3]*e+r[7]*o+r[15],v=_+c,x=y+h,b=m+u,w=g+p,T=_+d,C=y+f,P=new l((m+a)/x,(g+s)/x);P.z=v/x,t.push(P);const M=new l(b/C,w/C);M.z=T/C,i.push(M)}n.push(t),o.push(i)}return[n,o]}(r,h,c,a);return function(t,e,i){let r=1/0;ms(i,e)&&(r=lc(i,e[0]));for(let n=0;n<e.length;n++){const o=e[n],a=t[n];for(let t=0;t<o.length-1;t++){const e=o[t],n=[e,o[t+1],a[t+1],a[t],e];ds(i,n)&&(r=Math.min(r,lc(i,n)))}}return r!==1/0&&r}(p[0],p[1],u)}}function sc(t,e){return t.x*e.x+t.y*e.y}function lc(t,e){if(1===t.length){let i=0;const r=e[i++];let n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){const o=e[i],a=t[0],s=n.sub(r),l=o.sub(r),c=a.sub(r),h=sc(s,s),u=sc(s,l),p=sc(l,l),d=sc(c,s),f=sc(c,l),m=h*p-u*u,g=(p*d-u*f)/m,_=(h*f-u*d)/m,y=r.z*(1-g-_)+n.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const cc=Ao([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:hc}=cc,uc=Ao([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:pc}=uc,dc=Kl.VectorTileFeature.types,fc=Math.cos(Math.PI/180*37.5),mc=Math.pow(2,14)/.5;class gc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new ya,this.layoutVertexArray2=new va,this.indexArray=new Ma,this.programConfigurations=new rs(t.layers,t.zoom),this.segments=new za,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=Xs("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:e,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=cs(e,t);if(!this.layers[0]._featureFilter.filter(new ho(this.zoom),c,i))continue;const h=n?r.evaluate(c,{},i):void 0,u={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?c.geometry:ls(e),patterns:{},sortKey:h};o.push(u)}n&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const t=Ws("line",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,n,o,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[o].feature,n,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,pc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hc),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,r,n,o){const a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),h=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,s,l,c,h,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,n,r)}addLine(t,e,i,r,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=Sl(t,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===dc[e.type];let c=t.length;for(;c>=2&&t[c-1].equals(t[c-2]);)c--;let h=0;for(;h<c-1&&t[h].equals(t[h+1]);)h++;if(c<(l?3:2))return;"bevel"===i&&(n=1.05);const u=this.overscaling<=16?15*M/(512*this.overscaling):0,p=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let d,f,m,g,_;this.e1=this.e2=-1,l&&(d=t[c-2],_=t[h].sub(d)._unit()._perp());for(let e=h;e<c;e++){if(m=e===c-1?l?t[h+1]:void 0:t[e+1],m&&t[e].equals(m))continue;_&&(g=_),d&&(f=d),d=t[e],_=m?m.sub(d)._unit()._perp():g,g=g||_;let a=g.add(_);0===a.x&&0===a.y||a._unit();const s=g.x*_.x+g.y*_.y,y=a.x*_.x+a.y*_.y,v=0!==y?1/y:1/0,x=2*Math.sqrt(2-2*y),b=y<fc&&f&&m,w=g.x*_.y-g.y*_.x>0;if(b&&e>h){const t=d.dist(f);if(t>2*u){const e=d.sub(d.sub(f)._mult(u/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,g,0,0,p),f=e}}const T=f&&m;let C=T?i:l?"butt":r;if(T&&"round"===C&&(v<o?C="miter":v<=2&&(C="fakeround")),"miter"===C&&v>n&&(C="bevel"),"bevel"===C&&(v>2&&(C="flipbevel"),v<n&&(C="miter")),f&&this.updateDistance(f,d),"miter"===C)a._mult(v),this.addCurrentVertex(d,a,0,0,p);else if("flipbevel"===C){if(v>100)a=_.mult(-1);else{const t=v*g.add(_).mag()/g.sub(_).mag();a._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(d,a,0,0,p),this.addCurrentVertex(d,a.mult(-1),0,0,p)}else if("bevel"===C||"fakeround"===C){const t=-Math.sqrt(v*v-1),e=w?t:0,i=w?0:t;if(f&&this.addCurrentVertex(d,g,e,i,p),"fakeround"===C){const t=Math.round(180*x/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*t*t+(.848013+s*(.215638*s-1.06021)))}const r=_.sub(g)._mult(i)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(d,r.x,r.y,!1,w,0,p)}}m&&this.addCurrentVertex(d,_,-e,-i,p)}else if("butt"===C)this.addCurrentVertex(d,a,0,0,p);else if("square"===C){const t=f?1:-1;this.addCurrentVertex(d,a,t,t,p)}else"round"===C&&(f&&(this.addCurrentVertex(d,g,0,0,p),this.addCurrentVertex(d,g,1,1,p,!0)),m&&(this.addCurrentVertex(d,_,-1,-1,p,!0),this.addCurrentVertex(d,_,0,0,p)));if(b&&e<c-1){const t=d.dist(m);if(t>2*u){const e=d.add(m.sub(d)._mult(u/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,_,0,0,p),d=e}}}}addCurrentVertex(t,e,i,r,n,o=!1){const a=e.y*r-e.x,s=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,a,s,o,!0,-r,n),this.distance>mc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,o))}addHalfVertex({x:t,y:e},i,r,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(mc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),s.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let _c,yc;Zn("LineBucket",gc,{omit:["layers","patternFeatures"]});var vc={get paint(){return yc=yc||new Po({"line-opacity":new bo(ut.paint_line["line-opacity"]),"line-color":new bo(ut.paint_line["line-color"]),"line-translate":new xo(ut.paint_line["line-translate"]),"line-translate-anchor":new xo(ut.paint_line["line-translate-anchor"]),"line-width":new bo(ut.paint_line["line-width"]),"line-gap-width":new bo(ut.paint_line["line-gap-width"]),"line-offset":new bo(ut.paint_line["line-offset"]),"line-blur":new bo(ut.paint_line["line-blur"]),"line-dasharray":new To(ut.paint_line["line-dasharray"]),"line-pattern":new wo(ut.paint_line["line-pattern"]),"line-gradient":new Co(ut.paint_line["line-gradient"])})},get layout(){return _c=_c||new Po({"line-cap":new xo(ut.layout_line["line-cap"]),"line-join":new bo(ut.layout_line["line-join"]),"line-miter-limit":new xo(ut.layout_line["line-miter-limit"]),"line-round-limit":new xo(ut.layout_line["line-round-limit"]),"line-sort-key":new bo(ut.layout_line["line-sort-key"])})}};class xc extends bo{possiblyEvaluate(t,e){return e=new ho(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=L({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let bc;class wc extends So{constructor(t){super(t,vc),this.gradientVersion=0,bc||(bc=new xc(vc.paint.properties["line-width"].specification),bc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof He,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=bc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new gc(t)}queryRadius(t){const e=t,i=Tc(Cs("line-width",this,e),Cs("line-gap-width",this,e)),r=Cs("line-offset",this,e);return i/2+Math.abs(r)+Ps(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o}){const a=Ms(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),s=o/2*Tc(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(r=function(t,e){const i=[];for(let r=0;r<t.length;r++){const n=t[r],o=[];for(let t=0;t<n.length;t++){const i=n[t-1],r=n[t],a=n[t+1],s=0===t?new l(0,0):r.sub(i)._unit()._perp(),c=t===n.length-1?new l(0,0):a.sub(r)._unit()._perp(),h=s._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),o.push(h._mult(e)._add(r))}i.push(o)}return i}(r,c*o)),function(t,e,i){for(let r=0;r<e.length;r++){const n=e[r];if(t.length>=3)for(let e=0;e<n.length;e++)if(ws(t,n[e]))return!0;if(gs(t,n,i))return!0}return!1}(a,r,s)}isTileClipped(){return!0}}function Tc(t,e){return e>0?e+2*t:t}const Cc=Ao([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Pc=Ao([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ao([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Mc=Ao([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ao([{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"}]);const Sc=Ao([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ic=Ao([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ec(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),co.applyArabicShaping&&(t=co.applyArabicShaping(t)),t}(t.text,e,i)})),t}Ao([{name:"triangle",components:3,type:"Uint16"}]),Ao([{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"}]),Ao([{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"}]),Ao([{type:"Float32",name:"offsetX"}]),Ao([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ao([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const zc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ac,kc,Dc,Rc=24,Lc={};function Bc(){return Ac||(Ac=1,Lc.read=function(t,e,i,r,n){var o,a,s=8*n-r-1,l=(1<<s)-1,c=l>>1,h=-7,u=i?n-1:0,p=i?-1:1,d=t[e+u];for(u+=p,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+t[e+u],u+=p,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=r;h>0;a=256*a+t[e+u],u+=p,h-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},Lc.write=function(t,e,i,r,n,o){var a,s,l,c=8*o-n-1,h=(1<<c)-1,u=h>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=h?(s=0,a=h):a+u>=1?(s=(e*l-1)*Math.pow(2,n),a+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),a=0));n>=8;t[i+d]=255&s,d+=f,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;t[i+d]=255&a,d+=f,a/=256,c-=8);t[i+d-f]|=128*m}),Lc}function Fc(){if(Dc)return kc;Dc=1,kc=e;var t=Bc();function e(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function o(t){return t.type===e.Bytes?t.readVarint()+t.pos:t.pos+1}function a(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function s(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function l(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function c(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function h(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function u(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function p(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function d(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function f(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function m(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function g(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function _(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function y(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function v(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}return e.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_(this.buf,this.pos)+_(this.buf,this.pos+4)*i;return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+v(this.buf,this.pos+4)*i;return this.pos+=8,t},readFloat:function(){var e=t.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=t.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return a(t,r,e);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return a(t,r,e);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return a(t,r,e);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return a(t,r,e);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return a(t,r,e);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return a(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&n?function(t,e,i){return n.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",n=e;n<i;){var o,a,s,l=t[n],c=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h>i)break;1===h?l<128&&(c=l):2===h?128==(192&(o=t[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===h?(a=t[n+2],128==(192&(o=t[n+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(a=t[n+2],s=t[n+3],128==(192&(o=t[n+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,i){if(this.type!==e.Bytes)return t.push(this.readVarint(i));var r=o(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(i));return t},readPackedSVarint:function(t){if(this.type!==e.Bytes)return t.push(this.readSVarint());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==e.Bytes)return t.push(this.readBoolean());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==e.Bytes)return t.push(this.readFloat());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==e.Bytes)return t.push(this.readDouble());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==e.Bytes)return t.push(this.readFixed32());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==e.Bytes)return t.push(this.readSFixed32());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==e.Bytes)return t.push(this.readFixed64());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==e.Bytes)return t.push(this.readSFixed64());var i=o(this);for(t=t||[];this.pos<i;)t.push(this.readSFixed64());return t},skip:function(t){var i=7&t;if(i===e.Varint)for(;this.buf[this.pos++]>127;);else if(i===e.Bytes)this.pos=this.readVarint()+this.pos;else if(i===e.Fixed32)this.pos+=4;else{if(i!==e.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),y(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),y(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),y(this.buf,-1&t,this.pos),y(this.buf,Math.floor(t*r),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),y(this.buf,-1&t,this.pos),y(this.buf,Math.floor(t*r),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var r,n,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):n=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(t[i++]=239,t[i++]=191,t[i++]=189,n=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&s(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),t.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),t.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&s(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,i,r){this.writeTag(t,e.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,u,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,g,e)},writeBytesField:function(t,i){this.writeTag(t,e.Bytes),this.writeBytes(i)},writeFixed32Field:function(t,i){this.writeTag(t,e.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(t,i){this.writeTag(t,e.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(t,i){this.writeTag(t,e.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(t,i){this.writeTag(t,e.Fixed64),this.writeSFixed64(i)},writeVarintField:function(t,i){this.writeTag(t,e.Varint),this.writeVarint(i)},writeSVarintField:function(t,i){this.writeTag(t,e.Varint),this.writeSVarint(i)},writeStringField:function(t,i){this.writeTag(t,e.Bytes),this.writeString(i)},writeFloatField:function(t,i){this.writeTag(t,e.Fixed32),this.writeFloat(i)},writeDoubleField:function(t,i){this.writeTag(t,e.Fixed64),this.writeDouble(i)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}},kc}var Oc=i(Fc());const jc=3;function Vc(t,e,i){1===t&&i.readMessage(Nc,e)}function Nc(t,e,i){if(3===t){const{id:t,bitmap:r,width:n,height:o,left:a,top:s,advance:l}=i.readMessage(qc,{});e.push({id:t,bitmap:new Os({width:n+2*jc,height:o+2*jc},r),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function qc(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}const Zc=jc;function Uc(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,o=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,o=Math.max(o,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}const Gc=1;class $c{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+Gc,this.paddedRect.y+Gc]}get br(){return[this.paddedRect.x+this.paddedRect.w-Gc,this.paddedRect.y+this.paddedRect.h-Gc]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Gc)/this.pixelRatio,(this.paddedRect.h-2*Gc)/this.pixelRatio]}}class Hc{constructor(t,e){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,i,n),this.addImages(e,r,n);const{w:o,h:a}=Uc(n),s=new js({width:o||1,height:a||1});for(const e in t){const r=t[e],n=i[e].paddedRect;js.copy(r.data,s,{x:0,y:0},{x:n.x+Gc,y:n.y+Gc},r.data)}for(const t in e){const i=e[t],n=r[t].paddedRect,o=n.x+Gc,a=n.y+Gc,l=i.data.width,c=i.data.height;js.copy(i.data,s,{x:0,y:0},{x:o,y:a},i.data),js.copy(i.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),js.copy(i.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),js.copy(i.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),js.copy(i.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(const r in t){const n=t[r],o={x:0,y:0,w:n.data.width+2*Gc,h:n.data.height+2*Gc};i.push(o),e[r]=new $c(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}var Xc;Zn("ImagePosition",$c),Zn("ImageAtlas",Hc),t.ai=void 0,(Xc=t.ai||(t.ai={}))[Xc.none=0]="none",Xc[Xc.horizontal=1]="horizontal",Xc[Xc.vertical=2]="vertical",Xc[Xc.horizontalOnly=3]="horizontalOnly";const Wc=-17;class Kc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,e,i){const r=new Kc;return r.scale=t||1,r.fontStack=e,r.verticalAlign=i||"bottom",r}static forImage(t,e){const i=new Kc;return i.imageName=t,i.verticalAlign=e||"bottom",i}}class Yc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new Yc;for(let r=0;r<t.sections.length;r++){const n=t.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const r=t.charCodeAt(i+1)||null,n=t.charCodeAt(i-1)||null;e+=r&&no(r)&&!zc[t[i+1]]||n&&no(n)&&!zc[t[i-1]]||!zc[t[i]]?t[i]:zc[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&Qc[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&Qc[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new Yc;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}getMaxImageSize(t){let e=0,i=0;for(let r=0;r<this.length();r++){const n=this.getSection(r);if(n.imageName){const r=t[n.imageName];if(!r)continue;const o=r.displaySize;e=Math.max(e,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:e,maxImageHeight:i}}addTextSection(t,e){this.text+=t.text,this.sections.push(Kc.forText(t.scale,t.fontStack||e,t.verticalAlign));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void N("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(Kc.forImage(e,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):N("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Jc(e,i,r,n,o,a,s,l,c,h,u,p,d,f,m){const g=Yc.fromFeature(e,o);let _;p===t.ai.vertical&&g.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:v}=co;if(y&&1===g.sections.length){_=[];const t=y(g.toString(),sh(g,h,a,i,n,f));for(const e of t){const t=new Yc;t.text=e,t.sections=g.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);_.push(t)}}else if(v){_=[];const t=v(g.text,g.sectionIndex,sh(g,h,a,i,n,f));for(const e of t){const t=new Yc;t.text=e[0],t.sectionIndex=e[1],t.sections=g.sections,_.push(t)}}else _=function(t,e){const i=[],r=t.text;let n=0;for(const r of e)i.push(t.substring(n,r)),n=r;return n<r.length&&i.push(t.substring(n,r.length)),i}(g,sh(g,h,a,i,n,f));const x=[],b={positionedLines:x,text:g.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,i,r,n,o,a,s,l,c,h,u){let p=0,d=0,f=0,m=0;const g="right"===s?1:"left"===s?0:.5,_=Rc/u;let y=0;for(const a of n){a.trim();const n=a.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};t.positionedLines[y]=s;const u=s.positionedGlyphs;let v=0;if(!a.length()){d+=o,++y;continue}const x=ch(r,a,_);for(let o=0;o<a.length();o++){const s=a.getSection(o),f=a.getSectionIndex(o),m=a.getCharCode(o),g=uh(l,h,m);let y;if(s.imageName){if(t.iconsInText=!0,s.scale=s.scale*_,y=dh(s,g,n,x,r),!y)continue;v=Math.max(v,y.imageOffset)}else if(y=ph(s,m,g,x,e,i),!y)continue;const{rect:b,metrics:w,baselineOffset:T}=y;u.push({glyph:m,imageName:s.imageName,x:p,y:d+T+Wc,vertical:g,scale:s.scale,fontStack:s.fontStack,sectionIndex:f,metrics:w,rect:b}),g?(t.verticalizable=!0,p+=(s.imageName?w.advance:Rc)*s.scale+c):p+=w.advance*s.scale+c}0!==u.length&&(f=Math.max(p-c,f),fh(u,0,u.length-1,g)),p=0,s.lineOffset=Math.max(v,(n-1)*Rc);const b=o*n+v;d+=b,m=Math.max(b,m),++y}const{horizontalAlign:v,verticalAlign:x}=lh(a);(function(t,e,i,r,n,o,a,s,l){const c=(e-i)*n;let h=0;h=o!==a?-s*r-Wc:-r*l*a+.5*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=h})(t.positionedLines,g,v,x,f,m,o,d,n.length),t.top+=-x*d,t.bottom=t.top+d,t.left+=-v*f,t.right=t.left+f}(b,i,r,n,_,s,l,c,p,h,d,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(x)&&b}const Qc={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},th={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},eh={40:!0};function ih(t,e,i,r,n,o){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*Rc/o+n:0}{const r=i[e.fontStack],o=r&&r[t];return o?o.metrics.advance*e.scale+n:0}}function rh(t,e,i,r){const n=Math.pow(t-e,2);return r?t<e?n/2:2*n:n+Math.abs(i)*i}function nh(t,e,i){let r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function oh(t,e,i,r,n,o){let a=null,s=rh(e,i,n,o);for(const t of r){const r=rh(e-t.x,i,n,o)+t.badness;r<=s&&(a=t,s=r)}return{index:t,x:e,priorBreak:a,badness:s}}function ah(t){return t?ah(t.priorBreak).concat(t.index):[]}function sh(t,e,i,r,n,o){if(!t)return[];const a=[],s=function(t,e,i,r,n,o){let a=0;for(let i=0;i<t.length();i++){const s=t.getSection(i);a+=ih(t.getCharCode(i),s,r,n,e,o)}return a/Math.max(1,Math.ceil(a/i))}(t,e,i,r,n,o),l=t.text.indexOf("")>=0;let c=0;for(let i=0;i<t.length();i++){const u=t.getSection(i),p=t.getCharCode(i);if(Qc[p]||(c+=ih(p,u,r,n,e,o)),i<t.length()-1){const e=!((h=p)<11904)&&(!!Kn["CJK Compatibility Forms"](h)||!!Kn["CJK Compatibility"](h)||!!Kn["CJK Strokes"](h)||!!Kn["CJK Symbols and Punctuation"](h)||!!Kn["Enclosed CJK Letters and Months"](h)||!!Kn["Halfwidth and Fullwidth Forms"](h)||!!Kn["Ideographic Description Characters"](h)||!!Kn["Vertical Forms"](h)||io.test(String.fromCodePoint(h)));(th[p]||e||u.imageName||i!==t.length()-2&&eh[t.getCharCode(i+1)])&&a.push(oh(i+1,c,s,a,nh(p,t.getCharCode(i+1),e&&l),!1))}}var h;return ah(oh(t.length(),c,s,a,0,!0))}function lh(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function ch(t,e,i){const r=e.getMaxScale()*Rc,{maxImageWidth:n,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(r,o*i);return{verticalLineContentWidth:Math.max(r,n*i),horizontalLineContentHeight:a}}function hh(t){switch(t){case"top":return 0;case"center":return.5;default:return 1}}function uh(e,i,r){return!(e===t.ai.horizontal||!i&&!ro(r)||i&&(Qc[r]||(n=r,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function ph(t,e,i,r,n,o){const a=o[t.fontStack],s=function(t,e,i,r){if(t&&t.rect)return t;const n=e[i.fontStack],o=n&&n[r];return o?{rect:null,metrics:o.metrics}:null}(a&&a[e],n,t,e);if(null===s)return null;let l;if(i)l=r.verticalLineContentWidth-t.scale*Rc;else{const e=hh(t.verticalAlign);l=(r.horizontalLineContentHeight-t.scale*Rc)*e}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function dh(t,e,i,r,n){const o=n[t.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:Gc,top:-3,advance:e?s[1]:s[0]};let c;if(e)c=r.verticalLineContentWidth-s[1]*t.scale;else{const e=hh(t.verticalAlign);c=(r.horizontalLineContentHeight-s[1]*t.scale)*e}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(e?s[0]:s[1])*t.scale-Rc*i}}function fh(t,e,i,r){if(0===r)return;const n=t[i],o=(t[i].x+n.metrics.advance*n.scale)*r;for(let r=e;r<=i;r++)t[r].x-=o}function mh(t,e,i){const{horizontalAlign:r,verticalAlign:n}=lh(i),o=e[0]-t.displaySize[0]*r,a=e[1]-t.displaySize[1]*n;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function gh(t){var e,i;let r=t.left,n=t.top,o=t.right-r,a=t.bottom-n;const s=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(i=t.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",c=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const t=Math.ceil(a*c);r*=t/o,o=t}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const t=Math.ceil(o/c);n*=t/a,a=t}return{x1:r,y1:n,x2:r+o,y2:n+a}}function _h(t,e,i,r,n,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let h,u,p,d;"width"===i||"both"===i?(d=n[0]+l-r[3],u=n[0]+c+r[1]):(d=n[0]+(l+c-a.displaySize[0])/2,u=d+a.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===i||"both"===i?(h=n[1]+f-r[0],p=n[1]+m+r[2]):(h=n[1]+(f+m-a.displaySize[1])/2,p=h+a.displaySize[1]),{image:a,top:h,right:u,bottom:p,left:d,collisionPadding:s}}const yh=255,vh=128,xh=yh*vh;function bh(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new ho(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=i;let n=0;for(;n<e.length&&e[n]<=t;)n++;n=Math.max(0,n-1);let o=n;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[n],s=e[o];return"composite"===i.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:r}:{kind:"camera",minZoom:a,maxZoom:s,minSize:i.evaluate(new ho(a)),maxSize:i.evaluate(new ho(s)),interpolationType:r}}}function wh(t,e,i){let r="never";const n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}const Th=Kl.VectorTileFeature.types,Ch=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ph(t,e,i,r,n,o,a,s,l,c,h,u,p){const d=s?Math.min(xh,Math.round(s[0])):0,f=s?Math.min(xh,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),o,a,(d<<1)+(l?1:0),f,16*c,16*h,256*u,256*p)}function Mh(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Sh(t){for(const e of t.sections)if(lo(e.text))return!0;return!1}class Ih{constructor(t){this.layoutVertexArray=new ba,this.indexArray=new Ma,this.programConfigurations=t,this.segments=new za,this.dynamicLayoutVertexArray=new wa,this.opacityVertexArray=new Ta,this.hasVisibleVertices=!1,this.placedSymbolArray=new oa}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Cc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Pc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Ch,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Zn("SymbolBuffers",Ih);class Eh{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new za,this.collisionVertexArray=new Pa}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Mc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Zn("CollisionBuffers",Eh);class zh{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=bh(this.zoom,i["text-size"]),this.iconSizeData=bh(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==wh(r,"text-overlap","text-allow-overlap")||"never"!==wh(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>t.ai[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Ih(new rs(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Ih(new rs(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new la,this.lineVertexArray=new ca,this.symbolInstances=new sa,this.textAnchorOffsets=new ua}calculateGlyphDependencies(t,e,i,r,n){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||r)&&n){const i=zc[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,r){const n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof ve&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=o.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const p=i.iconDependencies,d=i.glyphDependencies,f=i.availableImages,m=new ho(this.zoom);for(const{feature:i,id:s,index:l,sourceLayerIndex:g}of e){const e=n._featureFilter.needGeometry,_=cs(i,e);if(!n._featureFilter.filter(m,_,r))continue;let y,v;if(e||(_.geometry=ls(i)),c){const t=n.getValueAndResolveTokens("text-field",_,r,f),e=ve.factory(t),i=this.hasRTLText=this.hasRTLText||Sh(e);(!i||"unavailable"===co.getRTLTextPluginStatus()||i&&co.isParsed())&&(y=Ec(e,n,_))}if(h){const t=n.getValueAndResolveTokens("icon-image",_,r,f);v=t instanceof Ce?t:Ce.fromString(t)}if(!y&&!v)continue;const x=this.sortFeaturesByKey?u.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:y,icon:v,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:i.properties,type:Th[i.type],sortKey:x}),v&&(p[v.name]=!0),y){const e=a.evaluate(_,{},r).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ai.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const r=Yn(y.toString()),n=t.fontStack||e,o=d[n]=d[n]||{};this.calculateGlyphDependencies(t.text,o,i,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let n=0;function o(e){r.push(t[e]),n++}function a(t,e,n){const o=i[t];return delete i[t],i[e]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function s(t,i,n){const o=e[i];return delete e[i],e[t]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){o(c);continue}const d=l(p,u),f=l(p,u,!0);if(d in i&&f in e&&i[d]!==e[f]){const t=s(d,f,u),n=a(d,f,r[t].geometry);delete e[d],delete i[f],i[l(p,r[n].geometry,!0)]=n,r[t].geometry=null}else d in i?a(d,f,u):f in e?s(d,f,u):(o(c),e[d]=n-1,i[f]=n-1)}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const n={};for(let r=t.segment+1;r<e.length;r++)n[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r<e.length-1&&(i+=e[r+1].dist(e[r]));for(let i=t.segment||0;i>=0;i--)n[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=n[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,r,n,o,a,s,l,c,h,u,p){const d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*i.length,f,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===t.ai.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let t=0;t<i.length;t++){const{tl:n,tr:o,bl:s,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:T}=i[t],C=m.vertexLength,P=b[1];Ph(f,l.x,l.y,n.x,P+n.y,h.x,h.y,r,w,u.x,u.y,_,x),Ph(f,l.x,l.y,o.x,P+o.y,h.x+h.w,h.y,r,w,g.x,u.y,_,x),Ph(f,l.x,l.y,s.x,P+s.y,h.x,h.y+h.h,r,w,u.x,g.y,_,x),Ph(f,l.x,l.y,c.x,P+c.y,h.x+h.w,h.y+h.h,r,w,g.x,g.y,_,x),Mh(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(C,C+2,C+1),d.emplaceBack(C+1,C+2,C+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&T===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,a,a.index,{},p,v&&v[T])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,h,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],s,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,n,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,r,n,o,a){const s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=s.vertexLength,h=n.layoutVertexArray,u=n.collisionVertexArray,p=a.anchorX,d=a.anchorY;this._addCollisionDebugVertex(h,u,o,p,d,new l(t,e)),this._addCollisionDebugVertex(h,u,o,p,d,new l(i,e)),this._addCollisionDebugVertex(h,u,o,p,d,new l(i,r)),this._addCollisionDebugVertex(h,u,o,p,d,new l(t,r)),s.vertexLength+=4;const f=n.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),s.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){const t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Eh(Ca,Sc.members,Sa),this.iconCollisionBox=new Eh(Ca,Sc.members,Sa);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,o,a,s,l){const c={};for(let r=e;r<i;r++){const e=t.get(r);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=r;e<n;e++){const i=t.get(e);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let e=o;e<a;e++){const i=t.get(e);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let e=s;e<l;e++){const i=t.get(e);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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(t,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+2,e+1),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),r=[],n=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const a=this.symbolInstances.get(t);r.push(0|Math.round(e*a.anchorX+i*a.anchorY)),n.push(a.featureIndex)}return o.sort(((t,e)=>r[t]-r[e]||n[e]-n[t])),o}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ah,kh;Zn("SymbolBucket",zh,{omit:["layers","collisionBoxArray","features","compareText"]}),zh.MAX_GLYPHS=65535,zh.addDynamicAttributes=Mh;var Dh={get paint(){return kh=kh||new Po({"icon-opacity":new bo(ut.paint_symbol["icon-opacity"]),"icon-color":new bo(ut.paint_symbol["icon-color"]),"icon-halo-color":new bo(ut.paint_symbol["icon-halo-color"]),"icon-halo-width":new bo(ut.paint_symbol["icon-halo-width"]),"icon-halo-blur":new bo(ut.paint_symbol["icon-halo-blur"]),"icon-translate":new xo(ut.paint_symbol["icon-translate"]),"icon-translate-anchor":new xo(ut.paint_symbol["icon-translate-anchor"]),"text-opacity":new bo(ut.paint_symbol["text-opacity"]),"text-color":new bo(ut.paint_symbol["text-color"],{runtimeType:At,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new bo(ut.paint_symbol["text-halo-color"]),"text-halo-width":new bo(ut.paint_symbol["text-halo-width"]),"text-halo-blur":new bo(ut.paint_symbol["text-halo-blur"]),"text-translate":new xo(ut.paint_symbol["text-translate"]),"text-translate-anchor":new xo(ut.paint_symbol["text-translate-anchor"])})},get layout(){return Ah=Ah||new Po({"symbol-placement":new xo(ut.layout_symbol["symbol-placement"]),"symbol-spacing":new xo(ut.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new xo(ut.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new bo(ut.layout_symbol["symbol-sort-key"]),"symbol-z-order":new xo(ut.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new xo(ut.layout_symbol["icon-allow-overlap"]),"icon-overlap":new xo(ut.layout_symbol["icon-overlap"]),"icon-ignore-placement":new xo(ut.layout_symbol["icon-ignore-placement"]),"icon-optional":new xo(ut.layout_symbol["icon-optional"]),"icon-rotation-alignment":new xo(ut.layout_symbol["icon-rotation-alignment"]),"icon-size":new bo(ut.layout_symbol["icon-size"]),"icon-text-fit":new xo(ut.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new xo(ut.layout_symbol["icon-text-fit-padding"]),"icon-image":new bo(ut.layout_symbol["icon-image"]),"icon-rotate":new bo(ut.layout_symbol["icon-rotate"]),"icon-padding":new bo(ut.layout_symbol["icon-padding"]),"icon-keep-upright":new xo(ut.layout_symbol["icon-keep-upright"]),"icon-offset":new bo(ut.layout_symbol["icon-offset"]),"icon-anchor":new bo(ut.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new xo(ut.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new xo(ut.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new xo(ut.layout_symbol["text-rotation-alignment"]),"text-field":new bo(ut.layout_symbol["text-field"]),"text-font":new bo(ut.layout_symbol["text-font"]),"text-size":new bo(ut.layout_symbol["text-size"]),"text-max-width":new bo(ut.layout_symbol["text-max-width"]),"text-line-height":new xo(ut.layout_symbol["text-line-height"]),"text-letter-spacing":new bo(ut.layout_symbol["text-letter-spacing"]),"text-justify":new bo(ut.layout_symbol["text-justify"]),"text-radial-offset":new bo(ut.layout_symbol["text-radial-offset"]),"text-variable-anchor":new xo(ut.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new bo(ut.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new bo(ut.layout_symbol["text-anchor"]),"text-max-angle":new xo(ut.layout_symbol["text-max-angle"]),"text-writing-mode":new xo(ut.layout_symbol["text-writing-mode"]),"text-rotate":new bo(ut.layout_symbol["text-rotate"]),"text-padding":new xo(ut.layout_symbol["text-padding"]),"text-keep-upright":new xo(ut.layout_symbol["text-keep-upright"]),"text-transform":new bo(ut.layout_symbol["text-transform"]),"text-offset":new bo(ut.layout_symbol["text-offset"]),"text-allow-overlap":new xo(ut.layout_symbol["text-allow-overlap"]),"text-overlap":new xo(ut.layout_symbol["text-overlap"]),"text-ignore-placement":new xo(ut.layout_symbol["text-ignore-placement"]),"text-optional":new xo(ut.layout_symbol["text-optional"])})}};class Rh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:St,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Zn("FormatSectionOverride",Rh,{omit:["defaultValue"]});class Lh extends So{constructor(t){super(t,Dh)}recalculate(t,e){if(super.recalculate(t,e),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){const n=this.layout.get(t).evaluate(e,{},i,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Vr(o.value)||!n?n:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>t&&i in t?String(t[i]):""))}(e.properties,n)}createBucket(t){return new zh(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Dh.paint.overridableProperties){if(!Lh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Rh(e),r=new jr(i,e.property.specification);let n=null;n="constant"===e.value.kind||"source"===e.value.kind?new qr("source",r):new Zr("composite",r,e.value.zoomStops),this.paint._values[t]=new yo(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Lh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=Dh.paint.properties[e];let n=!1;const o=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof ve)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{n||(e instanceof ze&&Ie(e.value)===Bt?o(e.value.sections):e instanceof fi?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return n}}let Bh;var Fh={get paint(){return Bh=Bh||new Po({"background-color":new xo(ut.paint_background["background-color"]),"background-pattern":new To(ut.paint_background["background-pattern"]),"background-opacity":new xo(ut.paint_background["background-opacity"])})}};class Oh extends So{constructor(t){super(t,Fh)}}let jh;var Vh={get paint(){return jh=jh||new Po({"raster-opacity":new xo(ut.paint_raster["raster-opacity"]),"raster-hue-rotate":new xo(ut.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new xo(ut.paint_raster["raster-brightness-min"]),"raster-brightness-max":new xo(ut.paint_raster["raster-brightness-max"]),"raster-saturation":new xo(ut.paint_raster["raster-saturation"]),"raster-contrast":new xo(ut.paint_raster["raster-contrast"]),"raster-resampling":new xo(ut.paint_raster["raster-resampling"]),"raster-fade-duration":new xo(ut.paint_raster["raster-fade-duration"])})}};class Nh extends So{constructor(t){super(t,Vh)}}class qh extends So{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Zh{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(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=()=>{}}}const Uh=6371008.8;class Gh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Gh(R(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Uh*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof Gh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Gh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Gh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const $h=2*Math.PI*Uh;function Hh(t){return $h*Math.cos(t*Math.PI/180)}function Xh(t){return(180+t)/360}function Wh(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Kh(t,e){return t/Hh(e)}function Yh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Jh(t,e){return t*Hh(Yh(e))}class Qh{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Gh.convert(t);return new Qh(Xh(i.lng),Wh(i.lat),Kh(e,i.lat))}toLngLat(){return new Gh(360*this.x-180,Yh(this.y))}toAltitude(){return Jh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/$h*(t=Yh(this.y),1/Math.cos(t*Math.PI/180));var t}}function tu(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class eu{constructor(t,e,i){if(!function(t,e,i){return!(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,i))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=nu(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const r=(o=this.y,a=this.z,s=tu(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=tu(256*(n+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,o,a,s,l;const c=function(t,e,i){let r,n="";for(let o=t;o>0;o--)r=1<<o-1,n+=(e&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return t[(this.x+this.y)%t.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("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new l((t.x*e-this.x)*M,(t.y*e-this.y)*M)}toString(){return`${this.z}/${this.x}/${this.y}`}}class iu{constructor(t,e){this.wrap=t,this.canonical=e,this.key=nu(t,e.z,e.z,e.x,e.y)}}class ru{constructor(t,e,i,r,n){if(this.terrainRttPosMatrix32f=null,t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new eu(i,+r,+n),this.key=nu(e,t,i,r,n)}clone(){return new ru(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new ru(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ru(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?nu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):nu(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new ru(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new ru(e,this.wrap,e,i,r),new ru(e,this.wrap,e,i+1,r),new ru(e,this.wrap,e,i,r+1),new ru(e,this.wrap,e,i+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new ru(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ru(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new iu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Qh(t.x-this.wrap,t.y))}}function nu(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);const o=1<<i;return(o*o*t+o*n+r).toString(36)+i.toString(36)+e.toString(36)}Zn("CanonicalTileID",eu),Zn("OverscaledTileID",ru,{omit:["terrainRttPosMatrix32f"]});class ou{constructor(t,e,i,r=1,n=1,o=1,a=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void N(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const s=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<s;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(s,t)]=this.data[this._idx(s-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,s)]=this.data[this._idx(t,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<s;t++)for(let e=0;e<s;e++){const i=this.get(t,e);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(t,e){const i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new js({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-i*this.dim;for(let e=o;e<a;e++)for(let i=r;i<n;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+s,e+l)]}}Zn("DEMData",ou);class au{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class su{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class lu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Nn(M,16,0),this.grid3D=new Nn(M,16,0),this.featureIndexArray=new da,this.promoteId=e}insert(t,e,i,r,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const s=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];r[0]=Math.min(r[0],e.x),r[1]=Math.min(r[1],e.y),r[2]=Math.max(r[2],e.x),r[3]=Math.max(r[3],e.y)}r[0]<M&&r[1]<M&&r[2]>=0&&r[3]>=0&&s.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Kl.VectorTile(new Oc(this.rawTileData)).layers,this.sourceLayerCoder=new au(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();const n=t.params,o=M/t.tileSize/t.scale,a=Wr(n.filter),s=t.queryGeometry,c=t.queryPadding*o,h=hu(s),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),p=hu(t.cameraQueryGeometry),d=this.grid3D.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c,((e,i,r,n)=>function(t,e,i,r,n){for(const o of t)if(e<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new l(e,i),new l(e,n),new l(r,n),new l(r,i)];if(t.length>2)for(const e of o)if(ws(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Ts(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,r+c,n+c)));for(const t of d)u.push(t);u.sort(uu);const f={};let m;for(let l=0;l<u.length;l++){const c=u[l];if(c===m)continue;m=c;const h=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(f,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,n.layers,n.availableImages,e,i,r,((e,i,r)=>(p||(p=ls(e)),i.queryIntersectsFeature({queryGeometry:s,feature:e,featureState:r,geometry:p,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix}))))}return f}loadMatchingFeature(t,e,i,r,n,o,a,s,l,c,h){const u=this.bucketLayerIDs[e];if(o&&!u.some((t=>o.has(t))))return;const p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){const t=cs(d,!0);if(!n.filter(new ho(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new ho(this.tileID.overscaledZ),d))return;const f=this.getId(d,p);for(let e=0;e<u.length;e++){const i=u[e];if(o&&!o.has(i))continue;const n=s[i];if(!n)continue;let p={};f&&c&&(p=c.getState(n.sourceLayer||"_geojsonTileLayer",f));const m=L({},l[i]);m.paint=cu(m.paint,n.paint,d,p,a),m.layout=cu(m.layout,n.layout,d,p,a);const g=!h||h(d,n,p);if(!g)continue;const _=new su(d,this.z,this.x,this.y,f);_.layer=m;let y=t[i];void 0===y&&(y=t[i]=[]),y.push({featureIndex:r,feature:_,intersectionZ:g})}}lookupSymbolFeatures(t,e,i,r,n,o,a,s){const l={};this.loadVTLayers();const c=Wr(n);for(const n of t)this.loadMatchingFeature(l,i,r,n,c,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){var i;let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r)),void 0===r&&(null===(i=t.properties)||void 0===i?void 0:i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))),r}}function cu(t,e,i,r,n){return F(t,((t,o)=>{const a=e instanceof vo?e.get(o):null;return a&&a.evaluate?a.evaluate(i,r,n):a}))}function hu(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{minX:e,minY:i,maxX:r,maxY:n}}function uu(t,e){return e-t}function pu(t,e,i,r,n){const o=[];for(let a=0;a<t.length;a++){const s=t[a];let c;for(let t=0;t<s.length-1;t++){let a=s[t],h=s[t+1];a.x<e&&h.x<e||(a.x<e?a=new l(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x<e&&(h=new l(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y<i&&h.y<i||(a.y<i?a=new l(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round():h.y<i&&(h=new l(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round()),a.x>=r&&h.x>=r||(a.x>=r?a=new l(r,a.y+(r-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x>=r&&(h=new l(r,a.y+(r-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y>=n&&h.y>=n||(a.y>=n?a=new l(a.x+(n-a.y)/(h.y-a.y)*(h.x-a.x),n)._round():h.y>=n&&(h=new l(a.x+(n-a.y)/(h.y-a.y)*(h.x-a.x),n)._round()),c&&a.equals(c[c.length-1])||(c=[a],o.push(c)),c.push(h)))))}}return o}Zn("FeatureIndex",lu,{omit:["rawTileData","sourceLayerCoder"]});class du extends l{constructor(t,e,i,r){super(t,e),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new du(this.x,this.y,this.angle,this.segment)}}function fu(t,e,i,r,n){if(void 0===e.segment||0===i)return!0;let o=e,a=e.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let c=0;for(;s<i/2;){const e=t[a],i=t[a+1];if(!i)return!1;let o=t[a-1].angleTo(e)-e.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=e.dist(i)}return!0}function mu(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function gu(t,e,i){return t?.6*e*i:0}function _u(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function yu(t,e,i,r,n,o){const a=gu(i,n,o),s=_u(i,r)*o;let l=0;const c=mu(t)/2;for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1],o=r.dist(n);if(l+o>c){const h=(c-l)/o,u=ei.number(r.x,n.x,h),p=ei.number(r.y,n.y,h),d=new du(u,p,n.angleTo(r),i);return d._round(),!a||fu(t,d,s,a,e)?d:void 0}l+=o}}function vu(t,e,i,r,n,o,a,s,l){const c=gu(r,o,a),h=_u(r,n),u=h*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),xu(t,p?e/2*s%e:(h/2+2*o)*a*s%e,e,c,i,u,p,!1,l)}function xu(t,e,i,r,n,o,a,s,l){const c=o/2,h=mu(t);let u=0,p=e-i,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],s=t[e+1],f=a.dist(s),m=s.angleTo(a);for(;p+i<u+f;){p+=i;const g=(p-u)/f,_=ei.number(a.x,s.x,g),y=ei.number(a.y,s.y,g);if(_>=0&&_<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const i=new du(_,y,m,e);i._round(),r&&!fu(t,i,o,r,n)||d.push(i)}}u+=f}return s||d.length||a||(d=xu(t,u/2,i,r,n,o,a,!0,l)),d}Zn("Anchor",du);const bu=Gc;function wu(t,e,i,r){const n=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*bu,c=o.paddedRect.h-2*bu;let h={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const u=o.stretchX||[[0,s]],p=o.stretchY||[[0,c]],d=(t,e)=>t+e[1]-e[0],f=u.reduce(d,0),m=p.reduce(d,0),g=s-f,_=c-m;let y=0,v=f,x=0,b=m,w=0,T=g,C=0,P=_;if(o.content&&r){const e=o.content,i=e[2]-e[0],r=e[3]-e[1];(o.textFitWidth||o.textFitHeight)&&(h=gh(t)),y=Tu(u,0,e[0]),x=Tu(p,0,e[1]),v=Tu(u,e[0],e[2]),b=Tu(p,e[1],e[3]),w=e[0]-y,C=e[1]-x,T=i-v,P=r-b}const M=h.x1,S=h.y1,I=h.x2-M,E=h.y2-S,z=(t,r,n,s)=>{const c=Pu(t.stretch-y,v,I,M),h=Mu(t.fixed-w,T,t.stretch,f),u=Pu(r.stretch-x,b,E,S),p=Mu(r.fixed-C,P,r.stretch,m),d=Pu(n.stretch-y,v,I,M),g=Mu(n.fixed-w,T,n.stretch,f),_=Pu(s.stretch-x,b,E,S),z=Mu(s.fixed-C,P,s.stretch,m),A=new l(c,u),k=new l(d,u),D=new l(d,_),R=new l(c,_),L=new l(h/a,p/a),B=new l(g/a,z/a),F=e*Math.PI/180;if(F){const t=Math.sin(F),e=Math.cos(F),i=[e,-t,t,e];A._matMult(i),k._matMult(i),R._matMult(i),D._matMult(i)}const O=t.stretch+t.fixed,j=r.stretch+r.fixed;return{tl:A,tr:k,bl:R,br:D,tex:{x:o.paddedRect.x+bu+O,y:o.paddedRect.y+bu+j,w:n.stretch+n.fixed-O,h:s.stretch+s.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:B,minFontScaleX:T/a/I,minFontScaleY:P/a/E,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const t=Cu(u,g,f),e=Cu(p,_,m);for(let i=0;i<t.length-1;i++){const r=t[i],o=t[i+1];for(let t=0;t<e.length-1;t++)n.push(z(r,e[t],o,e[t+1]))}}else n.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:c+1}));return n}function Tu(t,e,i){let r=0;for(const n of t)r+=Math.max(e,Math.min(i,n[1]))-Math.max(e,Math.min(i,n[0]));return r}function Cu(t,e,i){const r=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return r.push({fixed:e+bu,stretch:i}),r}function Pu(t,e,i,r){return t/e*i+r}function Mu(t,e,i,r){return t-e*i/r}class Su{constructor(t,e,i,r,n,o,a,s,c,h){var u;if(this.boxStartIndex=t.length,c){let t=o.top,e=o.bottom;const i=o.collisionPadding;i&&(t-=i[1],e+=i[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(u=o.image)||void 0===u?void 0:u.content)&&(o.image.textFitWidth||o.image.textFitHeight)?gh(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*a-s[0],c.y2=c.y2*a+s[2],c.x1=c.x1*a-s[3],c.x2=c.x2*a+s[1];const p=o.collisionPadding;if(p&&(c.x1-=p[0]*a,c.y1-=p[1]*a,c.x2+=p[2]*a,c.y2+=p[3]*a),h){const t=new l(c.x1,c.y1),e=new l(c.x2,c.y1),i=new l(c.x1,c.y2),r=new l(c.x2,c.y2),n=h*Math.PI/180;t._rotate(n),e._rotate(n),i._rotate(n),r._rotate(n),c.x1=Math.min(t.x,e.x,i.x,r.x),c.x2=Math.max(t.x,e.x,i.x,r.x),c.y1=Math.min(t.y,e.y,i.y,r.y),c.y2=Math.max(t.y,e.y,i.y,r.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,i,r,n)}this.boxEndIndex=t.length}}class Iu{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let r=1+(t<<1);const o=r+1;if(o<this.length&&i(e[o],e[r])<0&&(r=o),i(e[r],n)>=0)break;e[t]=e[r],t=r}e[t]=n}}function Eu(t,e=1,i=!1){let r=1/0,n=1/0,o=-1/0,a=-1/0;const s=t[0];for(let t=0;t<s.length;t++){const e=s[t];(!t||e.x<r)&&(r=e.x),(!t||e.y<n)&&(n=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const c=Math.min(o-r,a-n);let h=c/2;const u=new Iu([],zu);if(0===c)return new l(r,n);for(let e=r;e<o;e+=c)for(let i=n;i<a;i+=c)u.push(new Au(e+h,i+h,h,t));let p=function(t){let e=0,i=0,r=0;const n=t[0];for(let t=0,o=n.length,a=o-1;t<o;a=t++){const o=n[t],s=n[a],l=o.x*s.y-s.x*o.y;i+=(o.x+s.x)*l,r+=(o.y+s.y)*l,e+=3*l}return new Au(i/e,r/e,0,t)}(t),d=u.length;for(;u.length;){const r=u.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(h=r.h/2,u.push(new Au(r.p.x-h,r.p.y-h,h,t)),u.push(new Au(r.p.x+h,r.p.y-h,h,t)),u.push(new Au(r.p.x-h,r.p.y+h,h,t)),u.push(new Au(r.p.x+h,r.p.y+h,h,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function zu(t,e){return e.max-t.max}function Au(t,e,i,r){this.p=new l(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let n=0;n<e.length;n++){const o=e[n];for(let e=0,n=o.length,a=n-1;e<n;a=e++){const n=o[e],s=o[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(i=!i),r=Math.min(r,xs(t,n,s))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var ku;t.av=void 0,(ku=t.av||(t.av={}))[ku.center=1]="center",ku[ku.left=2]="left",ku[ku.right=3]="right",ku[ku.top=4]="top",ku[ku.bottom=5]="bottom",ku[ku["top-left"]=6]="top-left",ku[ku["top-right"]=7]="top-right",ku[ku["bottom-left"]=8]="bottom-left",ku[ku["bottom-right"]=9]="bottom-right";const Du=7,Ru=Number.POSITIVE_INFINITY;function Lu(t,e){return e[1]!==Ru?function(t,e,i){let r=0,n=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":n=i-Du;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Du}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,n]}(t,e[0],e[1]):function(t,e){let i=0,r=0;e<0&&(e=0);const n=e/Math.SQRT2;switch(t){case"top-right":case"top-left":r=n-Du;break;case"bottom-right":case"bottom-left":r=-n+Du;break;case"bottom":r=-e+Du;break;case"top":r=e-Du}switch(t){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function Bu(t,e,i){var r;const n=t.layout,o=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(e,{},i);if(o){const t=o.values,e=[];for(let i=0;i<t.length;i+=2){const r=e[i]=t[i],n=t[i+1].map((t=>t*Rc));r.startsWith("top")?n[1]-=Du:r.startsWith("bottom")&&(n[1]+=Du),e[i+1]=n}return new Te(e)}const a=n.get("text-variable-anchor");if(a){let r;r=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(e,{},i)*Rc,Ru]:n.get("text-offset").evaluate(e,{},i).map((t=>t*Rc));const o=[];for(const t of a)o.push(t,Lu(t,r));return new Te(o)}return null}function Fu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ou(e,i,r,n,o,a,s,l,c,h,u,p){let d=a.textMaxSize.evaluate(i,{});void 0===d&&(d=s);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(i,{},u),g=Vu(r.horizontal),_=s/24,y=e.tilePixelRatio*_,v=e.tilePixelRatio*d/24,x=e.tilePixelRatio*l,b=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,T=function(t,e,i,r=1){const n=t.get("icon-padding").evaluate(e,{},i),o=n&&n.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(f,i,u,e.tilePixelRatio),C=f.get("text-max-angle")/180*Math.PI,P="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),S="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),I=f.get("symbol-placement"),E=b/2,z=f.get("icon-text-fit");let A;n&&"none"!==z&&(e.allowVerticalPlacement&&r.vertical&&(A=_h(n,r.vertical,z,f.get("icon-text-fit-padding"),m,_)),g&&(n=_h(n,g,z,f.get("icon-text-fit-padding"),m,_)));const k=u?p.line.getGranularityForZoomLevel(u.z):1,D=(l,p)=>{p.x<0||p.x>=M||p.y<0||p.y>=M||function(e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,v,x,b,w,T,C,P){const M=e.addToLineVertexArray(i,r);let S,I,E,z,A=0,k=0,D=0,R=0,L=-1,B=-1;const F={};let O=Va("");if(e.allowVerticalPlacement&&n.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},C)+90;E=new Su(c,i,h,u,p,n.vertical,d,f,m,t),s&&(z=new Su(c,i,h,u,p,s,_,y,m,t))}if(o){const r=l.layout.get("icon-rotate").evaluate(b,{}),n="none"!==l.layout.get("icon-text-fit"),a=wu(o,r,T,n),d=s?wu(s,r,T,n):void 0;I=new Su(c,i,h,u,p,o,_,y,!1,r),A=4*a.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[vh*l.layout.get("icon-size").evaluate(b,{})],m[0]>xh&&N(`${e.layerIds[0]}: Value for "icon-size" is >= ${yh}. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[vh*w.compositeIconSizes[0].evaluate(b,{},C),vh*w.compositeIconSizes[1].evaluate(b,{},C)],(m[0]>xh||m[1]>xh)&&N(`${e.layerIds[0]}: Value for "icon-size" is >= ${yh}. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,m,x,v,b,t.ai.none,i,M.lineStartIndex,M.lineLength,-1,C),L=e.icon.placedSymbolArray.length-1,d&&(k=4*d.length,e.addSymbols(e.icon,d,m,x,v,b,t.ai.vertical,i,M.lineStartIndex,M.lineLength,-1,C),B=e.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const r of j){const o=n.horizontal[r];if(!S){O=Va(o.text);const t=l.layout.get("text-rotate").evaluate(b,{},C);S=new Su(c,i,h,u,p,o,d,f,m,t)}const s=1===o.positionedLines.length;if(D+=ju(e,i,o,a,l,m,b,g,M,n.vertical?t.ai.horizontal:t.ai.horizontalOnly,s?j:[r],F,L,w,C),s)break}n.vertical&&(R+=ju(e,i,n.vertical,a,l,m,b,g,M,t.ai.vertical,["vertical"],F,B,w,C));const V=S?S.boxStartIndex:e.collisionBoxArray.length,q=S?S.boxEndIndex:e.collisionBoxArray.length,Z=E?E.boxStartIndex:e.collisionBoxArray.length,U=E?E.boxEndIndex:e.collisionBoxArray.length,G=I?I.boxStartIndex:e.collisionBoxArray.length,$=I?I.boxEndIndex:e.collisionBoxArray.length,H=z?z.boxStartIndex:e.collisionBoxArray.length,X=z?z.boxEndIndex:e.collisionBoxArray.length;let W=-1;const K=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;W=K(S,W),W=K(E,W),W=K(I,W),W=K(z,W);const Y=W>-1?1:0;Y&&(W*=P/Rc),e.glyphOffsetArray.length>=zh.MAX_GLYPHS&&N("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const J=Bu(l,b,C),[Q,tt]=function(e,i){const r=e.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){const r=n[i+1];e.emplaceBack(t.av[n[i]],r[0],r[1])}return[r,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(i.x,i.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,L,B,O,V,q,Z,U,G,$,H,X,h,D,R,A,k,Y,0,d,W,Q,tt)}(e,p,l,r,n,o,A,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,y,[w,w,w,w],P,c,x,T,S,m,i,a,h,u,s)};if("line"===I)for(const t of pu(i.geometry,0,0,M,M)){const i=Sl(t,k),o=vu(i,b,C,r.vertical||g,n,24,v,e.overscaling,M);for(const t of o)g&&Nu(e,g.text,E,t)||D(i,t)}else if("line-center"===I){for(const t of i.geometry)if(t.length>1){const e=Sl(t,k),i=yu(e,C,r.vertical||g,n,24,v);i&&D(e,i)}}else if("Polygon"===i.type)for(const t of Vi(i.geometry,0)){const e=Eu(t,16);D(Sl(t[0],k,!0),new du(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry){const e=Sl(t,k);D(e,new du(e[0].x,e[0].y,0))}else if("Point"===i.type)for(const t of i.geometry)for(const e of t)D([e],new du(e.x,e.y,0))}function ju(t,e,i,r,n,o,a,s,c,h,u,p,d,f,m){const g=function(t,e,i,r,n,o,a,s){const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,h=[];for(const t of e.positionedLines)for(const r of t.positionedGlyphs){if(!r.rect)continue;const o=r.rect||{};let u=Zc+1,p=!0,d=1,f=0;const m=(n||s)&&r.vertical,g=r.metrics.advance*r.scale/2;if(s&&e.verticalizable&&(f=t.lineOffset/2-(r.imageName?-(Rc-r.metrics.width*r.scale)/2:(r.scale-1)*Rc)),r.imageName){const t=a[r.imageName];p=t.sdf,d=t.pixelRatio,u=Gc/d}const _=n?[r.x+g,r.y]:[0,0];let y=n?[0,0]:[r.x+g+i[0],r.y+i[1]-f],v=[0,0];m&&(v=y,y=[0,0]);const x=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-u)*r.scale-g+y[0],w=(-r.metrics.top-u)*r.scale+y[1],T=b+o.w/x*r.scale/d,C=w+o.h/x*r.scale/d,P=new l(b,w),M=new l(T,w),S=new l(b,C),I=new l(T,C);if(m){const t=new l(-g,g-Wc),e=-Math.PI/2,i=Rc/2-g,n=new l(5-Wc-i,-(r.imageName?i:0)),o=new l(...v);P._rotateAround(e,t)._add(n)._add(o),M._rotateAround(e,t)._add(n)._add(o),S._rotateAround(e,t)._add(n)._add(o),I._rotateAround(e,t)._add(n)._add(o)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];P._matMult(i),M._matMult(i),S._matMult(i),I._matMult(i)}const E=new l(0,0),z=new l(0,0);h.push({tl:P,tr:M,bl:S,br:I,tex:o,writingMode:e.writingMode,glyphOffset:_,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:E,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,s,n,o,a,r,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[vh*n.layout.get("text-size").evaluate(a,{})],y[0]>xh&&N(`${t.layerIds[0]}: Value for "text-size" is >= ${yh}. Reduce your "text-size".`)):"composite"===_.kind&&(y=[vh*f.compositeTextSizes[0].evaluate(a,{},m),vh*f.compositeTextSizes[1].evaluate(a,{},m)],(y[0]>xh||y[1]>xh)&&N(`${t.layerIds[0]}: Value for "text-size" is >= ${yh}. Reduce your "text-size".`)),t.addSymbols(t.text,g,y,s,o,a,h,e,c.lineStartIndex,c.lineLength,d,m);for(const e of u)p[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function Vu(t){for(const e in t)return t[e];return null}function Nu(t,e,i,r){const n=t.compareText;if(e in n){const t=n[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else n[e]=[];return n[e].push(r),!1}const qu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Zu{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=qu[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Zu(a,o,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=qu.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+s,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Uu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,h=s.pop()||0,u=s.pop()||0;if(h-u<=a){for(let a=u;a<=h;a++){const s=o[2*a],c=o[2*a+1];s>=t&&s<=i&&c>=e&&c<=r&&l.push(n[a])}continue}const p=u+h>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=i&&f>=e&&f<=r&&l.push(n[p]),(0===c?t<=d:e<=f)&&(s.push(u),s.push(p-1),s.push(1-c)),(0===c?i>=d:r>=f)&&(s.push(p+1),s.push(h),s.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,a=[0,r.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=o){for(let i=u;i<=h;i++)Xu(n[2*i],n[2*i+1],t,e)<=l&&s.push(r[i]);continue}const p=u+h>>1,d=n[2*p],f=n[2*p+1];Xu(d,f,t,e)<=l&&s.push(r[p]),(0===c?t-i<=d:e-i<=f)&&(a.push(u),a.push(p-1),a.push(1-c)),(0===c?t+i>=d:e+i>=f)&&(a.push(p+1),a.push(h),a.push(1-c))}return s}}function Uu(t,e,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;Gu(t,e,a,r,n,o),Uu(t,e,i,r,a-1,1-o),Uu(t,e,i,a+1,n,1-o)}function Gu(t,e,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,s=i-r+1,l=Math.log(a),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Gu(t,e,i,Math.max(r,Math.floor(i-s*c/a+h)),Math.min(n,Math.floor(i+(a-s)*c/a+h)),o)}const a=e[2*i+o];let s=r,l=n;for($u(t,e,r,i),e[2*n+o]>a&&$u(t,e,r,n);s<l;){for($u(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*r+o]===a?$u(t,e,r,l):(l++,$u(t,e,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function $u(t,e,i,r){Hu(t,i,r),Hu(e,2*i,2*r),Hu(e,2*i+1,2*r+1)}function Hu(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function Xu(t,e,i,r){const n=t-i,o=e-r;return n*n+o*o}var Wu;t.ce=void 0,(Wu=t.ce||(t.ce={})).create="create",Wu.load="load",Wu.fullLoad="fullLoad";let Ku=null,Yu=[];const Ju=1e3/60,Qu="loadTime",tp="fullLoadTime",ep={mark(t){performance.mark(t)},frame(t){const e=t;null!=Ku&&Yu.push(e-Ku),Ku=e},clearMetrics(){Ku=null,Yu=[],performance.clearMeasures(Qu),performance.clearMeasures(tp);for(const e in t.ce)performance.clearMarks(t.ce[e])},getPerformanceMetrics(){performance.measure(Qu,t.ce.create,t.ce.load),performance.measure(tp,t.ce.create,t.ce.fullLoad);const e=performance.getEntriesByName(Qu)[0].duration,i=performance.getEntriesByName(tp)[0].duration,r=Yu.length,n=1/(Yu.reduce(((t,e)=>t+e),0)/r/1e3),o=Yu.filter((t=>t>Ju)).reduce(((t,e)=>t+(e-Ju)/Ju),0);return{loadTime:e,fullLoadTime:i,fps:n,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};t.$=Tt,t.A=_,t.B=Fn,t.C=function(t){if(null==U){const e=t.navigator?t.navigator.userAgent:null;U=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return U},t.D=xo,t.E=ht,t.F=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Zh((()=>this.process())),this.subscription=function(t,e,i){return t.addEventListener(e,i,!1),{unsubscribe:()=>{t.removeEventListener(e,i,!1)}}}(this.target,"message",(t=>this.receive(t))),this.globalScope=Z(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise(((i,r)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[n]={resolve:i,reject:r},e&&e.signal.addEventListener("abort",(()=>{delete this.resolveRejects[n];const e={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)}),{once:!0});const o=[],a=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Hn(t.data,o)});this.target.postMessage(a,{transfer:o})}))}receive(t){const e=t.data,i=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&"resource://android"!==e.origin&&"resource://android"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[i];const t=this.abortControllers[i];return delete this.abortControllers[i],void(t&&t.abort())}if(Z(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,i){return e(this,void 0,void 0,(function*(){if("<response>"===i.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(i.error?e.reject(Xn(i.error)):e.resolve(Xn(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=Xn(i.data),r=new AbortController;this.abortControllers[t]=r;try{const n=yield this.messageHandlers[i.type](i.sourceMapId,e,r);this.completeTask(t,null,n)}catch(e){this.completeTask(t,e)}}))}completeTask(t,e,i){const r=[];delete this.abortControllers[t];const n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Hn(e):null,data:Hn(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.G=et,t.H=function(){var t=new _(16);return _!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.I=$c,t.J=function(t,e,i){var r,n,o,a,s,l,c,h,u,p,d,f,m=i[0],g=i[1],_=i[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*_+e[12],t[13]=e[1]*m+e[5]*g+e[9]*_+e[13],t[14]=e[2]*m+e[6]*g+e[10]*_+e[14],t[15]=e[3]*m+e[7]*g+e[11]*_+e[15]):(n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=f,t[12]=r*m+s*g+u*_+e[12],t[13]=n*m+l*g+p*_+e[13],t[14]=o*m+c*g+d*_+e[14],t[15]=a*m+h*g+f*_+e[15]),t},t.K=function(t,e,i){var r=i[0],n=i[1],o=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.L=function(t,e,i){var r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],v=i[0],x=i[1],b=i[2],w=i[3];return t[0]=v*r+x*s+b*u+w*m,t[1]=v*n+x*l+b*p+w*g,t[2]=v*o+x*c+b*d+w*_,t[3]=v*a+x*h+b*f+w*y,t[4]=(v=i[4])*r+(x=i[5])*s+(b=i[6])*u+(w=i[7])*m,t[5]=v*n+x*l+b*p+w*g,t[6]=v*o+x*c+b*d+w*_,t[7]=v*a+x*h+b*f+w*y,t[8]=(v=i[8])*r+(x=i[9])*s+(b=i[10])*u+(w=i[11])*m,t[9]=v*n+x*l+b*p+w*g,t[10]=v*o+x*c+b*d+w*_,t[11]=v*a+x*h+b*f+w*y,t[12]=(v=i[12])*r+(x=i[13])*s+(b=i[14])*u+(w=i[15])*m,t[13]=v*n+x*l+b*p+w*g,t[14]=v*o+x*c+b*d+w*_,t[15]=v*a+x*h+b*f+w*y,t},t.M=function(t,e){const i={};for(let r=0;r<e.length;r++){const n=e[r];n in t&&(i[n]=t[n])}return i},t.N=Gh,t.O=Xh,t.P=l,t.Q=Wh,t.R=js,t.S=ru,t.T=fo,t.U=d,t.V=f,t.W=H,t.X=M,t.Y=Qh,t.Z=eu,t._=e,t.a=Q,t.a$=function(){return new Float64Array(16)},t.a0=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const i of t){const t=window.document.createElement("source");ot(i)||(e.crossOrigin="Anonymous"),t.src=i,e.appendChild(t)}}))},t.a1=function(){return B++},t.a2=ra,t.a3=zh,t.a4=Wr,t.a5=cs,t.a6=su,t.a7=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,r,n)=>{const o=r||n;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.a8=function(t){return Math.log(t)/Math.LN2},t.a9=function(t){var e=t[0],i=t[1];return e*e+i*i},t.aA=Ao,t.aB=wl,t.aC=fa,t.aD=za,t.aE=Ma,t.aF=85.051129,t.aG=function(t){return Math.pow(2,t)},t.aH=Kh,t.aI=R,t.aJ=K,t.aK=Jh,t.aL=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},t.aM=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},t.aN=function(t){var e=new _(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.aO=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.aP=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},t.aQ=function(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.aR=function(t,e,i){var r=e[0],n=e[1],o=e[2],a=i[0],s=i[1],l=i[2];return t[0]=n*l-o*s,t[1]=o*a-r*l,t[2]=r*s-n*a,t},t.aS=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.aT=iu,t.aU=nu,t.aV=function(t,e,i,r,n){var o,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0?(t[10]=(n+r)*(o=1/(r-n)),t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r),t},t.aW=function(t){var e=new _(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.aX=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+c*r,t[1]=a*n+h*r,t[2]=s*n+u*r,t[3]=l*n+p*r,t[4]=c*n-o*r,t[5]=h*n-a*r,t[6]=u*n-s*r,t[7]=p*n-l*r,t},t.aY=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+c*r,t[5]=a*n+h*r,t[6]=s*n+u*r,t[7]=l*n+p*r,t[8]=c*n-o*r,t[9]=h*n-a*r,t[10]=u*n-s*r,t[11]=p*n-l*r,t},t.aZ=function(){const t=new Float32Array(16);return v(t),t},t.a_=function(){const t=new Float64Array(16);return v(t),t},t.aa=function(t){return t*Math.PI/180},t.ab=D,t.ac=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i},t.ad=C,t.ae=function(t){return Math.hypot(t[0],t[1])},t.af=function(t){return t[0]=0,t[1]=0,t},t.ag=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},t.ah=function(t,e){let i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=t,s=n?D(Qe.interpolationFactor(n,e,o,a),0,1):0;"camera"===t.kind?r=ei.number(t.minSize,t.maxSize,s):i=s}return{uSizeT:i,uSize:r}},t.aj=function(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===t.kind?r/vh:"composite"===t.kind?ei.number(r/vh,n/vh,i):e},t.ak=Mh,t.al=w,t.am=function(t,e,i,r){const n=e.y-t.y,o=e.x-t.x,a=r.y-i.y,s=r.x-i.x,c=a*o-s*n;if(0===c)return null;const h=(s*(t.y-i.y)-a*(t.x-i.x))/c;return new l(t.x+h*o,t.y+h*n)},t.an=function(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=i*s-r*a,v=i*l-n*a,x=i*c-o*a,b=r*l-n*s,w=r*c-o*s,T=n*c-o*l,C=h*m-u*f,P=h*g-p*f,M=h*_-d*f,S=u*g-p*m,I=u*_-d*m,E=p*_-d*g,z=y*E-v*I+x*S+b*M-w*P+T*C;return z?(t[0]=(s*E-l*I+c*S)*(z=1/z),t[1]=(n*I-r*E-o*S)*z,t[2]=(m*T-g*w+_*b)*z,t[3]=(p*w-u*T-d*b)*z,t[4]=(l*M-a*E-c*P)*z,t[5]=(i*E-n*M+o*P)*z,t[6]=(g*x-f*T-_*v)*z,t[7]=(h*T-p*x+d*v)*z,t[8]=(a*I-s*M+c*C)*z,t[9]=(r*M-i*I-o*C)*z,t[10]=(f*w-m*x+_*y)*z,t[11]=(u*x-h*w-d*y)*z,t[12]=(s*P-a*S-l*C)*z,t[13]=(i*S-r*P+n*C)*z,t[14]=(m*v-f*b-g*y)*z,t[15]=(h*b-u*v+p*y)*z,t):null},t.ao=pu,t.ap=ds,t.aq=v,t.ar=function(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[e,i,r,n]},t.as=Rc,t.at=S,t.au=function(t,e,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];const o=n?"map"===r?-t.bearingInRadians:0:"viewport"===r?t.bearingInRadians:0;if(o){const t=Math.sin(o),e=Math.cos(o);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e]}return[n?i[0]:S(e,i[0],t.zoom),n?i[1]:S(e,i[1],t.zoom)]},t.aw=wh,t.ax=Fu,t.ay=lh,t.az=Zu,t.b=G,t.b$=t=>"line"===t.type,t.b0=function(t,e,i){const r=new Float64Array(4);return function(t,e,i,r){var n=.5*Math.PI/180;e*=n,i*=n,r*=n;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(i),l=Math.cos(i),c=Math.sin(r),h=Math.cos(r);t[0]=o*l*h-a*s*c,t[1]=a*s*h+o*l*c,t[2]=a*l*c-o*s*h,t[3]=a*l*h+o*s*c}(r,t,e-90,i),r},t.b1=function(t,e,i,r){var n,o,a,s,l,c=e[0],h=e[1],u=e[2],p=e[3],d=i[0],f=i[1],m=i[2],_=i[3];return(o=c*d+h*f+u*m+p*_)<0&&(o=-o,d=-d,f=-f,m=-m,_=-_),1-o>g?(n=Math.acos(o),a=Math.sin(n),s=Math.sin((1-r)*n)/a,l=Math.sin(r*n)/a):(s=1-r,l=r),t[0]=s*c+l*d,t[1]=s*h+l*f,t[2]=s*u+l*m,t[3]=s*p+l*_,t},t.b2=function(t){const e=new Float64Array(9);var i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,v;u=(n=(r=t)[0])*(l=n+n),p=(o=r[1])*l,f=(a=r[2])*l,m=a*(c=o+o),_=(s=r[3])*l,y=s*c,v=s*(h=a+a),(i=e)[0]=1-(d=o*c)-(g=a*h),i[3]=p-v,i[6]=f+y,i[1]=p+v,i[4]=1-u-g,i[7]=m-_,i[2]=f-y,i[5]=m+_,i[8]=1-u-d;const x=K(-Math.asin(D(e[2],-1,1)));let b,w;return Math.hypot(e[5],e[8])<.001?(b=0,w=-K(Math.atan2(e[3],e[4]))):(b=K(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),w=K(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:b,pitch:x+90,bearing:w}},t.b3=function(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing},t.b4=me,t.b5=$a,t.b6=Tl,t.b7=Cl,t.b8=bl,t.b9=E,t.bA=F,t.bB=O,t.bC=class extends Ga{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.bD=class extends Ga{constructor(t,e){super(t,e),this.current=Wa}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.bE=Ha,t.bF=Xa,t.bG=class extends Ga{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.bH=class extends Ga{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.bI=y,t.bJ=function(t,e){var i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.bK=function(t,e,i){var r=e[0],n=e[1],o=e[2];return t[0]=r*i[0]+n*i[3]+o*i[6],t[1]=r*i[1]+n*i[4]+o*i[7],t[2]=r*i[2]+n*i[5]+o*i[8],t},t.bL=function(t,e,i,r,n,o,a){var s=1/(e-i),l=1/(r-n),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*s,t[13]=(n+r)*l,t[14]=(a+o)*c,t[15]=1,t},t.bM=class extends Go{},t.bN=Ic,t.bO=class extends Ho{},t.bP=Ns,t.bQ=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.bR=Vs,t.bS=function(t,e,i){var r=e[0],n=e[1],o=e[2],a=i[3]*r+i[7]*n+i[11]*o+i[15];return t[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(a=a||1),t[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/a,t[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/a,t},t.bT=class extends Lo{},t.bU=class extends ta{},t.bV=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},t.bW=function(t,e){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],d=t[11],f=t[12],m=t[13],_=t[14],y=t[15],v=e[0],x=e[1],b=e[2],w=e[3],T=e[4],C=e[5],P=e[6],M=e[7],S=e[8],I=e[9],E=e[10],z=e[11],A=e[12],k=e[13],D=e[14],R=e[15];return Math.abs(i-v)<=g*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(r-x)<=g*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-b)<=g*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-w)<=g*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=g*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-C)<=g*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(l-P)<=g*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-M)<=g*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(h-S)<=g*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(u-I)<=g*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(p-E)<=g*Math.max(1,Math.abs(p),Math.abs(E))&&Math.abs(d-z)<=g*Math.max(1,Math.abs(d),Math.abs(z))&&Math.abs(f-A)<=g*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-k)<=g*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(_-D)<=g*Math.max(1,Math.abs(_),Math.abs(D))&&Math.abs(y-R)<=g*Math.max(1,Math.abs(y),Math.abs(R))},t.bX=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.bY=t=>"symbol"===t.type,t.bZ=t=>"circle"===t.type,t.b_=t=>"heatmap"===t.type,t.ba=z,t.bb=Pe,t.bc=function(t,e,i,r,n){return E(r,n,D((t-e)/(i-e),0,1))},t.bd=I,t.be=function(){return new Float64Array(4)},t.bf=function(){return new Float64Array(3)},t.bg=function(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t},t.bh=function(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t},t.bi=function(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t},t.bj=function(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],a=e[1],s=e[2],l=e[3],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-c*r,t[1]=a*n-h*r,t[2]=s*n-u*r,t[3]=l*n-p*r,t[8]=o*r+c*n,t[9]=a*r+h*n,t[10]=s*r+u*n,t[11]=l*r+p*n,t},t.bk=function(t,e){const i=I(t,360),r=I(e,360),n=r-i,o=r>i?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},t.bl=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bm=function(t,e,i,r){const n=Math.sqrt(t*t+e*e),o=Math.sqrt(i*i+r*r);t/=n,e/=n,i/=o,r/=o;const a=Math.acos(t*i+e*r);return-e*i+t*r>0?a:-a},t.bn=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]},t.bo=Uh,t.bp=function(t,e){const i=I(t,2*Math.PI),r=I(e,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},t.bq=function(t){return Math.hypot(t[0],t[1],t[2])},t.br=function(){const t={},e=ut.$version;for(const i in ut.$root){const r=ut.$root[i];if(r.required){let n=null;n="version"===i?e:"array"===r.type?[]:{},null!=n&&(t[i]=n)}}return t},t.bs=Wn,t.bt=rt,t.bu=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=dt(t[i],e[t[i].ref]));return t},t.bv=function(t){if("custom"===t.type)return new qh(t);switch(t.type){case"background":return new Oh(t);case"circle":return new zs(t);case"fill":return new Ll(t);case"fill-extrusion":return new ac(t);case"heatmap":return new qs(t);case"hillshade":return new Gs(t);case"line":return new wc(t);case"raster":return new Nh(t);case"symbol":return new Lh(t)}},t.bw=j,t.bx=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let i=[];try{if(!ft(t.version,e.version))return[{command:"setStyle",args:[e]}];ft(t.center,e.center)||i.push({command:"setCenter",args:[e.center]}),ft(t.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),ft(t.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),ft(t.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),ft(t.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),ft(t.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),ft(t.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),ft(t.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),ft(t.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),ft(t.light,e.light)||i.push({command:"setLight",args:[e.light]}),ft(t.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),ft(t.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),ft(t.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const r={},n=[];!function(t,e,i,r){let n;for(n in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)||_t(n,i,r));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)?ft(t[n],e[n])||("geojson"===t[n].type&&"geojson"===e[n].type&&vt(t,e,n)?mt(i,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):yt(n,e,i,r)):gt(n,e,i))}(t.sources,e.sources,n,r);const o=[];t.layers&&t.layers.forEach((t=>{"source"in t&&r[t.source]?i.push({command:"removeLayer",args:[t.id]}):o.push(t)})),i=i.concat(n),function(t,e,i){e=e||[];const r=(t=t||[]).map(bt),n=e.map(bt),o=t.reduce(wt,{}),a=e.reduce(wt,{}),s=r.slice(),l=Object.create(null);let c,h,u,p,d;for(let t=0,e=0;t<r.length;t++)c=r[t],Object.prototype.hasOwnProperty.call(a,c)?e++:(mt(i,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,e),1));for(let t=0,e=0;t<n.length;t++)c=n[n.length-1-t],s[s.length-1-t]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(mt(i,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-e),1)):e++,p=s[s.length-t],mt(i,{command:"addLayer",args:[a[c],p]}),s.splice(s.length-t,0,c),l[c]=!0);for(let t=0;t<n.length;t++)if(c=n[t],h=o[c],u=a[c],!l[c]&&!ft(h,u))if(ft(h.source,u.source)&&ft(h["source-layer"],u["source-layer"])&&ft(h.type,u.type)){for(d in xt(h.layout,u.layout,i,c,null,"setLayoutProperty"),xt(h.paint,u.paint,i,c,null,"setPaintProperty"),ft(h.filter,u.filter)||mt(i,{command:"setFilter",args:[c,u.filter]}),ft(h.minzoom,u.minzoom)&&ft(h.maxzoom,u.maxzoom)||mt(i,{command:"setLayerZoomRange",args:[c,u.minzoom,u.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?xt(h[d],u[d],i,c,d.slice(6),"setPaintProperty"):ft(h[d],u[d])||mt(i,{command:"setLayerProperty",args:[c,d,u[d]]}));for(d in u)Object.prototype.hasOwnProperty.call(u,d)&&!Object.prototype.hasOwnProperty.call(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?xt(h[d],u[d],i,c,d.slice(6),"setPaintProperty"):ft(h[d],u[d])||mt(i,{command:"setLayerProperty",args:[c,d,u[d]]}))}else mt(i,{command:"removeLayer",args:[c]}),p=s[s.lastIndexOf(c)+1],mt(i,{command:"addLayer",args:[u,p]})}(o,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:"setStyle",args:[e]}]}return i},t.by=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.bz=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const r in e)if(!t(e[r],i[r]))return!1;return!0}return e===i},t.c=J,t.c0=t=>"fill"===t.type,t.c1=t=>"fill-extrusion"===t.type,t.c2=t=>"hillshade"===t.type,t.c3=t=>"raster"===t.type,t.c4=t=>"background"===t.type,t.c5=t=>"custom"===t.type,t.c6=A,t.c7=function(t,e,i){const r=P(e.x-i.x,e.y-i.y),n=P(t.x-i.x,t.y-i.y);var o,a;return K(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(a=n)[0]+o[1]*a[1]))},t.c8=k,t.c9=function(t,e,i){var r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t},t.cA=Fc,t.cB=Nr,t.cC=co,t.ca=function(t,e){const{x:i,y:r}=Qh.fromLngLat(e);return!(t<0||t>25||r<0||r>=1||i<0||i>=1)},t.cb=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.cc=class extends Ro{},t.cd=ep,t.cf=function(t){return t.message===Y},t.cg=it,t.ch=function(t,e){Q.REGISTERED_PROTOCOLS[t]=e},t.ci=function(t){delete Q.REGISTERED_PROTOCOLS[t]},t.cj=function(t,e){const i={};for(let r=0;r<t.length;r++){const n=e&&e[t[r].id]||on(t[r]);e&&(e[t[r].id]=n);let o=i[n];o||(o=i[n]=[]),o.push(t[r])}const r=[];for(const t in i)r.push(i[t]);return r},t.ck=Zn,t.cl=au,t.cm=lu,t.cn=Hc,t.co=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=M/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],r=i.layout,n=i._unevaluatedLayout._values,o={layoutIconSize:n["icon-size"].possiblyEvaluate(new ho(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new ho(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new ho(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;o.compositeTextSizes=[n["text-size"].possiblyEvaluate(new ho(t),e.canonical),n["text-size"].possiblyEvaluate(new ho(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;o.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new ho(t),e.canonical),n["icon-size"].possiblyEvaluate(new ho(i),e.canonical)]}const a=r.get("text-line-height")*Rc,s="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),c=r.get("text-size");for(const n of e.bucket.features){const h=r.get("text-font").evaluate(n,{},e.canonical).join(","),u=c.evaluate(n,{},e.canonical),p=o.layoutTextSize.evaluate(n,{},e.canonical),d=o.layoutIconSize.evaluate(n,{},e.canonical),f={horizontal:{},vertical:void 0},m=n.text;let g,_=[0,0];if(m){const o=m.toString(),c=r.get("text-letter-spacing").evaluate(n,{},e.canonical)*Rc,d=Jn(o)?c:0,g=r.get("text-anchor").evaluate(n,{},e.canonical),y=Bu(i,n,e.canonical);if(!y){const t=r.get("text-radial-offset").evaluate(n,{},e.canonical);_=t?Lu(g,[t*Rc,Ru]):r.get("text-offset").evaluate(n,{},e.canonical).map((t=>t*Rc))}let v=s?"center":r.get("text-justify").evaluate(n,{},e.canonical);const x="point"===r.get("symbol-placement")?r.get("text-max-width").evaluate(n,{},e.canonical)*Rc:1/0,b=()=>{e.bucket.allowVerticalPlacement&&Yn(o)&&(f.vertical=Jc(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,x,a,g,"left",d,_,t.ai.vertical,!0,p,u))};if(!s&&y){const i=new Set;if("auto"===v)for(let t=0;t<y.values.length;t+=2)i.add(Fu(y.values[t]));else i.add(v);let r=!1;for(const n of i)if(!f.horizontal[n])if(r)f.horizontal[n]=f.horizontal[0];else{const i=Jc(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,x,a,"center",n,d,_,t.ai.horizontal,!1,p,u);i&&(f.horizontal[n]=i,r=1===i.positionedLines.length)}b()}else{"auto"===v&&(v=Fu(g));const i=Jc(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,x,a,g,v,d,_,t.ai.horizontal,!1,p,u);i&&(f.horizontal[v]=i),b(),Yn(o)&&s&&l&&(f.vertical=Jc(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,x,a,g,v,d,_,t.ai.vertical,!1,p,u))}}let y=!1;if(n.icon&&n.icon.name){const t=e.imageMap[n.icon.name];t&&(g=mh(e.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},e.canonical),r.get("icon-anchor").evaluate(n,{},e.canonical)),y=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&N("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const v=Vu(f.horizontal)||f.vertical;e.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&Ou(e.bucket,n,f,g,e.imageMap,o,p,d,_,y,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.cp=gc,t.cq=Al,t.cr=tc,t.cs=Kl,t.ct=Oc,t.cu=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.cv=function(t,i,r,n,o){return e(this,void 0,void 0,(function*(){if(f())try{return yield H(t,i,r,n,o)}catch(t){}return function(t,e,i,r,n){const o=t.width,a=t.height;X&&W||(X=new OffscreenCanvas(o,a),W=X.getContext("2d",{willReadFrequently:!0})),X.width=o,X.height=a,W.drawImage(t,0,0,o,a);const s=W.getImageData(e,i,r,n);return W.clearRect(0,0,o,a),s.data}(t,i,r,n,o)}))},t.cw=ou,t.cx=i,t.cy=o,t.cz=Wl,t.d=t=>e(void 0,void 0,void 0,(function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),t.e=L,t.f=t=>new Promise(((e,i)=>{const r=new Image;r.onload=()=>{e(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=$}))},r.onerror=()=>i(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."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(n):$})),t.g=tt,t.h=(t,e)=>nt(L(t,{type:"json"}),e),t.i=Z,t.j=ct,t.k=lt,t.l=(t,e)=>nt(L(t,{type:"arrayBuffer"}),e),t.m=nt,t.n=function(t){return new Oc(t).readFields(Vc,[])},t.o=Os,t.p=Uc,t.q=Po,t.r=Bn,t.s=ot,t.t=Vn,t.u=Ln,t.v=ut,t.w=N,t.x=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.y=ei,t.z=ho})),i("worker",["./shared"],(function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.bv(i);e._featureFilter=t.a4(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=t.cj(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map((t=>this._layers[t.id])),i=e[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let a=n[o];a||(a=n[o]=[]),a.push(e)}}}class i{constructor(e){const i={},r=[];for(const t in e){const n=e[t],o=i[t]={};for(const t in n){const e=n[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(i),o[t]={rect:i,metrics:e.metrics}}}const{w:n,h:o}=t.p(r),a=new t.o({width:n||1,height:o||1});for(const r in e){const n=e[r];for(const e in n){const o=n[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=i[r][e].rect;t.o.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=i}}t.ck("GlyphAtlas",i);class r{constructor(e){this.tileID=new t.S(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}parse(e,r,o,a,s){return t._(this,void 0,void 0,(function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a2;const l=new t.cl(Object.keys(e.layers).sort()),c=new t.cm(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},u={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o,subdivisionGranularity:s},p=r.familiesBySource[this.source];for(const i in p){const r=e.layers[i];if(!r)continue;1===r.version&&t.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(i),s=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=c.getId(e,i);s.push({feature:e,id:n,index:t,sourceLayerIndex:a})}for(const e of p[i]){const i=e[0];i.source!==this.source&&t.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(n(e,this.zoom,o),(h[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,u,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}const d=t.bA(u.glyphDependencies,(t=>Object.keys(t).map(Number)));this.inFlightDependencies.forEach((t=>null==t?void 0:t.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(d).length){const t=new AbortController;this.inFlightDependencies.push(t),f=a.sendAsync({type:"GG",data:{stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const m=Object.keys(u.iconDependencies);let g=Promise.resolve({});if(m.length){const t=new AbortController;this.inFlightDependencies.push(t),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},t)}const _=Object.keys(u.patternDependencies);let y=Promise.resolve({});if(_.length){const t=new AbortController;this.inFlightDependencies.push(t),y=a.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const[v,x,b]=yield Promise.all([f,g,y]),w=new i(v),T=new t.cn(x,b);for(const e in h){const i=h[e];i instanceof t.a3?(n(i.layers,this.zoom,o),t.co({bucket:i,glyphMap:v,glyphPositions:w.positions,imageMap:x,imagePositions:T.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):i.hasPattern&&(i instanceof t.cp||i instanceof t.cq||i instanceof t.cr)&&(n(i.layers,this.zoom,o),i.addFeatures(u,this.tileID.canonical,T.patternPositions))}return this.status="done",{buckets:Object.values(h).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:w.image,imageAtlas:T,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?w.positions:null}}))}}function n(e,i,r){const n=new t.z(i);for(const t of e)t.recalculate(n,r)}class o{constructor(t,e,i){this.actor=t,this.layerIndex=e,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(e,i){return t._(this,void 0,void 0,(function*(){const r=yield t.l(e.request,i);try{return{vectorTile:new t.cs.VectorTile(new t.ct(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(t){const i=new Uint8Array(r.data);let n=`Unable to parse the tile at ${e.request.url}, `;throw n+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(n)}}))}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.uid,n=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cu(e.request),o=new r(e);this.loading[i]=o;const a=new AbortController;o.abort=a;try{const r=yield this.loadVectorTile(e,a);if(delete this.loading[i],!r)return null;const s=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(n){const t=n.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}o.vectorTile=r.vectorTile;const h=o.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[i]=o,this.fetching[i]={rawTileData:s,cacheControl:l,resourceTiming:c};try{const e=yield h;return t.e({rawTileData:s.slice(0)},e,l,c)}finally{delete this.fetching[i]}}catch(t){throw delete this.loading[i],o.status="done",this.loaded[i]=o,t}}))}reloadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const r=this.loaded[i];if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const n=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);let o;if(this.fetching[i]){const{rawTileData:e,cacheControl:r,resourceTiming:a}=this.fetching[i];delete this.fetching[i],o=t.e({rawTileData:e.slice(0)},n,r,a)}else o=n;return o}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){const t=this.loading,i=e.uid;t&&t[i]&&t[i].abort&&(t[i].abort.abort(),delete t[i])}))}removeTile(e){return t._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}))}}class a{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,(function*(){const{uid:i,encoding:r,rawImageData:n,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,c=n.width+2,h=n.height+2,u=t.b(n)?new t.R({width:c,height:h},yield t.cv(n,-1,-1,c,h)):n,p=new t.cw(i,u,r,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[i]=p,p}))}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}var s,l,c=function(){if(l)return s;function t(t,i){if(0!==t.length){e(t[0],i);for(var r=1;r<t.length;r++)e(t[r],!i)}}function e(t,e){for(var i=0,r=0,n=0,o=t.length,a=o-1;n<o;a=n++){var s=(t[n][0]-t[a][0])*(t[a][1]+t[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!e&&t.reverse()}return l=1,s=function e(i,r){var n,o=i&&i.type;if("FeatureCollection"===o)for(n=0;n<i.features.length;n++)e(i.features[n],r);else if("GeometryCollection"===o)for(n=0;n<i.geometries.length;n++)e(i.geometries[n],r);else if("Feature"===o)e(i.geometry,r);else if("Polygon"===o)t(i.coordinates,r);else if("MultiPolygon"===o)for(n=0;n<i.coordinates.length;n++)t(i.coordinates[n],r);return i}}(),h=t.cx(c);const u=t.cs.VectorTileFeature.prototype.toGeoJSON;class p{constructor(e){this._feature=e,this.extent=t.X,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.P(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const r=[];for(const e of i)r.push(new t.P(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,i){return u.call(this,t,e,i)}}class d{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.X,this.length=e.length,this._features=e}feature(t){return new p(this._features[t])}}var f,m,g,_={exports:{}},y=function(){if(g)return _.exports;g=1;var e=t.cA(),i=function(){if(m)return f;m=1;var e=t.cy(),i=t.cz().VectorTileFeature;function r(t,e){this.options=e||{},this.features=t,this.length=t.length}function n(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}return f=r,r.prototype.feature=function(t){return new n(this.features[t],this.options.extent)},n.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var i=0;i<t.length;i++){for(var r=t[i],n=[],o=0;o<r.length;o++)n.push(new e(r[o][0],r[o][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,n=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[e,r,i,n]},n.prototype.toGeoJSON=i.prototype.toGeoJSON,f}();function r(t){var i=new e;return function(t,e){for(var i in t.layers)e.writeMessage(3,n,t.layers[i])}(t,i),i.finish()}function n(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,o,r);var n=r.keys;for(i=0;i<n.length;i++)e.writeStringField(3,n[i]);var a=r.values;for(i=0;i<a.length;i++)e.writeMessage(4,h,a[i])}function o(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,a,t),e.writeVarintField(3,i.type),e.writeMessage(4,c,i)}function a(t,e){var i=t.feature,r=t.keys,n=t.values,o=t.keycache,a=t.valuecache;for(var s in i.properties){var l=i.properties[s],c=o[s];if(null!==l){void 0===c&&(r.push(s),o[s]=c=r.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,p=a[u];void 0===p&&(n.push(l),a[u]=p=n.length-1),e.writeVarint(p)}}}function s(t,e){return(e<<3)+(7&t)}function l(t){return t<<1^t>>31}function c(t,e){for(var i=t.loadGeometry(),r=t.type,n=0,o=0,a=i.length,c=0;c<a;c++){var h=i[c],u=1;1===r&&(u=h.length),e.writeVarint(s(1,u));for(var p=3===r?h.length-1:h.length,d=0;d<p;d++){1===d&&1!==r&&e.writeVarint(s(2,p-1));var f=h[d].x-n,m=h[d].y-o;e.writeVarint(l(f)),e.writeVarint(l(m)),n+=f,o+=m}3===r&&e.writeVarint(s(7,1))}}function h(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}return _.exports=r,_.exports.fromVectorTileJs=r,_.exports.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var o in t)n[o]=new i(t[o].features,e),n[o].name=o,n[o].version=e.version,n[o].extent=e.extent;return r({layers:n})},_.exports.GeoJSONWrapper=i,_.exports}(),v=t.cx(y);const x={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},b=Math.fround||(w=new Float32Array(1),t=>(w[0]=+t,w[0]));var w;const T=3,C=5,P=6;class M{constructor(t){this.options=Object.assign(Object.create(x),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:r}=this.options;e&&console.time("total time");const n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(!i.geometry)continue;const[r,n]=i.geometry.coordinates,a=b(E(r)),s=b(z(n));o.push(a,s,1/0,e,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[r+1]=this._createTree(o);e&&console.timeEnd(n);for(let t=r;t>=i;t--){const i=+Date.now();a=this.trees[t]=this._createTree(this._cluster(a,t)),e&&console.log("z%d: %d clusters in %dms",t,a.numItems,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let n=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,n=180;else if(i>n){const t=this.getClusters([i,r,180,o],e),a=this.getClusters([-180,r,n,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range(E(i),z(o),E(n),z(r)),l=a.data,c=[];for(const t of s){const e=this.stride*t;c.push(l[e+C]>1?S(l,e,this.clusterProps):this.points[l[e+T]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(e*this.stride>=o.length)throw new Error(r);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=n.within(o[e*this.stride],o[e*this.stride+1],a),l=[];for(const e of s){const i=e*this.stride;o[i+4]===t&&l.push(o[i+C]>1?S(o,i,this.clusterProps):this.points[o[i+T]])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,i){const r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r}getTile(t,e,i){const r=this.trees[this._limitZoom(t)],n=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/n,c=(i+1+s)/n,h={features:[]};return this._addTileFeatures(r.range((e-s)/n,l,(e+1+s)/n,c),r.data,e,i,n,h),0===e&&this._addTileFeatures(r.range(1-s/n,l,1,c),r.data,n,i,n,h),e===n-1&&this._addTileFeatures(r.range(0,l,s/n,c),r.data,-1,i,n,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,r,n){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(t,o.cluster_id,i,r,n):n<r?n++:t.push(e),t.length===i)break}return n}_createTree(e){const i=new t.az(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,r,n,o){for(const a of t){const t=a*this.stride,s=e[t+C]>1;let l,c,h;if(s)l=I(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const i=this.points[e[t+T]];l=i.properties;const[r,n]=i.geometry.coordinates;c=E(r),h=z(n)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(h*n-r))]],tags:l};let p;p=s||this.options.generateId?e[t+T]:this.points[e[t+T]].id,void 0!==p&&(u.id=p),o.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,a=i/(r*Math.pow(2,e)),s=t.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=e)continue;s[i+2]=e;const r=s[i],h=s[i+1],u=t.within(s[i],s[i+1],a),p=s[i+C];let d=p;for(const t of u){const i=t*c;s[i+2]>e&&(d+=s[i+C])}if(d>p&&d>=o){let t,o=r*p,a=h*p,f=-1;const m=(i/c<<5)+(e+1)+this.points.length;for(const r of u){const l=r*c;if(s[l+2]<=e)continue;s[l+2]=e;const h=s[l+C];o+=s[l]*h,a+=s[l+1]*h,s[l+4]=m,n&&(t||(t=this._map(s,i,!0),f=this.clusterProps.length,this.clusterProps.push(t)),n(t,this._map(s,l)))}s[i+4]=m,l.push(o/d,a/d,1/0,m,-1,d),n&&l.push(f)}else{for(let t=0;t<c;t++)l.push(s[i+t]);if(d>1)for(const t of u){const i=t*c;if(!(s[i+2]<=e)){s[i+2]=e;for(let t=0;t<c;t++)l.push(s[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+C]>1){const r=this.clusterProps[t[e+P]];return i?Object.assign({},r):r}const r=this.points[t[e+T]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function S(t,e,i){return{type:"Feature",id:t[e+T],properties:I(t,e,i),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),A(t[e+1])]}};var r}function I(t,e,i){const r=t[e+C],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=t[e+P],a=-1===o?{}:Object.assign({},i[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+T],point_count:r,point_count_abbreviated:n})}function E(t){return t/360+.5}function z(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function A(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function k(t,e,i,r){let n=r;const o=e+(i-e>>1);let a,s=i-e;const l=t[e],c=t[e+1],h=t[i],u=t[i+1];for(let r=e+3;r<i;r+=3){const e=D(t[r],t[r+1],l,c,h,u);if(e>n)a=r,n=e;else if(e===n){const t=Math.abs(r-o);t<s&&(a=r,s=t)}}n>r&&(a-e>3&&k(t,e,a,r),t[a+2]=n,i-a>3&&k(t,a,i,r))}function D(t,e,i,r,n,o){let a=n-i,s=o-r;if(0!==a||0!==s){const l=((t-i)*a+(e-r)*s)/(a*a+s*s);l>1?(i=n,r=o):l>0&&(i+=a*l,r+=s*l)}return a=t-i,s=e-r,a*a+s*s}function R(t,e,i,r){const n={id:null==t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===e||"MultiPoint"===e||"LineString"===e)L(n,i);else if("Polygon"===e)L(n,i[0]);else if("MultiLineString"===e)for(const t of i)L(n,t);else if("MultiPolygon"===e)for(const t of i)L(n,t[0]);return n}function L(t,e){for(let i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function B(t,e,i,r){if(!e.geometry)return;const n=e.geometry.coordinates;if(n&&0===n.length)return;const o=e.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)F(n,s);else if("MultiPoint"===o)for(const t of n)F(t,s);else if("LineString"===o)O(n,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(const i of n)s=[],O(i,s,a,!1),t.push(R(l,"LineString",s,e.properties));return}j(n,s,a,!1)}else if("Polygon"===o)j(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of e.geometry.geometries)B(t,{id:l,geometry:n,properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of n){const e=[];j(t,e,a,!0),s.push(e)}}t.push(R(l,o,s,e.properties))}function F(t,e){e.push(V(t[0]),N(t[1]),0)}function O(t,e,i,r){let n,o,a=0;for(let i=0;i<t.length;i++){const s=V(t[i][0]),l=N(t[i][1]);e.push(s,l,0),i>0&&(a+=r?(n*l-s*o)/2:Math.sqrt(Math.pow(s-n,2)+Math.pow(l-o,2))),n=s,o=l}const s=e.length-3;e[2]=1,k(e,0,s,i),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function j(t,e,i,r){for(let n=0;n<t.length;n++){const o=[];O(t[n],o,i,r),e.push(o)}}function V(t){return t/360+.5}function N(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function q(t,e,i,r,n,o,a,s){if(r/=e,o>=(i/=e)&&a<r)return t;if(a<i||o>=r)return null;const l=[];for(const e of t){const t=e.geometry;let o=e.type;const a=0===n?e.minX:e.minY,c=0===n?e.maxX:e.maxY;if(a>=i&&c<r){l.push(e);continue}if(c<i||a>=r)continue;let h=[];if("Point"===o||"MultiPoint"===o)Z(t,h,i,r,n);else if("LineString"===o)U(t,h,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===o)$(t,h,i,r,n,!1);else if("Polygon"===o)$(t,h,i,r,n,!0);else if("MultiPolygon"===o)for(const e of t){const t=[];$(e,t,i,r,n,!0),t.length&&h.push(t)}if(h.length){if(s.lineMetrics&&"LineString"===o){for(const t of h)l.push(R(e.id,o,t,e.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===h.length?(o="LineString",h=h[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===h.length?"Point":"MultiPoint"),l.push(R(e.id,o,h,e.tags))}}return l.length?l:null}function Z(t,e,i,r,n){for(let o=0;o<t.length;o+=3){const a=t[o+n];a>=i&&a<=r&&H(e,t[o],t[o+1],t[o+2])}}function U(t,e,i,r,n,o,a){let s=G(t);const l=0===n?X:W;let c,h,u=t.start;for(let p=0;p<t.length-3;p+=3){const d=t[p],f=t[p+1],m=t[p+2],g=t[p+3],_=t[p+4],y=0===n?d:f,v=0===n?g:_;let x=!1;a&&(c=Math.sqrt(Math.pow(d-g,2)+Math.pow(f-_,2))),y<i?v>i&&(h=l(s,d,f,g,_,i),a&&(s.start=u+c*h)):y>r?v<r&&(h=l(s,d,f,g,_,r),a&&(s.start=u+c*h)):H(s,d,f,m),v<i&&y>=i&&(h=l(s,d,f,g,_,i),x=!0),v>r&&y<=r&&(h=l(s,d,f,g,_,r),x=!0),!o&&x&&(a&&(s.end=u+c*h),e.push(s),s=G(t)),a&&(u+=c)}let p=t.length-3;const d=t[p],f=t[p+1],m=0===n?d:f;m>=i&&m<=r&&H(s,d,f,t[p+2]),p=s.length-3,o&&p>=3&&(s[p]!==s[0]||s[p+1]!==s[1])&&H(s,s[0],s[1],s[2]),s.length&&e.push(s)}function G(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function $(t,e,i,r,n,o){for(const a of t)U(a,e,i,r,n,o,!1)}function H(t,e,i,r){t.push(e,i,r)}function X(t,e,i,r,n,o){const a=(o-e)/(r-e);return H(t,o,i+(n-i)*a,1),a}function W(t,e,i,r,n,o){const a=(o-i)/(n-i);return H(t,e+(r-e)*a,o,1),a}function K(t,e){const i=[];for(let r=0;r<t.length;r++){const n=t[r],o=n.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Y(n.geometry,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of n.geometry)a.push(Y(t,e))}else if("MultiPolygon"===o){a=[];for(const t of n.geometry){const i=[];for(const r of t)i.push(Y(r,e));a.push(i)}}i.push(R(n.id,o,a,n.tags))}return i}function Y(t,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(let r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function J(t,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,n=t.y;for(const o of t.features){const t=o.geometry,a=o.type;if(o.geometry=[],1===a)for(let a=0;a<t.length;a+=2)o.geometry.push(Q(t[a],t[a+1],e,i,r,n));else for(let a=0;a<t.length;a++){const s=[];for(let o=0;o<t[a].length;o+=2)s.push(Q(t[a][o],t[a][o+1],e,i,r,n));o.geometry.push(s)}}return t.transformed=!0,t}function Q(t,e,i,r,n,o){return[Math.round(i*(t*r-n)),Math.round(i*(e*r-o))]}function tt(t,e,i,r,n){const o=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)et(a,e,o,n);return a}function et(t,e,i,r){const n=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let e=0;e<n.length;e+=3)a.push(n[e],n[e+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)it(a,n,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<n.length;e++)it(a,n[e],t,i,"Polygon"===o,0===e);else if("MultiPolygon"===o)for(let e=0;e<n.length;e++){const r=n[e];for(let e=0;e<r.length;e++)it(a,r[e],t,i,!0,0===e)}if(a.length){let i=e.tags||null;if("LineString"===o&&r.lineMetrics){i={};for(const t in e.tags)i[t]=e.tags[t];i.mapbox_clip_start=n.start/n.size,i.mapbox_clip_end=n.end/n.size}const s={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:i};null!==e.id&&(s.id=e.id),t.features.push(s)}}function it(t,e,i,r,n,o){const a=r*r;if(r>0&&e.size<(n?a:r))return void(i.numPoints+=e.length/3);const s=[];for(let t=0;t<e.length;t+=3)(0===r||e[t+2]>a)&&(i.numSimplified++,s.push(e[t],e[t+1])),i.numPoints++;n&&function(t,e){let i=0;for(let e=0,r=t.length,n=r-2;e<r;n=e,e+=2)i+=(t[e]-t[n])*(t[e+1]+t[n+1]);if(i>0===e)for(let e=0,i=t.length;e<i/2;e+=2){const r=t[e],n=t[e+1];t[e]=t[i-2-e],t[e+1]=t[i-1-e],t[i-2-e]=r,t[i-1-e]=n}}(s,o),t.push(s)}const rt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class nt{constructor(t,e){const i=(e=this.options=function(t,e){for(const i in e)t[i]=e[i];return t}(Object.create(rt),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const i=[];if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)B(i,t.features[r],e,r);else B(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const i=e.buffer/e.extent;let r=t;const n=q(t,1,-1-i,i,0,-1,2,e),o=q(t,1,1-i,2+i,0,-1,2,e);return(n||o)&&(r=q(t,1,-i,1+i,0,-1,2,e)||[],n&&(r=K(n,1).concat(r)),o&&(r=r.concat(K(o,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),i&&(r.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(t,e,i,r,n,o,a){const s=[t,e,i,r],l=this.options,c=l.debug;for(;s.length;){r=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();const h=1<<e,u=ot(e,i,r);let p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=tt(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==n){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(null!=n){const t=n-e;if(i!==o>>t||r!==a>>t)continue}}if(p.source=null,0===t.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,f=.5-d,m=.5+d,g=1+d;let _=null,y=null,v=null,x=null,b=q(t,h,i-d,i+m,0,p.minX,p.maxX,l),w=q(t,h,i+f,i+g,0,p.minX,p.maxX,l);t=null,b&&(_=q(b,h,r-d,r+m,1,p.minY,p.maxY,l),y=q(b,h,r+f,r+g,1,p.minY,p.maxY,l),b=null),w&&(v=q(w,h,r-d,r+m,1,p.minY,p.maxY,l),x=q(w,h,r+f,r+g,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),s.push(_||[],e+1,2*i,2*r),s.push(y||[],e+1,2*i,2*r+1),s.push(v||[],e+1,2*i+1,2*r),s.push(x||[],e+1,2*i+1,2*r+1)}}getTile(t,e,i){t=+t,e=+e,i=+i;const r=this.options,{extent:n,debug:o}=r;if(t<0||t>24)return null;const a=1<<t,s=ot(t,e=e+a&a-1,i);if(this.tiles[s])return J(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);let l,c=t,h=e,u=i;for(;!l&&c>0;)c--,h>>=1,u>>=1,l=this.tiles[ot(c,h,u)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(l.source,c,h,u,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?J(this.tiles[s],n):null):null}}function ot(t,e,i){return 32*((1<<t)*i+e)+t}function at(t,e){return e?t.properties[e]:t.id}function st(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=at(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const r of t.features){const t=at(r,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function lt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(at(t,e),t);else for(const r of t.features)i.set(at(r,e),r);return i}class ct extends o{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(e,i){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const i=this._geoJSONIndex.getTile(t.z,t.x,t.y);if(!i)return null;const r=new d(i.features);let n=v(r);return 0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:r,rawData:n.buffer}}))}loadData(e){return t._(this,void 0,void 0,(function*(){var i;null===(i=this._pendingRequest)||void 0===i||i.abort();const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.cu(e.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(e,this._pendingRequest),this._geoJSONIndex=e.cluster?new M(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const r={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const e of s){const[o,a]=i[e],s=t.cB(a),l=t.cB("string"==typeof o?[o,["accumulated"],["get",e]]:o);r[e]=s.value,n[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=r[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=n[e].evaluate(o,a)},e}(e)).load((yield this._pendingData).features):(n=yield this._pendingData,new nt(n,e.geojsonVtOptions)),this.loaded={};const i={};if(r){const t=r.finish();t&&(i.resourceTiming={},i.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}return i}catch(e){if(delete this._pendingRequest,t.cf(e))return{abandoned:!0};throw e}var n}))}getData(){return t._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(t){const e=this.loaded;return e&&e[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,i){return t._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(e,i);if(delete this._pendingRequest,"object"!=typeof r)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(h(r,!0),e.filter){const i=t.cB(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(", "));const n=r.features.filter((t=>i.value.evaluate({zoom:0},t)));r={type:"FeatureCollection",features:n}}return r}))}loadGeoJSON(e,i){return t._(this,void 0,void 0,(function*(){const{promoteId:r}=e;if(e.request){const n=yield t.h(e.request,i);return this._dataUpdateable=st(n.data,r)?lt(n.data,r):void 0,n.data}if("string"==typeof e.data)try{const t=JSON.parse(e.data);return this._dataUpdateable=st(t,r)?lt(t,r):void 0,t}catch(t){throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}if(!e.dataDiff)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${e.source}`);return function(t,e,i){var r,n,o,a;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const r of e.add){const e=at(r,i);null!=e&&t.set(e,r)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const s=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||s)&&(e=Object.assign({},e),t.set(i.id,e),s&&(e.properties=Object.assign({},e.properties))),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(a=i.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:t,value:r}of i.addOrUpdateProperties)e.properties[t]=r}}(this._dataUpdateable,e.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(e){return t._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}class ht{constructor(e){this.self=e,this.actor=new t.F(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.ch,this.self.removeProtocol=t.ci,this.self.registerRTLTextPlugin=e=>{t.cC.setMethods(e)},this.actor.registerMessageHandler("LDT",((t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e))),this.actor.registerMessageHandler("RDT",((e,i)=>t._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(e,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((e,i)=>t._(this,void 0,void 0,(function*(){return this._getWorkerSource(e,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e))),this.actor.registerMessageHandler("GD",((t,e)=>this._getWorkerSource(t,e.type,e.source).getData())),this.actor.registerMessageHandler("LT",((t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e))),this.actor.registerMessageHandler("RT",((t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e))),this.actor.registerMessageHandler("AT",((t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e))),this.actor.registerMessageHandler("RMT",((t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e))),this.actor.registerMessageHandler("RS",((e,i)=>t._(this,void 0,void 0,(function*(){if(!this.workerSources[e]||!this.workerSources[e][i.type]||!this.workerSources[e][i.type][i.source])return;const t=this.workerSources[e][i.type][i.source];delete this.workerSources[e][i.type][i.source],void 0!==t.removeSource&&t.removeSource(i)})))),this.actor.registerMessageHandler("RM",(e=>t._(this,void 0,void 0,(function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e]})))),this.actor.registerMessageHandler("SR",((e,i)=>t._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((t,e)=>this._syncRTLPluginState(t,e))),this.actor.registerMessageHandler("IS",((e,i)=>t._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((t,e)=>this._setImages(t,e))),this.actor.registerMessageHandler("UL",((e,i)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).update(i.layers,i.removedIds)})))),this.actor.registerMessageHandler("SL",((e,i)=>t._(this,void 0,void 0,(function*(){this._getLayerIndex(e).replace(i)}))))}_setImages(e,i){return t._(this,void 0,void 0,(function*(){this.availableImages[e]=i;for(const t in this.workerSources[e]){const r=this.workerSources[e][t];for(const t in r)r[t].availableImages=i}}))}_syncRTLPluginState(e,i){return t._(this,void 0,void 0,(function*(){return yield t.cC.syncState(i,this.self.importScripts)}))}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let i=this.layerIndexes[t];return i||(i=this.layerIndexes[t]=new e),i}_getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const r={sendAsync:(e,i)=>(e.targetMapId=t,this.actor.sendAsync(e,i))};switch(e){case"vector":this.workerSources[t][e][i]=new o(r,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][i]=new ct(r,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][i]=new this.externalWorkerSourceTypes[e](r,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][i]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new a),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new ht(self)),ht})),i("index",["exports","./shared"],(function(t,e){var i="5.1.0";function r(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let n,o;const a={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t,i,r){const n=requestAnimationFrame(i);t.signal.addEventListener("abort",(()=>{cancelAnimationFrame(n),r(e.c())}))},frameAsync(t){return new Promise(((e,i)=>{this.frame(t,e,i)}))},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(n||(n=document.createElement("a")),n.href=t,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)}};class s{static testProp(t){if(!s.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in s.docStyle)return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){s.docStyle&&s.selectProp&&(s.userSelect=s.docStyle[s.selectProp],s.docStyle[s.selectProp]="none")}static enableDrag(){s.docStyle&&s.selectProp&&(s.docStyle[s.selectProp]=s.userSelect)}static setTransform(t,e){t.style[s.transformProp]=e}static addEventListener(t,e,i,r={}){t.addEventListener(e,i,"passive"in r?r:r.capture)}static removeEventListener(t,e,i,r={}){t.removeEventListener(e,i,"passive"in r?r:r.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",s.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",s.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",s.suppressClickInternal,!0)}),0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,r){const n=i.boundingClientRect;return new e.P((r.clientX-n.left)/i.x-t.clientLeft,(r.clientY-n.top)/i.y-t.clientTop)}static mousePos(t,e){const i=s.getScale(t);return s.getPoint(t,i,e)}static touchPos(t,e){const i=[],r=s.getScale(t);for(let n=0;n<e.length;n++)i.push(s.getPoint(t,r,e[n]));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const e=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),i=e.querySelectorAll("script");for(const t of i)t.remove();return s.clean(e),e.innerHTML}static isPossiblyDangerous(t,e){const i=e.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!i.includes("javascript:")&&!i.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const e=t.children;for(const t of e)s.removeAttributes(t),s.clean(t)}static removeAttributes(t){for(const{name:e,value:i}of t.attributes)s.isPossiblyDangerous(e,i)&&t.removeAttribute(e)}}s.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,s.selectProp=s.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),s.transformProp=s.testProp(["transform","WebkitTransform"]);const l={supported:!1,testSupport:function(t){!u&&h&&(p?d(t):c=t)}};let c,h,u=!1,p=!1;function d(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,h),t.isContextLost())return;l.supported=!0}catch(t){}t.deleteTexture(e),u=!0}var f;"undefined"!=typeof document&&(h=document.createElement("img"),h.onload=()=>{c&&d(c),c=null,p=!0},h.onerror=()=>{u=!0,c=null},h.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let i,r,n,o;t.resetRequestQueue=()=>{i=[],r=0,n=0,o={}},t.addThrottleControl=t=>{const e=n++;return o[e]=t,e},t.removeThrottleControl=t=>{delete o[t],s()},t.getImage=(t,r,n=!0)=>new Promise(((o,a)=>{l.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),i.push({abortController:r,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{a(t)},onSuccess:t=>{o(t)}}),s()}));const a=t=>e._(this,void 0,void 0,(function*(){t.state="running";const{requestParameters:i,supportImageRefresh:n,onError:o,onSuccess:a,abortController:l}=t,h=!1===n&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0));r++;const u=h?c(i,l):e.m(i,l);try{const i=yield u;delete t.abortController,t.state="completed",i.data instanceof HTMLImageElement||e.b(i.data)?a(i):i.data&&a({data:yield(p=i.data,"function"==typeof createImageBitmap?e.d(p):e.f(p)),cacheControl:i.cacheControl,expires:i.expires})}catch(e){delete t.abortController,o(e)}finally{r--,s()}var p})),s=()=>{const t=(()=>{for(const t of Object.keys(o))if(o[t]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=r;e<t&&i.length>0;e++){const t=i.shift();t.abortController.signal.aborted?e--:a(t)}},c=(t,i)=>new Promise(((r,n)=>{const o=new Image,a=t.url,s=t.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!e.s(a))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{o.src="",n(e.c())})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||n(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."))},o.src=a}))}(f||(f={})),f.resetRequestQueue();class m{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function g(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:r,url:n}of t){const t=`${r}${n}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:r,url:n}))}}return e}function _(t,e,i){try{const r=new URL(t);return r.pathname+=`${e}${i}`,r.toString()}catch(e){throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class y{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(t,i,r){const{width:n,height:o}=t,a=!(this.size&&this.size[0]===n&&this.size[1]===o||r),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),a)this.size=[n,o],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:i,y:a}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texSubImage2D(l.TEXTURE_2D,0,i,a,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,i,a,n,o,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function v(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class x extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const t=i.spriteData;i.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,r=i&&i.width||e.data.width,n=i&&i.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((e,i)=>{let r=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(r=!1);this.isLoaded()||r?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})}))}_getImagesForIds(t){const i={};for(const r of t){let t=this.getImage(r);t||(this.fire(new e.k("styleimagemissing",{id:r})),t=this.getImage(r)),t?i[r]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${r}" 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 i}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const i=this.patterns[t],r=this.getImage(t);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new e.I(i,r);this.patterns[t]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new y(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:i,h:r}=e.p(t),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const t in this.patterns){const{bin:i}=this.patterns[t],r=i.x+1,o=i.y+1,a=this.getImage(t).data,s=a.width,l=a.height;e.R.copy(a,n,{x:0,y:0},{x:r,y:o},{width:s,height:l}),e.R.copy(a,n,{x:0,y:l-1},{x:r,y:o-1},{width:s,height:1}),e.R.copy(a,n,{x:0,y:0},{x:r,y:o+l},{width:s,height:1}),e.R.copy(a,n,{x:s-1,y:0},{x:r-1,y:o},{width:1,height:l}),e.R.copy(a,n,{x:0,y:0},{x:r+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const t=this.getImage(i);t||e.w(`Image with ID: "${i}" was not found`),v(t)&&this.updateImage(i,t)}}}const b=1e20;function w(t,e,i,r,n,o,a,s,l){for(let c=e;c<e+r;c++)T(t,i*o+c,o,n,a,s,l);for(let c=i;c<i+n;c++)T(t,c*o+e,1,r,a,s,l)}function T(t,e,i,r,n,o,a){o[0]=0,a[0]=-1e20,a[1]=b,n[0]=t[e];for(let s=1,l=0,c=0;s<r;s++){n[s]=t[e+s*i];const r=s*s;do{const t=o[l];c=(n[s]-n[t]+r-t*t)/(s-t)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=b}for(let s=0,l=0;s<r;s++){for(;a[l+1]<s;)l++;const r=o[l],c=s-r;t[e+s*i]=n[r]+c*c}}class C{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return e._(this,void 0,void 0,(function*(){const e=[];for(const i in t)for(const r of t[i])e.push(this._getAndCacheGlyphsPromise(i,r));const i=yield Promise.all(e),r={};for(const{stack:t,id:e,glyph:n}of i)r[t]||(r[t]={}),r[t][e]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return r}))}_getAndCacheGlyphsPromise(t,i){return e._(this,void 0,void 0,(function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=e.glyphs[i];if(void 0!==r)return{stack:t,id:i,glyph:r};if(r=this._tinySDF(e,t,i),r)return e.glyphs[i]=r,{stack:t,id:i,glyph:r};const n=Math.floor(i/256);if(256*n>65535)throw new Error("glyphs > 65535 not supported");if(e.ranges[n])return{stack:t,id:i,glyph:r};if(!this.url)throw new Error("glyphsUrl is not set");if(!e.requests[n]){const i=C.loadGlyphRange(t,n,this.url,this.requestManager);e.requests[n]=i}const o=yield e.requests[n];for(const t in o)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=o[+t]);return e.ranges[n]=!0,{stack:t,id:i,glyph:o[i]||null}}))}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(t))}_tinySDF(t,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))return;let o=t.tinySDF;if(!o){let e="400";/bold/i.test(i)?e="900":/medium/i.test(i)?e="500":/light/i.test(i)&&(e="200"),o=t.tinySDF=new C.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:e})}const a=o.draw(String.fromCharCode(r));return{id:r,bitmap:new e.o({width:a.width||60,height:a.height||60},a.data),metrics:{width:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:a.glyphAdvance/2||24,isDoubleResolution:!0}}}}C.loadGlyphRange=function(t,i,r,n){return e._(this,void 0,void 0,(function*(){const o=256*i,a=o+255,s=n.transformRequest(r.replace("{fontstack}",t).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield e.l(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${o}-${a}`);const c={};for(const t of e.n(l.data))c[t.id]=t;return c}))},C.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=i;const s=this.size=t+4*e,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${t}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(i),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(r)),c=s+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;f.clearRect(m,m,s,l),f.fillText(t,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(b,0,u),g.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const i=y.data[4*(t*s+e)+3]/255;if(0===i)continue;const r=(t+m)*c+e+m;if(1===i)_[r]=0,g[r]=b;else{const t=.5-i;_[r]=t>0?t*t:0,g[r]=t<0?t*t:0}}w(_,0,0,c,h,c,this.f,this.v,this.z),w(g,m,m,s,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(_[t])-Math.sqrt(g[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class P{constructor(){this.specification=e.v.light.position}possiblyEvaluate(t,i){return e.x(t.expression.evaluate(i))}interpolate(t,i,r){return{x:e.y.number(t.x,i.x,r),y:e.y.number(t.y,i.y,r),z:e.y.number(t.z,i.z,r)}}}let M;class S extends e.E{constructor(t){super(),M=M||new e.q({anchor:new e.D(e.v.light.anchor),position:new P,color:new e.D(e.v.light.color),intensity:new e.D(e.v.light.intensity)}),this._transitionable=new e.T(M),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,i={}){if(!this._validate(e.r,t,i))for(const e in t){const i=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),i):this._transitionable.setValue(e,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r){return(!r||!1!==r.validate)&&e.t(this,t.call(e.u,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.v}))}}const I=new e.q({"sky-color":new e.D(e.v.sky["sky-color"]),"horizon-color":new e.D(e.v.sky["horizon-color"]),"fog-color":new e.D(e.v.sky["fog-color"]),"fog-ground-blend":new e.D(e.v.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.v.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.v.sky["atmosphere-blend"])});class E extends e.E{constructor(t){super(),this._transitionable=new e.T(I),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.z(0))}setSky(t,i={}){if(!this._validate(e.B,t,i)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const e in t){const i=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),i):this._transitionable.setValue(e,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r={}){return!1!==(null==r?void 0:r.validate)&&e.t(this,t.call(e.u,e.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class z{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const r=[];let n=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,a=!0;r.push({left:n,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];n=s*i,s+=l,o=s*i,r.push({left:n,right:o,isDash:a,zeroLength:0===l})}return r}addRoundDash(t,e,i){const r=e/2;for(let e=-i;e<=i;e++){const n=this.width*(this.nextRow+i+e);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),h=Math.min(l,c);let u;const p=e/i*(r+1);if(a.isDash){const t=r-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=r-Math.sqrt(h*h+p*p);this.data[n+s]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const r=this.width*this.nextRow;let n=0,o=t[n];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++n]);const i=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(i,a);this.data[r+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(t,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return e.w("LineAtlas out of space"),null;let o=0;for(let e=0;e<t.length;e++)o+=t[e];if(0!==o){const e=this.width/o,n=this.getDashRanges(t,this.width,e);i?this.addRoundDash(n,e,r):this.addRegularDash(n)}const a={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}const A="maplibre_preloaded_worker_pool";class k{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<k.workerCount;)this.workers.push(new Worker(e.a.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[A]}numActive(){return Object.keys(this.active).length}}const D=Math.floor(a.hardwareConcurrency/2);let R,L;function B(){return R||(R=new k),R}k.workerCount=e.C(globalThis)?Math.max(Math.min(D,3),1):1;class F{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let t=0;t<r.length;t++){const n=new e.F(r[t],i);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const i=[];for(const r of this.actors)i.push(r.sendAsync({type:t,data:e}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(const i of this.actors)i.registerMessageHandler(t,e)}}function O(){return L||(L=new F(B(),e.G),L.registerMessageHandler("GR",((t,i,r)=>e.m(i,r)))),L}function j(t,i){const r=e.H();return e.J(r,r,[1,1,0]),e.K(r,r,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?e.L(r,r,t.calculatePosMatrix(i.toUnwrapped())):r}function V(t,e,i,r,n,o){var a;const s=function(t,e,i){if(t)for(const r of t){const t=e[r];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const r=e[t];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!==(a=null==n?void 0:n.layers)&&void 0!==a?a:null,e,t.id),l=o.maxPitchScaleFactor(),c=t.tilesIn(r,l,s);c.sort(N);const h=[];for(const r of c)h.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,i,t._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,l,j(t.transform,r.tileID))});return function(t,e){for(const i in t)for(const r of t[i])q(r,e);return t}(function(t){const e={},i={};for(const r of t){const t=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in t){const r=t[i],n=o[i]=o[i]||{},a=e[i]=e[i]||[];for(const t of r)n[t.featureIndex]||(n[t.featureIndex]=!0,a.push(t))}}return e}(h),t)}function N(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function q(t,e){const i=t.feature,r=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function Z(t,i,r){return e._(this,void 0,void 0,(function*(){let n=t;if(t.url?n=(yield e.h(i.transformRequest(t.url,"Source"),r)).data:yield a.frameAsync(r),!n)return null;const o=e.M(e.e(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((t=>t.id))),o}))}class U{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}extend(t){const i=this._sw,r=this._ne;let n,o;if(t instanceof e.N)n=t,o=t;else{if(!(t instanceof U))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(U.convert(t)):this.extend(e.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.N.convert(t)):this;if(n=t._sw,o=t._ne,!n||!o)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new e.N(n.lng,n.lat),this._ne=new e.N(o.lng,o.lat)),this}getCenter(){return new e.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 e.N(this.getWest(),this.getNorth())}getSouthEast(){return new e.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(t){const{lng:i,lat:r}=e.N.convert(t);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return t instanceof U?t:t?new U(t):t}static fromLngLat(t,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*t.lat);return new U(new e.N(t.lng-n,t.lat-r),new e.N(t.lng+n,t.lat+r))}adjustAntiMeridian(){const t=new e.N(this._sw.lng,this._sw.lat),i=new e.N(this._ne.lng,this._ne.lat);return new U(t,t.lng>i.lng?new e.N(i.lng+360,i.lat):i)}}class G{constructor(t,e,i){this.bounds=U.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),r=Math.floor(e.O(this.bounds.getWest())*i),n=Math.floor(e.Q(this.bounds.getNorth())*i),o=Math.ceil(e.O(this.bounds.getEast())*i),a=Math.ceil(e.Q(this.bounds.getSouth())*i);return t.x>=r&&t.x<o&&t.y>=n&&t.y<a}}class $ extends e.E{constructor(t,i,r,n){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.M(i,["url","scheme","tileSize","promoteId"])),this._options=e.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Z(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(e.e(this,t),t.bounds&&(this.tileBounds=new G(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.j(t))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise(((e,i)=>{t.reloadPromise={resolve:e,reject:i}}))}else t.actor=this.dispatcher.getActor(),r="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:r,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}}))}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class H extends e.E{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},i),e.e(this,e.M(i,["url","scheme","tileSize"]))}load(){return e._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Z(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(e.e(this,i),i.bounds&&(this.tileBounds=new G(i.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this.fire(new e.j(t))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield f.getImage(this.map._requestManager.transformRequest(e,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const e=this.map.painter.context,r=e.gl,n=i.data;t.texture=this.map.painter.getTileTexture(n.width),t.texture?t.texture.update(n,{useMipmap:!0}):(t.texture=new y(e,n,r.RGBA,{useMipmap:!0}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class X extends H{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const i=yield f.getImage(r,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){const r=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const n=e.b(r)&&e.U()?r:yield this.readImageNow(r),o={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:"LDT",data:o});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}readImageNow(t){return e._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&e.V()){const i=t.width+2,r=t.height+2;try{return new e.R({width:i,height:r},yield e.W(t,-1,-1,i,r))}catch(t){}}return a.getImageData(t,1)}))}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,a=(i.x+1+r)%r,s=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.S(t.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new e.S(t.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new e.S(t.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new e.S(t.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new e.S(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.S(t.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}class W extends e.E{constructor(t,i,r,n){super(),this.id=t,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=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=e.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=e.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:e.X,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.X,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(t){return t*(e.X/this.tileSize)}load(){return e._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return e._(this,void 0,void 0,(function*(){const t=e.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}_updateWorkerData(t){return e._(this,void 0,void 0,(function*(){const i=e.e({type:this.type},this.workerOptions);t?i.dataDiff=t:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(a.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new e.k("dataloading",{dataType:"source"}));try{const t=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||t.abandoned)return void this.fire(new e.k("dataabort",{dataType:"source"}));let r=null;t.resourceTiming&&t.resourceTiming[this.id]&&(r=t.resourceTiming[this.id].slice(0));const n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&e.e(n,{resourceTiming:r}),this.fire(new e.k("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new e.k("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(t){if(this._pendingLoads--,this._removed)return void this.fire(new e.k("dataabort",{dataType:"source"}));this.fire(new e.j(t))}}))}loaded(){return 0===this._pendingLoads}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const r=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(r,this.map.painter,"RT"===e)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.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 e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class K extends e.E{constructor(t,e,i,r){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(t){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield f.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new e.j(t))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const i=t.map(e.Y.fromLngLat);var r;return this.tileID=function(t){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const e of t)i=Math.min(i,e.x),r=Math.min(r,e.y),n=Math.max(n,e.x),o=Math.max(o,e.y);const a=Math.max(n-i,o-r),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new e.Z(s,Math.floor((i+n)/2*l),Math.floor((r+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((t=>this.tileID.getTilePoint(t)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this.texture||(this.texture=new y(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Y extends K{constructor(t,e,i,r){super(t,e,i,r),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.a0(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new e.j(t))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.j(new e.$(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new y(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new e.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 J extends K{constructor(t,i,r,n){super(t,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new e.j(new e.$(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.j(new e.$(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.j(new e.$(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.j(new e.$(`sources.${t}`,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 e.j(new e.$(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return e._(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 e.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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new y(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const Q={},tt=t=>{switch(t){case"geojson":return W;case"image":return K;case"raster":return H;case"raster-dem":return X;case"vector":return $;case"video":return Y;case"canvas":return J}return Q[t]},et="RTLPluginLoaded";class it extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=O()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((t=>{throw this.status="error",t}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return e._(this,arguments,void 0,(function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=a.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return e._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.k(et))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let rt=null;function nt(){return rt||(rt=new it),rt}class ot{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a1(),this.uses=0,this.tileSize=i,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(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,i,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const r of t){const t=r.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=r}}return i}(t.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a3){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a3&&i.hasRTLText){this.hasRTLText=!0,nt().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.a2}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new y(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new y(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,o,a,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(t,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;const s=e.a4(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<a.length;i++){const n=a.feature(i);if(s.needGeometry){const t=e.a5(n,!0);if(!s.filter(new e.z(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new e.z(this.tileID.overscaledZ),n))continue;const p=r.getId(n,o),d=new e.a6(n,l,c,h,p);d.tile=u,t.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const i=e.a7(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const r=this.expirationTime-i;r?this.expirationTime=t+Math.max(r,3e4):e=!0}else e=!0;e?(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(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!e.style.hasLayer(r))continue;const n=this.buckets[r],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=i[o],s=t[o];if(!a||!s||0===Object.keys(s).length)continue;n.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.now()+t}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class at{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:e,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(t,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t)}}class st{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,r){const n=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][n]=this.stateChanges[t][n]||{},e.e(this.stateChanges[t][n],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==n&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][n]){this.deletedStates[t][n]={};for(const e in this.state[t][n])r[e]||(this.deletedStates[t][n][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][e]&&delete this.deletedStates[t][n][e]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(t,i){const r=String(i),n=e.e({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return{};for(const t in e)delete n[t]}return n}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,i){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.e(this.state[t][r],this.stateChanges[t][r]),i[r]=this.state[t][r];r[t]=i}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e]}r[t]=r[t]||{},e.e(r[t],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].setFeatureState(r,i)}}function lt(t,e,i){const r=e.intersectsFrustum(t);if(!i)return r;const n=e.intersectsPlane(i);return 0===r||0===n?0:2===r&&2===n?2:1}function ct(t,i,r,n,o){let a=t;const s=Math.atan(i/r),l=Math.hypot(i,r);return a=t+e.a8(n/l/Math.max(.5,Math.cos(e.aa(o/2)))),a+=1*e.a8(Math.cos(s))/2,a+=e.ab(t-a,-0,0),a}function ht(t,i){const r=(i.roundZoom?Math.round:Math.floor)(t.zoom+e.a8(t.tileSize/i.tileSize));return Math.max(0,r)}function ut(t,i){const r=t.getCameraFrustum(),n=t.getClippingPlane(),o=t.screenPointToMercatorCoordinate(t.getCameraPoint()),a=e.Y.fromLngLat(t.center,t.elevation);o.z=a.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;const s=t.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(t,i),c=ht(t,i),h=i.minzoom||0,u=void 0!==i.maxzoom?i.maxzoom:t.maxZoom,p=Math.min(Math.max(0,c),u),d=Math.pow(2,p),f=[d*o.x,d*o.y,0],m=[d*a.x,d*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),_=Math.abs(a.z-o.z),y=Math.hypot(g,_),v=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),x=[],b=[];if(t.renderWorldCopies&&s.allowWorldCopies())for(let t=1;t<=3;t++)x.push(v(-t)),x.push(v(t));for(x.push(v(0));x.length>0;){const d=x.pop(),g=d.x,v=d.y;let w=d.fullyVisible;const T={x:g,y:v,z:d.zoom},C=s.getTileAABB(T,d.wrap,t.elevation,i);if(!w){const t=lt(r,C,n);if(0===t)continue;w=2===t}const P=s.distanceToTile2d(o.x,o.y,T,C);let M=c;l&&(M=(i.calculateTileZoom||ct)(t.zoom+e.a8(t.tileSize/i.tileSize),P,_,y,t.fov)),M=(i.roundZoom?Math.round:Math.floor)(M),M=Math.max(0,M);const S=Math.min(M,u);if(d.wrap=s.getWrap(a,T,d.wrap),d.zoom>=S){if(d.zoom<h)continue;const t=p-d.zoom,r=f[0]-.5-(g<<t),n=f[1]-.5-(v<<t),o=i.reparseOverscaled?Math.max(d.zoom,M):d.zoom;b.push({tileID:new e.S(d.zoom===u?o:d.zoom,d.wrap,d.zoom,g,v),distanceSq:e.a9([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(r*r+n*n)})}else for(let t=0;t<4;t++)x.push({zoom:d.zoom+1,x:(g<<1)+t%2,y:(v<<1)+(t>>1),wrap:d.wrap,fullyVisible:w})}return b.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}class pt extends e.E{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(t=>this._dataHandler(t))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((t,e,i,r)=>{const n=new(tt(e.type))(t,e,i,r);if(n.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,e,i,this),this._tiles={},this._cache=new at(0,(t=>this._unloadTile(t))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new st,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,i,r){return e._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,i,r)}catch(i){t.state="errored",404!==i.status?this._source.fire(new e.j(i,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(dt).map((t=>t.key))}getRenderableIds(t){const i=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&i.push(this._tiles[e]);return t?i.sort(((t,i)=>{const r=t.tileID,n=i.tileID,o=new e.P(r.canonical.x,r.canonical.y)._rotate(-this.transform.bearingInRadians),a=new e.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return r.overscaledZ-n.overscaledZ||a.y-o.y||a.x-o.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(dt).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(t){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)(t||"errored"!==this._tiles[e].state)&&this._reloadTile(e,"reloading")}}_reloadTile(t,i){return e._(this,void 0,void 0,(function*(){const e=this._tiles[t];e&&("loading"!==e.state&&(e.state=i),yield this._loadTile(e,t,i))}))}_tileLoaded(t,i,r){t.timeAdded=a.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){const e=this.getTileByID(n);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,n=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]||t[s.canonical.key]){r[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);if(r)return r}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}_updateCoveredAndRetainedTiles(t,e,i,r,n,o){const s={},l={},c=Object.keys(t),h=a.now();for(const i of c){const r=t[i],n=this._tiles[i];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=h)continue;const o=this.findLoadedParent(r,e),a=this.findLoadedSibling(r),c=o||a||null;c&&(this._addTile(c.tileID),s[c.tileID.key]=c.tileID),l[i]=r}this._retainLoadedChildren(l,r,i,t);for(const e in s)t[e]||(this._coveredTiles[e]=!0,t[e]=s[e]);if(o){const e={},i={};for(const t of n)this._tiles[t.key].hasData()?e[t.key]=t:i[t.key]=t;for(const r in i){const n=i[r].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(e[n[0].key]=t[n[0].key]=n[0],e[n[1].key]=t[n[1].key]=n[1],e[n[2].key]=t[n[2].key]=n[2],e[n[3].key]=t[n[3].key]=n[3],delete i[r])}for(const r in i){const n=i[r],o=this.findLoadedParent(n,this._source.minzoom),a=this.findLoadedSibling(n),s=o||a||null;if(s){e[s.tileID.key]=t[s.tileID.key]=s.tileID;for(const t in e)e[t].isChildOf(s.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.S(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(r=ut(t,{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:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((t=>this._source.hasTile(t))))):r=[];const n=ht(t,this._source),o=Math.max(n-pt.maxOverzooming,this._source.minzoom),a=Math.max(n+pt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of r)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}r=r.concat(Object.values(t))}const s=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new e.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);ft(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,n,r,i);for(const t in l)this._tiles[t].clearFadeHold();const c=e.ac(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var i;const r={},n={},o=Math.max(e-pt.maxOverzooming,this._source.minzoom),a=Math.max(e+pt.maxUnderzooming,this._source.minzoom),s={};for(const i of t){const t=this._addTile(i);r[i.key]=i,t.hasData()||e<this._source.maxzoom&&(s[i.key]=i)}this._retainLoadedChildren(s,e,a,r);for(const a of t){let t=this._tiles[a.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=a.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){r[t.key]=t;continue}}else{const t=a.children(this._source.maxzoom);if(r[t[0].key]&&r[t[1].key]&&r[t[2].key]&&r[t[3].key])continue}let s=t.wasRequested();for(let e=a.overscaledZ-1;e>=o;--e){const o=a.scaledTo(e);if(n[o.key])break;if(n[o.key]=!0,t=this.getTile(o),!t&&s&&(t=this._addTile(o)),t){const e=t.hasData();if((e||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||s)&&(r[o.key]=o),s=t.wasRequested(),e)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,i=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=i;return i||(i=new ot(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,r||this._source.fire(new e.k("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){const e=t.sourceDataType;"source"===t.dataType&&"metadata"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===e&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,r){const n=[],o=this.transform;if(!o)return n;const a=r?o.getCameraQueryGeometry(t):t,s=t.map((t=>o.screenPointToMercatorCoordinate(t,this.terrain))),l=a.map((t=>o.screenPointToMercatorCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,p=-1/0,d=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let t=0;t<c.length;t++){const r=this._tiles[c[t]];if(r.holdingForFade())continue;const a=r.tileID,f=Math.pow(2,o.zoom-r.tileID.overscaledZ),m=i*r.queryPadding*e.X/r.tileSize/f,g=[a.getTilePoint(new e.Y(h,u)),a.getTilePoint(new e.Y(p,d))];if(g[0].x-m<e.X&&g[0].y-m<e.X&&g[1].x+m>=0&&g[1].y+m>=0){const t=s.map((t=>a.getTilePoint(t))),e=l.map((t=>a.getTilePoint(t)));n.push({tile:r,tileID:a,queryGeometry:t,cameraQueryGeometry:e,scale:f})}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));return this.transform&&this.transform.populateCache(e),e}hasTransition(){if(this._source.hasTransition())return!0;if(ft(this._source.type)){const t=a.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter((i=>!i.hasDependency(t,e)))}}function dt(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function ft(t){return"raster"===t||"image"===t||"video"===t}pt.maxOverzooming=10,pt.maxUnderzooming=3;class mt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.ab(t,0,1);let i=1,r=this._distances[i];const n=t*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,a=this._distances[o],s=r-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function gt(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class _t{constructor(t,e,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,i,r,n,o){this.circleCells[n].push(o)}_query(t,e,i,r,n,o,a){if(i<0||t>this.width||r<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t<this.boxKeys.length;t++)s.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++){const e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}else this._forEachCell(t,e,i,r,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,o){return this._query(t,e,i,r,!0,n,o).length>0}hitTestCircle(t,e,i,r,n){const o=t-i,a=t+i,s=e-i,l=e+i;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(t,e,i,r,n,o,a,s){const{seenUids:l,hitTest:c,overlapMode:h}=a,u=this.boxCells[n];if(null!==u){const n=this.bboxes;for(const a of u)if(!l.box[a]){l.box[a]=!0;const u=4*a,p=this.boxKeys[a];if(t<=n[u+2]&&e<=n[u+3]&&i>=n[u+0]&&r>=n[u+1]&&(!s||s(p))&&(!c||!gt(h,p.overlapMode))&&(o.push({key:p,x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const u=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],t,e,i,r)&&(!s||s(p))&&(!c||!gt(h,p.overlapMode))){const t=n[u],e=n[u+1],i=n[u+2];if(o.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,o,a,s){const{circle:l,seenUids:c,overlapMode:h}=a,u=this.boxCells[n];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!s||s(r))&&!gt(h,r.overlapMode))return o.push(!0),!0}}const p=this.circleCells[n];if(null!==p){const t=this.circles;for(const e of p)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!s||s(r))&&!gt(h,r.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,r,n,o,a,s){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(n.call(this,t,e,i,r,this.xCellCount*l+p,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,o){const a=r-t,s=n-e,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,i,r,n,o,a){const s=(o-r)/2,l=Math.abs(t-(r+s));if(l>s+i)return!1;const c=(a-n)/2,h=Math.abs(e-(n+c));if(h>c+i)return!1;if(l<=s||h<=c)return!0;const u=l-s,p=h-c;return u*u+p*p<=i*i}}function yt(t,i,n){const o=e.H();if(!t){const{vecSouth:t,vecEast:e}=xt(i),n=r();n[0]=e[0],n[1]=e[1],n[2]=t[0],n[3]=t[1],a=n,(p=(l=(s=n)[0])*(u=s[3])-(h=s[2])*(c=s[1]))&&(a[0]=u*(p=1/p),a[1]=-c*p,a[2]=-h*p,a[3]=l*p),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var a,s,l,c,h,u,p;return e.K(o,o,[1/n,1/n,1]),o}function vt(t,i,r,n){if(t){const t=e.H();if(!i){const{vecSouth:e,vecEast:i}=xt(r);t[0]=i[0],t[1]=i[1],t[4]=e[0],t[5]=e[1]}return e.K(t,t,[n,n,1]),t}return r.pixelsToClipSpaceMatrix}function xt(t){const i=Math.cos(t.rollInRadians),r=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),o=Math.cos(t.bearingInRadians),a=Math.sin(t.bearingInRadians),s=e.ad();s[0]=-o*n*r-a*i,s[1]=-a*n*r+o*i;const l=e.ae(s);l<1e-9?e.af(s):e.ag(s,s,1/l);const c=e.ad();c[0]=o*n*i-a*r,c[1]=a*n*i+o*r;const h=e.ae(c);return h<1e-9?e.af(c):e.ag(c,c,1/h),{vecEast:c,vecSouth:s}}function bt(t,i,r,n){let o;n?(o=[t,i,n(t,i),1],e.al(o,o,r)):(o=[t,i,0,1],Ot(o,o,r));const a=o[3];return{point:new e.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function wt(t,e){return.5+t/e*.5}function Tt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function Ct(t,i,r,n,o,a,s,l,c,h,u,p,d){const f=r?t.textSizeData:t.iconSizeData,m=e.ah(f,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],_=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();const y=t.lineVertexArray,v=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=i.transform.width/i.transform.height;let b=!1;for(let r=0;r<v.length;r++){const w=v.get(r);if(w.hidden||w.writingMode===e.ai.vertical&&!b){Ft(w.numGlyphs,_);continue}b=!1;const T=new e.P(w.anchorX,w.anchorY),C={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:T,unwrappedTileID:c,width:h,height:u,translation:p},P=kt(w.anchorX,w.anchorY,C);if(!Tt(P.point,g)){Ft(w.numGlyphs,_);continue}const M=wt(i.transform.cameraToCenterDistance,P.signedDistanceFromCamera),S=e.aj(f,m,w),I=a?S*i.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/M:S*M,E=St({projectionContext:C,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:I,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:x,rotateToLine:l});b=E.useVertical,(E.notEnoughRoom||b||E.needsFlipping&&St({projectionContext:C,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:I,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:x,rotateToLine:l}).notEnoughRoom)&&Ft(w.numGlyphs,_)}r?t.text.dynamicLayoutVertexBuffer.updateData(_):t.icon.dynamicLayoutVertexBuffer.updateData(_)}function Pt(t,e,i,r,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,h=o.lineStartIndex+o.lineLength,u=e.getoffsetX(o.glyphStartIndex),p=e.getoffsetX(l-1),d=Lt(t*u,i,r,n,o.segment,c,h,s,a);if(!d)return null;const f=Lt(t*p,i,r,n,o.segment,c,h,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}:null}function Mt(t,i,r,n){return t===e.ai.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(t===e.ai.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function St(t){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:h,rotateToLine:u}=t,p=o/24,d=n.lineOffsetX*p,f=n.lineOffsetY*p;let m;if(n.numGlyphs>1){const t=n.glyphStartIndex+n.numGlyphs,e=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Pt(p,l,d,f,a,n,u,i);if(!c)return{notEnoughRoom:!0};const g=At(c.first.point.x,c.first.point.y,i,r),_=At(c.last.point.x,c.last.point.y,i,r);if(s&&!a){const t=Mt(n.writingMode,g,_,h);if(t)return t}m=[c.first];for(let r=n.glyphStartIndex+1;r<t-1;r++)m.push(Lt(p*l.getoffsetX(r),d,f,a,n.segment,e,o,i,u));m.push(c.last)}else{if(s&&!a){const t=zt(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,o=n.lineStartIndex+n.segment+1,a=new e.P(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),s=zt(a.x,a.y,i),l=s.signedDistanceFromCamera>0?s.point:It(i.tileAnchorPoint,a,t,1,i),c=At(t.x,t.y,i,r),u=At(l.x,l.y,i,r),p=Mt(n.writingMode,c,u,h);if(p)return p}const t=Lt(p*l.getoffsetX(n.glyphStartIndex),d,f,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,u);if(!t||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(const t of m)e.ak(c,t.point,t.angle);return{}}function It(t,e,i,r,n){const o=t.add(t.sub(e)._unit()),a=zt(o.x,o.y,n).point,s=i.sub(a);return i.add(s._mult(r/s.mag()))}function Et(t,i,r){const n=i.projectionCache;if(n.projections[t])return n.projections[t];const o=new e.P(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),a=zt(o.x,o.y,i);if(a.signedDistanceFromCamera>0)return n.projections[t]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=t-r.direction;return It(0===r.distanceFromAnchor?i.tileAnchorPoint:new e.P(i.lineVertexArray.getx(s),i.lineVertexArray.gety(s)),o,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function zt(t,e,i){const r=t+i.translation[0],n=e+i.translation[1];let o;return i.pitchWithMap?(o=bt(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height),o}function At(t,i,r,n){if(r.pitchWithMap){const o=[t,i,0,1];return e.al(o,o,n),r.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],r.unwrappedTileID,r.getElevation).point}return{x:t/r.width*2-1,y:i/r.height*2-1}}function kt(t,e,i){return i.transform.projectTileCoordinates(t,e,i.unwrappedTileID,i.getElevation)}function Dt(t,e,i){return t._unit()._perp()._mult(e*i)}function Rt(t,i,r,n,o,a,s,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const h=r.add(i);if(t+c.direction<n||t+c.direction>=o)return l.projectionCache.offsets[t]=h,h;const u=Et(t+c.direction,l,c),p=Dt(u.sub(r),s,c.direction),d=r.add(p),f=u.add(p);return l.projectionCache.offsets[t]=e.am(a,h,d,f)||h,l.projectionCache.offsets[t]}function Lt(t,e,i,r,n,o,a,s,l){const c=r?t-e:t+e;let h=c>0?1:-1,u=0;r&&(h*=-1,u=Math.PI),h<0&&(u+=Math.PI);let p,d=h>0?o+n:o+n+1;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=zt(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let f,m,g=p,_=p,y=0,v=0;const x=Math.abs(c),b=[];let w;for(;y+v<=x;){if(d+=h,d<o||d>=a)return null;y+=v,_=g,m=f;const t={absOffsetX:x,direction:h,distanceFromAnchor:y,previousVertex:_};if(g=Et(d,s,t),0===i)b.push(_),w=g.sub(_);else{let e;const r=g.sub(_);e=0===r.mag()?Dt(Et(d+h,s,t).sub(g),i,h):Dt(r,i,h),m||(m=_.add(e)),f=Rt(d,e,g,o,a,m,i,s,t),b.push(m),w=f.sub(m)}v=w.mag()}const T=w._mult((x-y)/v)._add(m||_),C=u+Math.atan2(g.y-_.y,g.x-_.x);return b.push(T),{point:T,angle:l?C:0,path:b}}const Bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ft(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(Bt,3*t)}}function Ot(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}const jt=100;class Vt{constructor(t,e=new _t(t.width+200,t.height+200,25),i=new _t(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+jt,this.screenBottomBoundary=t.height+jt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,r,n,o,a,s,l,c,h,u){const p=this.projectAndGetPerspectiveRatio(t.anchorPointX+s[0],t.anchorPointY+s[1],n,c,u),d=i*p.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(t,d,r,n,o,a,s,p,c,h,u);else{const e=p.x+(h?h.x*d:0),i=p.y+(h?h.y*d:0);f={allPointsOccluded:!1,box:[e+t.x1*d,i+t.y1*d,e+t.x2*d,i+t.y2*d]}}const[m,g,_,y]=f.box,v=o?f.allPointsOccluded:p.isOccluded;let x=v;return x||(x=p.perspectiveRatio<this.perspectiveRatioCutoff),x||(x=!this.isInsideGrid(m,g,_,y)),x||"always"!==e&&this.grid.hitTest(m,g,_,y,e,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:v}}placeCollisionCircles(t,i,r,n,o,a,s,l,c,h,u,p,d,f){const m=[],g=new e.P(i.anchorX,i.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),y=(c?o*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,a)/_:o*_)/e.as,v={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:r,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:d},x=Pt(y,n,i.lineOffsetX*y,i.lineOffsetY*y,!1,i,!1,v);let b=!1,w=!1,T=!0;if(x){const i=.5*u*_+p,r=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new mt,a=x.first,s=x.last;let d=[];for(let t=a.path.length-1;t>=1;t--)d.push(a.path[t]);for(let t=1;t<s.path.length;t++)d.push(s.path[t]);const f=2.5*i;if(c){const t=this.projectPathToScreenSpace(d,v);d=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let g=[];if(d.length>0){const t=d[0].clone(),i=d[0].clone();for(let e=1;e<d.length;e++)t.x=Math.min(t.x,d[e].x),t.y=Math.min(t.y,d[e].y),i.x=Math.max(i.x,d[e].x),i.y=Math.max(i.y,d[e].y);g=t.x>=r.x&&i.x<=n.x&&t.y>=r.y&&i.y<=n.y?[d]:i.x<r.x||t.x>n.x||i.y<r.y||t.y>n.y?[]:e.ao([d],r.x,r.y,n.x,n.y)}for(const e of g){o.reset(e,.25*i);let r=0;r=o.length<=.5*i?1:Math.ceil(o.paddedLength/f)+1;for(let e=0;e<r;e++){const n=e/Math.max(r-1,1),a=o.lerp(n),s=a.x+jt,c=a.y+jt;m.push(s,c,i,0);const u=s-i,p=c-i,d=s+i,f=c+i;if(T=T&&this.isOffscreen(u,p,d,f),w=w||this.isInsideGrid(u,p,d,f),"always"!==t&&this.grid.hitTestCircle(s,c,i,t,h)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:b}}projectPathToScreenSpace(t,i){const r=function(t,i){const r=e.H();return e.an(r,i.pitchedLabelPlaneMatrix),t.map((t=>{const e=bt(t.x,t.y,r,i.getElevation),n=i.transform.projectTileCoordinates(e.point.x,e.point.y,i.unwrappedTileID,i.getElevation);return n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height,n}))}(t,i);return function(t){let e=0,i=0,r=0,n=0;for(let o=0;o<t.length;o++)t[o].isOccluded?(r=o+1,n=0):(n++,n>i&&(i=n,e=r));return t.slice(e,e+i)}(r)}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,a=-1/0;for(const s of t){const t=new e.P(s.x+jt,s.y+jt);r=Math.min(r,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),a=Math.max(a,t.y),i.push(t)}const s=this.grid.query(r,n,o,a).concat(this.ignoredGrid.query(r,n,o,a)),l={},c={};for(const t of s){const r=t.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.ap(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(t,e,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,o){const a=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)a.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(t,i,r,n,o){if(o){let r;n?(r=[t,i,n(t,i),1],e.al(r,r,o)):(r=[t,i,0,1],Ot(r,r,o));const a=r[3];return{x:(r[0]/a+1)/2*this.transform.width+jt,y:(-r[1]/a+1)/2*this.transform.height+jt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const e=this.transform.projectTileCoordinates(t,i,r,n);return{x:(e.point.x+1)/2*this.transform.width+jt,y:(1-e.point.y)/2*this.transform.height+jt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/e.signedDistanceFromCamera*.5,isOccluded:e.isOccluded,signedDistanceFromCamera:e.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,i,r){const n=this.transform.projectTileCoordinates(t,e,i,r);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,i,r){return i<jt||t>=this.screenRightBoundary||r<jt||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.aq([]);return e.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,r,n,o,a,s,l,c,h,u){let p=1,d=0,f=0,m=1;const g=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(a&&!o){const t=this.projectAndGetPerspectiveRatio(g+1,_,n,c,u),e=t.x-l.x,i=Math.atan((t.y-l.y)/e)+(e<0?Math.PI:0),r=Math.sin(i),o=Math.cos(i);p=o,d=r,f=-r,m=o}else if(!a&&o){const t=xt(this.transform);p=t.vecEast[0],d=t.vecEast[1],f=t.vecSouth[0],m=t.vecSouth[1]}let y=l.x,v=l.y,x=i;o&&(y=g,v=_,x=Math.pow(2,-(this.transform.zoom-r.overscaledZ)),x*=this.transform.getPitchedTextCorrection(g,_,n),h||(x*=e.ab(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),h&&(y+=p*h.x*x+f*h.y*x,v+=d*h.x*x+m*h.y*x);const b=t.x1*x,w=t.x2*x,T=(b+w)/2,C=t.y1*x,P=t.y2*x,M=(C+P)/2,S=[{offsetX:b,offsetY:C},{offsetX:T,offsetY:C},{offsetX:w,offsetY:C},{offsetX:w,offsetY:M},{offsetX:w,offsetY:P},{offsetX:T,offsetY:P},{offsetX:b,offsetY:P},{offsetX:b,offsetY:M}];let I=[];for(const{offsetX:t,offsetY:i}of S)I.push(new e.P(y+p*t+f*i,v+d*t+m*i));let E=!1;if(o){const t=I.map((t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,c,u)));E=t.some((t=>!t.isOccluded)),I=t.map((t=>new e.P(t.x,t.y)))}else E=!0;return{box:e.ar(I),allPointsOccluded:!E}}}class Nt{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class qt{constructor(t,e,i,r,n){this.text=new Nt(t?t.text:null,e,i,n),this.icon=new Nt(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Zt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Ut{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Gt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function $t(t,i,r,n,o){const{horizontalAlign:a,verticalAlign:s}=e.ay(t);return new e.P(-(a-.5)*i+n[0]*o,-(s-.5)*r+n[1]*o)}class Ht{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Vt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Gt(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(i,r)=>e.getElevation(t,i,r):null}getBucketParts(t,i,r,n){const o=r.getBucket(i),a=r.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=r.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,h=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.X,p=r.tileID.toUnwrapped(),d="map"===l.get("text-rotation-alignment"),f=e.at(r,1,this.transform.zoom),m=e.au(this.collisionIndex.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),g=e.au(this.collisionIndex.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),_=yt(d,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new Ut(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);const y={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatrix:_,scale:h,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.ah(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const e of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y,v,x){const b=e.av[t.textAnchor],w=[t.textOffset0,t.textOffset1],T=$t(b,r,n,w,o),C=this.collisionIndex.placeCollisionBox(i,p,l,c,h,s,a,g,u.predicate,v,T,x);if((!y||this.collisionIndex.placeCollisionBox(y,p,l,c,h,s,a,_,u.predicate,v,T,x).placeable)&&C.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:w,width:r,height:n,anchor:b,textBoxScale:o,prevAnchor:t},this.markUsedJustification(f,b,d,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,d),this.placedOrientations[d.crossTileID]=m),{shift:T,placedGlyphBoxes:C}}}placeLayerBucketPart(t,i,r){const{bucket:n,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:h,holdingForFade:u,collisionBoxArray:p,partiallyEvaluatedTextSize:d,collisionGroup:f}=t.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=e.aw(o,"text-overlap","text-allow-overlap"),y="always"===_,v=e.aw(o,"icon-overlap","icon-allow-overlap"),x="always"===v,b="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),C="viewport-y"===o.get("symbol-z-order"),P=y&&(x||!n.hasIconData()||g),M=x&&(y||!n.hasTextData()||m);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);const S=this.retainedQueryData[n.bucketInstanceId].tileID,I=this._getTerrainElevationFunc(S),E=this.transform.getFastPathSimpleProjectionMatrix(S),z=(t,p,x)=>{var C,z;if(i[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new Zt(!1,!1,!1));let A=!1,k=!1,D=!0,R=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},B={box:null,placeable:!1,offscreen:null},F=null,O=null,j=null,V=0,N=0,q=0;p.textFeatureIndex?V=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(V=t.featureIndex),p.verticalTextFeatureIndex&&(N=p.verticalTextFeatureIndex);const Z=p.textBox;if(Z){const i=i=>{let r=e.ai.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,r=e,this.markUsedOrientation(n,r,t))}return r},o=(i,r)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const t of n.writingModes)if(t===e.ai.vertical?(L=r(),B=L):L=i(),L&&L.placeable)break}else L=i()},c=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===c){const r=(e,i)=>{const r=this.collisionIndex.placeCollisionBox(e,_,h,S,l,w,b,a,f.predicate,I,void 0,E);return r&&r.placeable&&(this.markUsedOrientation(n,i,t),this.placedOrientations[t.crossTileID]=i),r};o((()=>r(Z,e.ai.horizontal)),(()=>{const i=p.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?r(i,e.ai.vertical):{box:null,offscreen:null}})),i(L&&L.placeable)}else{let d=e.av[null===(z=null===(C=this.prevPlacement)||void 0===C?void 0:C.variableOffsets[t.crossTileID])||void 0===z?void 0:z.anchor];const m=(e,i,o)=>{const p=e.x2-e.x1,m=e.y2-e.y1,g=t.textBoxScale,y=T&&"never"===v?i:null;let x=null,C="never"===_?1:2,P="never";d&&C++;for(let i=0;i<C;i++){for(let i=c;i<u;i++){const r=n.textAnchorOffsets.get(i);if(d&&r.textAnchor!==d)continue;const c=this.attemptAnchorPlacement(r,e,p,m,g,b,w,h,S,l,f,P,t,n,o,a,s,y,I);if(c&&(x=c.placedGlyphBoxes,x&&x.placeable))return A=!0,R=c.shift,x}d?d=null:P=_}return r&&!x&&(x={box:this.collisionIndex.placeCollisionBox(Z,"always",h,S,l,w,b,a,f.predicate,I,void 0,E).box,offscreen:!1,placeable:!1,occluded:!1}),x};o((()=>m(Z,p.iconBox,e.ai.horizontal)),(()=>{const i=p.verticalTextBox;return n.allowVerticalPlacement&&(!L||!L.placeable)&&t.numVerticalGlyphVertices>0&&i?m(i,p.verticalIconBox,e.ai.vertical):{box:null,occluded:!0,offscreen:null}})),L&&(A=L.placeable,D=L.offscreen);const g=i(L&&L.placeable);if(!A&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(n,e.anchor,t,g))}}}if(F=L,A=F&&F.placeable,D=F&&F.offscreen,t.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),s=e.aj(n.textSizeData,d,i),h=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(_,i,n.lineVertexArray,n.glyphOffsetArray,s,l,c,r,w,f.predicate,t.collisionCircleDiameter,h,a,I),O.circles.length&&O.collisionDetected&&!r&&e.w("Collisions detected, but collision boxes are not shown"),A=y||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(p.iconFeatureIndex&&(q=p.iconFeatureIndex),p.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,v,h,S,l,w,b,s,f.predicate,I,T&&R?R:void 0,E);B&&B.placeable&&p.verticalIconBox?(j=t(p.verticalIconBox),k=j.placeable):(j=t(p.iconBox),k=j.placeable),D=D&&j.offscreen}const U=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,G=g||0===t.numIconVertices;U||G?G?U||(k=k&&A):A=k&&A:k=A=k&&A;const $=k&&j.placeable;if(A&&F.placeable&&this.collisionIndex.insertCollisionBox(F.box,_,o.get("text-ignore-placement"),n.bucketInstanceId,B&&B.placeable&&N?N:V,f.ID),$&&this.collisionIndex.insertCollisionBox(j.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,q,f.ID),O&&A&&this.collisionIndex.insertCollisionCircles(O.circles,_,o.get("text-ignore-placement"),n.bucketInstanceId,V,f.ID),r&&this.storeCollisionData(n.bucketInstanceId,x,p,F,j,O),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Zt((A||P)&&!(null==F?void 0:F.occluded),(k||M)&&!(null==j?void 0:j.occluded),D||n.justReloaded),i[t.crossTileID]=!0};if(C){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){const i=e[t];z(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)z(n.symbolInstances.get(e),n.collisionArrays[e],e);n.justReloaded=!1}storeCollisionData(t,e,i,r,n,o){if(i.textBox||i.iconBox){let o,a;this.collisionBoxArrays.has(t)?o=this.collisionBoxArrays.get(t):(o=new Map,this.collisionBoxArrays.set(t,o)),o.has(e)?a=o.get(e):(a={text:null,icon:null},o.set(e,a)),i.textBox&&(a.text=r.box),i.iconBox&&(a.icon=n.box)}if(o){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<o.circles.length;t+=4)e.push(o.circles[t+0]-jt),e.push(o.circles[t+1]-jt),e.push(o.circles[t+2]),e.push(o.collisionDetected?1:0)}}markUsedJustification(t,i,r,n){let o;o=n===e.ai.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[e.ax(i)];const a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const e of a)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=o>=0&&e!==o?0:r.crossTileID)}markUsedOrientation(t,i,r){const n=i===e.ai.horizontal||i===e.ai.horizontalOnly?i:0,o=i===e.ai.vertical?i:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const e of a)t.text.placedSymbolArray.get(e).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=n[t];o?(this.opacities[t]=new qt(o,r,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new qt(null,r,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in n){const e=n[t];if(!this.opacities[t]){const n=new qt(e,r,!1,!1);n.isHidden()||(this.opacities[t]=n,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(t,i,r,n){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const o=t.layers[0],a=o.layout,s=new qt(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),h=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===a.get("text-rotation-alignment"),p="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),f=new qt(null,0,l&&(c||!t.hasIconData()||a.get("icon-optional")),c&&(l||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const m=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==re},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let i=0;i<t.symbolInstances.length;i++){const n=t.symbolInstances.get(i),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:a,crossTileID:l}=n;let c=this.opacities[l];r[l]?c=s:c||(c=f,this.opacities[l]=c),r[l]=!0;const _=n.numIconVertices>0,y=this.placedOrientations[n.crossTileID],v=y===e.ai.vertical,x=y===e.ai.horizontal||y===e.ai.horizontalOnly;if(o>0||a>0){const e=ie(c.text);m(t.text,o,v?re:e),m(t.text,a,x?re:e);const i=c.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||v?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const r=this.variableOffsets[n.crossTileID];r&&this.markUsedJustification(t,r.anchor,n,y);const s=this.placedOrientations[n.crossTileID];s&&(this.markUsedJustification(t,"left",n,s),this.markUsedOrientation(t,s,n))}if(_){const e=ie(c.icon),i=!(d&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(m(t.icon,n.numIconVertices,i?e:re),t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,n.numVerticalIconVertices,i?re:e),t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const b=g&&g.has(i)?g.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const r=t.collisionArrays[i];if(r){let i=new e.P(0,0);if(r.textBox||r.verticalTextBox){let e=!0;if(h){const t=this.variableOffsets[l];t?(i=$t(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):e=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=x),Xt(t.textCollisionBox.collisionVertexArray,c.text.placed,!e||n,b.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const e=Boolean(!x&&r.verticalIconBox);let n;r.iconBox&&(n=e),r.verticalIconBox&&(n=!e),Xt(t.iconCollisionBox.collisionVertexArray,c.icon.placed,n,b.icon,d?i.x:0,d?i.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Xt(t,e,i,r,n,o){r&&0!==r.length||(r=[0,0,0,0]);const a=r[0]-jt,s=r[1]-jt,l=r[2]-jt,c=r[3]-jt;t.emplaceBack(e?1:0,i?1:0,n||0,o||0,a,s),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,l,s),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,l,c),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,a,c)}const Wt=Math.pow(2,25),Kt=Math.pow(2,24),Yt=Math.pow(2,17),Jt=Math.pow(2,16),Qt=Math.pow(2,9),te=Math.pow(2,8),ee=Math.pow(2,1);function ie(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Wt+e*Kt+i*Yt+e*Jt+i*Qt+e*te+i*ee+e}const re=0;class ne{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class oe{constructor(t,e,i,r,n,o,a,s){this.placement=new Ht(t,e,o,a,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,i){const r=a.now(),n=()=>!this._forceFullPlacement&&a.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=e[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=o)&&(!r.maxzoom||r.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new ne(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const ae=512/e.X/2;class se{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),r=e.key,o=n.get(r);o?o.push(e):n.set(r,[e])}for(const[t,i]of n){const r={positions:i.map((t=>({x:Math.floor(t.anchorX*ae),y:Math.floor(t.anchorY*ae)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(r.positions.length>128){const t=new e.az(r.positions.length,16,Uint16Array);for(const{x:e,y:i}of r.positions)t.add(e,i);t.finish(),delete r.positions,r.index=t}this._symbolsByKey[t]=r}}getScaledCoordinates(t,i){const{x:r,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=i.canonical,c=ae/Math.pow(2,l-o),h=(s*e.X+t.anchorY)*c,u=n*e.X*ae;return{x:Math.floor((a*e.X+t.anchorX)*c-r*e.X*ae),y:Math.floor(h-u)}}findMatches(t,e,i){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){const o=t.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);if(a.index){const t=a.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(const e of t){const t=a.crossTileIDs[e];if(!i[t]){i[t]=!0,o.crossTileID=t;break}}}else if(a.positions)for(let t=0;t<a.positions.length;t++){const e=a.positions[t],n=a.crossTileIDs[t];if(Math.abs(e.x-s.x)<=r&&Math.abs(e.y-s.y)<=r&&!i[n]){i[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class le{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ce{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],r={};for(const t in i){const n=i[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),r[n.tileID.key]=n}this.indexes[t]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const n=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,r)}else{const o=n[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,r)}}for(let t=0;t<e.symbolInstances.length;t++){const n=e.symbolInstances.get(t);n.crossTileID||(n.crossTileID=i.generate(),r[n.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new se(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class he{constructor(){this.layerIndexes={},this.crossTileIDs=new le,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new ce);let n=!1;const o={};r.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(i.tileID,e,this.crossTileIDs)&&(n=!0),o[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}var ue="void main() {fragColor=vec4(1.0);}";const pe={prelude:de("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:de("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:de("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:de("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:de("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:de("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:de(ue,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:de("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:de("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:de("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:de("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:de("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:de(ue,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:de("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:de("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:de("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:de("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:de("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:de("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:de("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:de("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:de("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:de("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:de("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:de("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:de("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:de("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:de("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:de("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:de("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:de("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:de("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:de("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:de("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:de("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function de(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:t=t.replace(i,((t,e,i,r,n)=>(s[n]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,r,n)=>{const o="float"===r?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:a}}class fe{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var me=e.aA([{name:"a_pos",type:"Int16",components:2}]);const ge="#define PROJECTION_MERCATOR",_e="mercator";class ye{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return _e}get shaderDefine(){return ge}get shaderPreludeCode(){return pe.projectionMercator}get vertexShaderPreludeCode(){return pe.projectionMercator.vertexSource}get subdivisionGranularity(){return e.aB.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,i,r,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new e.aC;a.emplaceBack(0,0),a.emplaceBack(e.X,0),a.emplaceBack(0,e.X),a.emplaceBack(e.X,e.X);const s=t.createVertexBuffer(a,me.members),l=e.aD.simpleSegment(0,0,4,2),c=new e.aE;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const h=t.createIndexBuffer(c);return this._cachedMesh=new fe(s,h,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}function ve(t,i){const r=e.ab(i.lat,-85.051129,e.aF);return new e.P(e.O(i.lng)*t,e.Q(r)*t)}function xe(t,i){return new e.Y(i.x/t,i.y/t).toLngLat()}function be(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(e.aa(90-t.pitch)),Math.tan(e.aa(89.25-t.pitch)))}function we(t,i){const r=t.canonical,n=i/e.aG(r.z),o=r.x+Math.pow(2,r.z)*t.wrap,a=e.aq(new Float64Array(16));return e.J(a,a,[o*n,r.y*n,0]),e.K(a,a,[n/e.X,n/e.X,1]),a}function Te(t,i,r,n,o){const a=e.Y.fromLngLat(t,i),s=o*e.aH(1,t.lat),l=s*Math.cos(e.aa(r)),c=Math.sqrt(s*s-l*l),h=c*Math.sin(e.aa(-n)),u=c*Math.cos(e.aa(-n));return new e.Y(a.x+h,a.y+u,a.z+l)}class Ce{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.y.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.y.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.y.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.y.number(t.right,i.right,r)),this}getCenter(t,i){const r=e.ab((this.left+t-this.right)/2,0,t),n=e.ab((this.top+i-this.bottom)/2,0,i);return new e.P(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ce(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Pe(t,e){if(!t.renderWorldCopies||t.lngRange)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}function Me(t){return Math.max(0,Math.floor(t))}class Se{constructor(t,i,r,n,o,a){this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===a||!!a,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new e.N(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Me(this._zoom),this._scale=e.aG(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ce,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,i,r){this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Me(this._zoom),this._scale=e.aG(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Ce(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!r&&t.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const i=e.aI(t,-180,180)*Math.PI/180;var n,o,a,s,l,c,h,u,p;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],h=o[3],u=Math.sin(a),p=Math.cos(a),n[0]=s*p+c*u,n[1]=l*p+h*u,n[2]=s*-u+c*p,n[3]=l*-u+h*p)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const i=e.ab(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return e.aJ(this._fovInRadians)}setFov(t){t=e.ab(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=e.aa(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const i=this.getConstrained(this._center,t).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=e.aG(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}resize(t,e,i=!0){this._width=t,this._height=e,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new U([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,e.aF])}getConstrained(t,e){return this._callbacks.getConstrained(t,e)}getCameraQueryGeometry(t,i){if(1===i.length)return[i[0],t];{let r=t.x,n=t.y,o=t.x,a=t.y;for(const t of i)r=Math.min(r,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),a=Math.max(a,t.y);return[new e.P(r,n),new e.P(o,n),new e.P(o,a),new e.P(r,a),new e.P(r,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(e),this.setZoom(i),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=e.aq(new Float64Array(16));e.K(t,t,[this._width/2,-this._height/2,1]),e.J(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=e.aq(new Float64Array(16)),e.K(t,t,[1,-1,1]),e.J(t,t,[-1,-1,0]),e.K(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,i,r,n){const o=void 0!==r?r:this.bearing,a=n=void 0!==n?n:this.pitch,s=e.Y.fromLngLat(t,i),l=-Math.cos(e.aa(a)),c=Math.sin(e.aa(a)),h=c*Math.sin(e.aa(o)),u=-c*Math.cos(e.aa(o));let p=this.elevation;const d=i-p;let f;l*d>=0||Math.abs(l)<.1?(f=1e4,p=i+f*l):f=-d/l;let m,g,_=e.aK(1,s.y),y=0;do{if(y+=1,y>10)break;g=f/_,m=new e.Y(s.x+h*g,s.y+u*g),_=1/m.meterInMercatorCoordinateUnits()}while(Math.abs(f-g*_)>1e-12);return{center:m.toLngLat(),elevation:p,zoom:e.a8(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const i=e.aH(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/i,n=e.Y.fromLngLat(this.center,this.elevation),o=Te(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=t;const a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),e.aK(o.z,n.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=e.aH(1,this.center.lat)*this.worldSize;return Te(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const i=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/i,t.canonical.y/i,1/i/e.X,1/i/e.X]}}class Ie{constructor(t,i){this.min=t,this.max=i,this.center=e.aL([],e.aM([],this.min,this.max),.5)}quadrant(t){const i=[t%2==0,t<2],r=e.aN(this.min),n=e.aN(this.max);for(let t=0;t<i.length;t++)r[t]=i[t]?this.min[t]:this.center[t],n[t]=i[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new Ie(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let e=!0;for(let i=0;i<t.planes.length;i++){const r=this.intersectsPlane(t.planes[i]);if(0===r)return 0;1===r&&(e=!1)}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],i=t[3];for(let r=0;r<3;r++)t[r]>0?(e+=t[r]*this.min[r],i+=t[r]*this.max[r]):(i+=t[r]*this.min[r],e+=t[r]*this.max[r]);return e>=0?2:i<0?0:1}}class Ee{distanceToTile2d(t,e,i,r){const n=r.distanceX([t,e]),o=r.distanceY([t,e]);return Math.hypot(n,o)}getWrap(t,e,i){return i}getTileAABB(t,i,r,n){var o,a;let s=r,l=r;if(n.terrain){const c=new e.S(t.z,i,t.z,t.x,t.y),h=n.terrain.getMinMaxElevation(c);s=null!==(o=h.minElevation)&&void 0!==o?o:r,l=null!==(a=h.maxElevation)&&void 0!==a?a:r}const c=1<<t.z;return new Ie([i+t.x/c,t.y/c,s],[i+(t.x+1)/c,(t.y+1)/c,l])}allowVariableZoom(t,i){const r=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=e.ab(78.5-r/2,0,60);return!!i.terrain||t.pitch>n||t.padding.top>=.1}allowWorldCopies(){return!0}recalculateCache(){}}class ze{constructor(t,e,i){this.points=t,this.planes=e,this.aabb=i}static fromInvProjectionMatrix(t,i=1,r=0){const n=Math.pow(2,r),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>{const o=1/(r=e.al([],r,t))[3]/i*n;return e.aO(r,r,[o,o,1/r[3],o])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const i=e.aP([],o[t[0]],o[t[1]]),r=e.aP([],o[t[2]],o[t[1]]),n=e.aQ([],e.aR([],i,r)),a=-e.aS(n,o[t[1]]);return n.concat(a)})),s=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],l=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const t of o)for(let e=0;e<3;e++)s[e]=Math.min(s[e],t[e]),l[e]=Math.max(l[e],t[e]);return new ze(o,a,new Ie(s,l))}}class Ae{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t,e,i,r,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Se({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)},t,e,i,r,n),this._coveringTilesDetailsProvider=new Ee}clone(){const t=new Ae;return t.apply(this),t}apply(t,e,i){this._helper.apply(t,e,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const i=[new e.aT(0,t)];if(this._helper._renderWorldCopies){const r=this.screenPointToMercatorCoordinate(new e.P(0,0)),n=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new e.P(0,this._helper._height)),s=Math.floor(Math.min(r.x,n.x,o.x,a.x)),l=Math.floor(Math.max(r.x,n.x,o.x,a.x)),c=1;for(let r=s-c;r<=l+c;r++)0!==r&&i.push(new e.aT(r,t))}return i}getCameraFrustum(){return ze.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const e=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,i){const r=e.aH(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),a=e.Y.fromLngLat(t),s=new e.Y(a.x-(n.x-o.x),a.y-(n.y-o.y));this.setCenter(null==s?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(e.Y.fromLngLat(t),i.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(e.Y.fromLngLat(t))}screenPointToLocation(t,e){var i;return null===(i=this.screenPointToMercatorCoordinate(t,e))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){const i=e.pointCoordinate(t);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){const r=i||0,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.al(n,n,this._pixelMatrixInverse),e.al(o,o,this._pixelMatrixInverse);const a=n[3],s=o[3],l=n[1]/a,c=o[1]/s,h=n[2]/a,u=o[2]/s,p=h===u?0:(r-h)/(u-h);return new e.Y(e.y.number(n[0]/a,o[0]/s,p)/this.worldSize,e.y.number(l,c,p)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){const n=[t.x*this.worldSize,t.y*this.worldSize,i,1];return e.al(n,n,r),new e.P(n[0]/n[3],n[1]/n[3])}getBounds(){const t=Math.max(0,this._helper._height/2-be(this));return(new U).extend(this.screenPointToLocation(new e.P(0,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new e.P(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?null!=e.pointCoordinate(t):t.y>this.height/2-be(this)}calculatePosMatrix(t,i=!1,r){var n;const o=null!==(n=t.key)&&void 0!==n?n:e.aU(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const t=a.get(o);return r?t.f32:t.f64}const s=we(t,this.worldSize);e.L(s,i?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),r?l.f32:l.f64}calculateFogMatrix(t){const i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);const n=we(t,this.worldSize);return e.L(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(t,i){i=e.ab(+i,this.minZoom,this.maxZoom);const r={center:new e.N(t.lng,t.lat),zoom:i};let n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);const o=this.tileSize*e.aG(r.zoom);let a=0,s=o,l=0,c=o,h=0,u=0;const{x:p,y:d}=this.size;if(this._helper._latRange){const t=this._helper._latRange;a=e.Q(t[1])*o,s=e.Q(t[0])*o,s-a<d&&(h=d/(s-a))}n&&(l=e.aI(e.O(n[0])*o,0,o),c=e.aI(e.O(n[1])*o,0,o),c<l&&(c+=o),c-l<p&&(u=p/(c-l)));const{x:f,y:m}=ve(o,t);let g,_;const y=Math.max(u||0,h||0);if(y){const t=new e.P(u?(c+l)/2:f,h?(s+a)/2:m);return r.center=xe(o,t).wrap(),r.zoom+=e.a8(y),r}if(this._helper._latRange){const t=d/2;m-t<a&&(_=a+t),m+t>s&&(_=s-t)}if(n){const t=(l+c)/2;let i=f;this._helper._renderWorldCopies&&(i=e.aI(f,t-o/2,t+o/2));const r=p/2;i-r<l&&(g=l+r),i+r>c&&(g=c-r)}if(void 0!==g||void 0!==_){const t=new e.P(null!=g?g:f,null!=_?_:m);r.center=xe(o,t).wrap()}return r}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}_calculateNearFarZIfNeeded(t,i,r){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=t-n*this._helper._pixelPerMeter/Math.cos(i),a=n<0?o:t,s=Math.PI/2+this.pitchInRadians,l=e.aa(this.fov)*(Math.abs(Math.cos(e.aa(this.roll)))*this.height+Math.abs(Math.sin(e.aa(this.roll)))*this.width)/this.height*(.5+r.y/this.height),c=Math.sin(l)*a/Math.sin(e.ab(Math.PI-s-l,.01,Math.PI-.01)),h=be(this),u=Math.atan(h/this._helper.cameraToCenterDistance),p=e.aa(.75),d=u>p?2*u*(.5+r.y/(2*h)):p,f=Math.sin(d)*a/Math.sin(e.ab(Math.PI-s-d,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,i=ve(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=e.aH(1,this.center.lat)*this.worldSize;const o=e.aa(Math.min(this.pitch,89.25)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let s;this._calculateNearFarZIfNeeded(a,o,t),s=new Float64Array(16),e.aV(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),e.an(this._invProjMatrix,s),s[8]=2*-t.x/this._helper._width,s[9]=2*t.y/this._helper._height,this._projectionMatrix=e.aW(s),e.K(s,s,[1,-1,1]),e.J(s,s,[0,0,-this._helper.cameraToCenterDistance]),e.aX(s,s,-this.rollInRadians),e.aY(s,s,this.pitchInRadians),e.aX(s,s,-this.bearingInRadians),e.J(s,s,[-r,-n,0]),this._mercatorMatrix=e.K([],s,[this.worldSize,this.worldSize,this.worldSize]),e.K(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=e.L(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),e.J(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=e.an([],s);const l=[0,0,-1,1];e.al(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),e.aV(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,e.K(this._fogMatrix,this._fogMatrix,[1,-1,1]),e.J(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),e.aX(this._fogMatrix,this._fogMatrix,-this.rollInRadians),e.aY(this._fogMatrix,this._fogMatrix,this.pitchInRadians),e.aX(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),e.J(this._fogMatrix,this._fogMatrix,[-r,-n,0]),e.K(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),e.J(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=e.L(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,h=this._helper._height%2/2,u=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=r-Math.round(r)+u*c+p*h,f=n-Math.round(n)+u*h+p*c,m=new Float64Array(s);if(e.J(m,m,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=e.an(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new e.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.al(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=e.aH(1,this.center.lat)*this.worldSize;return Te(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,i){const r=e.Y.fromLngLat(t),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return e.al(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){const{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=t,o=this._helper.getMercatorTileCoordinates(i),a=i?this.calculatePosMatrix(i,r,!0):null;let s;return s=i&&i.terrainRttPosMatrix32f&&n?i.terrainRttPosMatrix32f:a||e.aZ(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,i){return 1}transformLightDirection(t){return e.aN(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,r,n){const o=this.calculatePosMatrix(r);let a;n?(a=[t,i,n(t,i),1],e.al(a,a,o)):(a=[t,i,0,1],Ot(a,a,o));const s=a[3];return{point:new e.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(const e of t)this.calculatePosMatrix(e)}getMatrixForModel(t,i){const r=e.Y.fromLngLat(t,i),n=r.meterInMercatorCoordinateUnits(),o=e.a_();return e.J(o,o,[r.x,r.y,r.z]),e.aX(o,o,Math.PI),e.aY(o,o,Math.PI/2),e.K(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const i=new e.S(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),n=we(i,this.worldSize);e.L(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];const o=[e.X,e.X,this.worldSize/this._helper.pixelsPerMeter],a=e.a$();return e.K(a,n,o),r.fallbackMatrix=a,r.mainMatrix=a,r}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function ke(){e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function De(t){if(t.useSlerp)if(t.k<1){const i=e.b0(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),r=e.b0(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);e.b1(n,i,r,t.k);const o=e.b2(n);t.tr.setRoll(o.roll),t.tr.setPitch(o.pitch),t.tr.setBearing(o.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(e.y.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(e.y.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(e.y.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Re(t,i,r,n,o){const a=o.padding,s=ve(o.worldSize,r.getNorthWest()),l=ve(o.worldSize,r.getNorthEast()),c=ve(o.worldSize,r.getSouthEast()),h=ve(o.worldSize,r.getSouthWest()),u=e.aa(-n),p=s.rotate(u),d=l.rotate(u),f=c.rotate(u),m=h.rotate(u),g=new e.P(Math.max(p.x,d.x,m.x,f.x),Math.max(p.y,d.y,m.y,f.y)),_=new e.P(Math.min(p.x,d.x,m.x,f.x),Math.min(p.y,d.y,m.y,f.y)),y=g.sub(_),v=(o.width-(a.left+a.right+i.left+i.right))/y.x,x=(o.height-(a.top+a.bottom+i.top+i.bottom))/y.y;if(x<0||v<0)return void ke();const b=Math.min(e.a8(o.scale*Math.min(v,x)),t.maxZoom),w=e.P.convert(t.offset),T=new e.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(e.aa(n)),C=w.add(T).mult(o.scale/e.aG(b));return{center:xe(o.worldSize,s.add(c).div(2).sub(C)),zoom:b,bearing:n}}class Le{get useGlobeControls(){return!1}handlePanInertia(t,e){return{easingOffset:t,easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,i){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(i,t.around)}cameraForBoxAndBearing(t,e,i,r,n){return Re(t,e,i,r,n)}handleJumpToCenterZoom(t,i){t.zoom!==(void 0!==i.zoom?+i.zoom:t.zoom)&&t.setZoom(+i.zoom),void 0!==i.center&&t.setCenter(e.N.convert(i.center))}handleEaseTo(t,i){const r=t.zoom,n=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},a={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},s=void 0!==i.zoom,l=!t.isPaddingEqual(i.padding);let c=!1;const h=s?+i.zoom:t.zoom;let u=t.centerPoint.add(i.offsetAsPoint);const p=t.screenPointToLocation(u),{center:d,zoom:f}=t.getConstrained(e.N.convert(i.center||p),null!=h?h:r);Pe(t,d);const m=ve(t.worldSize,p),g=ve(t.worldSize,d).sub(m),_=e.aG(f-r);return c=f!==r,{easeFunc:s=>{if(c&&t.setZoom(e.y.number(r,f,s)),e.b3(o,a)||De({startEulerAngles:o,endEulerAngles:a,tr:t,k:s,useSlerp:o.roll!=a.roll}),l&&(t.interpolatePadding(n,i.padding,s),u=t.centerPoint.add(i.offsetAsPoint)),i.around)t.setLocationAtPoint(i.around,i.aroundPoint);else{const i=e.aG(t.zoom-r),n=f>r?Math.min(2,_):Math.max(.5,_),o=Math.pow(n,1-s),a=xe(t.worldSize,m.add(g.mult(s*o)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,u)}},isZooming:c,elevationCenter:d}}handleFlyTo(t,i){const r=void 0!==i.zoom,n=t.zoom,o=t.getConstrained(e.N.convert(i.center||i.locationAtOffset),r?+i.zoom:n),a=o.center,s=o.zoom;Pe(t,a);const l=ve(t.worldSize,i.locationAtOffset),c=ve(t.worldSize,a).sub(l),h=c.mag(),u=e.aG(s-n);let p;if(void 0!==i.minZoom){const r=Math.min(+i.minZoom,n,s),o=t.getConstrained(a,r).zoom;p=e.aG(o-n)}return{easeFunc:(i,r,o,h)=>{t.setZoom(1===i?s:n+e.a8(r));const u=1===i?a:xe(t.worldSize,l.add(c.mult(o)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?u.wrap():u,h)},scaleOfZoom:u,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:h}}}class Be{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Be.Replace=[1,0],Be.disabled=new Be(Be.Replace,e.b4.transparent,[!1,!1,!1,!1]),Be.unblended=new Be(Be.Replace,e.b4.transparent,[!0,!0,!0,!0]),Be.alphaBlended=new Be([1,771],e.b4.transparent,[!0,!0,!0,!0]);const Fe=2305;class Oe{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}Oe.disabled=new Oe(!1,1029,Fe),Oe.backCCW=new Oe(!0,1029,Fe),Oe.frontCCW=new Oe(!0,1028,Fe);class je{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}je.ReadOnly=!1,je.ReadWrite=!0,je.disabled=new je(519,je.ReadOnly,[0,1]);const Ve=7680;class Ne{constructor(t,e,i,r,n,o){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}Ne.disabled=new Ne({func:519,mask:0},0,0,Ve,Ve,Ve);const qe=new WeakMap;function Ze(t){var e;if(qe.has(t))return qe.get(t);{const i=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return qe.set(t,i),i}}class Ue{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const i=t.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const n=new e.aC;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new e.aE;o.emplaceBack(0,1,2),this._fullscreenTriangle=new fe(i.createVertexBuffer(n,me.members),i.createIndexBuffer(o),e.aD.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Ze(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,e){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,i){const r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:e.b4.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,je.disabled,Ne.disabled,Be.unblended,Oe.disabled,((t,e)=>({u_input:t,u_output_expected:e}))(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Ze(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const t=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Ze(t)){const i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED)return e.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Ue._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}const Ge=e.X/128;function $e(t,i){const r=void 0!==t.granularity?Math.max(t.granularity,1):1,n=r+(t.generateBorders?2:0),o=r+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),a=n+1,s=o+1,l=t.generateBorders?-1:0,c=t.generateBorders||t.extendToNorthPole?-1:0,h=r+(t.generateBorders?1:0),u=r+(t.generateBorders||t.extendToSouthPole?1:0),p=a*s,d=n*o*6,f=a*s>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===i,g=new Int16Array(2*p);let _=0;for(let i=c;i<=u;i++)for(let n=l;n<=h;n++){let o=n/r*e.X;-1===n&&(o=-64),n===r+1&&(o=e.X+Ge);let a=i/r*e.X;-1===i&&(a=t.extendToNorthPole?e.b6:-64),i===r+1&&(a=t.extendToSouthPole?e.b7:e.X+Ge),g[_++]=o,g[_++]=a}const y=m?new Uint32Array(d):new Uint16Array(d);let v=0;for(let t=0;t<o;t++)for(let e=0;e<n;e++){const i=e+1+t*a,r=e+(t+1)*a,n=e+1+(t+1)*a;y[v++]=e+t*a,y[v++]=r,y[v++]=i,y[v++]=i,y[v++]=r,y[v++]=n}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const He=new e.aB({fill:new e.b8(128,2),line:new e.b8(512,0),tile:new e.b8(128,32),stencil:new e.b8(128,1),circle:3});class Xe{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return pe.projectionGlobe}get vertexShaderPreludeCode(){return pe.projectionMercator.vertexSource}get subdivisionGranularity(){return He}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new Ue(t));const i=e.Q(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(i,r),o=a.now();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const s=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=e.b9(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,e.ba(s))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,i,r,n){const o=("stencil"===n?He.stencil:He.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:o,generateBorders:i,extendToNorthPole:0===e.y&&r,extendToSouthPole:e.y===(1<<e.z)-1&&r})}_getMesh(t,i){const r=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];const n=function(t,i){const r=$e(i,"16bit"),n=e.aC.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),o=e.aE.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new fe(t.createVertexBuffer(n,me.members),t.createIndexBuffer(o),e.aD.simpleSegment(0,0,n.length,o.length))}(t,i);return this._tileMeshCache[r]=n,n}recalculate(t){}hasTransition(){const t=a.now();let e=!1;return e=e||(t-this._errorMeasurementLastChangeTime)/1e3<.7,e=e||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,e}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const We=new e.q({type:new e.D(e.v.projection.type)});class Ke extends e.E{constructor(t){super(),this._transitionable=new e.T(We),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.z(0)),this._mercatorProjection=new ye,this._verticalPerspectiveProjection=new Xe}get transitionState(){const t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof e.bb){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,e,i,r,n){return this.currentProjection.getMeshFromTileID(t,e,i,r,n)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function Ye(t){const e=ti(t.worldSize,t.center.lat);return 2*Math.PI*e}function Je(t,i,r,n,o){const a=1/(1<<o),s=i/e.X*a+n*a,l=e.bd((t/e.X*a+r*a)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,h=Math.cos(c),u=new Float64Array(3);return u[0]=Math.sin(l)*h,u[1]=Math.sin(c),u[2]=Math.cos(l)*h,u}function Qe(t){return function(t,e){const i=Math.cos(e),r=new Float64Array(3);return r[0]=Math.sin(t)*i,r[1]=Math.sin(e),r[2]=Math.cos(t)*i,r}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function ti(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function ei(t){const i=Math.asin(t[1])/Math.PI*180,r=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(r>1e-6){const n=t[0]/r,o=Math.acos(t[2]/r),a=(n>0?o:-o)/Math.PI*180;return new e.N(e.aI(a,-180,180),i)}return new e.N(0,i)}function ii(t){return Math.cos(t*Math.PI/180)}function ri(t,i){const r=ii(t),n=ii(i);return e.a8(n/r)}function ni(t,i){const r=t.rotate(i.bearingInRadians),n=i.zoom+ri(i.center.lat,0),o=e.b9(1/ii(i.center.lat),1/ii(Math.min(Math.abs(i.center.lat),60)),e.bc(n,7,3,0,1)),a=360/Ye({worldSize:i.worldSize,center:{lat:i.center.lat}});return new e.N(i.center.lng-r.x*a*o,e.ab(i.center.lat+r.y*a,-85.051129,e.aF))}function oi(t){const e=.5*t,i=Math.sin(e),r=Math.cos(e);return Math.log(i+r)-Math.log(r-i)}function ai(t,i,r,n){const o=t.lat+r*n;if(Math.abs(r)>1){const a=(Math.sign(t.lat+r)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,s=Math.abs(t.lat+r)*Math.PI/180,l=oi(a+n*(s-a)),c=oi(a),h=oi(s);return new e.N(t.lng+i*((l-c)/(h-c)),o)}return new e.N(t.lng+i*n,o)}class si{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=t}recalculateCache(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(t,e,i,r){const n=`${t.z}_${t.x}_${t.y}`,o=this._cache.get(n);if(o)return o;const a=this._cachePrevious.get(n);if(a)return this._cache.set(n,a),a;const s=this._aabbFactory(t,e,i,r);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}function li(t,e,i){const r=t-e;return r<0?-r:Math.max(0,r-i)}function ci(t,e,i,r,n){const o=t-i;let a;return a=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(a,li(e,r,n))}class hi{constructor(){this._aabbCache=new si(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(t,e,i,r){const n=1<<i.z,o=1/n,a=i.x/n,s=i.y/n;let l=2;return l=Math.min(l,ci(t,e,a,s,o)),l=Math.min(l,ci(t,e,a+.5,-s-o,o)),l=Math.min(l,ci(t,e,a+.5,2-s-o,o)),l}getWrap(t,e,i){const r=1<<e.z,n=1/r,o=e.x/r,a=li(t.x,o,n),s=li(t.x,o-1,n),l=li(t.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(t,e){return ht(t,e)>4}allowWorldCopies(){return!1}getTileAABB(t,e,i,r){return this._aabbCache.getTileAABB(t,e,i,r)}_computeTileAABB(t,i,r,n){if(t.z<=0)return new Ie([-1,-1,-1],[1,1,1]);if(1===t.z)return new Ie([0===t.x?-1:0,0===t.y?0:-1,-1],[0===t.x?0:1,0===t.y?1:0,1]);{const i=[Je(0,0,t.x,t.y,t.z),Je(e.X,0,t.x,t.y,t.z),Je(e.X,e.X,t.x,t.y,t.z),Je(0,e.X,t.x,t.y,t.z)],r=[1,1,1],n=[-1,-1,-1];for(const t of i)for(let e=0;e<3;e++)r[e]=Math.min(r[e],t[e]),n[e]=Math.max(n[e],t[e]);if(0===t.y||t.y===(1<<t.z)-1){const e=[0,0===t.y?1:-1,0];for(let t=0;t<3;t++)r[t]=Math.min(r[t],e[t]),n[t]=Math.max(n[t],e[t])}return new Ie(r,n)}}}class ui{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(){this._cachedClippingPlane=e.be(),this._projectionMatrix=e.a_(),this._globeViewProjMatrix32f=e.aZ(),this._globeViewProjMatrixNoCorrection=e.a_(),this._globeViewProjMatrixNoCorrectionInverted=e.a_(),this._globeProjMatrixInverted=e.a_(),this._cameraPosition=e.bf(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Se({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._coveringTilesDetailsProvider=new hi}clone(){const t=new ui;return t.apply(this),t}apply(t,e){this._globeLatitudeErrorCorrectionRadians=e||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=e.bf();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:e,applyGlobeMatrix:i}=t,r=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const i=this.pitchInRadians,r=this.cameraToCenterDistance/t,n=Math.sin(i)*r,o=Math.cos(i)*r+1,a=1/Math.sqrt(n*n+o*o)*1;let s=-n,l=o;const c=Math.sqrt(s*s+l*l);s/=c,l/=c;const h=[0,s,l];return e.bg(h,h,[0,0,0],-this.bearingInRadians),e.bh(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),e.bi(h,h,[0,0,0],this.center.lng*Math.PI/180),e.aL(h,h,.25),[...h,.25*-a]}isLocationOccluded(t){return!this.isSurfacePointVisible(Qe(t))}transformLightDirection(t){const i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),o=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],a=[o[2],0,-o[0]],s=[0,0,0];e.aR(s,a,o),e.aQ(a,a),e.aQ(s,s);const l=[0,0,0];return e.aQ(l,[a[0]*t[0]+s[0]*t[1]+o[0]*t[2],a[1]*t[0]+s[1]*t[1]+o[1]*t[2],a[2]*t[0]+s[2]*t[1]+o[2]*t[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,r){const n=function(t,i,r){const n=1/(1<<r.z);return new e.Y(t/e.X*n+r.x*n,i/e.X*n+r.y*n)}(t,i,r.canonical),o=(a=n.y,[e.bd(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);var a;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(t,i,r,n){const o=r.canonical,a=Je(t,i,o.x,o.y,o.z),s=1+(n?n(t,i):0)/e.bo,l=[a[0]*s,a[1]*s,a[2]*s,1];e.al(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,h=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new e.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=ti(this.worldSize,this.center.lat),i=e.a$(),r=e.a$();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),e.aV(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;i[8]=2*-n.x/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=e.aW(i),this._globeProjMatrixInverted=e.a$(),e.an(this._globeProjMatrixInverted,i),e.J(i,i,[0,0,-this.cameraToCenterDistance]),e.aX(i,i,this.rollInRadians),e.aY(i,i,-this.pitchInRadians),e.aX(i,i,this.bearingInRadians),e.J(i,i,[0,0,-t]);const o=e.bf();o[0]=t,o[1]=t,o[2]=t,e.aY(r,i,this.center.lat*Math.PI/180),e.bj(r,r,-this.center.lng*Math.PI/180),e.K(r,r,o),this._globeViewProjMatrixNoCorrection=r,e.aY(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),e.bj(i,i,-this.center.lng*Math.PI/180),e.K(i,i,o),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=e.a$(),e.an(this._globeViewProjMatrixNoCorrectionInverted,r);const a=e.bf();this._cameraPosition=e.bf(),this._cameraPosition[2]=this.cameraToCenterDistance/t,e.bg(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),e.bh(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),e.bg(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),e.aM(this._cameraPosition,this._cameraPosition,[0,0,1]),e.bh(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),e.bi(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const s=e.aW(this._globeViewProjMatrixNoCorrectionInverted);e.K(s,s,[1,1,-1]),this._cachedFrustum=ze.fromInvProjectionMatrix(s)}calculateFogMatrix(t){e.w("calculateFogMatrix is not supported on globe projection.");const i=e.a$();return e.aq(i),i}getVisibleUnwrappedCoordinates(t){return[new e.aT(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&e.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const r=Qe(t);e.aL(r,r,1+i/e.bo);const n=e.be();return e.al(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){const t=.5*this.width,i=.5*this.height,r=[new e.P(0,0),new e.P(t,0),new e.P(this.width,0),new e.P(this.width,i),new e.P(this.width,this.height),new e.P(t,this.height),new e.P(0,this.height),new e.P(0,i)],n=[];for(const t of r)n.push(this.unprojectScreenPoint(t));let o=0,a=0,s=0,l=0;const c=this.center;for(const t of n){const i=e.bk(c.lng,t.lng),r=e.bk(c.lat,t.lat);i<a&&(a=i),i>o&&(o=i),r<l&&(l=r),r>s&&(s=r)}const h=[c.lng+a,c.lat+l,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new U(h)}getConstrained(t,i){const r=e.ab(t.lat,-85.051129,e.aF),n=e.ab(+i,this.minZoom+ri(0,r),this.maxZoom);return{center:new e.N(t.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}setLocationAtPoint(t,i){const r=Qe(this.unprojectScreenPoint(i)),n=Qe(t),o=e.bf();e.bl(o);const a=e.bf();e.bi(a,r,o,-this.center.lng*Math.PI/180),e.bh(a,a,o,this.center.lat*Math.PI/180);const s=n[0]*n[0]+n[2]*n[2],l=a[0]*a[0];if(s<l)return;const c=Math.sqrt(s-l),h=-c,u=e.bm(n[0],n[2],a[0],c),p=e.bm(n[0],n[2],a[0],h),d=e.bf();e.bi(d,n,o,-u);const f=e.bm(d[1],d[2],a[1],a[2]),m=e.bf();e.bi(m,n,o,-p);const g=e.bm(m[1],m[2],a[1],a[2]),_=.5*Math.PI,y=f>=-_&&f<=_,v=g>=-_&&g<=_;let x,b;if(y&&v){const t=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;e.bp(u,t)+e.bp(f,i)<e.bp(p,t)+e.bp(g,i)?(x=u,b=f):(x=p,b=g)}else if(y)x=u,b=f;else{if(!v)return;x=p,b=g}const w=x/Math.PI*180,T=b/Math.PI*180,C=this.center.lat;this.setCenter(new e.N(w,e.ab(T,-90,90))),this.setZoom(this.zoom+ri(C,this.center.lat))}locationToScreenPoint(t,i){const r=Qe(t);if(i){const n=i.getElevationForLngLatZoom(t,this._helper._tileZoom);e.aL(r,r,1+n/e.bo)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){const i=e.be();return e.al(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new e.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){const e=i.pointCoordinate(t);if(e)return e}return e.Y.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var i;return null===(i=this.screenPointToMercatorCoordinate(t,e))||void 0===i?void 0:i.toLngLat()}isPointOnMapSurface(t,e){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(t){const i=e.be();i[0]=t.x/this.width*2-1,i[1]=-1*(t.y/this.height*2-1),i[2]=1,i[3]=1,e.al(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const r=e.bf();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];const n=e.bf();return e.aQ(n,r),n}isSurfacePointVisible(t){const e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const i=e.be();return e.al(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(t,i){const r=e.aS(t,i),n=e.bf(),o=e.bf();e.aL(o,i,r),e.aP(n,t,o);const a=1-e.aS(n,n);if(a<0)return null;const s=e.aS(t,t)-1,l=-r+(r<0?1:-1)*Math.sqrt(a),c=s/l,h=l;return{tMin:Math.min(c,h),tMax:Math.max(c,h)}}unprojectScreenPoint(t){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(i,r);if(n){const t=e.bf();e.aM(t,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);const o=e.bf();return e.aQ(o,t),ei(o)}const o=this._cachedClippingPlane[0]*r[0]+this._cachedClippingPlane[1]*r[1]+this._cachedClippingPlane[2]*r[2],a=-e.bn(this._cachedClippingPlane,i)/o,s=e.bf();if(a>0)e.aM(s,i,[r[0]*a,r[1]*a,r[2]*a]);else{const t=e.bf();e.aM(t,i,[2*r[0],2*r[1],2*r[2]]);const n=e.bn(this._cachedClippingPlane,t);e.aP(s,t,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const l=e.bf();return e.aQ(l,s),ei(l)}getMatrixForModel(t,i){const r=e.N.convert(t),n=1/e.bo,o=e.a_();return e.bj(o,o,r.lng/180*Math.PI),e.aY(o,o,-r.lat/180*Math.PI),e.J(o,o,[0,0,1+i/e.bo]),e.aY(o,o,.5*Math.PI),e.K(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(t=!0){const i=this.getProjectionData({overscaledTileID:new e.S(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}}class pi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Se({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,e)=>this.getConstrained(t,e)}),this._globeness=1,this._mercatorTransform=new Ae,this._verticalPerspectiveTransform=new ui}clone(){const t=new pi;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const e=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:e.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return e.b9(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return e.b9(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){const n=this._mercatorTransform.getPitchedTextCorrection(t,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return e.b9(n,o,this._globeness)}projectTileCoordinates(t,e,i,r){return this.currentTransform.projectTileCoordinates(t,e,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,e){return this.currentTransform.getConstrained(t,e)}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){const e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=e.mainMatrix,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class di{get useGlobeControls(){return!0}handlePanInertia(t,i){const r=ni(t,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new e.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){const r=t.around,n=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);const o=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);const a=i.zoom-o;if(0===a)return;const s=e.bk(i.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=e.bk(i.center.lat,n.lat),h=i.getRayDirectionFromPixel(r),u=i.cameraPosition,p=-1*e.aS(u,h),d=e.bf();e.aM(d,u,[h[0]*p,h[1]*p,h[2]*p]);const f=e.bq(d)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=ti(i.worldSize,i.center.lat)/Math.min(i.width,i.height),_=e.bc(g,.9,.5,1,.25),y=(1-e.aG(-a))*Math.min(m,_),v=i.center.lat,x=i.zoom,b=new e.N(i.center.lng+l*y,e.ab(i.center.lat+c*y,-85.051129,e.aF));i.setLocationAtPoint(n,r);const w=i.center,T=e.bc(Math.abs(s),45,85,0,1),C=e.bc(g,.75,.35,0,1),P=Math.pow(Math.max(T,C),.25),M=e.bk(w.lng,b.lng),S=e.bk(w.lat,b.lat);i.setCenter(new e.N(w.lng+M*P,w.lat+S*P).wrap()),i.setZoom(x+ri(v,i.center.lat))}handleMapControlsPan(t,e,i){if(!t.panDelta)return;const r=e.center.lat,n=e.zoom;e.setCenter(ni(t.panDelta,e).wrap()),e.setZoom(n+ri(r,e.center.lat))}cameraForBoxAndBearing(t,i,r,n,o){const a=Re(t,i,r,n,o),s=i.left/o.width*2-1,l=(o.width-i.right)/o.width*2-1,c=i.top/o.height*-2+1,h=(o.height-i.bottom)/o.height*-2+1,u=e.bk(r.getWest(),r.getEast())<0,p=u?r.getEast():r.getWest(),d=u?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),g=p+.5*e.bk(p,d),_=f+.5*e.bk(f,m),y=o.clone();y.setCenter(a.center),y.setBearing(a.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(a.zoom);const v=y.modelViewProjectionMatrix,x=[Qe(r.getNorthWest()),Qe(r.getNorthEast()),Qe(r.getSouthWest()),Qe(r.getSouthEast()),Qe(new e.N(d,_)),Qe(new e.N(p,_)),Qe(new e.N(g,f)),Qe(new e.N(g,m))],b=Qe(a.center);let w=Number.POSITIVE_INFINITY;for(const t of x)s<0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(t,b,v,"x",s))),l>0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(t,b,v,"x",l))),c>0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(t,b,v,"y",c))),h<0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(t,b,v,"y",h)));if(Number.isFinite(w)&&0!==w)return a.zoom=y.zoom+e.a8(w),a;ke()}handleJumpToCenterZoom(t,i){const r=t.center.lat,n=t.getConstrained(i.center?e.N.convert(i.center):t.center,t.zoom).center;t.setCenter(n.wrap());const o=void 0!==i.zoom?+i.zoom:t.zoom+ri(r,n.lat);t.zoom!==o&&t.setZoom(o)}handleEaseTo(t,i){const r=t.zoom,n=t.center,o=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},l=void 0!==i.zoom,c=!t.isPaddingEqual(i.padding);let h=!1;const u=i.center?e.N.convert(i.center):n,p=t.getConstrained(u,r).center;Pe(t,p);const d=t.clone();d.setCenter(p),d.setZoom(l?+i.zoom:r+ri(n.lat,u.lat)),d.setBearing(i.bearing);const f=new e.P(e.ab(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),e.ab(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(p,f);const m=(i.offset&&i.offsetAsPoint.mag())>0?d.center:p,g=l?+i.zoom:r+ri(n.lat,m.lat),_=r+ri(n.lat,0),y=g+ri(m.lat,0),v=e.bk(n.lng,m.lng),x=e.bk(n.lat,m.lat),b=e.aG(y-_);return h=g!==r,{easeFunc:r=>{if(e.b3(a,s)||De({startEulerAngles:a,endEulerAngles:s,tr:t,k:r,useSlerp:a.roll!=s.roll}),c&&t.interpolatePadding(o,i.padding,r),i.around)e.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{const e=y>_?Math.min(2,b):Math.max(.5,b),i=Math.pow(e,1-r),o=ai(n,v,x,r*i);t.setCenter(o.wrap())}if(h){const i=e.y.number(_,y,r)+ri(0,t.center.lat);t.setZoom(i)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,i){const r=void 0!==i.zoom,n=t.center,o=t.zoom,a=!t.isPaddingEqual(i.padding),s=t.getConstrained(e.N.convert(i.center||i.locationAtOffset),o).center,l=r?+i.zoom:t.zoom+ri(t.center.lat,s.lat),c=t.clone();c.setCenter(s),a&&c.setPadding(i.padding),c.setZoom(l),c.setBearing(i.bearing);const h=new e.P(e.ab(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),e.ab(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));c.setLocationAtPoint(s,h);const u=c.center;Pe(t,u);const p=function(t,i,r){const n=Qe(i),o=Qe(r),a=e.aS(n,o),s=Math.acos(a),l=Ye(t);return s/(2*Math.PI)*l}(t,n,u),d=o+ri(n.lat,0),f=l+ri(u.lat,0),m=e.aG(f-d);let g;if("number"==typeof i.minZoom){const r=+i.minZoom+ri(u.lat,0),n=Math.min(r,d,f)+ri(0,u.lat),o=t.getConstrained(u,n).zoom+ri(u.lat,0);g=e.aG(o-d)}const _=e.bk(n.lng,u.lng),y=e.bk(n.lat,u.lat);return{easeFunc:(i,r,o,a)=>{const s=ai(n,_,y,o),c=1===i?u:s;t.setCenter(c.wrap());const h=d+e.a8(r);t.setZoom(1===i?l:h+ri(0,c.lat))},scaleOfZoom:m,targetCenter:u,scaleOfMinZoom:g,pixelPathLength:p}}static solveVectorScale(t,e,i,r,n){const o="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],a=[i[3],i[7],i[11],i[15]],s=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],l=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],h=e[0]*a[0]+e[1]*a[1]+e[2]*a[2];return c+n*l===s+n*h||a[3]*(s-c)+o[3]*(h-l)+s*h==c*l?null:(c+o[3]-n*h-n*a[3])/(c-s-n*h+n*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}}class fi{constructor(t){this._globe=t,this._mercatorCameraHelper=new Le,this._verticalPerspectiveCameraHelper=new di}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,i){this.currentHelper.handleMapControlsPan(t,e,i)}cameraForBoxAndBearing(t,e,i,r,n){return this.currentHelper.cameraForBoxAndBearing(t,e,i,r,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}const mi=(t,i)=>e.t(t,i&&i.filter((t=>"source.canvas"!==t.identifier))),gi=e.br();class _i extends e.E{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||this.sourceCaches[t].reload()}},this.map=t,this.dispatcher=new F(B(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler("GI",((t,e)=>this.getImages(t,e))),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new C(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new z(256,512),this.crossTileSymbolIndex=new he,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.bs,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",e.bt()),nt().on(et,this._rtlPluginLoaded),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}}))}loadURL(t,i={},r){this.fire(new e.k("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;e.h(n,this._loadStyleRequest).then((t=>{this._loadStyleRequest=null,this._load(t.data,i,r)})).catch((t=>{this._loadStyleRequest=null,t&&!o.signal.aborted&&this.fire(new e.j(t))}))}loadJSON(t,i={},r){this.fire(new e.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,r)})).catch((()=>{}))}loadEmpty(){this.fire(new e.k("dataloading",{dataType:"style"})),this._load(gi,{validate:!1})}_load(t,i,r){var n,o;const a=i.transformStyle?i.transformStyle(r,t):t;if(!i.validate||!mi(this,e.u(a))){this._loaded=!0,this.stylesheet=a;for(const t in a.sources)this.addSource(t,a.sources[t],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new S(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new E(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new e.k("data",{dataType:"style"})),this.fire(new e.k("style.load"))}}_createLayers(){const t=e.bu(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of t){const t=e.bv(i);t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t}}_loadSprite(t,i=!1,r=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,i,r,n){return e._(this,void 0,void 0,(function*(){const o=g(t),s=r>1?"@2x":"",l={},c={};for(const{id:t,url:r}of o){const o=i.transformRequest(_(r,s,".json"),"SpriteJSON");l[t]=e.h(o,n);const a=i.transformRequest(_(r,s,".png"),"SpriteImage");c[t]=f.getImage(a,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,i){return e._(this,void 0,void 0,(function*(){const e={};for(const r in t){e[r]={};const n=a.getImageCanvasContext((yield i[r]).data),o=(yield t[r]).data;for(const t in o){const{width:i,height:a,x:s,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d,textFitWidth:f,textFitHeight:m}=o[t];e[r][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d,textFitWidth:f,textFitHeight:m,spriteData:{width:i,height:a,x:s,y:l,context:n}}}}return e}))}(l,c)}))}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const r=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in t))):[];for(const t of r)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const r in t[e]){const n="default"===e?r:`${e}:${r}`;this._spritesImagesIds[e].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,t[e][r],!1):this.imageManager.addImage(n,t[e][r]),i&&(this._changedImages[n]=!0)}}})).catch((t=>{this._spriteRequest=null,n=t,this.fire(new e.j(n))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"})),r&&r(n)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}_validateLayer(t){const i=this.sourceCaches[t.source];if(!i)return;const r=t.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new e.j(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,i=!1){const r=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?e.bw(r):r);const n=[];for(const o of t)if(r[o]){const t=i?e.bw(r[o]):r[o];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){var t,e,i;if(null===(t=this.light)||void 0===t?void 0:t.hasTransition())return!0;if(null===(e=this.sky)||void 0===e?void 0:e.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const r={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];r[t]=e.used,e.used=!1}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const t in r){const i=this.sourceCaches[t];!!r[t]!=!!i.used&&i.fire(new e.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,i&&this.fire(new e.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var r;this._checkLoaded();const n=this.serialize();if(t=i.transformStyle?i.transformStyle(n,t):t,(null===(r=i.validate)||void 0===r||r)&&mi(this,e.u(t)))return!1;(t=e.bw(t)).layers=e.bu(t.layers);const o=e.bx(n,t),a=this._getOperationsToPerform(o);if(a.unimplemented.length>0)throw new Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(const t of a.operations)t();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],i=[];for(const r of t)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":e.push((()=>this.addLayer.apply(this,r.args)));break;case"removeLayer":e.push((()=>this.removeLayer.apply(this,r.args)));break;case"setPaintProperty":e.push((()=>this.setPaintProperty.apply(this,r.args)));break;case"setLayoutProperty":e.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case"setFilter":e.push((()=>this.setFilter.apply(this,r.args)));break;case"addSource":e.push((()=>this.addSource.apply(this,r.args)));break;case"removeSource":e.push((()=>this.removeSource.apply(this,r.args)));break;case"setLayerZoomRange":e.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case"setLight":e.push((()=>this.setLight.apply(this,r.args)));break;case"setGeoJSONSourceData":e.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case"setGlyphs":e.push((()=>this.setGlyphs.apply(this,r.args)));break;case"setSprite":e.push((()=>this.setSprite.apply(this,r.args)));break;case"setTerrain":e.push((()=>this.map.setTerrain.apply(this,r.args)));break;case"setSky":e.push((()=>this.setSky.apply(this,r.args)));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setTransition":e.push((()=>{}));break;default:i.push(r.command)}return{operations:e,unimplemented:i}}addImage(t,i){if(this.getImage(t))return this.fire(new e.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.u.source,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[t]=new pt(t,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t}))),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.j(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new e.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this.getLayer(n))return void this.fire(new e.j(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===t.type){if(mi(this,e.by(t)))return;o=e.bv(t)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(n,t.source),t=e.bw(t),t=e.e(t,{source:n})),this._validate(e.u.layer,`layers.${n}`,t,{arrayIndex:-1},r))return;o=e.bv(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new e.j(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const t=this._removedLayers[n];delete this._removedLayers[n],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const r=this._order.indexOf(t);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new e.j(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.j(new Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);const r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,r){this._checkLoaded();const n=this.getLayer(t);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new e.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,i,r={}){this._checkLoaded();const n=this.getLayer(t);if(n){if(!e.bz(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(e.u.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=e.bw(i),this._updateLayer(n)))}else this.fire(new e.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.bw(this.getLayer(t).filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bz(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new e.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,i){const r=this.getLayer(t);if(r)return r.getLayoutProperty(i);this.fire(new e.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,r,n={}){this._checkLoaded();const o=this.getLayer(t);o?e.bz(o.getPaintProperty(i),r)||(o.setPaintProperty(i,r,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new e.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,i){this._checkLoaded();const r=t.source,n=t.sourceLayer,o=this.sourceCaches[r];if(void 0===o)return void this.fire(new e.j(new Error(`The source '${r}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&n?this.fire(new e.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===t.id&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,t.id,i)):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,i){this._checkLoaded();const r=t.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new e.j(new Error(`The source '${r}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?t.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.j(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,t.id,i):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const i=t.source,r=t.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===t.id&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,t.id)):void this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.j(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.bA(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return e.bB({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:t,layers:i,terrain:r},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(e(o)){i[o]=n;for(const e of t){const t=e[o];if(t)for(const e of t)r.push(e)}}}r.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]<o)break;n.push(e),r.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)n.push(e.feature)}}return n}queryRenderedFeatures(t,i,r){i&&i.filter&&this._validate(e.u.filter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new e.j(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:s});for(const e in this.sourceCaches)i.layers&&!n[e]||o.push(V(this.sourceCaches[e],this._layers,a,t,l,r));return this.placement&&o.push(function(t,e,i,r,n,o,a){const s={},l=o.queryRenderedSymbols(r),c=[];for(const t of Object.keys(l).map(Number))c.push(a[t]);c.sort(N);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,t);for(const t in r){const e=s[t]=s[t]||[],n=r[t];n.sort(((t,e)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of n)e.push(t)}}return function(t,e,i){for(const r in t)for(const n of t[r])q(n,i[e[r].source]);return t}(s,t,i)}(this._layers,a,this.sourceCaches,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.u.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[t];return r?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),r=[],n={};for(let t=0;t<i.length;t++){const o=i[t],a=o.tileID.canonical.key;n[a]||(n[a]=!0,o.querySourceFeatures(r,e))}return r}(r,i):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const i in t)if(!e.bz(t[i],r[i])){n=!0;break}if(!n)return;const o={now:a.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(o)}getProjection(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.sky}setSky(t,i={}){this._checkLoaded();const r=this.getSky();let n=!1;if(!t&&!r)return;if(t&&!r)n=!0;else if(!t&&r)n=!0;else for(const i in t)if(!e.bz(t[i],r[i])){n=!0;break}if(!n)return;const o={now:a.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,i),this.sky.updateTransitions(o)}_setProjectionInternal(t){const i=function(t){if(Array.isArray(t)){const e=new Ke({type:t});return{projection:e,transform:new pi,cameraHelper:new fi(e)}}switch(t){case"mercator":return{projection:new ye,transform:new Ae,cameraHelper:new Le};case"globe":{const t=new Ke({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new pi,cameraHelper:new fi(t)}}case"vertical-perspective":return{projection:new Xe,transform:new ui,cameraHelper:new di};default:return e.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new ye,transform:new Ae,cameraHelper:new Le}}}(t);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const t in this.sourceCaches)this.sourceCaches[t].reload()}_validate(t,i,r,n,o={}){return(!o||!1!==o.validate)&&mi(this,t.call(e.u,e.e({key:i,style:this.serialize(),value:r,styleSpec:e.v},n)))}_remove(t=!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),nt().off(et,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,e,i,r,n=!1){let o=!1,s=!1;const l={};for(const e of this._order){const i=this._layers[e];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.now(),t.zoom))&&(this.pauseablePlacement=new oe(t,this.map.terrain,this._order,n,e,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,i.icons),t}))}getGlyphs(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.glyphManager.getGlyphs(i.stacks),e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,[""]),t}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(e.u.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,r={},n){this._checkLoaded();const o=[{id:t,url:i}],a=[...g(this.stylesheet.sprite),...o];this._validate(e.u.sprite,"sprite",a,null,r)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(t){this._checkLoaded();const i=g(this.stylesheet.sprite);if(i.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;i.splice(i.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}else this.fire(new e.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return g(this.stylesheet.sprite)}setSprite(t,i={},r){this._checkLoaded(),t&&this._validate(e.u.sprite,"sprite",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,r):(this._unloadSprite(),r&&r(null)))}}var yi=e.aA([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class vi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,o,a,s,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!c&&t<r.length;t++)this.boundPaintVertexBuffers[t]!==r[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,r,n,o,a,s,l):(t.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(t,e,i,r,n,o,a,s){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);o&&o.enableAttributes(h,t),a&&a.enableAttributes(h,t),s&&s.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,n);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,n);o&&(o.bind(),o.setVertexAttribPointers(h,t,n)),r&&r.bind(),a&&(a.bind(),a.setVertexAttribPointers(h,t,n)),s&&(s.bind(),s.setVertexAttribPointers(h,t,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const xi=(t,i,r,n,o)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):e.b4.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):e.b4.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),bi={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function wi(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const r=t[i].split(" ");e.push(r.pop())}return e}class Ti{constructor(t,i,r,n,o,a,s,l){const c=t.gl;this.program=c.createProgram();const h=wi(i.staticAttributes),u=r?r.getBinderAttributes():[],p=h.concat(u),d=pe.prelude.staticUniforms?wi(pe.prelude.staticUniforms):[],f=s.staticUniforms?wi(s.staticUniforms):[],m=i.staticUniforms?wi(i.staticUniforms):[],g=r?r.getBinderUniforms():[],_=d.concat(f).concat(m).concat(g),y=[];for(const t of _)y.indexOf(t)<0&&y.push(t);const v=r?r.defines():[];Ze(c)&&v.unshift("#version 300 es"),o&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),l&&v.push(l);let x=v.concat(pe.prelude.fragmentSource,s.fragmentSource,i.fragmentSource).join("\n"),b=v.concat(pe.prelude.vertexSource,s.vertexSource,i.vertexSource).join("\n");Ze(c)||(x=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),b=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(b));const w=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(w,x),c.compileShader(w),!c.getShaderParameter(w,c.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${c.getShaderInfoLog(w)}`);c.attachShader(this.program,w);const T=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(T,b),c.compileShader(T),!c.getShaderParameter(T,c.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${c.getShaderInfoLog(T)}`);c.attachShader(this.program,T),this.attributes={};const C={};this.numAttributes=p.length;for(let t=0;t<this.numAttributes;t++)p[t]&&(c.bindAttribLocation(this.program,t,p[t]),this.attributes[p[t]]=t);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw new Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(T),c.deleteShader(w);for(let t=0;t<y.length;t++){const e=y[t];if(e&&!C[e]){const t=c.getUniformLocation(this.program,e);t&&(C[e]=t)}}this.fixedUniforms=n(t,C),this.terrainUniforms=((t,i)=>({u_depth:new e.bC(t,i.u_depth),u_terrain:new e.bC(t,i.u_terrain),u_terrain_dim:new e.b5(t,i.u_terrain_dim),u_terrain_matrix:new e.bD(t,i.u_terrain_matrix),u_terrain_unpack:new e.bE(t,i.u_terrain_unpack),u_terrain_exaggeration:new e.b5(t,i.u_terrain_exaggeration)}))(t,C),this.projectionUniforms=((t,i)=>({u_projection_matrix:new e.bD(t,i.u_projection_matrix),u_projection_tile_mercator_coords:new e.bE(t,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new e.bE(t,i.u_projection_clipping_plane),u_projection_transition:new e.b5(t,i.u_projection_transition),u_projection_fallback_matrix:new e.bD(t,i.u_projection_fallback_matrix)}))(t,C),this.binderUniforms=r?r.getUniforms(t,C):[]}draw(t,e,i,r,n,o,a,s,l,c,h,u,p,d,f,m,g,_,y){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(o),s){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(s[t])}if(l)for(const t in l)this.projectionUniforms[bi[t]].set(l[t]);if(a)for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);m&&m.setUniforms(t,this.binderUniforms,d,{zoom:f});let x=0;switch(e){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1}for(const i of p.get()){const r=i.vaos||(i.vaos={});(r[c]||(r[c]=new vi)).bind(t,this,h,m?m.getPaintVertexBuffers():[],u,i.vertexOffset,g,_,y),v.drawElements(e,i.primitiveLength*x,v.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}}function Ci(t,i,r){const n=1/e.at(r,1,i.transform.tileZoom),o=Math.pow(2,r.tileID.overscaledZ),a=r.tileSize*Math.pow(2,i.transform.tileZoom)/o,s=a*(r.tileID.canonical.x+r.tileID.wrap*o),l=a*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Pi=(t,i,r,n)=>{const o=t.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=e.bI();"viewport"===o.properties.get("anchor")&&e.bJ(l,t.transform.bearingInRadians),e.bK(s,s,l);const c=t.transform.transformLightDirection(s),h=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},Mi=(t,i,r,n,o,a,s)=>e.e(Pi(t,i,r,n),Ci(a,t,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),Si=(t,i,r,n)=>e.e(Ci(i,t,r),{u_fill_translate:n}),Ii=(t,e)=>({u_world:t,u_fill_translate:e}),Ei=(t,i,r,n,o)=>e.e(Si(t,i,r,o),{u_world:n}),zi=(t,i,r,n,o)=>{const a=t.transform;let s,l,c=0;if("map"===r.paint.get("circle-pitch-alignment")){const t=e.at(i,1,a.zoom);s=!0,l=[t,t],c=t/(e.X*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*o}else s=!1,l=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},Ai=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),ki=t=>({u_viewport_size:[t.width,t.height]}),Di=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),Ri=(t,i,r,n)=>{const o=e.at(t,1,i)/(e.X*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:e.at(t,1,i),u_intensity:r,u_globe_extrude_scale:o}},Li=(t,i,r,n)=>{const o=e.H();e.bL(o,0,t.width,t.height,0,0,1);const a=t.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},Bi=(t,e,i)=>{const r=i.paint.get("hillshade-shadow-color"),n=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a+=t.transform.bearingInRadians),{u_image:0,u_latrange:Oi(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:r,u_highlight:n,u_accent:o}},Fi=(t,i)=>{const r=i.stride,n=e.H();return e.bL(n,0,e.X,-8192,0,0,1),e.J(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}};function Oi(t,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new e.Y(0,n/r).toLngLat().lat,new e.Y(0,(n+1)/r).toLngLat().lat]}const ji=(t,i,r,n)=>{const o=t.transform;return{u_translation:Ui(t,i,r),u_ratio:n/e.at(i,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Vi=(t,i,r,n,o)=>e.e(ji(t,i,r,n),{u_image:0,u_image_height:o}),Ni=(t,i,r,n,o)=>{const a=t.transform,s=Zi(i,a);return{u_translation:Ui(t,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/e.at(i,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},qi=(t,i,r,n,o,a)=>{const s=t.lineAtlas,l=Zi(i,t.transform),c="round"===r.layout.get("line-cap"),h=s.getDash(o.from,c),u=s.getDash(o.to,c),p=h.width*a.fromScale,d=u.width*a.toScale;return e.e(ji(t,i,r,n),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-u.height/2],u_sdfgamma:s.width/(256*Math.min(p,d)*t.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:a.t})};function Zi(t,i){return 1/e.at(t,1,i.tileZoom)}function Ui(t,i,r){return e.au(t.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Gi=(t,e,i,r,n)=>{return{u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:$i(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,a};function $i(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Hi=(t,e,i,r,n,o,a,s,l,c,h,u,p)=>{const d=a.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:d.width/d.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:u,u_texture:0,u_translation:c,u_pitched_scale:p}},Xi=(t,i,r,n,o,a,s,l,c,h,u,p,d,f)=>{const m=s.transform;return e.e(Hi(t,i,r,n,o,a,s,l,c,h,u,p,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},Wi=(t,i,r,n,o,a,s,l,c,h,u,p,d)=>e.e(Xi(t,i,r,n,o,a,s,l,c,h,!0,u,0,d),{u_texsize_icon:p,u_texture_icon:1}),Ki=(t,e)=>({u_opacity:t,u_color:e}),Yi=(t,i,r,n,o)=>e.e(function(t,i,r,n){const o=r.imageManager.getPattern(t.from.toString()),a=r.imageManager.getPattern(t.to.toString()),{width:s,height:l}=r.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,u=h*(n.tileID.canonical.x+n.tileID.wrap*c),p=h*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/e.at(n,1,r.transform.tileZoom),u_pixel_coord_upper:[u>>16,p>>16],u_pixel_coord_lower:[65535&u,65535&p]}}(r,o,i,n),{u_opacity:t}),Ji=(t,e)=>{},Qi={fillExtrusion:(t,i)=>({u_lightpos:new e.bG(t,i.u_lightpos),u_lightpos_globe:new e.bG(t,i.u_lightpos_globe),u_lightintensity:new e.b5(t,i.u_lightintensity),u_lightcolor:new e.bG(t,i.u_lightcolor),u_vertical_gradient:new e.b5(t,i.u_vertical_gradient),u_opacity:new e.b5(t,i.u_opacity),u_fill_translate:new e.bH(t,i.u_fill_translate)}),fillExtrusionPattern:(t,i)=>({u_lightpos:new e.bG(t,i.u_lightpos),u_lightpos_globe:new e.bG(t,i.u_lightpos_globe),u_lightintensity:new e.b5(t,i.u_lightintensity),u_lightcolor:new e.bG(t,i.u_lightcolor),u_vertical_gradient:new e.b5(t,i.u_vertical_gradient),u_height_factor:new e.b5(t,i.u_height_factor),u_opacity:new e.b5(t,i.u_opacity),u_fill_translate:new e.bH(t,i.u_fill_translate),u_image:new e.bC(t,i.u_image),u_texsize:new e.bH(t,i.u_texsize),u_pixel_coord_upper:new e.bH(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bH(t,i.u_pixel_coord_lower),u_scale:new e.bG(t,i.u_scale),u_fade:new e.b5(t,i.u_fade)}),fill:(t,i)=>({u_fill_translate:new e.bH(t,i.u_fill_translate)}),fillPattern:(t,i)=>({u_image:new e.bC(t,i.u_image),u_texsize:new e.bH(t,i.u_texsize),u_pixel_coord_upper:new e.bH(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bH(t,i.u_pixel_coord_lower),u_scale:new e.bG(t,i.u_scale),u_fade:new e.b5(t,i.u_fade),u_fill_translate:new e.bH(t,i.u_fill_translate)}),fillOutline:(t,i)=>({u_world:new e.bH(t,i.u_world),u_fill_translate:new e.bH(t,i.u_fill_translate)}),fillOutlinePattern:(t,i)=>({u_world:new e.bH(t,i.u_world),u_image:new e.bC(t,i.u_image),u_texsize:new e.bH(t,i.u_texsize),u_pixel_coord_upper:new e.bH(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bH(t,i.u_pixel_coord_lower),u_scale:new e.bG(t,i.u_scale),u_fade:new e.b5(t,i.u_fade),u_fill_translate:new e.bH(t,i.u_fill_translate)}),circle:(t,i)=>({u_camera_to_center_distance:new e.b5(t,i.u_camera_to_center_distance),u_scale_with_map:new e.bC(t,i.u_scale_with_map),u_pitch_with_map:new e.bC(t,i.u_pitch_with_map),u_extrude_scale:new e.bH(t,i.u_extrude_scale),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_globe_extrude_scale:new e.b5(t,i.u_globe_extrude_scale),u_translate:new e.bH(t,i.u_translate)}),collisionBox:(t,i)=>({u_pixel_extrude_scale:new e.bH(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_viewport_size:new e.bH(t,i.u_viewport_size)}),debug:(t,i)=>({u_color:new e.bF(t,i.u_color),u_overlay:new e.bC(t,i.u_overlay),u_overlay_scale:new e.b5(t,i.u_overlay_scale)}),depth:Ji,clippingMask:Ji,heatmap:(t,i)=>({u_extrude_scale:new e.b5(t,i.u_extrude_scale),u_intensity:new e.b5(t,i.u_intensity),u_globe_extrude_scale:new e.b5(t,i.u_globe_extrude_scale)}),heatmapTexture:(t,i)=>({u_matrix:new e.bD(t,i.u_matrix),u_world:new e.bH(t,i.u_world),u_image:new e.bC(t,i.u_image),u_color_ramp:new e.bC(t,i.u_color_ramp),u_opacity:new e.b5(t,i.u_opacity)}),hillshade:(t,i)=>({u_image:new e.bC(t,i.u_image),u_latrange:new e.bH(t,i.u_latrange),u_light:new e.bH(t,i.u_light),u_shadow:new e.bF(t,i.u_shadow),u_highlight:new e.bF(t,i.u_highlight),u_accent:new e.bF(t,i.u_accent)}),hillshadePrepare:(t,i)=>({u_matrix:new e.bD(t,i.u_matrix),u_image:new e.bC(t,i.u_image),u_dimension:new e.bH(t,i.u_dimension),u_zoom:new e.b5(t,i.u_zoom),u_unpack:new e.bE(t,i.u_unpack)}),line:(t,i)=>({u_translation:new e.bH(t,i.u_translation),u_ratio:new e.b5(t,i.u_ratio),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.bH(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_translation:new e.bH(t,i.u_translation),u_ratio:new e.b5(t,i.u_ratio),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.bH(t,i.u_units_to_pixels),u_image:new e.bC(t,i.u_image),u_image_height:new e.b5(t,i.u_image_height)}),linePattern:(t,i)=>({u_translation:new e.bH(t,i.u_translation),u_texsize:new e.bH(t,i.u_texsize),u_ratio:new e.b5(t,i.u_ratio),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_image:new e.bC(t,i.u_image),u_units_to_pixels:new e.bH(t,i.u_units_to_pixels),u_scale:new e.bG(t,i.u_scale),u_fade:new e.b5(t,i.u_fade)}),lineSDF:(t,i)=>({u_translation:new e.bH(t,i.u_translation),u_ratio:new e.b5(t,i.u_ratio),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.bH(t,i.u_units_to_pixels),u_patternscale_a:new e.bH(t,i.u_patternscale_a),u_patternscale_b:new e.bH(t,i.u_patternscale_b),u_sdfgamma:new e.b5(t,i.u_sdfgamma),u_image:new e.bC(t,i.u_image),u_tex_y_a:new e.b5(t,i.u_tex_y_a),u_tex_y_b:new e.b5(t,i.u_tex_y_b),u_mix:new e.b5(t,i.u_mix)}),raster:(t,i)=>({u_tl_parent:new e.bH(t,i.u_tl_parent),u_scale_parent:new e.b5(t,i.u_scale_parent),u_buffer_scale:new e.b5(t,i.u_buffer_scale),u_fade_t:new e.b5(t,i.u_fade_t),u_opacity:new e.b5(t,i.u_opacity),u_image0:new e.bC(t,i.u_image0),u_image1:new e.bC(t,i.u_image1),u_brightness_low:new e.b5(t,i.u_brightness_low),u_brightness_high:new e.b5(t,i.u_brightness_high),u_saturation_factor:new e.b5(t,i.u_saturation_factor),u_contrast_factor:new e.b5(t,i.u_contrast_factor),u_spin_weights:new e.bG(t,i.u_spin_weights),u_coords_top:new e.bE(t,i.u_coords_top),u_coords_bottom:new e.bE(t,i.u_coords_bottom)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new e.bC(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bC(t,i.u_is_size_feature_constant),u_size_t:new e.b5(t,i.u_size_t),u_size:new e.b5(t,i.u_size),u_camera_to_center_distance:new e.b5(t,i.u_camera_to_center_distance),u_pitch:new e.b5(t,i.u_pitch),u_rotate_symbol:new e.bC(t,i.u_rotate_symbol),u_aspect_ratio:new e.b5(t,i.u_aspect_ratio),u_fade_change:new e.b5(t,i.u_fade_change),u_label_plane_matrix:new e.bD(t,i.u_label_plane_matrix),u_coord_matrix:new e.bD(t,i.u_coord_matrix),u_is_text:new e.bC(t,i.u_is_text),u_pitch_with_map:new e.bC(t,i.u_pitch_with_map),u_is_along_line:new e.bC(t,i.u_is_along_line),u_is_variable_anchor:new e.bC(t,i.u_is_variable_anchor),u_texsize:new e.bH(t,i.u_texsize),u_texture:new e.bC(t,i.u_texture),u_translation:new e.bH(t,i.u_translation),u_pitched_scale:new e.b5(t,i.u_pitched_scale)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new e.bC(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bC(t,i.u_is_size_feature_constant),u_size_t:new e.b5(t,i.u_size_t),u_size:new e.b5(t,i.u_size),u_camera_to_center_distance:new e.b5(t,i.u_camera_to_center_distance),u_pitch:new e.b5(t,i.u_pitch),u_rotate_symbol:new e.bC(t,i.u_rotate_symbol),u_aspect_ratio:new e.b5(t,i.u_aspect_ratio),u_fade_change:new e.b5(t,i.u_fade_change),u_label_plane_matrix:new e.bD(t,i.u_label_plane_matrix),u_coord_matrix:new e.bD(t,i.u_coord_matrix),u_is_text:new e.bC(t,i.u_is_text),u_pitch_with_map:new e.bC(t,i.u_pitch_with_map),u_is_along_line:new e.bC(t,i.u_is_along_line),u_is_variable_anchor:new e.bC(t,i.u_is_variable_anchor),u_texsize:new e.bH(t,i.u_texsize),u_texture:new e.bC(t,i.u_texture),u_gamma_scale:new e.b5(t,i.u_gamma_scale),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_is_halo:new e.bC(t,i.u_is_halo),u_translation:new e.bH(t,i.u_translation),u_pitched_scale:new e.b5(t,i.u_pitched_scale)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new e.bC(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bC(t,i.u_is_size_feature_constant),u_size_t:new e.b5(t,i.u_size_t),u_size:new e.b5(t,i.u_size),u_camera_to_center_distance:new e.b5(t,i.u_camera_to_center_distance),u_pitch:new e.b5(t,i.u_pitch),u_rotate_symbol:new e.bC(t,i.u_rotate_symbol),u_aspect_ratio:new e.b5(t,i.u_aspect_ratio),u_fade_change:new e.b5(t,i.u_fade_change),u_label_plane_matrix:new e.bD(t,i.u_label_plane_matrix),u_coord_matrix:new e.bD(t,i.u_coord_matrix),u_is_text:new e.bC(t,i.u_is_text),u_pitch_with_map:new e.bC(t,i.u_pitch_with_map),u_is_along_line:new e.bC(t,i.u_is_along_line),u_is_variable_anchor:new e.bC(t,i.u_is_variable_anchor),u_texsize:new e.bH(t,i.u_texsize),u_texsize_icon:new e.bH(t,i.u_texsize_icon),u_texture:new e.bC(t,i.u_texture),u_texture_icon:new e.bC(t,i.u_texture_icon),u_gamma_scale:new e.b5(t,i.u_gamma_scale),u_device_pixel_ratio:new e.b5(t,i.u_device_pixel_ratio),u_is_halo:new e.bC(t,i.u_is_halo),u_translation:new e.bH(t,i.u_translation),u_pitched_scale:new e.b5(t,i.u_pitched_scale)}),background:(t,i)=>({u_opacity:new e.b5(t,i.u_opacity),u_color:new e.bF(t,i.u_color)}),backgroundPattern:(t,i)=>({u_opacity:new e.b5(t,i.u_opacity),u_image:new e.bC(t,i.u_image),u_pattern_tl_a:new e.bH(t,i.u_pattern_tl_a),u_pattern_br_a:new e.bH(t,i.u_pattern_br_a),u_pattern_tl_b:new e.bH(t,i.u_pattern_tl_b),u_pattern_br_b:new e.bH(t,i.u_pattern_br_b),u_texsize:new e.bH(t,i.u_texsize),u_mix:new e.b5(t,i.u_mix),u_pattern_size_a:new e.bH(t,i.u_pattern_size_a),u_pattern_size_b:new e.bH(t,i.u_pattern_size_b),u_scale_a:new e.b5(t,i.u_scale_a),u_scale_b:new e.b5(t,i.u_scale_b),u_pixel_coord_upper:new e.bH(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.bH(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new e.b5(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_texture:new e.bC(t,i.u_texture),u_ele_delta:new e.b5(t,i.u_ele_delta),u_fog_matrix:new e.bD(t,i.u_fog_matrix),u_fog_color:new e.bF(t,i.u_fog_color),u_fog_ground_blend:new e.b5(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.b5(t,i.u_fog_ground_blend_opacity),u_horizon_color:new e.bF(t,i.u_horizon_color),u_horizon_fog_blend:new e.b5(t,i.u_horizon_fog_blend),u_is_globe_mode:new e.b5(t,i.u_is_globe_mode)}),terrainDepth:(t,i)=>({u_ele_delta:new e.b5(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_texture:new e.bC(t,i.u_texture),u_terrain_coords_id:new e.b5(t,i.u_terrain_coords_id),u_ele_delta:new e.b5(t,i.u_ele_delta)}),projectionErrorMeasurement:(t,i)=>({u_input:new e.b5(t,i.u_input),u_output_expected:new e.b5(t,i.u_output_expected)}),atmosphere:(t,i)=>({u_sun_pos:new e.bG(t,i.u_sun_pos),u_atmosphere_blend:new e.b5(t,i.u_atmosphere_blend),u_globe_position:new e.bG(t,i.u_globe_position),u_globe_radius:new e.b5(t,i.u_globe_radius),u_inv_proj_matrix:new e.bD(t,i.u_inv_proj_matrix)}),sky:(t,i)=>({u_sky_color:new e.bF(t,i.u_sky_color),u_horizon_color:new e.bF(t,i.u_horizon_color),u_horizon:new e.bH(t,i.u_horizon),u_horizon_normal:new e.bH(t,i.u_horizon_normal),u_sky_horizon_blend:new e.b5(t,i.u_sky_horizon_blend),u_sky_blend:new e.b5(t,i.u_sky_blend)})};class tr{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const er={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ir{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],o=e.attributes[n.name];void 0!==o&&t.vertexAttribPointer(o,n.components,t[er[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class rr{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class nr extends rr{getDefault(){return e.b4.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class or extends rr{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class ar extends rr{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class sr extends rr{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class lr extends rr{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class cr extends rr{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class hr extends rr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ur extends rr{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class pr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class dr extends rr{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class fr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class mr extends rr{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class gr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class _r extends rr{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class yr extends rr{getDefault(){return e.b4.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class vr extends rr{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class xr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class br extends rr{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class wr extends rr{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Tr extends rr{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Cr extends rr{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Pr extends rr{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Mr extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Sr extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ir extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Er extends rr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class zr extends rr{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ar extends rr{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;Ze(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class kr extends rr{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Dr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Rr extends rr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Lr extends rr{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class Br extends Lr{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Fr extends Lr{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Or extends Lr{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const jr="Framebuffer is not complete";class Vr{constructor(t,e,i,r,n){this.context=t,this.width=e,this.height=i;const o=t.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new Br(t,a),r)this.depthAttachment=n?new Or(t,a):new Fr(t,a);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(jr)}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Nr{constructor(t){var e,i;if(this.gl=t,this.clearColor=new nr(this),this.clearDepth=new or(this),this.clearStencil=new ar(this),this.colorMask=new sr(this),this.depthMask=new lr(this),this.stencilMask=new cr(this),this.stencilFunc=new hr(this),this.stencilOp=new ur(this),this.stencilTest=new pr(this),this.depthRange=new dr(this),this.depthTest=new fr(this),this.depthFunc=new mr(this),this.blend=new gr(this),this.blendFunc=new _r(this),this.blendColor=new yr(this),this.blendEquation=new vr(this),this.cullFace=new xr(this),this.cullFaceSide=new br(this),this.frontFace=new wr(this),this.program=new Tr(this),this.activeTexture=new Cr(this),this.viewport=new Pr(this),this.bindFramebuffer=new Mr(this),this.bindRenderbuffer=new Sr(this),this.bindTexture=new Ir(this),this.bindVertexBuffer=new Er(this),this.bindElementBuffer=new zr(this),this.bindVertexArray=new Ar(this),this.pixelStoreUnpack=new kr(this),this.pixelStoreUnpackPremultiplyAlpha=new Dr(this),this.pixelStoreUnpackFlipY=new Rr(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ze(t)){this.HALF_FLOAT=t.HALF_FLOAT;const r=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==r?void 0:r.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new tr(this,t,e)}createVertexBuffer(t,e,i){return new ir(this,t,e,i)}createRenderbuffer(t,e,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i,r){return new Vr(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){const r=this.gl;let n=0;t&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.bz(t.blendFunction,Be.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Ze(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return Ze(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let qr;function Zr(t,i,r,n,o){const a=t.context,s=t.transform,l=a.gl,c=t.useProgram("collisionBox"),h=[];let u=0,p=0;for(let e=0;e<n.length;e++){const d=n[e],f=i.getTile(d).getBucket(r);if(!f)continue;const m=o?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;g.length>0&&(h.push({circleArray:g,circleOffset:p,coord:d}),u+=g.length/4,p=u),m&&c.draw(a,l.LINES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,Ai(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(d),s.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,t.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!h.length)return;const d=t.useProgram("collisionCircle"),f=new e.bM;f.resize(4*u),f._trim();let m=0;for(const t of h)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,r=t.circleArray[i+0],n=t.circleArray[i+1],o=t.circleArray[i+2],a=t.circleArray[i+3];f.emplace(m++,r,n,o,a,0),f.emplace(m++,r,n,o,a,1),f.emplace(m++,r,n,o,a,2),f.emplace(m++,r,n,o,a,3)}(!qr||qr.length<2*u)&&(qr=function(t){const i=2*t,r=new e.bO;r.resize(i),r._trim();for(let t=0;t<i;t++){const e=6*t;r.uint16[e+0]=4*t+0,r.uint16[e+1]=4*t+1,r.uint16[e+2]=4*t+2,r.uint16[e+3]=4*t+2,r.uint16[e+4]=4*t+3,r.uint16[e+5]=4*t+0}return r}(u));const g=a.createIndexBuffer(qr,!0),_=a.createVertexBuffer(f,e.bN.members,!0);for(const i of h){const n=ki(t.transform);d.draw(a,l.TRIANGLES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,n,t.style.map.terrain&&t.style.map.terrain.getTerrainData(i.coord),null,r.id,_,g,e.aD.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,t.transform.zoom,null,null,null)}_.destroy(),g.destroy()}const Ur=e.aq(new Float32Array(16));function Gr(t,i,r,n,o,a){const{horizontalAlign:s,verticalAlign:l}=e.ay(t);return new e.P((-(s-.5)*i/o+n[0])*a,(-(l-.5)*r/o+n[1])*a)}function $r(t,i,r,n,o,a){const s=i.tileAnchorPoint.add(new e.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let t=n.mult(a);r||(t=t.rotate(-o));const e=s.add(t);return bt(e.x,e.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){const e=zt(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(t),r=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(n.rotate(r))}return t.add(n)}function Hr(t,i,r,n,o,a,s,l,c,h,u,p){const d=t.text.placedSymbolArray,f=t.text.dynamicLayoutVertexArray,m=t.icon.dynamicLayoutVertexArray,g={};f.clear();for(let m=0;m<d.length;m++){const _=d.get(m),y=_.hidden||!_.crossTileID||t.allowVerticalPlacement&&!_.placedOrientation?null:n[_.crossTileID];if(y){const n=new e.P(_.anchorX,_.anchorY),d={getElevation:p,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:r,transform:o,projectionCache:null,tileAnchorPoint:n,translation:h,unwrappedTileID:u},m=r?kt(n.x,n.y,d):zt(n.x,n.y,d),v=wt(o.cameraToCenterDistance,m.signedDistanceFromCamera);let x=e.aj(t.textSizeData,l,_)*v/e.as;r&&(x*=t.tilePixelRatio/s);const{width:b,height:w,anchor:T,textOffset:C,textBoxScale:P}=y,M=Gr(T,b,w,C,P,x),S=o.getPitchedTextCorrection(n.x+h[0],n.y+h[1],u),I=$r(m.point,d,i,M,-o.bearingInRadians,S),E=t.allowVerticalPlacement&&_.placedOrientation===e.ai.vertical?Math.PI/2:0;for(let t=0;t<_.numGlyphs;t++)e.ak(f,I,E);c&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:I,angle:E})}else Ft(_.numGlyphs,f)}if(c){m.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const r=i.get(t);if(r.hidden)Ft(r.numGlyphs,m);else{const i=g[t];if(i)for(let t=0;t<r.numGlyphs;t++)e.ak(m,i.shiftedAnchor,i.angle);else Ft(r.numGlyphs,m)}}t.icon.dynamicLayoutVertexBuffer.updateData(m)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function Xr(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Wr(t,i,r,n,o,a,s,l,c,h,u,p,d){const f=t.context,m=f.gl,g=t.transform,_="map"===l,y="map"===c,v="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),x=_&&!y&&!v,b=!r.layout.get("symbol-sort-key").isConstant();let w=!1;const T=t.getDepthModeForSublayer(0,je.ReadOnly),C=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=[],M=g.getCircleRadiusCorrection();for(const l of n){const n=i.getTile(l),c=n.getBucket(r);if(!c)continue;const u=o?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const p=u.programConfigurations.get(r.id),f=o||c.sdfIcons,T=o?c.textSizeData:c.iconSizeData,S=y||0!==g.pitch,I=t.useProgram(Xr(f,o,c),p),E=e.ah(T,g.zoom),z=t.style.map.terrain&&t.style.map.terrain.getTerrainData(l);let A,k,D,R,L=[0,0],B=null;if(o)k=n.glyphAtlasTexture,D=m.LINEAR,A=n.glyphAtlasTexture.size,c.iconsInText&&(L=n.imageAtlasTexture.size,B=n.imageAtlasTexture,R=S||t.options.rotating||t.options.zooming||"composite"===T.kind||"camera"===T.kind?m.LINEAR:m.NEAREST);else{const e=1!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;k=n.imageAtlasTexture,D=f||t.options.rotating||t.options.zooming||e||S?m.LINEAR:m.NEAREST,A=n.imageAtlasTexture.size}const F=e.at(n,1,t.transform.zoom),O=yt(_,t.transform,F),j=e.H();e.an(j,O);const V=vt(y,_,t.transform,F),N=e.au(g,n,a,s),q=g.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),Z=C&&c.hasTextData(),U="none"!==r.layout.get("icon-text-fit")&&Z&&c.hasIconData();if(v){const e=t.style.map.terrain?(e,i)=>t.style.map.terrain.getElevation(l,e,i):null,i="map"===r.layout.get("text-rotation-alignment");Ct(c,t,o,O,j,y,h,i,l.toUnwrapped(),g.width,g.height,N,e)}const G=o&&C||U,$=v||G?Ur:y?O:t.transform.clipSpaceToPixelsMatrix,H=f&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let X;X=f?c.iconsInText?Wi(T.kind,E,x,y,v,G,t,$,V,N,A,L,M):Xi(T.kind,E,x,y,v,G,t,$,V,N,o,A,0,M):Hi(T.kind,E,x,y,v,G,t,$,V,N,o,A,M);const W={program:I,buffers:u,uniformValues:X,projectionData:q,atlasTexture:k,atlasTextureIcon:B,atlasInterpolation:D,atlasInterpolationIcon:R,isSDF:f,hasHalo:H};if(b&&c.canOverlap){w=!0;const t=u.segments.get();for(const i of t)P.push({segments:new e.aD([i]),sortKey:i.sortKey,state:W,terrainData:z})}else P.push({segments:u.segments,sortKey:0,state:W,terrainData:z})}w&&P.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of P){const i=e.state;if(f.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Kr(i.buffers,e.segments,r,t,i.program,T,u,p,n,i.projectionData,e.terrainData)),n.u_is_halo=0}Kr(i.buffers,e.segments,r,t,i.program,T,u,p,i.uniformValues,i.projectionData,e.terrainData)}}function Kr(t,e,i,r,n,o,a,s,l,c,h){const u=r.context;n.draw(u,u.gl.TRIANGLES,o,a,s,Oe.backCCW,l,h,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Yr(t,i,r,n,o){const a=t.context,s=a.gl,l=Ne.disabled,c=new Be([s.ONE,s.ONE],e.b4.transparent,[!0,!0,!0,!0]),h=i.getBucket(r);if(!h)return;const u=n.key;let p=r.heatmapFbos.get(u);p||(p=Qr(a,i.tileSize,i.tileSize),r.heatmapFbos.set(u,p)),a.bindFramebuffer.set(p.framebuffer),a.viewport.set([0,0,i.tileSize,i.tileSize]),a.clear({color:e.b4.transparent});const d=h.programConfigurations.get(r.id),f=t.useProgram("heatmap",d,!o),m=t.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);f.draw(a,s.TRIANGLES,je.disabled,l,c,Oe.disabled,Ri(i,t.transform.zoom,r.paint.get("heatmap-intensity"),1),g,m,r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,t.transform.zoom,d)}function Jr(t,e,i,r,n){const o=t.context,a=o.gl,s=t.transform;o.setColorMode(t.colorModeForRenderPass());const l=tn(o,e),c=i.key,h=e.heatmapFbos.get(c);if(!h)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,h.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);const u=s.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});t.useProgram("heatmapTexture").draw(o,a.TRIANGLES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,Li(t,e,0,1),null,u,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,s.zoom),h.destroy(),e.heatmapFbos.delete(c)}function Qr(t,e,i){var r,n;const o=t.gl,a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const s=null!==(r=t.HALF_FLOAT)&&void 0!==r?r:o.UNSIGNED_BYTE,l=null!==(n=t.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e,i,0,o.RGBA,s,null);const c=t.createFramebuffer(e,i,!1,!1);return c.colorAttachment.set(a),c}function tn(t,e){return e.colorRampTexture||(e.colorRampTexture=new y(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}function en(t,e,i,r,n){if(!i||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let a=o[i.to.toString()],s=o[i.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){const t=n.getPaintProperty(e);a=o[t],s=o[t]}a&&s&&t.setConstantPatternPositions(a,s)}function rn(t,i,r,n,o,a,s,l){const c=t.context.gl,h="fill-pattern",u=r.paint.get(h),p=u&&u.constantOr(1),d=r.getCrossfadeParameters();let f,m,g,_,y;const v=t.transform,x=r.paint.get("fill-translate"),b=r.paint.get("fill-translate-anchor");s?(m=p&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=p?"fillPattern":"fill",f=c.TRIANGLES);const w=u.constantOr(null);for(const u of n){const T=i.getTile(u);if(p&&!T.patternsLoaded())continue;const C=T.getBucket(r);if(!C)continue;const P=C.programConfigurations.get(r.id),M=t.useProgram(m,P),S=t.style.map.terrain&&t.style.map.terrain.getTerrainData(u);p&&(t.context.activeTexture.set(c.TEXTURE0),T.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),P.updatePaintBuffers(d)),en(P,h,w,T,r);const I=v.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),E=e.au(v,T,x,b);if(s){_=C.indexBuffer2,y=C.segments2;const e=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&p?Ei(t,d,T,e,E):Ii(e,E)}else _=C.indexBuffer,y=C.segments,g=p?Si(t,d,T,E):{u_fill_translate:E};let z;if("translucent"===t.renderPass&&l){const[e]=t.getStencilConfigForOverlapAndUpdateStencilID(n);z=e[u.overscaledZ]}else z=t.stencilModeForClipping(u);M.draw(t.context,f,o,z,a,Oe.backCCW,g,S,I,r.id,C.layoutVertexBuffer,_,y,r.paint,t.transform.zoom,P)}}function nn(t,i,r,n,o,a,s,l){const c=t.context,h=c.gl,u="fill-extrusion-pattern",p=r.paint.get(u),d=p.constantOr(1),f=r.getCrossfadeParameters(),m=r.paint.get("fill-extrusion-opacity"),g=p.constantOr(null),_=t.transform;for(const p of n){const n=i.getTile(p),y=n.getBucket(r);if(!y)continue;const v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),x=y.programConfigurations.get(r.id),b=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",x);d&&(t.context.activeTexture.set(h.TEXTURE0),n.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),x.updatePaintBuffers(f));const w=_.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!l,applyTerrainMatrix:!0});en(x,u,g,n,r);const T=e.au(_,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),C=r.paint.get("fill-extrusion-vertical-gradient"),P=d?Mi(t,C,m,T,p,f,n):Pi(t,C,m,T);b.draw(c,c.gl.TRIANGLES,o,a,s,Oe.backCCW,P,v,w,r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,t.transform.zoom,x,t.style.map.terrain&&y.centroidVertexBuffer)}}function on(t,e,i,r,n,o,a,s,l){var c;const h=t.style.projection,u=t.context,p=t.transform,d=u.gl,f=t.useProgram("hillshade"),m=!t.options.moving;for(const g of r){const r=e.getTile(g),_=r.fbo;if(!_)continue;const y=h.getMeshFromTileID(u,g.canonical,s,!0,"raster"),v=null===(c=t.style.map.terrain)||void 0===c?void 0:c.getTerrainData(g);u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,_.colorAttachment.get());const x=p.getProjectionData({overscaledTileID:g,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(u,d.TRIANGLES,o,n[g.overscaledZ],a,Oe.backCCW,Bi(t,r,i),v,x,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}const an=[new e.P(0,0),new e.P(e.X,0),new e.P(e.X,e.X),new e.P(0,e.X)];function sn(t,e,i,r,n,o,a,s,l=!1,c=!1){const h=r[r.length-1].overscaledZ,u=t.context,p=u.gl,d=t.useProgram("raster"),f=t.transform,m=t.style.projection,g=t.colorModeForRenderPass(),_=!t.options.moving;for(const y of r){const r=t.getDepthModeForSublayer(y.overscaledZ-h,1===i.paint.get("raster-opacity")?je.ReadWrite:je.ReadOnly,p.LESS),v=e.getTile(y);v.registerFadeDuration(i.paint.get("raster-fade-duration"));const x=e.findLoadedParent(y,0),b=e.findLoadedSibling(y),w=ln(v,x||b||null,e,i,t.transform,t.style.map.terrain);let T,C;const P="nearest"===i.paint.get("raster-resampling")?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),v.texture.bind(P,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),x?(x.texture.bind(P,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),T=Math.pow(2,x.tileID.overscaledZ-v.tileID.overscaledZ),C=[v.tileID.canonical.x*T%1,v.tileID.canonical.y*T%1]):v.texture.bind(P,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),v.texture.useMipmap&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const M=t.style.map.terrain&&t.style.map.terrain.getTerrainData(y),S=f.getProjectionData({overscaledTileID:y,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),I=Gi(C||[0,0],T||1,w,i,s),E=m.getMeshFromTileID(u,y.canonical,o,a,"raster");d.draw(u,p.TRIANGLES,r,n?n[y.overscaledZ]:Ne.disabled,g,l?Oe.frontCCW:Oe.backCCW,I,M,S,i.id,E.vertexBuffer,E.indexBuffer,E.segments)}}function ln(t,i,r,n,o,s){const l=n.paint.get("raster-fade-duration");if(!s&&l>0){const n=a.now(),s=(n-t.timeAdded)/l,c=i?(n-i.timeAdded)/l:-1,h=r.getSource(),u=ht(o,{tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=p&&t.refreshedUponExpiration?1:e.ab(p?s:1-c,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const cn=new e.b4(1,0,0,1),hn=new e.b4(0,1,0,1),un=new e.b4(0,0,1,1),pn=new e.b4(1,0,1,1),dn=new e.b4(0,1,1,1);function fn(t,e,i,r){gn(t,0,e+i/2,t.transform.width,i,r)}function mn(t,e,i,r){gn(t,e-i/2,0,i,t.transform.height,r)}function gn(t,e,i,r,n,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function _n(t,i,r){const n=t.context,o=n.gl,a=t.useProgram("debug"),s=je.disabled,l=Ne.disabled,c=t.colorModeForRenderPass(),h="$debug",u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r);n.activeTexture.set(o.TEXTURE0);const p=i.getTileByID(r.key).latestRawTileData,d=Math.floor((p&&p.byteLength||0)/1024),f=i.getTile(r).tileSize,m=512/Math.min(f,512)*(r.overscaledZ/t.transform.zoom)*.5;let g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,n=t.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${g} ${d}kB`);const _=t.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,Be.alphaBlended,Oe.disabled,Di(e.b4.transparent,m),null,_,h,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,Oe.disabled,Di(e.b4.red),u,_,h,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function yn(t,e,i,r){const{isRenderingGlobe:n}=r,o=t.context,a=o.gl,s=t.transform,l=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),h=t.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);for(const r of i){const i=e.getTerrainMesh(r.tileID),u=t.renderToTexture.getTexture(r),p=e.getTerrainData(r.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,u.texture);const d=e.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(r.tileID.toUnwrapped()),m=xi(d,f,t.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(o,a.TRIANGLES,c,Ne.disabled,l,Oe.backCCW,m,p,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function vn(t,i){if(!i.mesh){const r=new e.aC;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);const n=new e.aE;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new fe(t.createVertexBuffer(r,me.members),t.createIndexBuffer(n),e.aD.simpleSegment(0,0,r.length,n.length))}return i.mesh}class xn{constructor(t,i){this.context=new Nr(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.aq(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=pt.maxUnderzooming+pt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new he}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const t=this.context,i=new e.aC;i.emplaceBack(0,0),i.emplaceBack(e.X,0),i.emplaceBack(0,e.X),i.emplaceBack(e.X,e.X),this.tileExtentBuffer=t.createVertexBuffer(i,me.members),this.tileExtentSegments=e.aD.simpleSegment(0,0,4,2);const r=new e.aC;r.emplaceBack(0,0),r.emplaceBack(e.X,0),r.emplaceBack(0,e.X),r.emplaceBack(e.X,e.X),this.debugBuffer=t.createVertexBuffer(r,me.members),this.debugSegments=e.aD.simpleSegment(0,0,4,5);const n=new e.bT;n.emplaceBack(0,0,0,0),n.emplaceBack(e.X,0,e.X,0),n.emplaceBack(0,e.X,0,e.X),n.emplaceBack(e.X,e.X,e.X,e.X),this.rasterBoundsBuffer=t.createVertexBuffer(n,yi.members),this.rasterBoundsSegments=e.aD.simpleSegment(0,0,4,2);const o=new e.aC;o.emplaceBack(0,0),o.emplaceBack(e.X,0),o.emplaceBack(0,e.X),o.emplaceBack(e.X,e.X),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(o,me.members),this.rasterBoundsSegmentsPosOnly=e.aD.simpleSegment(0,0,4,5);const a=new e.aC;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(a,me.members),this.viewportSegments=e.aD.simpleSegment(0,0,4,2);const s=new e.bU;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);const l=new e.aE;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new Ne({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new fe(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=e.H();e.bL(r,0,this.width,this.height,0,0,1),e.K(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,je.disabled,this.stencilClearMode,Be.disabled,Oe.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();const r=this.context;r.setColorMode(Be.disabled),r.setDepthMode(je.disabled);const n={};for(const t of e)n[t.key]=this.nextStencilID++;this._renderTileMasks(n,e,i,!0),this._renderTileMasks(n,e,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,e,i,r){const n=this.context,o=n.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of e){const e=t[c.key],h=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),u=a.getMeshFromTileID(this.context,c.canonical,r,!0,"stencil"),p=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,je.disabled,new Ne({func:o.ALWAYS,mask:0},e,255,o.KEEP,o.KEEP,o.REPLACE),Be.disabled,i?Oe.disabled:Oe.backCCW,null,h,p,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}_renderTilesDepthBuffer(){const t=this.context,e=t.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=ut(r,{tileSize:r.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,e.TRIANGLES,o,Ne.disabled,Be.disabled,Oe.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ne({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ne({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const t={};for(let i=0;i<n;i++)t[i+r]=new Ne({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[t,i]}return[{[r]:Ne.disabled},i]}stencilConfigForOverlapTwoPass(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){const t={},o={};for(let i=0;i<n;i++)t[i+r]=new Ne({func:e.GREATER,mask:255},n+1+i,255,e.KEEP,e.KEEP,e.REPLACE),o[i+r]=new Ne({func:e.GREATER,mask:255},1+i,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[t,o,i]}return this.nextStencilID=3,[{[r]:new Ne({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[r]:new Ne({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},i]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Be([t.CONSTANT_COLOR,t.ONE],new e.b4(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Be.unblended:Be.alphaBlended}getDepthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return je.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new je(i||this.context.gl.LEQUAL,e,[r,r])}getDepthModeFor3D(){return new je(this.context.gl.LEQUAL,je.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,i){var r,n;this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.now()),this.imageManager.beginFrame();const o=this.style._order,s=this.style.sourceCaches,l={},c={},h={},u={isRenderingToTexture:!1,isRenderingGlobe:(null===(r=t.projection)||void 0===r?void 0:r.transitionState)>0};for(const t in s){const e=s[t];e.used&&e.prepare(this.context),l[t]=e.getVisibleCoordinates(!1),c[t]=l[t].slice().reverse(),h[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of o){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=c[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,s[e.source],e,i,u)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?e.b4.black:e.b4.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,e){const i=t.context,r=i.gl,n=((t,e,i)=>{const r=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),o=be(e),a=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-o*n)*i,(e.height/2+o*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*i,u_sky_blend:a}})(e,t.style.map.transform,t.pixelRatio),o=new je(r.LEQUAL,je.ReadWrite,[0,1]),a=Ne.disabled,s=t.colorModeForRenderPass(),l=t.useProgram("sky"),c=vn(i,e);l.draw(i,r.TRIANGLES,o,a,s,Oe.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[o[this.currentLayer]],e=s[t.source],i=l[t.source];this._renderTileClippingMasks(t,i,!1),this.renderLayer(this,e,t,i,u)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const t=this.style._layers[o[this.currentLayer]],e=s[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,u))continue;this.opaquePassEnabledForLayer()||p||(p=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const i=("symbol"===t.type?h:c)[t.source];this._renderTileClippingMasks(t,l[t.source],!1),this.renderLayer(this,e,t,i,u)}if(u.isRenderingGlobe&&function(t,i,r){const n=t.context,o=n.gl,a=t.useProgram("atmosphere"),s=new je(o.LEQUAL,je.ReadOnly,[0,1]),l=t.transform,c=function(t,i){const r=t.properties.get("position"),n=[-r.x,-r.y,-r.z],o=e.aq(new Float64Array(16));return"map"===t.properties.get("anchor")&&(e.aX(o,o,i.rollInRadians),e.aY(o,o,-i.pitchInRadians),e.aX(o,o,i.bearingInRadians),e.aY(o,o,i.center.lat*Math.PI/180),e.bj(o,o,-i.center.lng*Math.PI/180)),e.bS(n,n,o),n}(r,t.transform),h=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=i.properties.get("atmosphere-blend")*h.projectionTransition;if(0===u)return;const p=ti(l.worldSize,l.center.lat),d=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,e.al(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,e.al(f,f,d),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((t,e,i,r,n)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(c,u,[f[0],f[1],f[2]],p,d),g=vn(n,i);a.draw(n,o.TRIANGLES,s,Ne.disabled,Be.alphaBlended,Oe.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const t=function(t,e){let i=null;const r=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),n=r.filter((t=>"vector"===t.getSource().type)),o=r.filter((t=>"vector"!==t.getSource().type)),a=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return n.forEach((t=>a(t))),i||o.forEach((t=>a(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let r=0;r<i.length;r++)_n(t,e,i[r])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;fn(t,t.transform.height-(e.top||0),3,cn),fn(t,e.bottom||0,3,hn),mn(t,e.left||0,3,un),mn(t,t.transform.width-(e.right||0),3,pn);const i=t.transform.centerPoint;!function(t,e,i,r){gn(t,e-1,i-10,2,20,r),gn(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,dn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=t?!e.bV(i,r):!e.bW(i,r)),n||(n=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(e.bX(i,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,i){const r=t.context,n=r.gl,o=t.transform,a=Be.unblended,s=new je(n.LEQUAL,je.ReadWrite,[0,1]),l=i.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.b4.transparent,depth:1});for(const t of l){const e=i.getTerrainMesh(t.tileID),l=i.getTerrainData(t.tileID),h=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),u={u_ele_delta:i.getMeshFrameDelta(o.zoom)};c.draw(r,n.TRIANGLES,s,Ne.disabled,a,Oe.backCCW,u,l,h,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,i){const r=t.context,n=r.gl,o=t.transform,a=Be.unblended,s=new je(n.LEQUAL,je.ReadWrite,[0,1]),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=t.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.b4.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const e=i.getTerrainMesh(t.tileID),c=i.getTerrainData(t.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const u={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(o.zoom)},p=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(r,n.TRIANGLES,s,Ne.disabled,a,Oe.backCCW,u,c,p,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),i.coordsIndex.push(t.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,i,r,n,o){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||(n||[]).length)&&(this.id=r.id,e.bY(r)?function(t,i,r,n,o,a){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:s}=a,l=Ne.disabled,c=t.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,r,n,o,a,s,l,c){const h=i.transform,u=i.style.map.terrain,p="map"===o,d="map"===a;for(const o of t){const t=n.getTile(o),a=t.getBucket(r);if(!a||!a.text||!a.text.segments.get().length)continue;const f=e.ah(a.textSizeData,h.zoom),m=e.at(t,1,i.transform.zoom),g=yt(p,i.transform,m),_="none"!==r.layout.get("icon-text-fit")&&a.hasIconData();{const i=Math.pow(2,h.zoom-t.tileID.overscaledZ),r=u?(t,e)=>u.getElevation(o,t,e):null;Hr(a,p,d,c,h,g,i,f,_,e.au(h,t,s,l),o.toUnwrapped(),r)}}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&Wr(t,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,c,s),0!==r.paint.get("text-opacity").constantOr(1)&&Wr(t,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,c,s),i.map.showCollisionBoxes&&(Zr(t,i,r,n,!0),Zr(t,i,r,n,!1))}(t,i,r,n,this.style.placement.variableOffsets,o):e.bZ(r)?function(t,i,r,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),c=r.paint.get("circle-stroke-opacity"),h=!r.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const u=t.context,p=u.gl,d=t.transform,f=t.getDepthModeForSublayer(0,je.ReadOnly),m=Ne.disabled,g=t.colorModeForRenderPass(),_=[],y=d.getCircleRadiusCorrection();for(let o=0;o<n.length;o++){const s=n[o],l=i.getTile(s),c=l.getBucket(r);if(!c)continue;const u=r.paint.get("circle-translate"),p=r.paint.get("circle-translate-anchor"),f=e.au(d,l,u,p),m=c.programConfigurations.get(r.id),g=t.useProgram("circle",m),v=c.layoutVertexBuffer,x=c.indexBuffer,b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(s),w={programConfiguration:m,program:g,layoutVertexBuffer:v,indexBuffer:x,uniformValues:zi(t,l,r,f,y),terrainData:b,projectionData:d.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(h){const t=c.segments.get();for(const i of t)_.push({segments:new e.aD([i]),sortKey:i.sortKey,state:w})}else _.push({segments:c.segments,sortKey:0,state:w})}h&&_.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of _){const{programConfiguration:i,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=e.state;n.draw(u,p.TRIANGLES,f,m,g,Oe.backCCW,s,l,c,r.id,o,a,e.segments,r.paint,t.transform.zoom,i)}}(t,i,r,n,o):e.b_(r)?function(t,i,r,n,o){if(0===r.paint.get("heatmap-opacity"))return;const a=t.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(t.style.map.terrain){for(const e of n){const n=i.getTile(e);i.hasRenderableParent(e)||("offscreen"===t.renderPass?Yr(t,n,r,e,l):"translucent"===t.renderPass&&Jr(t,r,e,s,l))}a.viewport.set([0,0,t.width,t.height])}else"offscreen"===t.renderPass?function(t,i,r,n){const o=t.context,a=o.gl,s=t.transform,l=Ne.disabled,c=new Be([a.ONE,a.ONE],e.b4.transparent,[!0,!0,!0,!0]);(function(t,i,r){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,i.width/4,i.height/4]);let o=r.heatmapFbos.get(e.bP);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer)):(o=Qr(t,i.width/4,i.height/4),r.heatmapFbos.set(e.bP,o))})(o,t,r),o.clear({color:e.b4.transparent});for(let e=0;e<n.length;e++){const h=n[e];if(i.hasRenderableParent(h))continue;const u=i.getTile(h),p=u.getBucket(r);if(!p)continue;const d=p.programConfigurations.get(r.id),f=t.useProgram("heatmap",d),m=s.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,je.disabled,l,c,Oe.backCCW,Ri(u,s.zoom,r.paint.get("heatmap-intensity"),g),null,m,r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,r.paint,s.zoom,d)}o.viewport.set([0,0,t.width,t.height])}(t,i,r,n):"translucent"===t.renderPass&&function(t,i){const r=t.context,n=r.gl;r.setColorMode(t.colorModeForRenderPass());const o=i.heatmapFbos.get(e.bP);o&&(r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),tn(r,i).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,je.disabled,Ne.disabled,t.colorModeForRenderPass(),Oe.disabled,Li(t,i,0,1),null,null,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom))}(t,r)}(t,i,r,n,o):e.b$(r)?function(t,i,r,n,o){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=o,s=r.paint.get("line-opacity"),l=r.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;const c=t.getDepthModeForSublayer(0,je.ReadOnly),h=t.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),p=r.paint.get("line-pattern"),d=p.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters(),g=d?"linePattern":u?"lineSDF":f?"lineGradient":"line",_=t.context,v=_.gl,x=t.transform;let b=!0;for(const o of n){const s=i.getTile(o);if(d&&!s.patternsLoaded())continue;const l=s.getBucket(r);if(!l)continue;const w=l.programConfigurations.get(r.id),T=t.context.program.get(),C=t.useProgram(g,w),P=b||C.program!==T,M=t.style.map.terrain&&t.style.map.terrain.getTerrainData(o),S=p.constantOr(null);if(S&&s.imageAtlas){const t=s.imageAtlas,e=t.patternPositions[S.to.toString()],i=t.patternPositions[S.from.toString()];e&&i&&w.setConstantPatternPositions(e,i)}const I=x.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),E=x.getPixelScale(),z=d?Ni(t,s,r,E,m):u?qi(t,s,r,E,u,m):f?Vi(t,s,r,E,l.lineClipsArray.length):ji(t,s,r,E);if(d)_.activeTexture.set(v.TEXTURE0),s.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),w.updatePaintBuffers(m);else if(u&&(P||t.lineAtlas.dirty))_.activeTexture.set(v.TEXTURE0),t.lineAtlas.bind(_);else if(f){const n=l.gradients[r.id];let a=n.texture;if(r.gradientVersion!==n.version){let s=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=o.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-o.canonical.z):1;s=e.ab(e.bQ(l.maxLineLength/e.X*1024*n),256,_.maxTextureSize)}n.gradient=e.bR({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:s,image:n.gradient||void 0,clips:l.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new y(_,n.gradient,v.RGBA),n.version=r.gradientVersion,a=n.texture}_.activeTexture.set(v.TEXTURE0),a.bind(r.stepInterpolant?v.NEAREST:v.LINEAR,v.CLAMP_TO_EDGE)}let A;if(a){const[e]=t.getStencilConfigForOverlapAndUpdateStencilID(n);A=e[o.overscaledZ]}else A=t.stencilModeForClipping(o);C.draw(_,v.TRIANGLES,c,A,h,Oe.disabled,z,M,I,r.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,r.paint,t.transform.zoom,w,l.layoutVertexBuffer2),b=!1}}(t,i,r,n,o):e.c0(r)?function(t,i,r,n,o){const a=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=t.colorModeForRenderPass(),h=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===a.constantOr(e.b4.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){const e=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?je.ReadWrite:je.ReadOnly);rn(t,i,r,n,e,c,!1,l)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const e=t.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,je.ReadOnly);rn(t,i,r,n,e,c,!0,l)}}(t,i,r,n,o):e.c1(r)?function(t,e,i,r,n){const o=i.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===t.renderPass){const n=new je(t.context.gl.LEQUAL,je.ReadWrite,t.depthRangeFor3D);if(1!==o||i.paint.get("fill-extrusion-pattern").constantOr(1))nn(t,e,i,r,n,Ne.disabled,Be.disabled,a),nn(t,e,i,r,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),a);else{const o=t.colorModeForRenderPass();nn(t,e,i,r,n,Ne.disabled,o,a)}}}(t,i,r,n,o):e.c2(r)?function(t,e,i,r,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const{isRenderingToTexture:o}=n,a=t.context,s=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,je.ReadOnly),c=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,e,i,r,n,o,a){const s=t.context,l=s.gl;for(const c of i){const i=e.getTile(c),h=i.dem;if(!h||!h.data)continue;if(!i.needsHillshadePrepare)continue;const u=h.dim,p=h.stride,d=h.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(p),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new y(s,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let f=i.fbo;if(!f){const t=new y(s,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),f=i.fbo=s.createFramebuffer(u,u,!0,!1),f.colorAttachment.set(t.texture)}s.bindFramebuffer.set(f.framebuffer),s.viewport.set([0,0,u,u]),t.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,o,a,Oe.disabled,Fi(i.tileID,h),null,null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(t,e,r,i,l,Ne.disabled,c),a.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(s){const[n,a,s]=t.stencilConfigForOverlapTwoPass(r);on(t,e,i,s,n,l,c,!1,o),on(t,e,i,s,a,l,c,!0,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(r);on(t,e,i,a,n,l,c,!1,o)}}(t,i,r,n,o):e.c3(r)?function(t,e,i,r,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const{isRenderingToTexture:o}=n,a=e.getSource(),s=t.style.projection.useSubdivision;if(a instanceof K)sn(t,e,i,r,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=t.stencilConfigForOverlapTwoPass(r);sn(t,e,i,s,n,!1,!0,an,!1,o),sn(t,e,i,s,a,!0,!0,an,!1,o)}else{const[n,a]=t.getStencilConfigForOverlapAndUpdateStencilID(r);sn(t,e,i,a,n,!1,!0,an,!1,o)}}(t,i,r,n,o):e.c4(r)?function(t,e,i,r,n){const o=i.paint.get("background-color"),a=i.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:s}=n,l=t.context,c=l.gl,h=t.style.projection,u=t.transform,p=u.tileSize,d=i.paint.get("background-pattern");if(t.isPatternMissing(d))return;const f=!d&&1===o.a&&1===a&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;const m=Ne.disabled,g=t.getDepthModeForSublayer(0,"opaque"===f?je.ReadWrite:je.ReadOnly),_=t.colorModeForRenderPass(),y=t.useProgram(d?"backgroundPattern":"background"),v=r||ut(u,{tileSize:p,terrain:t.style.map.terrain});d&&(l.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context));const x=i.getCrossfadeParameters();for(const e of v){const r=u.getProjectionData({overscaledTileID:e,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),n=d?Yi(a,t,d,{tileID:e,tileSize:p},x):Ki(a,o),f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e),v=h.getMeshFromTileID(l,e.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,g,m,_,Oe.backCCW,n,f,r,i.id,v.vertexBuffer,v.indexBuffer,v.segments)}}(t,0,r,n,o):e.c5(r)&&function(t,e,i,r){const{isRenderingGlobe:n}=r,o=t.context,a=i.implementation,s=t.style.projection,l=t.transform,c=l.getProjectionDataForCustomLayer(n),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:c},u=a.renderingMode?a.renderingMode:"2d";if("offscreen"===t.renderPass){const e=a.prerender;e&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),e.call(a,o.gl,h),o.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(Ne.disabled);const e="3d"===u?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,je.ReadOnly);o.setDepthMode(e),a.render(o.gl,h),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}(t,0,r,o))}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e,i=!1){this.cache=this.cache||{};const r=!!this.style.map.terrain,n=this.style.projection,o=t+(e?e.cacheKey:"")+`/${i?_e:n.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(r?"/terrain":"");return this.cache[o]||(this.cache[o]=new Ti(this.context,pe[t],e,Qi[t],this._showOverdrawInspector,r,i?pe.projectionMercator:n.shaderPreludeCode,i?ge:n.shaderDefine)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new y(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function bn(t,e){let i,r=!1,n=null,o=null;const a=()=>{n=null,r&&(t.apply(o,i),n=setTimeout(a,e),r=!1)};return(...t)=>(r=!0,o=this,i=t,n||a(),n)}class wn{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(!this._isValidHash(t))return!1;const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let i=e;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${e}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=bn(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(e.lng*n)/n,a=Math.round(e.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===t?(e=!0,`${r}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new e.N(+t[2],+t[1])}catch(t){return!1}const i=+t[0],r=+(t[3]||0),n=+(t[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=0&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Tn={linearity:.3,easing:e.c6(0,0,.3,1)},Cn=e.e({deceleration:2500,maxSpeed:1400},Tn),Pn=e.e({deceleration:20,maxSpeed:1400},Tn),Mn=e.e({deceleration:1e3,maxSpeed:360},Tn),Sn=e.e({deceleration:1e3,maxSpeed:90},Tn),In=e.e({deceleration:1e3,maxSpeed:360},Tn);class En{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=a.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=An(i.pan.mag(),r,e.e({},Cn,t||{})),a=i.pan.mult(o.amount/i.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);n.center=s.easingCenter,n.offset=s.easingOffset,zn(n,o)}if(i.zoom){const t=An(i.zoom,r,Pn);n.zoom=this._map.transform.zoom+t.amount,zn(n,t)}if(i.bearing){const t=An(i.bearing,r,Mn);n.bearing=this._map.transform.bearing+e.ab(t.amount,-179,179),zn(n,t)}if(i.pitch){const t=An(i.pitch,r,Sn);n.pitch=this._map.transform.pitch+t.amount,zn(n,t)}if(i.roll){const t=An(i.roll,r,In);n.roll=this._map.transform.roll+e.ab(t.amount,-179,179),zn(n,t)}if(n.zoom||n.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(n,{noMoveStart:!0})}}function zn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function An(t,i,r){const{maxSpeed:n,linearity:o,deceleration:a}=r,s=e.ab(t*o/(i/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}class kn extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,n={}){const o=s.mousePos(i.getCanvas(),r),a=i.unproject(o);super(t,e.e({point:o,lngLat:a,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class Dn extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){const n="touchend"===t?r.changedTouches:r.touches,o=s.touchPos(i.getCanvasContainer(),n),a=o.map((t=>i.unproject(t))),l=o.reduce(((t,e,i,r)=>t.add(e.div(r.length))),new e.P(0,0));super(t,{points:o,point:l,lngLats:a,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class Rn extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class Ln{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Rn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new kn(t.type,this._map,t))}mouseup(t){this._map.fire(new kn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new kn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new kn(t.type,this._map,t))}mouseover(t){this._map.fire(new kn(t.type,this._map,t))}mouseout(t){this._map.fire(new kn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Dn(t.type,this._map,t))}touchmove(t){this._map.fire(new Dn(t.type,this._map,t))}touchend(t){this._map.fire(new Dn(t.type,this._map,t))}touchcancel(t){this._map.fire(new Dn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new kn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new kn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new kn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this._map.terrain)}}class On{constructor(t,e){this._map=t,this._tr=new Fn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(s.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=i,this._box||(this._box=s.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),a=Math.min(r.y,i.y),l=Math.max(r.y,i.y);s.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=l-a+"px"}mouseupWindow(t,i){if(!this._active)return;if(0!==t.button)return;const r=this._startPos,n=i;if(this.reset(),s.suppressClick(),r.x!==n.x||r.y!==n.y)return this._map.fire(new e.k("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(r,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.k(t,{originalEvent:i}))}}function jn(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class Vn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=jn(r,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=jn(i,e);for(const t in this.touches){const e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Nn{constructor(t){this.singleTap=new Vn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class qn{constructor(t){this._tr=new Fn(t),this._zoomIn=new Nn({numTouches:1,numTaps:2}),this._zoomOut=new Nn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),o=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=Array.isArray(e)?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&s.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Un={0:1,2:2};class Gn{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=s.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=Un[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return s.mouseButton(t)===this._eventButton}}class $n{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Hn{constructor(t=new Gn({checkCorrectEvent:()=>!0}),e=new $n){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e}_executeRelevantHandler(t,e,i){return t instanceof MouseEvent?e(t):"undefined"!=typeof TouchEvent&&t instanceof TouchEvent?i(t):void 0}startMove(t){this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.startMove(t)),(t=>this.oneFingerTouchMoveStateManager.startMove(t)))}endMove(t){this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.endMove(t)),(t=>this.oneFingerTouchMoveStateManager.endMove(t)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidStartEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidMoveEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidEndEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t)))}}const Xn=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class Wn{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active){if(!this._shouldBePrevented(i.length))return t.preventDefault(),this._calculateTransform(t,e,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);const n=jn(r,i),o=new e.P(0,0),a=new e.P(0,0);let s=0;for(const t in n){const e=n[t],i=this._touches[t];i&&(o._add(e),a._add(e.sub(i)),s++,n[t]=e)}if(this._touches=n,this._shouldBePrevented(s)||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Kn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[r,n]=this._firstTwoTouches,o=Yn(i,e,r),a=Yn(i,e,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=Yn(i,e,r),a=Yn(i,e,n);o&&a||(this._active&&s.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Yn(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Jn(t,e){return Math.log(t/e)/Math.LN2}class Qn extends Kn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Jn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jn(this._distance,i),pinchAround:e}}}function to(t,e){return 180*t.angleWith(e)/Math.PI}class eo extends Kn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,i){const r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:to(this._vector,r),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=to(t,this._startVector);return Math.abs(i)<e}}function io(t){return Math.abs(t.y)>Math.abs(t.x)}class ro extends Kn{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,io(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return io(t)&&io(e)&&o}}const no={panStep:100,bearingStep:15,pitchStep:10};class oo{constructor(t){this._tr=new Fn(t);const e=no;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:a=>{const s=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:ao,zoom:e?Math.round(s.zoom)+e*(t.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ao(t){return t*(2-t)}const so=4.000244140625;class lo{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Fn(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=a.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%so==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=s.mousePos(this._map.getCanvas(),t),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(e.N.convert(r.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>so?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n="number"!=typeof this._targetZoom?t.scale:e.aG(this._targetZoom);this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,e.a8(n*r))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,r=this._startZoom,n=this._easing;let o,s=!1;if("wheel"===this._type&&r&&n){const t=a.now()-this._lastWheelEventTime,l=Math.min((t+5)/200,1),c=n(l);o=e.y.number(r,i,c),l<1?this._frameId||(this._frameId=!0):s=!0}else o=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.c8;if(this._prevEase){const t=this._prevEase,r=(a.now()-t.start)/t.duration,n=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.c6(o,s,.25,1)}return this._prevEase={start:a.now(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class co{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ho{constructor(t){this._tr=new Fn(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class uo{constructor(){this._tap=new Nn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const r=e[0],n=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;n&&o?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(t,e,i);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class po{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class fo{constructor(t,e,i,r){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class mo{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class go{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=s.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=e,this._container.appendChild(r);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(s.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new e.k("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const _o=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class yo extends e.k{}function vo(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class xo{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,r={needsRenderFrame:!1},n={},o={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?s.touchPos(this._map.getCanvas(),l):s.mousePos(this._map.getCanvas(),t);for(const{handlerName:a,handler:s,allowed:h}of this._handlers){if(!s.isEnabled())continue;let u;this._blockedByActive(o,h,a)?s.reset():s[e||t.type]&&(u=s[e||t.type](t,c,l),this.mergeHandlerResult(r,n,u,a,i),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||s.isActive())&&(o[a]=s)}const h={};for(const t in this._previousActiveHandlers)o[t]||(h[t]=i);this._previousActiveHandlers=o,(Object.keys(h).length||vo(r))&&(this._changes.push([r,n,h]),this._triggerRenderFrame()),(Object.keys(o).length||vo(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=r;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new En(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)s.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[t,e,i]of this._listeners)s.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new Ln(i,t));const n=i.boxZoom=new On(i,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();const o=i.cooperativeGestures=new go(i,t.cooperativeGestures);this._add("cooperativeGestures",o),t.cooperativeGestures&&o.enable();const a=new qn(i),l=new ho(i);i.doubleClickZoom=new co(l,a),this._add("tapZoom",a),this._add("clickZoom",l),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();const c=new uo;this._add("tapDragZoom",c);const h=i.touchPitch=new ro(i);this._add("touchPitch",h),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);const u=()=>i.project(i.getCenter()),p=function({enable:t,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const l=new Gn({checkCorrectEvent:t=>0===s.mouseButton(t)&&t.ctrlKey||2===s.mouseButton(t)&&!t.ctrlKey});return new Zn({clickTolerance:i,move:(t,i)=>{const s=a();if(r&&Math.abs(s.y-t.y)>n)return{bearingDelta:e.c7(new e.P(t.x,i.y),i,s)};let l=(i.x-t.x)*o;return r&&i.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:l,enable:t,assignEvents:Xn})}(t,u),d=function({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5}){const r=new Gn({checkCorrectEvent:t=>0===s.mouseButton(t)&&t.ctrlKey||2===s.mouseButton(t)});return new Zn({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:Xn})}(t),f=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:i=.3},r){const n=new Gn({checkCorrectEvent:t=>2===s.mouseButton(t)&&t.ctrlKey});return new Zn({clickTolerance:e,move:(t,e)=>{const n=r();let o=(e.x-t.x)*i;return e.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:t,assignEvents:Xn})}(t,u);i.dragRotate=new fo(t,p,d,f),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();const m=function({enable:t,clickTolerance:e}){const i=new Gn({checkCorrectEvent:t=>0===s.mouseButton(t)&&!t.ctrlKey});return new Zn({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:Xn})}(t),g=new Wn(t,i);i.dragPan=new po(r,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);const _=new eo,y=new Qn;i.touchZoomRotate=new mo(r,y,_,c),this._add("touchRotate",_,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate);const v=i.scrollZoom=new lo(i,(()=>this._triggerRenderFrame()));this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);const x=i.keyboard=new oo(i);this._add("keyboard",x),t.interactive&&t.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Bn(i))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(_o(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,i,r,n,o){if(!r)return;e.e(t,r);const a={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=a),void 0!==r.panDelta&&(i.drag=a),void 0!==r.rollDelta&&(i.roll=a),void 0!==r.pitchDelta&&(i.pitch=a),void 0!==r.bearingDelta&&(i.rotate=a)}_applyChanges(){const t={},i={},r={};for(const[n,o,a]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.e(i,o),e.e(r,a);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,e,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(vo(t)||o&&this._terrainMovement))return this._fireEvents(e,i,!0);r._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:h,around:u,pinchAround:p}=t;void 0!==p&&(u=p),u=u||r.transform.centerPoint,o&&!n.isPointOnMapSurface(u)&&(u=n.centerPoint);const d={panDelta:a,zoomDelta:s,rollDelta:h,pitchDelta:c,bearingDelta:l,around:u};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(u)&&(u=n.centerPoint);const f=u.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(a?u.sub(a):u);o?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(a))):this._map.cameraHelper.handleMapControlsPan(d,n,f):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,n,f))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._map.cameraHelper.handleMapControlsPan(d,n,f)),r._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(t,i,r){const n=_o(this._eventsInProgress),o=_o(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in s)this._fireEvent(t,s[t]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:r}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=i[e]||r,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const h=_o(this._eventsInProgress),u=(n||o)&&!h;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(r&&u){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&a.prefersReducedMotion?(this._map.fire(new e.k("moveend",{originalEvent:c})),i(this._map.getBearing())&&this._map.resetNorth()):(i(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new e.k(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new yo("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class bo extends e.E{constructor(t,e,i){super(),this._renderFrameCallback=()=>{const t=Math.min((a.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this.cameraHelper=e,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,e){t.apply(this.transform),this.transform=t,this.cameraHelper=e}getCenter(){return new e.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),r)}panTo(t,i,r){return this.easeTo(e.e({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,i,r){return this.easeTo(e.e({zoom:t},i),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,i){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new e.k("movestart",i)).fire(new e.k("move",i)).fire(new e.k("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,i,r){return this.easeTo(e.e({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,roll:0,duration:1e3},t),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=U.convert(t).adjustAntiMeridian();const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(t,i,r,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=e.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}const a=e.e(o,n.padding);n.padding=a;const s=this.transform,l=new U(t,i);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,r,s)}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(t,i,r,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(e.P.convert(t)),this.transform.screenPointToLocation(e.P.convert(i)),r,n),n,o)}_fitInternal(t,i,r){return t?(delete(i=e.e(t,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(t,i){this.stop();const r=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=r.zoom;this.cameraHelper.handleJumpToCenterZoom(r,t);const l=r.zoom!==s;return"elevation"in t&&r.elevation!==+t.elevation&&r.setElevation(+t.elevation),"bearing"in t&&r.bearing!==+t.bearing&&(n=!0,r.setBearing(+t.bearing)),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.setPitch(+t.pitch)),"roll"in t&&r.roll!==+t.roll&&(a=!0,r.setRoll(+t.roll)),null==t.padding||r.isPaddingEqual(t.padding)||r.setPadding(t.padding),this._applyUpdatedTransform(r),this.fire(new e.k("movestart",i)).fire(new e.k("move",i)),l&&this.fire(new e.k("zoomstart",i)).fire(new e.k("zoom",i)).fire(new e.k("zoomend",i)),n&&this.fire(new e.k("rotatestart",i)).fire(new e.k("rotate",i)).fire(new e.k("rotateend",i)),o&&this.fire(new e.k("pitchstart",i)).fire(new e.k("pitch",i)).fire(new e.k("pitchend",i)),a&&this.fire(new e.k("rollstart",i)).fire(new e.k("roll",i)).fire(new e.k("rollend",i)),this.fire(new e.k("moveend",i))}calculateCameraOptionsFromTo(t,i,r,n=0){const o=e.Y.fromLngLat(t,i),a=e.Y.fromLngLat(r,n),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,h=Math.hypot(s,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(s,l),p=e.a8(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=180*Math.atan2(s,-l)/Math.PI;let f=180*Math.acos(u/h)/Math.PI;return f=c<0?90-f:90+f,{center:a.toLngLat(),elevation:n,zoom:p,pitch:f,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,r,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(t,e,i,r);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:r,roll:n}}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.c8},t)).animate||!t.essential&&a.prefersReducedMotion)&&(t.duration=0);const r=this._getTransformForUpdate(),n=this.getBearing(),o=r.pitch,s=r.roll,l="bearing"in t?this._normalizeBearing(t.bearing,n):n,c="pitch"in t?+t.pitch:o,h="roll"in t?this._normalizeBearing(t.roll,s):s,u="padding"in t?t.padding:r.padding,p=e.P.convert(t.offset);let d,f;t.around&&(d=e.N.convert(t.around),f=r.locationToScreenPoint(d));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(r,{bearing:l,pitch:c,roll:h,padding:u,around:d,aroundPoint:f,offsetAsPoint:p,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||h!==s,this._padding=!r.isPaddingEqual(u),this._zooming=this._zooming||g.isZooming,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease((e=>{g.easeFunc(e),this.terrain&&!t.freezeElevation&&this._updateElevation(e),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,r={}){this._moving=!0,i||r.moving||this.fire(new e.k("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.k("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.k("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.k("pitchstart",t)),this._rolling&&!r.rolling&&this.fire(new e.k("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(i-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=i}this.transform.setElevation(e.y.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const e=t.getCameraLngLat(),i=t.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(i<r){const i=this.calculateCameraOptionsFromTo(e,r,t.center,t.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(t){const e=[];if(e.push((t=>this._elevateCameraIfInsideTerrain(t))),this.transformCameraUpdate&&e.push((t=>this.transformCameraUpdate(t))),!e.length)return;const i=t.clone();for(const t of e){const e=i.clone(),{center:r,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=t(e);r&&e.setCenter(r),void 0!==l&&e.setElevation(l),void 0!==n&&e.setZoom(n),void 0!==o&&e.setRoll(o),void 0!==a&&e.setPitch(a),void 0!==s&&e.setBearing(s),i.apply(e)}this.transform.apply(i)}_fireMoveEvents(t){this.fire(new e.k("move",t)),this._zooming&&this.fire(new e.k("zoom",t)),this._rotating&&this.fire(new e.k("rotate",t)),this._pitching&&this.fire(new e.k("pitch",t)),this._rolling&&this.fire(new e.k("roll",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,o=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new e.k("zoomend",t)),n&&this.fire(new e.k("rotateend",t)),o&&this.fire(new e.k("pitchend",t)),a&&this.fire(new e.k("rollend",t)),this.fire(new e.k("moveend",t))}flyTo(t,i){if(!t.essential&&a.prefersReducedMotion){const r=e.M(t,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(r,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.c8},t);const r=this._getTransformForUpdate(),n=r.bearing,o=r.pitch,s=r.roll,l=r.padding,c="bearing"in t?this._normalizeBearing(t.bearing,n):n,h="pitch"in t?+t.pitch:o,u="roll"in t?this._normalizeBearing(t.roll,s):s,p="padding"in t?t.padding:r.padding,d=e.P.convert(t.offset);let f=r.centerPoint.add(d);const m=r.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(r,{bearing:c,pitch:h,roll:u,padding:p,locationAtOffset:m,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let _=t.curve;const y=Math.max(r.width,r.height),v=y/g.scaleOfZoom,x=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/x*2));const b=_*_;function w(t){const e=(v*v-y*y+(t?-1:1)*b*b*x*x)/(2*(t?v:y)*b*x);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}const P=w(!1);let M=function(t){return C(P)/C(P+_*t)},S=function(t){return y*((C(P)*(T(e=P+_*t)/C(e))-T(P))/b)/x;var e},I=(w(!0)-P)/_;if(Math.abs(x)<2e-6||!isFinite(I)){if(Math.abs(y-v)<1e-6)return this.easeTo(t,i);const e=v<y?-1:1;I=Math.abs(Math.log(v/y))/_,S=()=>0,M=t=>Math.exp(e*_*t)}return t.duration="duration"in t?+t.duration:1e3*I/("screenSpeed"in t?+t.screenSpeed/_:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=h!==o,this._rolling=u!==s,this._padding=!r.isPaddingEqual(p),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease((a=>{const m=a*I,_=1/M(m),y=S(m);this._rotating&&r.setBearing(e.y.number(n,c,a)),this._pitching&&r.setPitch(e.y.number(o,h,a)),this._rolling&&r.setRoll(e.y.number(s,u,a)),this._padding&&(r.interpolatePadding(l,p,a),f=r.centerPoint.add(d)),g.easeFunc(a,_,y,f),this.terrain&&!t.freezeElevation&&this._updateElevation(a),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=a.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=e.aI(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.N.convert(t),this.transform.tileZoom):null}}const wo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class To{constructor(t=wo){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=s.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=s.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=s.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._sanitizedAttributionHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0}));const i=t.join(" | ");i!==this._sanitizedAttributionHTML&&(this._sanitizedAttributionHTML=s.sanitize(i),t.length?(this._innerContainer.innerHTML=this._sanitizedAttributionHTML,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Co{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=s.create("div","maplibregl-ctrl");const e=s.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){s.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Po{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Mo=e.aA([{name:"a_pos3d",type:"Int16",components:3}]);class So extends e.E{constructor(t){super(),this._lastTilesetChange=a.now(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,i){this.sourceCache.update(t,i),this._renderableTilesKeys=[];const r={};for(const n of ut(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),e.bL(n.terrainRttPosMatrix32f,0,e.X,e.X,0,0,1),this._tiles[n.key]=new ot(n,this.tileSize),this._lastTilesetChange=a.now());for(const t in this._tiles)r[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID,o=t.clone(),a=e.a$();if(n.canonical.equals(t.canonical))e.bL(a,0,e.X,e.X,0,0,1);else if(n.canonical.isChildOf(t.canonical)){const i=n.canonical.z-t.canonical.z,r=n.canonical.x-(n.canonical.x>>i<<i),o=n.canonical.y-(n.canonical.y>>i<<i),s=e.X>>i;e.bL(a,0,s,s,0,0,1),e.J(a,a,[-r*s,-o*s,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{const i=t.canonical.z-n.canonical.z,r=t.canonical.x-(t.canonical.x>>i<<i),o=t.canonical.y-(t.canonical.y>>i<<i),s=e.X>>i;e.bL(a,0,e.X,e.X,0,0,1),e.J(a,a,[r*s,o*s,0]),e.K(a,a,[1/2**i,1/2**i,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),i[r]=o}return i}getSourceTile(t,e){const i=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!n||!n.dem)&&e)for(;r>=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(t.scaledTo(r--).key);return n}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}}class Io{constructor(t,e,i){this._meshCache={},this.painter=t,this.sourceCache=new So(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,i,r,n=e.X){var o;if(!(i>=0&&i<n&&r>=0&&r<n))return 0;const a=this.getTerrainData(t),s=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!s)return 0;const l=e.c9([],[i/n*e.X,r/n*e.X],a.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],h=Math.floor(c[0]),u=Math.floor(c[1]),p=c[0]-h,d=c[1]-u;return s.get(h,u)*(1-p)*(1-d)+s.get(h+1,u)*p*(1-d)+s.get(h,u+1)*(1-p)*d+s.get(h+1,u+1)*p*d}getElevationForLngLatZoom(t,i){if(!e.ca(i,t.wrap()))return 0;const{tileID:r,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(r,n%e.X,o%e.X,e.X)}getElevation(t,i,r,n=e.X){return this.getDEMElevation(t,i,r,n)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,i=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new y(t,i,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new y(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.aq([])}const i=this.sourceCache.getSourceTile(t,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new y(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const r=i&&i+i.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let n=t.canonical.z-i.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?n=t.canonical.z-r:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=t.canonical.x-(t.canonical.x>>n<<n),a=t.canonical.y-(t.canonical.y>>n<<n),s=e.cb(new Float64Array(16),[1/(e.X<<n),1/(e.X<<n),0]);e.J(s,s,[o*e.X,a*e.X,0]),this._demMatrixCache[t.key]={matrix:s,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new y(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new y(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let r=0;r<this._coordsTextureSize;r++,e+=4)i[e+0]=255&r,i[e+1]=255&t,i[e+2]=r>>8<<4|t>>8,i[e+3]=0;const r=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new y(t,r,t.gl.RGBA,{premultiply:!1});return n.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),r=this.painter.context,n=r.gl,o=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),h=this.coordsIndex[255-i[3]],u=h&&this.sourceCache.getTileByID(h);if(!u)return null;const p=this._coordsTextureSize,d=(1<<u.tileID.canonical.z)*p;return new e.Y((u.tileID.canonical.x*p+l)/d+u.tileID.wrap,(u.tileID.canonical.y*p+c)/d,this.getElevation(u.tileID,l,c,p))}depthAtPoint(t){const e=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var i;const r=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,n=r&&0===t.canonical.y,o=r&&t.canonical.y===(1<<t.canonical.z)-1,a=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new e.cc,c=new e.aE,h=this.meshSize,u=e.X/h,p=h*h;for(let t=0;t<=h;t++)for(let e=0;e<=h;e++)l.emplaceBack(e*u,t*u,0);for(let t=0;t<p;t+=h+1)for(let e=0;e<h;e++)c.emplaceBack(e+t,h+e+t+1,h+e+t+2),c.emplaceBack(e+t,h+e+t+2,e+t+1);const d=l.length,f=d+(h+1),m=(h+1)*h,g=n?e.b6:0,_=n?0:1,y=o?e.b7:e.X,v=o?0:1;for(let t=0;t<=h;t++)l.emplaceBack(t*u,g,_);for(let t=0;t<=h;t++)l.emplaceBack(t*u,y,v);for(let t=0;t<h;t++)c.emplaceBack(m+t,f+t,f+t+1),c.emplaceBack(m+t,f+t+1,m+t+1),c.emplaceBack(0+t,d+t+1,d+t),c.emplaceBack(0+t,0+t+1,d+t+1);const x=l.length,b=x+2*(h+1);for(const t of[0,1])for(let i=0;i<=h;i++)for(const r of[0,1])l.emplaceBack(t*e.X,i*u,r);for(let t=0;t<2*h;t+=2)c.emplaceBack(x+t,x+t+1,x+t+3),c.emplaceBack(x+t,x+t+3,x+t+2),c.emplaceBack(b+t,b+t+3,b+t+1),c.emplaceBack(b+t,b+t+2,b+t+3);const w=new fe(s.createVertexBuffer(l,Mo.members),s.createIndexBuffer(c),e.aD.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(t){return 2*Math.PI*e.bo/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,e){var i;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(i=this.getMinMaxElevation(r).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,i){const r=e.Y.fromLngLat(t.wrap()),n=(1<<i)*e.X,o=r.x*n,a=r.y*n,s=Math.floor(o/e.X),l=Math.floor(a/e.X);return{tileID:new e.S(i,0,i,s,l),mercatorX:o,mercatorY:a}}}class Eo{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new y(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const zo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ao{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Eo(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsAscending={};for(const e in t.sourceCaches){this._coordsAscending[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsAscending[e][t]||(this._coordsAscending[e][t]=[]),this._coordsAscending[e][t].push(i[t])}}this._coordsAscendingStr={};for(const e of t._order){const i=t._layers[e],r=i.source;if(zo[i.type]&&!this._coordsAscendingStr[r]){this._coordsAscendingStr[r]={};for(const t in this._coordsAscending[r])this._coordsAscendingStr[r][t]=this._coordsAscending[r][t].map((t=>t.key)).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsAscendingStr){const i=this._coordsAscendingStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(t,i){if(t.isHidden(this.painter.transform.zoom))return!1;const r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(zo[n]&&(this._prevType&&zo[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(zo[this._prevType]||zo[n]&&a){this._prevType=n;const t=this._stacks.length-1,i=this._stacks[t]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(yn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){const e=this.pool.getObjectForId(n.rtt[t].id);if(e.stamp===n.rtt[t].stamp){this.pool.useObject(e);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),n.rtt[t]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:e.b4.transparent,stencil:0}),o.currentStencilSource=void 0;for(let t=0;t<i.length;t++){const e=o.style._layers[i[t]],s=e.source?this._coordsAscending[e.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(e,s,!0),o.renderLayer(o,o.style.sourceCaches[e.source],e,s,r),e.source&&(n.rttCoords[e.source]=this._coordsAscendingStr[e.source][n.tileID.key])}}return yn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),zo[n]}return!1}}const ko={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Do=i,Ro={hash:!1,interactive:!0,bearingSnap:7,attributionControl:wo,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:e.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Lo={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Bo{constructor(t,i,r=!1){this.mousedown=t=>{this.startMove(t,s.mousePos(this.element,t)),s.addEventListener(window,"mousemove",this.mousemove),s.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,s.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHanlder.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),s.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=s.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const n=new Hn;this._rotatePitchHanlder=new Zn({clickTolerance:3,move:(t,n)=>{const o=i.getBoundingClientRect(),a=new e.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:e.c7(new e.P(t.x,n.y),n,a),pitchDelta:r?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,s.addEventListener(i,"mousedown",this.mousedown),s.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),s.addEventListener(i,"touchcancel",this.reset)}startMove(t,e){this._rotatePitchHanlder.dragStart(t,e),s.disableDrag()}move(t,e){const i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHanlder.dragMove(t,e)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){const t=this.element;s.removeEventListener(t,"mousedown",this.mousedown),s.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend),s.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){s.enableDrag(),s.removeEventListener(window,"mousemove",this.mousemove),s.removeEventListener(window,"mouseup",this.mouseup),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend)}}let Fo;function Oo(t,i,r){const n=new e.N(t.lng,t.lat);if(t=new e.N(t.lng,t.lat),i){const n=new e.N(t.lng-360,t.lat),o=new e.N(t.lng+360,t.lat),a=r.locationToScreenPoint(t).distSqr(i);r.locationToScreenPoint(n).distSqr(i)<a?t=n:r.locationToScreenPoint(o).distSqr(i)<a&&(t=o)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationToScreenPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t.lng!==n.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(t))?t:n}const jo={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Vo(t,e,i){const r=t.classList;for(const t in jo)r.remove(`maplibregl-${i}-anchor-${t}`);r.add(`maplibregl-${i}-anchor-${e}`)}class No extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{var e;if(!this._map)return;const i=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!i)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Oo(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),s.setTransform(this._element,`${jo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${r}`),a.frameAsync(new AbortController).then((()=>{this._updateOpacity(t&&"moveend"===t.type)})).catch((()=>{}))},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.k("dragstart"))),this.fire(new e.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new e.k("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div");const i=s.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);const o=s.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=s.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=s.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=s.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const h=s.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=s.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),h.appendChild(u);const p=s.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=s.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),p.appendChild(d);const f=s.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=s.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=s.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=s.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),a.appendChild(l),a.appendChild(h),a.appendChild(p),a.appendChild(f),a.appendChild(m),i.appendChild(a),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=e.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),Vo(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),s.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-13.5,-1*(e-i)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,r;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain)){const t=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const n=this._map,o=n.terrain.depthAtPoint(this._pos),a=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom);if(n.transform.lngLatToCameraDepth(this._lngLat,a)-o<.006)return void(this._element.style.opacity=this._opacity);const s=-this._offset.y/n.transform.pixelsPerMeter,l=Math.sin(n.getPitch()*Math.PI/180)*s,c=n.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),h=n.transform.lngLatToCameraDepth(this._lngLat,a+l)-c>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&h&&this._popup.remove(),this._element.style.opacity=h?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return void 0===t&&void 0===e&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const qo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Zo=0,Uo=!1;const Go={maxWidth:100,unit:"metric"};function $o(t,e,i){const r=i&&i.maxWidth||100,n=t._container.clientHeight/2,o=t._container.clientWidth/2,a=t.unproject([o-r/2,n]),s=t.unproject([o+r/2,n]),l=Math.round(t.project(s).x-t.project(a).x),c=Math.min(r,l,t._container.clientWidth),h=a.distanceTo(s);if(i&&"imperial"===i.unit){const i=3.2808*h;i>5280?Ho(e,c,i/5280,t._getUIString("ScaleControl.Miles")):Ho(e,c,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Ho(e,c,h/1852,t._getUIString("ScaleControl.NauticalMiles")):h>=1e3?Ho(e,c,h/1e3,t._getUIString("ScaleControl.Kilometers")):Ho(e,c,h,t._getUIString("ScaleControl.Meters"))}function Ho(t,e,i,r){const n=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n} ${r}`}const Xo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Wo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ko(t){if(t){if("number"==typeof t){const i=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(i,i),"top-right":new e.P(-i,i),bottom:new e.P(0,-t),"bottom-left":new e.P(i,-i),"bottom-right":new e.P(-i,-i),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const i=e.P.convert(t);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return Ko(new e.P(0,0))}const Yo=i;t.AJAXError=e.cg,t.Event=e.k,t.Evented=e.E,t.LngLat=e.N,t.MercatorCoordinate=e.Y,t.Point=e.P,t.addProtocol=e.ch,t.config=e.a,t.removeProtocol=e.ci,t.AttributionControl=To,t.BoxZoomHandler=On,t.CanvasSource=J,t.CooperativeGesturesHandler=go,t.DoubleClickZoomHandler=co,t.DragPanHandler=po,t.DragRotateHandler=fo,t.EdgeInsets=Ce,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){s.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=s.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);s.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new e.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=W,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const i=new e.N(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),o=e.e({bearing:n},this.options.fitBoundsOptions),a=U.fromLngLat(i,r);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const i=new e.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&Uo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=s.create("button","maplibregl-ctrl-geolocate",this._container),s.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new No({element:this._dotElement}),this._circleElement=s.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new No({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.k("trackuserlocationend")),this.fire(new e.k("userlocationlostfocus")))}))}},this.options=e.e({},qo,t)}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,(function*(t=!1){if(void 0!==Fo&&!t)return Fo;if(void 0===window.navigator.permissions)return Fo=!!window.navigator.geolocation,Fo;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Fo="denied"!==t.state}catch(t){Fo=!!window.navigator.geolocation}return Fo}))}().then((t=>this._finishSetupUI(t))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),s.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Zo=0,Uo=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),r=e.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Zo--,Uo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new e.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.k("trackuserlocationstart")),this.fire(new e.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Zo++,Zo>1?(t={maximumAge:6e5,timeout:0},Uo=!0):(t=this.options.positionOptions,Uo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;const e=null===(t=this._map.getProjection())||void 0===t?void 0:t.type;this._map.setProjection("mercator"!==e&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(t=this._map.getProjection())||void 0===t?void 0:t.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=s.create("button","maplibregl-ctrl-globe",this._container),s.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=wn,t.ImageSource=K,t.KeyboardHandler=oo,t.LngLatBounds=U,t.LogoControl=Co,t.Map=class extends bo{constructor(t){var i,r;e.cd.mark(e.ce.create);const n=Object.assign(Object.assign(Object.assign({},Ro),t),{canvasContextAttributes:Object.assign(Object.assign({},Ro.canvasContextAttributes),t.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new Ae,a=new Le;if(void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),super(o,a,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Po,this._controls=[],this._mapId=e.a1(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},ko),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=f.addThrottleControl((()=>this.isMoving())),this._requestManager=new m(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=bn((t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())}),50);this._resizeObserver=new ResizeObserver((i=>{t?e(i):t=!0})),this._resizeObserver.observe(this._container)}this.handlers=new xo(this,n),this._hash=n.hash&&new wn("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,e.e({},n.fitBoundsOptions,{duration:0}))));const s="string"==typeof n.style||!("globe"===(null===(r=null===(i=n.style)||void 0===i?void 0:i.projection)||void 0===r?void 0:r.type));this.resize(null,s),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new To("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Co,n.logoPosition),this.on("style.load",(()=>{if(s||this._resizeTransform(),this.transform.unmodified){const t=e.M(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.k(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.k(`${t.dataType}dataloading`,t))})),this.on("dataabort",(t=>{this.fire(new e.k("sourcedataabort",t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(t,i=!0){const[r,n]=this._containerDimensions(),o=this._getClampedPixelRatio(r,n);if(this._resizeCanvas(r,n,o),this.painter.resize(r,n,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(r,n);this._resizeCanvas(r,n,e),this.painter.resize(r,n,e)}this._resizeTransform(i);const a=!this._moving;return a&&(this.stop(),this.fire(new e.k("movestart",t)).fire(new e.k("move",t))),this.fire(new e.k("resize",t)),a&&this.fire(new e.k("moveend",t)),this}_resizeTransform(t=!0){var e;const[i,r]=this._containerDimensions();this.transform.resize(i,r,t),null===(e=this._requestedCameraState)||void 0===e||e.resize(i,r,t)}_getClampedPixelRatio(t,e){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),o=t*n,a=e*n;return Math.min(o>i?i/o:1,a>r?r/a:1)*n}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(U.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.setMinZoom(t),this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.setMaxZoom(t),this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.setMinPitch(t),this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>180)throw new Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch)return this.transform.setMaxPitch(t),this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}project(t){return this.transform.locationToScreenPoint(e.N.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const n=n=>{const o=e.filter((t=>this.getLayer(t))),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?r||(r=!0,i.call(this,new kn(t,this,n.originalEvent,{features:a}))):r=!1};return{layers:e,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const n=n=>{const o=e.filter((t=>this.getLayer(t)));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new kn(t,this,n.originalEvent)))},o=e=>{r&&(r=!1,i.call(this,new kn(t,this,e.originalEvent)))};return{layers:e,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=t=>{const r=e.filter((t=>this.getLayer(t))),n=0!==r.length?this.queryRenderedFeatures(t.point,{layers:r}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layers:e,listener:i,delegates:{[t]:r}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){const n=r[t];if(n.listener===i&&n.layers.length===e.length&&n.layers.every((t=>e.includes(t)))){for(const t in n.delegates)this.off(t,n.delegates[t]);return void r.splice(t,1)}}}on(t,e,i){if(void 0===i)return super.on(t,e);const r="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,r,i);this._saveDelegatedListener(t,n);for(const t in n.delegates)this.on(t,n.delegates[t]);return{unsubscribe:()=>{this._removeDelegatedListener(t,r,i)}}}once(t,e,i){if(void 0===i)return super.once(t,e);const r="string"==typeof e?[e]:e,n=this._createDelegatedListener(t,r,i);for(const e in n.delegates){const o=n.delegates[e];n.delegates[e]=(...e)=>{this._removeDelegatedListener(t,r,i),o(...e)}}this._saveDelegatedListener(t,n);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,i),this)}queryRenderedFeatures(t,i){if(!this.style)return[];let r;const n=t instanceof e.P||Array.isArray(t),o=n?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:t)||{},o instanceof e.P||"number"==typeof o[0])r=[e.P.convert(o)];else{const t=e.P.convert(o[0]),i=e.P.convert(o[1]);r=[t,new e.P(i.x,t.y),i,new e.P(t.x,i.y),t]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,i){return!1!==(i=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var i,r;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const n=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new _i(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,n):this.style.loadJSON(t,e,n),this):(null===(r=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===r||r.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new _i(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if("string"==typeof t){const r=this._requestManager.transformRequest(t,"Style");e.h(r,new AbortController).then((t=>{this._updateDiff(t.data,i)})).catch((t=>{t&&this.fire(new e.j(t))}))}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(r){e.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const i=this.style&&this.style.sourceCaches[t];if(void 0!==i)return i.loaded();this.fire(new e.j(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const i=this.style.sourceCaches[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===t.source&&e.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Io(this.painter,i,t),this.painter.renderToTexture=new Ao(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=e=>{"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new e.k("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,r={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:c,textFitWidth:h,textFitHeight:u}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||e.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new e.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:r,height:a,data:p}=i,d=i;return this.style.addImage(t,{data:new e.R({width:r,height:a},new Uint8Array(p)),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:o,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}{const{width:r,height:p,data:d}=a.getImageData(i);this.style.addImage(t,{data:new e.R({width:r,height:p},d),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:o,version:0})}}updateImage(t,i){const r=this.style.getImage(t);if(!r)return this.fire(new e.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||e.b(i)?a.getImageData(i):i,{width:o,height:s,data:l}=n;if(void 0===o||void 0===s)return this.fire(new e.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==r.data.width||s!==r.data.height)return this.fire(new e.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||e.b(i));return r.data.replace(l,c),this.style.updateImage(t,r),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.j(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return f.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0)})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0)})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=s.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=s.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const n=this._controlContainer=s.create("div","maplibregl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{o[t]=s.create("div",`maplibregl-ctrl-${t} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new xn(i,this.transform),l.testSupport(i)}migrateProjection(t,i){super.migrateProjection(t,i),this.painter.transform=t,this.fire(new e.k("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var i,r,n,o,s;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=a.now();this.style.zoomHistory.update(t,i);const r=new e.z(t,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(h=!0,this._crossFadingFactor=n),this.style.update(r)}const u=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(s=this.style.projection)||void 0===s?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new e.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.cd.mark(e.ce.load),this.fire(new e.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.k("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,e.cd.mark(e.ce.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),s.remove(this._canvasContainer),s.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),e.cd.clearMetrics(),this._removed=!0,this.fire(new e.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,a.frame(this._frameRequest,(t=>{e.cd.frame(t),this._frameRequest=null;try{this._render(t)}catch(t){if(!e.cf(t)&&!function(t){return t.message===jr}(t))throw t}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return Do}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},t.MapMouseEvent=kn,t.MapTouchEvent=Dn,t.MapWheelEvent=Rn,t.Marker=No,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=e.e({},Lo,t),this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),s.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),s.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=s.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Bo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){s.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const i=s.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}},t.Popup=class extends e.E{constructor(t){super(),this.remove=()=>(this._content&&s.remove(this._content),this._container&&(s.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new e.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var e;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=s.create("div","maplibregl-popup",this._map.getContainer()),this._tip=s.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Oo(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._trackPointer&&!t)return;const i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor;const n=Ko(this.options.offset);if(!r){const t=this._container.offsetWidth,e=this._container.offsetHeight;let o;o=i.y+n.bottom.y<e?["top"]:i.y>this._map.transform.height-e?["bottom"]:[],i.x<t/2?o.push("left"):i.x>this._map.transform.width-t/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}let o=i.add(n[r]);this.options.subpixelPositioning||(o=o.round()),s.setTransform(this._container,`${jo[r]} translate(${o.x}px,${o.y}px)`),Vo(this._container,r,"popup")},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(Xo),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new e.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=s.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Wo);t&&t.focus()}},t.RasterDEMTileSource=X,t.RasterTileSource=H,t.ScaleControl=class{constructor(t){this._onMove=()=>{$o(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,$o(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Go),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=lo,t.Style=_i,t.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=t}onAdd(t){return this._map=t,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=s.create("button","maplibregl-ctrl-terrain",this._container),s.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){s.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=ro,t.TwoFingersTouchRotateHandler=eo,t.TwoFingersTouchZoomHandler=Qn,t.TwoFingersTouchZoomRotateHandler=mo,t.VectorTileSource=$,t.VideoSource=Y,t.addSourceType=(t,i)=>e._(void 0,void 0,void 0,(function*(){if(tt(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{Q[t]=e})(t,i)})),t.clearPrewarmedResources=function(){const t=R;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(A),R=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},t.createTileMesh=$e,t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return nt().getRTLTextPluginStatus()},t.getVersion=function(){return Yo},t.getWorkerCount=function(){return k.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return O().broadcast("IS",t)},t.prewarm=function(){B().acquire(A)},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setRTLTextPlugin=function(t,e){return nt().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){k.workerCount=t},t.setWorkerUrl=function(t){e.a.WORKER_URL=t}}));var r=t;return r}();var C=w(T.exports),P=[],M=[];function S(t,e){if(t&&"undefined"!=typeof document){var i,r=!0===e.prepend?"prepend":"append",n=!0===e.singleTag,o="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(n){var a=P.indexOf(o);-1===a&&(a=P.push(o)-1,M[a]={}),i=M[a]&&M[a][r]?M[a][r]:M[a][r]=s()}else i=s();65279===t.charCodeAt(0)&&(t=t.substring(1)),i.styleSheet?i.styleSheet.cssText+=t:i.appendChild(document.createTextNode(t))}function s(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var i=Object.keys(e.attributes),n=0;n<i.length;n++)t.setAttribute(i[n],e.attributes[i[n]]);var a="prepend"===r?"afterbegin":"beforeend";return o.insertAdjacentElement(a,t),t}}S(".maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E\")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E\")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E\")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E\")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E\")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E\")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E\")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E\")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E\")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E\")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:\"\";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:\"\";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}",{});S("\n.map-wrapper[data-v-a7912446] {\n position: relative;\n height: 60%;\n min-height: 300px;\n}\n.map-container[data-v-a7912446] {\n height: 100%;\n width: 100%;\n border-radius: 8px;\n border: 1px solid var(--background-normal-alt);\n}\n.reset-map-btn[data-v-a7912446] {\n position: absolute;\n top: 20px;\n right: 20px;\n z-index: 29;\n}\n",{});var I=(t,e)=>{const i=t.__vccOpts||t;for(const[t,r]of e)i[t]=r;return i};const E={class:"map-wrapper"},z={__name:"MapComponent",props:{items:{type:Array,required:!0},geolocation:{type:String,required:!0},title:{type:String,required:!0}},setup(t,{expose:e}){const i=t,r=n(null),d=n(null),f=n([]),m=n([]),g=()=>getComputedStyle(document.documentElement).getPropertyValue("--theme--primary").trim()||"#007bff",_=()=>({type:"FeatureCollection",features:i.items.map((t=>{const e=t[i.geolocation]?.coordinates;return e&&2===e.length?{type:"Feature",geometry:{type:"Point",coordinates:[e[0],e[1]]},properties:{id:t.id,title:t[i.title]||t.id}}:(console.log("Item with invalid coordinates:",t),null)})).filter((t=>null!==t))}),y=()=>{if(!d.value||0===i.items.length)return;const t=new C.LngLatBounds;i.items.forEach((e=>{const r=e[i.geolocation]?.coordinates;r&&2===r.length&&t.extend([r[0],r[1]])})),t.isEmpty()||d.value.fitBounds(t,{padding:50,maxZoom:15,duration:1e3})},v=()=>{d.value?(x(),y()):console.log("Map not initialized")},x=()=>{f.value.forEach((t=>t.remove())),f.value=[]},b=()=>{if(!d.value||!d.value.isStyleLoaded())return;const t=d.value.getSource("points");if(!t)return;t.setData(_()),m.value.forEach((t=>t.remove())),m.value=[];const e=d.value.querySourceFeatures("points",{filter:["has","point_count"]});console.log("Clusters found:",e),e.forEach((t=>{const e=t.properties.point_count,i=t.geometry.coordinates,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("width","40"),r.setAttribute("height","40");const n=document.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("x","50%"),n.setAttribute("y","50%"),n.setAttribute("text-anchor","middle"),n.setAttribute("dominant-baseline","middle"),n.setAttribute("fill","#fff"),n.setAttribute("font-size","14"),n.setAttribute("font-family","Arial"),n.textContent=e.toString(),r.appendChild(n);const o=document.createElement("div");o.appendChild(r),o.style.width="40px",o.style.height="40px",o.style.pointerEvents="none";const a=new C.Marker({element:o,offset:[0,0]}).setLngLat(i).addTo(d.value);m.value.push(a)})),d.value.setPaintProperty("unclustered-point","circle-color",g())};return o((()=>{r.value&&(d.value=new C.Map({container:r.value,style:{version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png","https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}},layers:[{id:"osm",type:"raster",source:"osm"}]},center:[0,0],zoom:1}),d.value.on("load",(()=>{d.value.addSource("points",{type:"geojson",data:_(),cluster:!0,clusterMaxZoom:14,clusterRadius:50}),d.value.addLayer({id:"clusters",type:"circle",source:"points",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],g(),10,"#51bbd6",50,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,10,30,50,40]}}),d.value.addLayer({id:"unclustered-point",type:"circle",source:"points",filter:["!",["has","point_count"]],paint:{"circle-color":g(),"circle-radius":10,"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),d.value.on("click","unclustered-point",(t=>{const e=t.features[0].geometry.coordinates.slice(),i=t.features[0].properties.title;for(;Math.abs(t.lngLat.lng-e[0])>180;)e[0]+=t.lngLat.lng>e[0]?360:-360;const r=(new C.Popup).setLngLat(e).setHTML(`<strong>${i}</strong>`).addTo(d.value);f.value.push(r)})),d.value.on("mouseenter","unclustered-point",(()=>{d.value.getCanvas().style.cursor="pointer"})),d.value.on("mouseleave","unclustered-point",(()=>{d.value.getCanvas().style.cursor=""})),d.value.on("click","clusters",(t=>{const e=d.value.queryRenderedFeatures(t.point,{layers:["clusters"]}),i=e[0].properties.cluster_id;d.value.getSource("points").getClusterExpansionZoom(i).then((t=>{d.value.easeTo({center:e[0].geometry.coordinates,zoom:t})}))})),d.value.on("mouseenter","clusters",(()=>{d.value.getCanvas().style.cursor="pointer"})),d.value.on("mouseleave","clusters",(()=>{d.value.getCanvas().style.cursor=""})),b(),y(),console.log("Map loaded successfully")})),d.value.on("moveend",(()=>{b()})),d.value.on("error",(t=>{console.error("Map error:",t)})))})),a((()=>i.items),(()=>{b(),y()}),{deep:!0}),e({focusOnItem:t=>{if(!d.value||!t||!t[i.geolocation]?.coordinates)return;const[e,r]=t[i.geolocation].coordinates;x();const n=(new C.Popup).setLngLat([e,r]).setHTML(`<strong>${t[i.title]||t.id}</strong>`).addTo(d.value);f.value.push(n),d.value.flyTo({center:[e,r],zoom:15,duration:1e3})}}),(t,e)=>{const i=s("VIcon"),n=s("VButton");return l(),c("div",E,[h("div",{ref_key:"mapContainer",ref:r,class:"map-container"},null,512),u(n,{class:"reset-map-btn",icon:"",onClick:v,title:"Reset view"},{default:p((()=>[u(i,{name:"zoom_out_map"})])),_:1})])}}};var A=I(z,[["__scopeId","data-v-a7912446"],["__file","MapComponent.vue"]]);S("\n.table-container[data-v-499a8411] {\n height: 40%;\n overflow-y: auto;\n background: var(--theme--background);\n border-radius: 8px;\n border: 1px solid var(--background-normal-alt);\n position: relative;\n}\n.table-header[data-v-499a8411] {\n display: flex;\n position: sticky;\n top: 0;\n background-color: var(--theme--background);\n z-index: 1;\n}\n.table-header-item[data-v-499a8411] {\n flex: 1;\n padding: 12px 16px;\n font-weight: bold;\n background-color: var(--color-primary-light);\n color: var(--color-primary-dark);\n border-bottom: 2px solid var(--background-normal-alt);\n text-transform: uppercase;\n font-size: 12px;\n}\n.table-row[data-v-499a8411] {\n display: flex;\n border-bottom: 1px solid var(--background-normal-alt);\n cursor: pointer;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: background-color 0.2s ease;\n position: relative;\n}\n.table-row[data-v-499a8411]:hover {\n background-color: var(--theme--primary-background);\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);\n}\n.table-row:hover .edit-btn[data-v-499a8411] {\n opacity: 1;\n}\n.table-cell[data-v-499a8411] {\n flex: 1;\n padding: 12px 16px;\n}\n.actions[data-v-499a8411] {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.edit-btn[data-v-499a8411] {\n opacity: 0;\n transition: opacity 0.2s ease;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n}\n.no-items-message[data-v-499a8411] {\n padding: 16px;\n text-align: center;\n color: var(--theme--foreground-subdued);\n}\n",{});const k={class:"table-container"},D={class:"table-header"},R=["onClick"],L={class:"actions"},B={key:1,class:"no-items-message"};var F=I({__name:"TableComponent",props:{items:{type:Array,required:!0},headers:{type:Array,required:!0},collection:{type:String,required:!0}},emits:["focus-on-item","edit-item"],setup(t,{emit:e}){const i=e;return(e,r)=>{const n=s("VIcon"),o=s("VButton");return l(),c("div",k,[h("div",D,[(l(!0),c(d,null,f(t.headers,(t=>(l(),c("div",{key:t.value,class:"table-header-item"},m(t.text),1)))),128))]),t.items&&t.items.length>0?(l(!0),c(d,{key:0},f(t.items,(e=>(l(),c("div",{key:e.id,class:"table-row item-lista",onClick:t=>i("focus-on-item",e)},[(l(!0),c(d,null,f(t.headers,(t=>(l(),c("div",{key:t.value,class:"table-cell"},m(((t,e)=>{if(!t||!e)return"";if(!Object.prototype.hasOwnProperty.call(t,e))return"";const i=t[e];return null==i?"":i})(e,t.value)),1)))),128)),h("div",L,[u(o,{class:"edit-btn",rounded:"",icon:"",outlined:"",small:"",onClick:g((t=>i("edit-item",e)),["stop"]),title:"Edit"},{default:p((()=>[u(n,{small:"",name:"edit"})])),_:2},1032,["onClick"])])],8,R)))),128)):(l(),c("div",B,"No items found."))])}}},[["__scopeId","data-v-499a8411"],["__file","TableComponent.vue"]]);S("\n.directus-table-layout[data-v-d91e405f] {\n height: calc(100vh - 120px);\n display: flex;\n flex-direction: column;\n padding: 16px;\n position: relative;\n}\n.layout-container[data-v-d91e405f] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n}\n.loading-container[data-v-d91e405f] {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n}\n",{});const O={class:"directus-table-layout"},j={key:0,class:"loading-container"},V={key:1,class:"layout-container"};var N=I({__name:"layout",props:{items:{type:Array,required:!0,default:()=>[]},loading:{type:Boolean,default:!1},collection:{type:String,required:!0},title:{type:String,default:"name"},geolocation:{type:String,default:"geolocation"},coluna1:String,coluna2:String,coluna3:String,coluna4:String,coluna5:String},setup(t){const e=t,i=b(),r=n(null),o=_((()=>[e.coluna1,e.coluna2,e.coluna3,e.coluna4,e.coluna5].filter(Boolean).map((t=>({text:t,value:t}))))),a=t=>{r.value&&r.value.focusOnItem&&r.value.focusOnItem(t)},h=t=>{i.push(`/content/${e.collection}/${t.id}`)};return(e,i)=>{const n=s("loader");return l(),c("div",O,[t.loading?(l(),c("div",j,[u(n)])):(l(),c("div",V,[u(A,{ref_key:"mapRef",ref:r,items:t.items,geolocation:t.geolocation,title:t.title},null,8,["items","geolocation","title"]),u(F,{items:t.items,headers:o.value,collection:t.collection,onFocusOnItem:a,onEditItem:h},null,8,["items","headers","collection"])]))])}}},[["__scopeId","data-v-d91e405f"],["__file","layout.vue"]]),q=y({name:"Options",props:{collection:{type:String,required:!0},layoutOptions:{type:Object,required:!0},fieldsInCollection:{type:Array,required:!0},title:{type:String,default:null},geolocation:{type:String,default:null},coluna1:{type:String,default:null},coluna2:{type:String,default:null},coluna3:{type:String,default:null},coluna4:{type:String,default:null},coluna5:{type:String,default:null}},emits:["update:layoutOptions","update:geolocation","update:title","update:coluna1","update:coluna2","update:coluna3","update:coluna4","update:coluna5"],setup(i,{emit:r}){const{collection:n}=v(i),o=t(n),a=e(i,"title",r),s=e(i,"geolocation",r),l=e(i,"coluna1",r),c=e(i,"coluna2",r),h=e(i,"coluna3",r),u=e(i,"coluna4",r),p=e(i,"coluna5",r),d=e(i,"layoutOptions",r);return{iconTemplateWritable:_({get(){var t;return null==(t=d.value)?void 0:t.iconTemplate},set(t){d.value=Object.assign({},d.value,{iconTemplate:t})}}),headerTemplateWritable:_({get(){var t;return null==(t=d.value)?void 0:t.headerTemplate},set(t){d.value=Object.assign({},d.value,{headerTemplate:t})}}),cardContentTemplateWritable:_({get(){var t;return null==(t=d.value)?void 0:t.cardContentTemplate},set(t){d.value=Object.assign({},d.value,{cardContentTemplate:t})}}),camposSelecao:_((()=>o.fields.value.filter((t=>{var e;return"map"===(null==(e=t.meta)?void 0:e.interface)})))),title:a,geolocation:s,coluna1:l,coluna2:c,coluna3:h,coluna4:u,coluna5:p}}});S("\n.options-container[data-v-9f6608be] {\n padding: 16px;\n width: 100%;\n display: block;\n}\n.field[data-v-9f6608be] {\n margin-bottom: 16px;\n width: 100%;\n display: block;\n}\n.type-label[data-v-9f6608be] {\n font-weight: bold;\n margin-bottom: 4px;\n}\n",{});const Z={class:"field"},U={class:"field"},G={class:"field"},$={class:"field"},H={class:"field"},X={class:"field"},W={class:"field"};var K=i({id:"mapgrid",name:"MapGrid",icon:"map",component:N,slots:{options:I(q,[["render",function(t,e,i,r,n,o){const a=s("v-select");return l(),c(d,null,[h("div",Z,[e[7]||(e[7]=h("div",{class:"type-label"},"Title Pin Map",-1)),u(a,{modelValue:t.title,"onUpdate:modelValue":e[0]||(e[0]=e=>t.title=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),h("div",U,[e[8]||(e[8]=h("div",{class:"type-label"},"Geolocation",-1)),u(a,{modelValue:t.geolocation,"onUpdate:modelValue":e[1]||(e[1]=e=>t.geolocation=e),collection:t.collection,items:[{name:"---",field:null},...t.camposSelecao],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),x(" Coluna 1 "),h("div",G,[e[9]||(e[9]=h("div",{class:"type-label"},"Col 1",-1)),u(a,{modelValue:t.coluna1,"onUpdate:modelValue":e[2]||(e[2]=e=>t.coluna1=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),x(" Coluna 2 "),h("div",$,[e[10]||(e[10]=h("div",{class:"type-label"},"Col 2",-1)),u(a,{modelValue:t.coluna2,"onUpdate:modelValue":e[3]||(e[3]=e=>t.coluna2=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),x(" Coluna 3 "),h("div",H,[e[11]||(e[11]=h("div",{class:"type-label"},"Col 3",-1)),u(a,{modelValue:t.coluna3,"onUpdate:modelValue":e[4]||(e[4]=e=>t.coluna3=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),x(" Coluna 4 "),h("div",X,[e[12]||(e[12]=h("div",{class:"type-label"},"Col 4",-1)),u(a,{modelValue:t.coluna4,"onUpdate:modelValue":e[5]||(e[5]=e=>t.coluna4=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])]),x(" Coluna 5 "),h("div",W,[e[13]||(e[13]=h("div",{class:"type-label"},"Col 5",-1)),u(a,{modelValue:t.coluna5,"onUpdate:modelValue":e[6]||(e[6]=e=>t.coluna5=e),collection:t.collection,items:[{name:"---",field:null},...t.fieldsInCollection],"item-text":"name","item-value":"field",placeholder:"Select a field"},null,8,["modelValue","collection","items"])])],64)}],["__scopeId","data-v-9f6608be"],["__file","options.vue"]]),sidebar:()=>{},actions:()=>{}},setup(i,{emit:n}){const o=e(i,"layoutOptions",n),a=e(i,"layoutQuery",n),{collection:s,filter:l,search:c}=v(i),{fields:h}=t(s),{sort:u,limit:p,page:d,fields:f}=function(){const t=_((()=>{var t;return(null==(t=a.value)?void 0:t.page)||1})),e=_((()=>{var t;return(null==(t=a.value)?void 0:t.limit)||25})),i=_((()=>{var t;return(null==(t=a.value)?void 0:t.sort)||[]})),r=_((()=>h.value?h.value.map((t=>t.field)):[]));return{sort:i,limit:e,page:t,fields:r}}(),{title:m,geolocation:g,coluna1:y,coluna2:x,coluna3:b,coluna4:w,coluna5:T}=function(){const t=l("title",void 0),e=l("geolocation",void 0),i=l("coluna1",void 0),r=l("coluna2",void 0),n=l("coluna3",void 0),a=l("coluna4",void 0),s=l("coluna5",void 0);return{title:t,geolocation:e,coluna1:i,coluna2:r,coluna3:n,coluna4:a,coluna5:s};function l(t,e){return _({get(){var i;return void 0!==(null==(i=o.value)?void 0:i[t])?o.value[t]:e},set(e){o.value={...o.value,[t]:e}}})}}(),{items:C,loading:P,error:M,totalPages:S,itemCount:I,totalCount:E}=r(s,{sort:u,limit:p,page:d,fields:f,filter:l,search:c});return{items:C,loading:P,error:M,totalPages:S,itemCount:I,totalCount:E,page:d,limit:p,fields:f,fieldsInCollection:h,title:m,geolocation:g,coluna1:y,coluna2:x,coluna3:b,coluna4:w,coluna5:T}}});export{K as default};
|