UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

5 lines 137 kB
/* @preserve * Leaflet 2.0.0-alpha.1, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2025 Volodymyr Agafonkin, (c) 2010-2011 CloudMade */ ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).leaflet={})})(this,function(t){let I=0;function r(t){return"_leaflet_id"in t||(t._leaflet_id=++I),t._leaflet_id}function j(e,i,s){let o,n;function a(){o=!1,n&&(t.apply(s,n),n=!1)}function t(...t){o?n=t:(e.apply(s,t),setTimeout(a,i),o=!0)}return t}function D(t,e,i){var s=e[1],e=e[0],o=s-e;return t===s&&i?t:((t-e)%o+o)%o+e}function n(){return!1}function i(t,e){return!1===e?t:(e=10**(void 0===e?6:e),Math.round(t*e)/e)}function h(t){return t.trim().split(/\s+/)}function l(t,e){for(var i in Object.hasOwn(t,"options")||(t.options=t.options?Object.create(t.options):{}),e)Object.hasOwn(e,i)&&(t.options[i]=e[i]);return t.options}let R=/\{ *([\w_ -]+) *\}/g;function N(t,s){return t.replace(R,(t,e)=>{let i=s[e];if(void 0===i)throw new Error("No value provided for variable "+t);return i="function"==typeof i?i(s):i})}let F="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",W={__proto__:null,emptyImageUrl:F,falseFn:n,formatNum:i,get lastId(){return I},setOptions:l,splitWords:h,stamp:r,template:N,throttle:j,wrapNum:D};class H{static extend({statics:t,includes:e,...i}){var s=class extends this{},o=(Object.setPrototypeOf(s,this),this.prototype),n=s.prototype;if(t&&Object.assign(s,t),Array.isArray(e))for(var a of e)Object.assign(n,a);else e&&Object.assign(n,e);return Object.assign(n,i),n.options&&(n.options=o.options?Object.create(o.options):{},Object.assign(n.options,i.options)),n._initHooks=[],s}static include(t){var e=this.prototype.options;return Object.assign(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this}static setDefaultOptions(t){return l(this.prototype,t),this}static mergeOptions(t){return this.prototype.options??={},Object.assign(this.prototype.options,t),this}static addInitHook(t,...e){var i="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks??=[],this.prototype._initHooks.push(i),this}constructor(...t){this._initHooksCalled=!1,l(this),this.initialize&&this.initialize(...t),this.callInitHooks()}initialize(){}callInitHooks(){if(!this._initHooksCalled){var e,i=[];let t=this;for(;null!==(t=Object.getPrototypeOf(t));)i.push(t);i.reverse();for(e of i)for(var s of e._initHooks??[])s.call(this);this._initHooksCalled=!0}}}class q extends H{on(t,e,i){if("object"==typeof t)for(var[s,o]of Object.entries(t))this._on(s,o,e);else for(var n of h(t))this._on(n,e,i);return this}off(t,e,i){if(arguments.length)if("object"==typeof t)for(var[s,o]of Object.entries(t))this._off(s,o,e);else{var n,a=1===arguments.length;for(n of h(t))a?this._off(n):this._off(n,e,i)}else delete this._events;return this}_on(t,e,i,s){"function"!=typeof e?console.warn("wrong listener type: "+typeof e):!1===this._listens(t,e,i)&&(e={fn:e,ctx:i=i===this?void 0:i},s&&(e.once=!0),this._events??={},this._events[t]??=[],this._events[t].push(e))}_off(e,i,s){if(this._events){let t=this._events[e];if(t)if(1===arguments.length){if(this._firingCount)for(var o of t)o.fn=n;delete this._events[e]}else"function"!=typeof i?console.warn("wrong listener type: "+typeof i):!1!==(i=this._listens(e,i,s))&&(s=t[i],this._firingCount&&(s.fn=n,this._events[e]=t=t.slice()),t.splice(i,1))}}fire(t,e,i){if(this.listens(t,i)){var s={...e,type:t,target:this,sourceTarget:e?.sourceTarget||this};if(this._events){e=this._events[t];if(e){this._firingCount=this._firingCount+1||1;for(var o of e){var n=o.fn;o.once&&this.off(t,n,o.ctx),n.call(o.ctx||this,s)}this._firingCount--}}i&&this._propagateEvent(s)}return this}listens(t,e,i,s){"string"!=typeof t&&console.warn('"string" type argument expected');let o=e;if("function"!=typeof e&&(s=!!e,i=o=void 0),this._events?.[t]?.length&&!1!==this._listens(t,o,i))return!0;if(s)for(var n of Object.values(this._eventParents??{}))if(n.listens(t,e,i,s))return!0;return!1}_listens(t,e,i){if(!this._events)return!1;t=this._events[t]??[];if(!e)return!!t.length;i===this&&(i=void 0);t=t.findIndex(t=>t.fn===e&&t.ctx===i);return-1!==t&&t}once(t,e,i){if("object"==typeof t)for(var[s,o]of Object.entries(t))this._on(s,o,e,!0);else for(var n of h(t))this._on(n,e,i,!0);return this}addEventParent(t){return this._eventParents??={},this._eventParents[r(t)]=t,this}removeEventParent(t){return this._eventParents&&delete this._eventParents[r(t)],this}_propagateEvent(t){for(var e of Object.values(this._eventParents??{}))e.fire(t.type,{propagatedFrom:t.target,...t},!0)}}class g{constructor(t,e,i){if(!g.validate(t,e))throw new Error(`Invalid Point object: (${t}, ${e})`);let s,o;if(t instanceof g)return t;o=Array.isArray(t)?(s=t[0],t[1]):"object"==typeof t&&"x"in t&&"y"in t?(s=t.x,t.y):(s=t,e),this.x=i?Math.round(s):s,this.y=i?Math.round(o):o}static validate(t,e){return!!(t instanceof g||Array.isArray(t))||!!(t&&"object"==typeof t&&"x"in t&&"y"in t)||!(!t&&0!==t||!e&&0!==e)}clone(){var t=new g(0,0);return t.x=this.x,t.y=this.y,t}add(t){return this.clone()._add(new g(t))}_add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.clone()._subtract(new g(t))}_subtract(t){return this.x-=t.x,this.y-=t.y,this}divideBy(t){return this.clone()._divideBy(t)}_divideBy(t){return this.x/=t,this.y/=t,this}multiplyBy(t){return this.clone()._multiplyBy(t)}_multiplyBy(t){return this.x*=t,this.y*=t,this}scaleBy(t){return new g(this.x*t.x,this.y*t.y)}unscaleBy(t){return new g(this.x/t.x,this.y/t.y)}round(){return this.clone()._round()}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}floor(){return this.clone()._floor()}_floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.clone()._ceil()}_ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}trunc(){return this.clone()._trunc()}_trunc(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}distanceTo(t){var e=(t=new g(t)).x-this.x,t=t.y-this.y;return Math.sqrt(e*e+t*t)}equals(t){return(t=new g(t)).x===this.x&&t.y===this.y}contains(t){return t=new g(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)}toString(){return`Point(${i(this.x)}, ${i(this.y)})`}}class u{constructor(t,e){if(t){if(t instanceof u)return t;var i;for(i of e?[t,e]:t)this.extend(i)}}extend(t){let e,i;if(t){if(t instanceof g||"number"==typeof t[0]||"x"in t)e=i=new g(t);else if(t=new u(t),e=t.min,i=t.max,!e||!i)return this;this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(i.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(i.y,this.max.y)):(this.min=e.clone(),this.max=i.clone())}return this}getCenter(t){return new g((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)}getBottomLeft(){return new g(this.min.x,this.max.y)}getTopRight(){return new g(this.max.x,this.min.y)}getTopLeft(){return this.min}getBottomRight(){return this.max}getSize(){return this.max.subtract(this.min)}contains(t){let e,i;return(t=new("number"==typeof t[0]||t instanceof g?g:u)(t))instanceof u?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y}intersects(t){t=new u(t);var e=this.min,i=this.max,s=t.min,t=t.max,o=t.x>=e.x&&s.x<=i.x,e=e.y<=t.y&&s.y<=i.y;return o&&e}overlaps(t){t=new u(t);var e=this.min,i=this.max,s=t.min,t=t.max,o=t.x>e.x&&s.x<i.x,e=e.y<t.y&&s.y<i.y;return o&&e}isValid(){return!(!this.min||!this.max)}pad(t){var e=this.min,i=this.max,s=Math.abs(e.x-i.x)*t,t=Math.abs(e.y-i.y)*t;return new u(new g(e.x-s,e.y-t),new g(i.x+s,i.y+t))}equals(t){return!!t&&(t=new u(t),this.min.equals(t.getTopLeft()))&&this.max.equals(t.getBottomRight())}}class f{constructor(t,e){if(t){if(t instanceof f)return t;var i;for(i of e?[t,e]:t)this.extend(i)}}extend(t){var e=this._southWest,i=this._northEast;let s,o;if(t instanceof w)s=t,o=t;else{if(!(t instanceof f))return t?w.validate(t)?this.extend(new w(t)):this.extend(new f(t)):this;if(s=t._southWest,o=t._northEast,!s||!o)return this}return e||i?(e.lat=Math.min(s.lat,e.lat),e.lng=Math.min(s.lng,e.lng),i.lat=Math.max(o.lat,i.lat),i.lng=Math.max(o.lng,i.lng)):(this._southWest=new w(s.lat,s.lng),this._northEast=new w(o.lat,o.lng)),this}pad(t){var e=this._southWest,i=this._northEast,s=Math.abs(e.lat-i.lat)*t,t=Math.abs(e.lng-i.lng)*t;return new f(new w(e.lat-s,e.lng-t),new w(i.lat+s,i.lng+t))}getCenter(){return new w((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)}getSouthWest(){return this._southWest}getNorthEast(){return this._northEast}getNorthWest(){return new w(this.getNorth(),this.getWest())}getSouthEast(){return new w(this.getSouth(),this.getEast())}getWest(){return this._southWest.lng}getSouth(){return this._southWest.lat}getEast(){return this._northEast.lng}getNorth(){return this._northEast.lat}contains(t){t=new(w.validate(t)?w:f)(t);var e=this._southWest,i=this._northEast;let s,o;return t instanceof f?(s=t.getSouthWest(),o=t.getNorthEast()):s=o=t,s.lat>=e.lat&&o.lat<=i.lat&&s.lng>=e.lng&&o.lng<=i.lng}intersects(t){t=new f(t);var e=this._southWest,i=this._northEast,s=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>=e.lat&&s.lat<=i.lat,t=t.lng>=e.lng&&s.lng<=i.lng;return o&&t}overlaps(t){t=new f(t);var e=this._southWest,i=this._northEast,s=t.getSouthWest(),t=t.getNorthEast(),o=t.lat>e.lat&&s.lat<i.lat,t=t.lng>e.lng&&s.lng<i.lng;return o&&t}toBBoxString(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")}equals(t,e){return!!t&&(t=new f(t),this._southWest.equals(t.getSouthWest(),e))&&this._northEast.equals(t.getNorthEast(),e)}isValid(){return!(!this._southWest||!this._northEast)}}class w{constructor(t,e,i){if(!w.validate(t,e,i))throw new Error(`Invalid LatLng object: (${t}, ${e})`);let s,o,n;if(t instanceof w)return t;Array.isArray(t)&&"object"!=typeof t[0]?3===t.length?(s=t[0],o=t[1],n=t[2]):2===t.length&&(s=t[0],o=t[1]):n="object"==typeof t&&"lat"in t?(s=t.lat,o="lng"in t?t.lng:t.lon,t.alt):(s=t,o=e,i),this.lat=+s,this.lng=+o,void 0!==n&&(this.alt=+n)}static validate(t,e,i){return t instanceof w||"object"==typeof t&&"lat"in t||(t&&Array.isArray(t)&&"object"!=typeof t[0]?3===t.length||2===t.length:!(!t&&0!==t||!e&&0!==e))}equals(t,e){return!!t&&(t=new w(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(e??1e-9))}toString(t){return`LatLng(${i(this.lat,t)}, ${i(this.lng,t)})`}distanceTo(t){return d.distance(this,new w(t))}wrap(){return d.wrapLatLng(this)}toBounds(t){var t=180*t/40075017,e=t/Math.cos(Math.PI/180*this.lat);return new f([this.lat-t,this.lng-e],[this.lat+t,this.lng+e])}clone(){var t=new w(0,0);return t.lat=this.lat,t.lng=this.lng,t.alt=this.alt,t}}class e{static projection=void 0;static transformation=void 0;static latLngToPoint(t,e){t=this.projection.project(t),e=this.scale(e);return this.transformation._transform(t,e)}static pointToLatLng(t,e){e=this.scale(e),t=this.transformation.untransform(t,e);return this.projection.unproject(t)}static project(t){return this.projection.project(t)}static unproject(t){return this.projection.unproject(t)}static scale(t){return 256*2**t}static zoom(t){return Math.log(t/256)/Math.LN2}static getProjectedBounds(t){var e,i;return this.infinite?null:(i=this.projection.bounds,t=this.scale(t),e=this.transformation.transform(i.min,t),i=this.transformation.transform(i.max,t),new u(e,i))}static infinite=!1;static wrapLatLng(t){t=new w(t);var e=this.wrapLng?D(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?D(t.lat,this.wrapLat,!0):t.lat,t=t.alt;return new w(i,e,t)}static wrapLatLngBounds(t){var e=(t=new f(t)).getCenter(),i=this.wrapLatLng(e),s=e.lat-i.lat,e=e.lng-i.lng;return 0==s&&0==e?t:(i=t.getSouthWest(),t=t.getNorthEast(),i=new w(i.lat-s,i.lng-e),s=new w(t.lat-s,t.lng-e),new f(i,s))}}class d extends e{static wrapLng=[-180,180];static R=6371e3;static distance(t,e){var i=Math.PI/180,s=t.lat*i,o=e.lat*i,n=Math.sin((e.lat-t.lat)*i/2),e=Math.sin((e.lng-t.lng)*i/2),t=n*n+Math.cos(s)*Math.cos(o)*e*e,i=2*Math.atan2(Math.sqrt(t),Math.sqrt(1-t));return this.R*i}}let U=6378137,V={R:U,MAX_LATITUDE:85.0511287798,project(t){t=new w(t);var e=Math.PI/180,i=this.MAX_LATITUDE,i=Math.max(Math.min(i,t.lat),-i),i=Math.sin(i*e);return new g(this.R*t.lng*e,this.R*Math.log((1+i)/(1-i))/2)},unproject(t){t=new g(t);var e=180/Math.PI;return new w((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(s=U*Math.PI,new u([-s,-s],[s,s]))};class G{constructor(t,e,i,s){Array.isArray(t)?(this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3]):(this._a=t,this._b=e,this._c=i,this._d=s)}transform(t,e){return this._transform(t.clone(),e)}_transform(t,e){return t.x=(e||=1)*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t}untransform(t,e){return e||=1,new g((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}}class K extends d{static code="EPSG:3857";static projection=V;static transformation=(s=.5/(Math.PI*V.R),new G(s,.5,-s,.5))}class Y extends K{static code="EPSG:900913"}var s=Q("chrome"),o=!s&&Q("safari"),$="undefined"!=typeof orientation||Q("mobile"),X="undefined"!=typeof window&&!!window.PointerEvent,J="undefined"!=typeof window&&("ontouchstart"in window||!!window.TouchEvent);function Q(t){return"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t)}var _={chrome:s,safari:o,mobile:$,pointer:X,touch:J||X,touchNative:J,retina:"undefined"!=typeof window&&void 0!==window.devicePixelRatio&&1<window.devicePixelRatio,mac:"undefined"!=typeof navigator&&void 0!==navigator.platform&&navigator.platform.startsWith("Mac"),linux:"undefined"!=typeof navigator&&void 0!==navigator.platform&&navigator.platform.startsWith("Linux")};let tt=200;function et(t,e){t.addEventListener("dblclick",e);let i=0,s;function o(t){var e;1!==t.detail?s=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(e=kt(t)).some(t=>t instanceof HTMLLabelElement&&t.attributes.for)&&!e.some(t=>t instanceof HTMLInputElement||t instanceof HTMLSelectElement)||((e=Date.now())-i<=tt?2===++s&&t.target.dispatchEvent((t=>{let e={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:2,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,button:t.button,buttons:t.buttons,relatedTarget:t.relatedTarget,region:t.region},i;return i=new(t instanceof PointerEvent?(e={...e,pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tangentialPressure:t.tangentialPressure,tiltX:t.tiltX,tiltY:t.tiltY,twist:t.twist,pointerType:t.pointerType,isPrimary:t.isPrimary},PointerEvent):MouseEvent)("dblclick",e)})(t)):s=1,i=e)}return t.addEventListener("click",o),{dblclick:e,simDblclick:o}}function it(t){return"string"==typeof t?document.getElementById(t):t}function a(t,e,i){t=document.createElement(t);return t.className=e??"",i?.appendChild(t),t}function st(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ot(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function p(t,e,i){e=e??new g(0,0);t.style.transform=`translate3d(${e.x}px,${e.y}px,0)`+(i?` scale(${i})`:"")}let nt=new WeakMap;function c(t,e){nt.set(t,e),p(t,e)}function m(t){return nt.get(t)??new g(0,0)}let at="undefined"==typeof document?{}:document.documentElement.style,rt=["userSelect","WebkitUserSelect"].find(t=>t in at),ht;function lt(){var t=at[rt];"none"!==t&&(ht=t,at[rt]="none")}function dt(){void 0!==ht&&(at[rt]=ht,ht=void 0)}function _t(){v(window,"dragstart",L)}function pt(){x(window,"dragstart",L)}let ct,ut;function mt(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(gt(),ct=t,ut=t.style.outlineStyle,t.style.outlineStyle="none",v(window,"keydown",gt))}function gt(){ct&&(ct.style.outlineStyle=ut,ct=void 0,ut=void 0,x(window,"keydown",gt))}function ft(t){for(;!((t=t.parentNode).offsetWidth&&t.offsetHeight||t===document.body););return t}function vt(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}let yt={__proto__:null,create:a,disableImageDrag:_t,disableTextSelection:lt,enableImageDrag:pt,enableTextSelection:dt,get:it,getPosition:m,getScale:vt,getSizedParentNode:ft,preventOutline:mt,restoreOutline:gt,setPosition:c,setTransform:p,toBack:ot,toFront:st},xt=new Map,wt=!1;function bt(){wt||(wt=!0,document.addEventListener("pointerdown",Lt,{capture:!0}),document.addEventListener("pointermove",Pt,{capture:!0}),document.addEventListener("pointerup",Tt,{capture:!0}),document.addEventListener("pointercancel",Tt,{capture:!0}),xt=new Map)}function Lt(t){xt.set(t.pointerId,t)}function Pt(t){xt.has(t.pointerId)&&xt.set(t.pointerId,t)}function Tt(t){xt.delete(t.pointerId)}function zt(){return[...xt.values()]}s={__proto__:null,cleanupPointers:function(){xt.clear()},disablePointerDetection:function(){document.removeEventListener("pointerdown",Lt,{capture:!0}),document.removeEventListener("pointermove",Pt,{capture:!0}),document.removeEventListener("pointerup",Tt,{capture:!0}),document.removeEventListener("pointercancel",Tt,{capture:!0}),wt=!1},enablePointerDetection:bt,getPointers:zt};function v(t,e,i,s){if(e&&"object"==typeof e)for(var[o,n]of Object.entries(e))Ot(t,o,n,i);else for(var a of h(e))Ot(t,a,i,s);return this}let y="_leaflet_events";function x(t,e,i,s){if(1===arguments.length)Mt(t),delete t[y];else if(e&&"object"==typeof e)for(var[o,n]of Object.entries(e))Ct(t,o,n,i);else if(e=h(e),2===arguments.length)Mt(t,t=>e.includes(t));else for(var a of e)Ct(t,a,i,s);return this}function Mt(t,e){for(var i of Object.keys(t[y]??{})){var s=i.split(/\d/)[0];e&&!e(s)||Ct(t,s,null,null,i)}}let Zt={pointerenter:"pointerover",pointerleave:"pointerout",wheel:"undefined"!=typeof window&&!("onwheel"in window)&&"mousewheel"};function Ot(i,s,o,n){var a=s+r(o)+(n?"_"+r(n):"");if(!i[y]||!i[y][a]){let t=function(t){return o.call(n||i,t||window.event)},e=t;_.touch&&"dblclick"===s?t=et(i,t):"addEventListener"in i?"wheel"===s||"mousewheel"===s?i.addEventListener(Zt[s]||s,t,{passive:!1}):"pointerenter"===s||"pointerleave"===s?(t=function(t){t??=window.event,Dt(i,t)&&e(t)},i.addEventListener(Zt[s],t,!1)):i.addEventListener(s,e,!1):i.attachEvent("on"+s,t),i[y]??={},i[y][a]=t}}function Ct(t,e,i,s,o){o??=e+r(i)+(s?"_"+r(s):"");var n,i=t[y]&&t[y][o];i&&(_.touch&&"dblclick"===e?(s=i,(n=t).removeEventListener("dblclick",s.dblclick),n.removeEventListener("click",s.simDblclick)):"removeEventListener"in t?t.removeEventListener(Zt[e]||e,i,!1):t.detachEvent("on"+e,i),t[y][o]=null)}function b(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function St(t){return Ot(t,"wheel",b),this}function At(t){return v(t,"pointerdown dblclick contextmenu",b),t._leaflet_disable_click=!0,this}function L(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Et(t){return L(t),b(t),this}function kt(t){return t.composedPath()}function Bt(t,e){var i,s;return e?(s=(i=vt(e)).boundingClientRect,new g((t.clientX-s.left)/i.x-e.clientLeft,(t.clientY-s.top)/i.y-e.clientTop)):new g(t.clientX,t.clientY)}function It(){var t=window.devicePixelRatio;return _.linux&&_.chrome?t:_.mac?3*t:0<t?2*t:1}function jt(t){return t.deltaY&&0===t.deltaMode?-t.deltaY/It():t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:(t.deltaX||t.deltaZ,0)}function Dt(t,e){let i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(t){return!1}return i!==t}var Rt={__proto__:null,PointerEvents:s,disableClickPropagation:At,disableScrollPropagation:St,getPointerPosition:Bt,getPropagationPath:kt,getWheelDelta:jt,getWheelPxFactor:It,isExternalTarget:Dt,off:x,on:v,preventDefault:L,stop:Et,stopPropagation:b};class Nt extends q{run(t,e,i,s){this.stop(),this._el=t,this._inProgress=!0,this._duration=i??.25,this._easeOutPower=1/Math.max(s??.5,.2),this._startPos=m(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()}stop(){this._inProgress&&(this._step(!0),this._complete())}_animate(){this._animId=requestAnimationFrame(this._animate.bind(this)),this._step()}_step(t){var e=+new Date-this._startTime,i=1e3*this._duration;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())}_runFrame(t,e){t=this._startPos.add(this._offset.multiplyBy(t));e&&t._round(),c(this._el,t),this.fire("step")}_complete(){cancelAnimationFrame(this._animId),this._inProgress=!1,this.fire("end")}_easeOut(t){return 1-(1-t)**this._easeOutPower}}o=class Map extends q{static{this.setDefaultOptions({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(t,e){e=l(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),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(new w(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=this.options.zoomAnimation,this._zoomAnimated&&this._createAnimProxy(),this._addLayers(this.options.layers)}setView(t,e,i){if((e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(new w(t),e,this.options.maxBounds),i??={},this._stop(),this._loaded&&!i.reset&&!0!==i)&&(void 0!==i.animate&&(i.zoom={animate:i.animate,...i.zoom},i.pan={animate:i.animate,duration:i.duration,...i.pan}),this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan)))return clearTimeout(this._sizeTimer),this;return this._resetView(t,e,i.pan?.noMoveStart),this}setZoom(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)}zoomIn(t,e){return t??=this.options.zoomDelta,this.setZoom(this._zoom+t,e)}zoomOut(t,e){return t??=this.options.zoomDelta,this.setZoom(this._zoom-t,e)}setZoomAround(t,e,i){var s=this.getZoomScale(e),o=this.getSize().divideBy(2),t=(t instanceof g?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/s),s=this.containerPointToLatLng(o.add(t));return this.setView(s,e,{zoom:i})}_getBoundsCenterZoom(t,e){e??={},t=t.getBounds?t.getBounds():new f(t);var i=new g(e.paddingTopLeft||e.padding||[0,0]),s=new g(e.paddingBottomRight||e.padding||[0,0]),o=this.getBoundsZoom(t,!1,i.add(s));return(o="number"==typeof e.maxZoom?Math.min(e.maxZoom,o):o)===1/0?{center:t.getCenter(),zoom:o}:(e=s.subtract(i).divideBy(2),s=this.project(t.getSouthWest(),o),i=this.project(t.getNorthEast(),o),{center:this.unproject(s.add(i).divideBy(2).add(e),o),zoom:o})}fitBounds(t,e){if((t=new f(t)).isValid())return t=this._getBoundsCenterZoom(t,e),this.setView(t.center,t.zoom,e);throw new Error("Bounds are not valid.")}fitWorld(t){return this.fitBounds([[-90,-180],[90,180]],t)}panTo(t,e){return this.setView(t,this._zoom,{pan:e})}panBy(t,e){var i;return e??={},(t=new g(t).round()).x||t.y?(!0===e.animate||this.getSize().contains(t)?(this._panAnim||(this._panAnim=new Nt,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate?(this._mapPane.classList.add("leaflet-pan-anim"),i=this._getMapPanePos().subtract(t).round(),this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)):(this._rawPanBy(t),this.fire("move").fire("moveend"))):this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this):this.fire("moveend")}flyTo(i,s,t){if(!1===(t??={}).animate)return this.setView(i,s,t);this._stop();let o=this.project(this.getCenter()),n=this.project(i),e=this.getSize(),a=this._zoom,r=(i=new w(i),s=void 0===s?a:this._limitZoom(s),Math.max(e.x,e.y)),h=r*this.getZoomScale(a,s),l=n.distanceTo(o)||1,d=1.42,_=d*d;function p(t){var e=t?-1:1,t=t?h:r,e=(h*h-r*r+e*_*_*l*l)/(2*t*_*l),t=Math.sqrt(e*e+1)-e;return t<1e-9?-18:Math.log(t)}function c(t){return(Math.exp(t)-Math.exp(-t))/2}function u(t){return(Math.exp(t)+Math.exp(-t))/2}let m=p(0);function g(t){return r*(u(m)*(c(t=m+d*t)/u(t))-c(m))/_}let f=Date.now(),v=(p(1)-m)/d,y=t.duration?1e3*t.duration:1e3*v*.8,x=()=>{var t=(Date.now()-f)/y,e=(1-(1-t)**1.5)*v;t<=1?(this._flyToFrame=requestAnimationFrame(x),this._move(this.unproject(o.add(n.subtract(o).multiplyBy(g(e)/l)),a),this.getScaleZoom(r/(t=e,r*(u(m)/u(m+d*t))),a),{flyTo:!0})):this._move(i,s)._moveEnd(!0)};return this._moveStart(!0,t.noMoveStart),x(),this}flyToBounds(t,e){t=this._getBoundsCenterZoom(t,e);return this.flyTo(t.center,t.zoom,e)}setMaxBounds(t){return t=new f(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(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(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(t,e){this._enforcingBounds=!0;var i=this.getCenter(),t=this._limitCenter(i,this._zoom,new f(t));return i.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this}panInside(t,e){e??={};var i=new g(e.paddingTopLeft||e.padding||[0,0]),s=new g(e.paddingBottomRight||e.padding||[0,0]),o=this.project(this.getCenter()),t=this.project(t),n=this.getPixelBounds(),i=new u([n.min.add(i),n.max.subtract(s)]),n=i.getSize();return i.contains(t)||(this._enforcingBounds=!0,s=t.subtract(i.getCenter()),i=i.extend(t).getSize().subtract(n),o.x+=s.x<0?-i.x:i.x,o.y+=s.y<0?-i.y:i.y,this.panTo(this.unproject(o),e),this._enforcingBounds=!1),this}invalidateSize(t){if(!this._loaded)return this;t={animate:!1,pan:!0,...!0===t?{animate:!0}:t};var e=this.getSize(),i=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),s=e.divideBy(2).round(),o=i.divideBy(2).round(),s=s.subtract(o);return s.x||s.y?(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(this.fire.bind(this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this}stop(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()}locate(t){var e,i;return t=this._locateOptions={timeout:1e4,watch:!1,...t},"geolocation"in navigator?(e=this._handleGeolocationResponse.bind(this),i=this._handleGeolocationError.bind(this),t.watch?(void 0!==this._locationWatchId&&navigator.geolocation.clearWatch(this._locationWatchId),this._locationWatchId=navigator.geolocation.watchPosition(e,i,t)):navigator.geolocation.getCurrentPosition(e,i,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this}stopLocate(){return navigator.geolocation?.clearWatch?.(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this}_handleGeolocationError(t){var e;this._container._leaflet_id&&(e=t.code,t=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: ${t}.`}))}_handleGeolocationResponse(t){if(this._container._leaflet_id){var e,i,s=t.coords.latitude,o=t.coords.longitude,s=new w(s,o),o=s.toBounds(2*t.coords.accuracy),n=this._locateOptions,a=(n.setView&&(e=this.getBoundsZoom(o),this.setView(s,n.maxZoom?Math.min(e,n.maxZoom):e)),{latlng:s,bounds:o,timestamp:t.timestamp});for(i in t.coords)"number"==typeof t.coords[i]&&(a[i]=t.coords[i]);this.fire("locationfound",a)}}addHandler(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t])&&e.enable(),this}remove(){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");delete this._container._leaflet_id,delete this._containerId,void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),this._mapPane.remove(),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(cancelAnimationFrame(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),clearTimeout(this._transitionEndTimer),clearTimeout(this._sizeTimer),this._loaded&&this.fire("unload"),this._destroyAnimProxy();for(var t of Object.values(this._layers))t.remove();for(var e of Object.values(this._panes))e.remove();return this._layers={},this._panes={},delete this._mapPane,delete this._renderer,this}createPane(t,e){e=a("div","leaflet-pane"+(t?` leaflet-${t.replace("Pane","")}-pane`:""),e||this._mapPane);return t&&(this._panes[t]=e),e}getCenter(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())}getZoom(){return this._zoom}getBounds(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),t=this.unproject(t.getTopRight());return new f(e,t)}getMinZoom(){return this.options.minZoom??this._layersMinZoom??0}getMaxZoom(){return this.options.maxZoom??this._layersMaxZoom??1/0}getBoundsZoom(t,e,i){t=new f(t),i=new g(i??[0,0]);let s=this.getZoom()??0;var o=this.getMinZoom(),n=this.getMaxZoom(),a=t.getNorthWest(),t=t.getSouthEast(),i=this.getSize().subtract(i),t=new u(this.project(t,s),this.project(a,s)).getSize(),a=this.options.zoomSnap,r=i.x/t.x,i=i.y/t.y,t=e?Math.max(r,i):Math.min(r,i);return s=this.getScaleZoom(t,s),a&&(s=Math.round(s/(a/100))*(a/100),s=e?Math.ceil(s/a)*a:Math.floor(s/a)*a),Math.max(o,Math.min(n,s))}getSize(){return this._size&&!this._sizeChanged||(this._size=new g(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()}getPixelBounds(t,e){t=this._getTopLeftPoint(t,e);return new u(t,t.add(this.getSize()))}getPixelOrigin(){return this._checkIfLoaded(),this._pixelOrigin}getPixelWorldBounds(t){return this.options.crs.getProjectedBounds(t??this.getZoom())}getPane(t){return"string"==typeof t?this._panes[t]:t}getPanes(){return this._panes}getContainer(){return this._container}getZoomScale(t,e){var i=this.options.crs;return e??=this._zoom,i.scale(t)/i.scale(e)}getScaleZoom(t,e){var i=this.options.crs,t=(e??=this._zoom,i.zoom(t*i.scale(e)));return isNaN(t)?1/0:t}project(t,e){return e??=this._zoom,this.options.crs.latLngToPoint(new w(t),e)}unproject(t,e){return e??=this._zoom,this.options.crs.pointToLatLng(new g(t),e)}layerPointToLatLng(t){t=new g(t).add(this.getPixelOrigin());return this.unproject(t)}latLngToLayerPoint(t){return this.project(new w(t))._round()._subtract(this.getPixelOrigin())}wrapLatLng(t){return this.options.crs.wrapLatLng(new w(t))}wrapLatLngBounds(t){return this.options.crs.wrapLatLngBounds(new f(t))}distance(t,e){return this.options.crs.distance(new w(t),new w(e))}containerPointToLayerPoint(t){return new g(t).subtract(this._getMapPanePos())}layerPointToContainerPoint(t){return new g(t).add(this._getMapPanePos())}containerPointToLatLng(t){t=this.containerPointToLayerPoint(new g(t));return this.layerPointToLatLng(t)}latLngToContainerPoint(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(new w(t)))}pointerEventToContainerPoint(t){return Bt(t,this._container)}pointerEventToLayerPoint(t){return this.containerPointToLayerPoint(this.pointerEventToContainerPoint(t))}pointerEventToLatLng(t){return this.layerPointToLatLng(this.pointerEventToLayerPoint(t))}_initContainer(t){t=this._container=it(t);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");v(t,"scroll",this._onScroll,this),this._containerId=r(t),bt()}_initLayout(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation,["leaflet-container","leaflet-touch"]),e=(_.retina&&e.push("leaflet-retina"),_.safari&&e.push("leaflet-safari"),this._fadeAnimated&&e.push("leaflet-fade-anim"),t.classList.add(...e),getComputedStyle(t)).position;"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()}_initPanes(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),c(this._mapPane,new g(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(t.markerPane.classList.add("leaflet-zoom-hide"),t.shadowPane.classList.add("leaflet-zoom-hide"))}_resetView(t,e,i){c(this._mapPane,new g(0,0));var s=!this._loaded,o=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(o,i)._move(t,e)._moveEnd(o),this.fire("viewreset"),s&&this.fire("load")}_moveStart(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this}_move(t,e,i,s){void 0===e&&(e=this._zoom);var o=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),s?i?.pinch&&this.fire("zoom",i):((o||i?.pinch)&&this.fire("zoom",i),this.fire("move",i)),this}_moveEnd(t){return t&&this.fire("zoomend"),this.fire("moveend")}_stop(){return cancelAnimationFrame(this._flyToFrame),this._panAnim?.stop(),this}_rawPanBy(t){c(this._mapPane,this._getMapPanePos().subtract(t))}_getZoomSpan(){return this.getMaxZoom()-this.getMinZoom()}_panInsideMaxBounds(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)}_checkIfLoaded(){if(!this._loaded)throw new Error("Set map center and zoom first.")}_initEvents(t){this._targets={},(t?x:v)((this._targets[r(this._container)]=this)._container,"click dblclick pointerdown pointerup pointerover pointerout pointermove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&(t?this._resizeObserver.disconnect():(this._resizeObserver||(this._resizeObserver=new ResizeObserver(this._onResize.bind(this))),this._resizeObserver.observe(this._container))),this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)}_onResize(){cancelAnimationFrame(this._resizeRequest),this._resizeRequest=requestAnimationFrame(()=>{this.invalidateSize({debounceMoveend:!0})})}_onScroll(){this._container.scrollTop=0,this._container.scrollLeft=0}_onMoveEnd(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())}_findEventTargets(t,e){let i=[],s,o=t.target||t.srcElement,n=!1;for(var a="pointerout"===e||"pointerover"===e;o;){if((s=this._targets[r(o)])&&("click"===e||"preclick"===e)&&this._draggableMoved(s)){n=!0;break}if(s&&s.listens(e,!0)){if(a&&!Dt(o,t))break;if(i.push(s),a)break}if(o===this._container)break;o=o.parentNode}return i=i.length||n||a||!this.listens(e,!0)?i:[this]}_isClickDisabled(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click||!t.parentNode)return!0;t=t.parentNode}}_handleDOMEvent(t){var e,i=t.target??t.srcElement;!this._loaded||i._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(i)||("pointerdown"===(e=t.type)&&mt(i),this._fireDOMEvent(t,e))}static _pointerEvents=["click","dblclick","pointerover","pointerout","contextmenu"];_fireDOMEvent(t,e,i){"click"===e&&this._fireDOMEvent(t,"preclick",i);let s=this._findEventTargets(t,e);if(i&&(i=i.filter(t=>t.listens(e,!0)),s=i.concat(s)),s.length){"contextmenu"===e&&L(t);var o,n,i=s[0],a={originalEvent:t};"keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type&&(o=i.getLatLng&&(!i._radius||i._radius<=10),a.containerPoint=o?this.latLngToContainerPoint(i.getLatLng()):this.pointerEventToContainerPoint(t),a.layerPoint=this.containerPointToLayerPoint(a.containerPoint),a.latlng=o?i.getLatLng():this.layerPointToLatLng(a.layerPoint));for(n of s)if(n.fire(e,a,!0),a.originalEvent._stopped||!1===n.options.bubblingPointerEvents&&Map._pointerEvents.includes(e))return}}_draggableMoved(t){return(t=t.dragging?.enabled()?t:this).dragging?.moved()||this.boxZoom?.moved()}_clearHandlers(){for(var t of this._handlers)t.disable()}whenReady(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this}_getMapPanePos(){return m(this._mapPane)}_moved(){var t=this._getMapPanePos();return t&&!t.equals([0,0])}_getTopLeftPoint(t,e){return(t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())}_getNewPixelOrigin(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()}_latLngToNewLayerPoint(t,e,i){i=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(i)}_latLngBoundsToNewLayerBounds(t,e,i){i=this._getNewPixelOrigin(i,e);return new u([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(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))}_getCenterOffset(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())}_limitCenter(t,e,i){var s,o;return!i||(s=this.project(t,e),o=this.getSize().divideBy(2),o=new u(s.subtract(o),s.add(o)),o=this._getBoundsOffset(o,i,e),Math.abs(o.x)<=1&&Math.abs(o.y)<=1)?t:this.unproject(s.add(o),e)}_limitOffset(t,e){var i;return e?(i=this.getPixelBounds(),i=new u(i.min.add(t),i.max.add(t)),t.add(this._getBoundsOffset(i,e))):t}_getBoundsOffset(t,e,i){e=new u(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),i=e.min.subtract(t.min),e=e.max.subtract(t.max),t=this._rebound(i.x,-e.x),i=this._rebound(i.y,-e.y);return new g(t,i)}_rebound(t,e){return 0<t+e?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))}_limitZoom(t){var e=this.getMinZoom(),i=this.getMaxZoom(),s=this.options.zoomSnap;return s&&(t=Math.round(t/s)*s),Math.max(e,Math.min(i,t))}_onPanTransitionStep(){this.fire("move")}_onPanTransitionEnd(){this._mapPane.classList.remove("leaflet-pan-anim"),this.fire("moveend")}_tryAnimatedPan(t,e){t=this._getCenterOffset(t)._trunc();return!(!0!==e?.animate&&!this.getSize().contains(t)||(this.panBy(t,e),0))}_createAnimProxy(){this._proxy=a("div","leaflet-proxy leaflet-zoom-animated"),this._panes.mapPane.appendChild(this._proxy),this.on("zoomanim",this._animateProxyZoom,this),this.on("load moveend",this._animMoveEnd,this),v(this._proxy,"transitionend",this._catchTransitionEnd,this)}_animateProxyZoom(t){var e=this._proxy.style.transform;p(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),e===this._proxy.style.transform&&this._animatingZoom&&this._onZoomTransitionEnd()}_animMoveEnd(){var t=this.getCenter(),e=this.getZoom();p(this._proxy,this.project(t,e),this.getZoomScale(e,1))}_destroyAnimProxy(){this._proxy&&(x(this._proxy,"transitionend",this._catchTransitionEnd,this),this._proxy.remove(),this.off("zoomanim",this._animateProxyZoom,this),this.off("load moveend",this._animMoveEnd,this),delete this._proxy)}_catchTransitionEnd(t){this._animatingZoom&&t.propertyName.includes("transform")&&this._onZoomTransitionEnd()}_nothingToAnimate(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length}_tryAnimatedZoom(t,e,i){if(!this._animatingZoom){if(i??={},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var s=this.getZoomScale(e),s=this._getCenterOffset(t)._divideBy(1-1/s);if(!0!==i.animate&&!this.getSize().contains(s))return!1;requestAnimationFrame(()=>{this._moveStart(!0,i.noMoveStart??!1)._animateZoom(t,e,!0)})}return!0}_animateZoom(t,e,i,s){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,this._mapPane.classList.add("leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:s}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._transitionEndTimer=setTimeout(this._onZoomTransitionEnd.bind(this),250))}_onZoomTransitionEnd(){this._animatingZoom&&(this._mapPane?.classList.remove("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))}},$=o;class P extends H{static{this.setDefaultOptions({position:"topright"})}initialize(t){l(this,t)}getPosition(){return this.options.position}setPosition(t){var e=this._map;return e?.removeControl(this),this.options.position=t,e?.addControl(this),this}getContainer(){return this._container}addTo(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),t=t._controlCorners[i];return e.classList.add("leaflet-control"),i.includes("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this}remove(){return this._map&&(this._container.remove(),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this}_refocusOnMap(t){this._map&&t&&(0!==t.screenX||0!==t.screenY)&&this._map.getContainer().focus()}}o.include({addControl(t){return t.addTo(this),this},removeControl(t){return t.remove(),this},_initControlPos(){let s=this._controlCorners={},o="leaflet-",n=this._controlContainer=a("div",o+"control-container",this._container);function t(t,e){var i=o+t+" "+o+e;s[t+e]=a("div",i,n)}t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos(){for(var t of Object.values(this._controlCorners))t.remove();this._controlContainer.remove(),delete this._controlCorners,delete this._controlContainer}});class Ft extends P{static{this.setDefaultOptions({collapsed:!0,collapseDelay:0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction(t,e,i,s){return i<s?-1:s<i?1:0}})}initialize(t,e,i){l(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var[s,o]of Object.entries(t??{}))this._addLayer(o,s);for(var[n,a]of Object.entries(e??{}))this._addLayer(a,n,!0)}onAdd(t){this._initLayout(),this._update(),(this._map=t).on("zoomend",this._checkDisabledLayers,this);for(var e of this._layers)e.layer.on("add remove",this._onLayerChange,this);return this.options.collapsed||t.on("resize",this._expandIfNotCollapsed,this),this._container}addTo(t){return P.prototype.addTo.call(this,t),this._expandIfNotCollapsed()}onRemove(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t of this._layers)t.layer.off("add remove",this._onLayerChange,this);this._map.off("resize",this._expandIfNotCollapsed,this)}addBaseLayer(t,e){return this._addLayer(t,e),this._map?this._update():this}addOverlay(t,e){return this._addLayer(t,e,!0),this._map?this._update():this}removeLayer(t){t.off("add remove",this._onLayerChange,this);t=this._getLayer(r(t));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this}expand(){clearTimeout(this._collapseDelayTimeout),this._container.classList.add("leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(this._section.classList.add("leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):this._section.classList.remove("leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this}collapse(t){if(!t||"pointerleave"!==t.type&&"pointerout"!==t.type||"touch"!==t.pointerType){if(0<this.options.collapseDelay)return this._collapseDelayTimeout=setTimeout(()=>{this._container.classList.remove("leaflet-control-layers-expanded")},this.options.collapseDelay),this;this._container.classList.remove("leaflet-control-layers-expanded")}return this}_initLayout(){var t="leaflet-control-layers",e=this._container=a("div",t),i=this.options.collapsed,s=(At(e),St(e),this._section=a("fieldset",t+"-list")),o=(i&&(this._map.on("click",this.collapse,this),v(e,{pointerenter:this._expandSafely,pointerleave:this.collapse},this)),this._layersLink=a("a",t+"-toggle",e));o.href="#",o.title="Layers",o.setAttribute("role","button"),v(o,{keydown(t){"Enter"===t.code&&this._expandSafely()},click(t){L(t),this._expandSafely()}},this),i||this.expand(),this._baseLayersList=a("div",t+"-base",s),this._separator=a("div",t+"-separator",s),this._overlaysList=a("div",t+"-overlays",s),e.appendChild(s)}_getLayer(t){for(var e of this._layers)if(e&&r(e.layer)===t)return e}_addLayer(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort((t,e)=>this.options.sortFunction(t.layer,e.layer,t.name,e.name)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()}_update(){if(this._container){this._baseLayersList.replaceChildren(),this._overlaysList.replaceChildren(),this._layerControlInputs=[];let t,e,i=0;for(var s of this._layers)this._addItem(s),e||=s.overlay,t||=!s.overlay,i+=s.overlay?0:1;this.options.hideSingleBase&&(t=t&&1<i,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none"}return this}_onLayerChange(t){this._handlingClick||this._update();var e=this._getLayer(r(t.target)),t=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;t&&this._map.fire(t,e)}_addItem(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),s=document.createElement("input"),i=(s.type=t.overlay?"checkbox":"radio",s.className="leaflet-control-layers-selector",s.defaultChecked=i,t.overlay||(s.name="leaflet-base-layers_"+r(this)),this._layerControlInputs.push(s),s.layerId=r(t.layer),v(s,"click",this._onInputClick,this),document.createElement("span")),o=(i.innerHTML=" "+t.name,document.createElement("span"));return e.appendChild(o),o.appendChild(s),o.appendChild(i),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e}_onInputClick(t){if(!this._preventClick){var e,i,s,o=this._layerControlInputs,n=[],a=[];this._handlingClick=!0;for(e of o){var r=this._getLayer(e.layerId).layer;(e.checked?n:(e.checked,a)).push(r)}for(i of a)this._map.hasLayer(i)&&this._map.removeLayer(i);for(s of n)this._map.hasLayer(s)||this._map.addLayer(s);this._handlingClick=!1,this._refocusOnMap(t)}}_checkDisabledLayers(){var t,e=this._layerControlInputs,i=this._map.getZoom();for(t of e){var s=this._getLayer(t.layerId).layer;t.disabled=void 0!==s.options.minZoom&&i<s.options.minZoom||void 0!==s.options.maxZoom&&i>s.options.maxZoom}}_expandIfNotCollapsed(){return this._map&&!this.options.collapsed&&this.expand(),this}_expandSafely(){let t=this._section;this._preventClick=!0,v(t,"click",L),this.expand(),setTimeout(()=>{x(t,"click",L),this._preventClick=!1})}}class Wt extends P{static{this.setDefaultOptions({position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"})}onAdd(t){var e="leaflet-control-zoom",i=a("div",e+" leaflet-bar"),s=this.options;return this._zoomInButton=this._createButton(s.zoomInText,s.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(s.zoomOutText,s.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i}onRemove(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)}disable(){return this._disabled=!0,this._updateDisabled(),this}enable(){return this._disabled=!1,this._updateDisabled(),this}_zoomIn(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))}_zoomOut(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))}_createButton(t,e,i,s,o){i=a("a",i,s);return i.innerHTML=t,i.href="#",i.title=e,i.setAttribute("role","button"),i.setAttribute("aria-label",e),At(i),v(i,"click",Et),v(i,"click",o,this),v(i,"click",this._refocusOnMap,this),i}_updateDisabled(){var t=this._map,e="leaflet-disabled";this._zoomInButton.classList.remove(e),this._zoomOutButton.classList.remove(e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(this._zoomOutButton.classList.add(e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(this._zoomInButton.classList.add(e),this._zoomInButton.setAttribute("aria-disabled","true"))}}o.mergeOptions({zoomControl:!0}),o.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Wt,this.addControl(this.zoomControl))});class Ht extends P{static{this.setDefaultOptions({position:"bottomleft",maxWidth:100,metric:!0,imperial:!0,updateWhenIdle:!1})}onAdd(t){var e="leaflet-control-scale",i=a("div",e),s=this.options;return this._addScales(s,e+"-line",i),t.on(s.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i}onRemove(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)}_addScales(t,e,i){t.metric&&(this._mScale=a("div",e,i)),t.imperial&&(this._iScale=a("div",e,i))}_update(){var t=this._map,e=t.getSize().y/2,t=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(t)}_updateScales(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)}_updateMetric(t){var e=this