@metoceanapi/wxtiles-leaflet 2.4.0-1 → 2.4.1-2

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +214 -92
  3. package/dist/es/index.d.ts +12 -16
  4. package/dist/es/index.js +4 -4
  5. package/dist/es/wxAPI/WxAPI.d.ts +17 -0
  6. package/dist/es/wxAPI/WxDataSetManager.d.ts +14 -4
  7. package/dist/es/wxsource/wxsource.d.ts +23 -19
  8. package/dist/es/wxsource/wxsourcetypes.d.ts +22 -10
  9. package/dist/web/index.js +4 -4
  10. package/docs/docs/assets/highlight.css +12 -19
  11. package/docs/docs/assets/search.js +1 -1
  12. package/docs/docs/classes/WxAPI.html +31 -18
  13. package/docs/docs/classes/WxAPIControl.html +70 -24
  14. package/docs/docs/classes/WxDataSetManager.html +22 -21
  15. package/docs/docs/classes/WxInfoControl.html +37 -10
  16. package/docs/docs/classes/WxLegendControl.html +33 -11
  17. package/docs/docs/classes/WxStyleEditorControl.html +206 -94
  18. package/docs/docs/classes/WxTileSource.html +40 -40
  19. package/docs/docs/classes/WxTimeControl.html +58 -20
  20. package/docs/docs/index.html +188 -101
  21. package/docs/docs/interfaces/FrameworkOptions.html +3 -3
  22. package/docs/docs/interfaces/WxSourceLayerOptions.html +5 -5
  23. package/docs/docs/modules.html +12 -130
  24. package/docs/docs/types/Loader.html +3 -59
  25. package/docs/docs/types/Painter.html +3 -59
  26. package/docs/docs/types/WxLayer.html +3 -59
  27. package/docs/docs/variables/WxLayerBaseImplementation.html +3 -59
  28. package/docs/script/script.css +1 -1
  29. package/docs/script/script.js +6 -6
  30. package/package.json +3 -3
  31. package/src_example/frwrkdeps.ts +131 -80
  32. package/src_example/index.ts +2 -53
  33. package/src_example/start.ts +143 -300
  34. package/dep.dot +0 -33
  35. package/dep.svg +0 -233
  36. package/docs/docs/classes/DataIntegral.html +0 -154
  37. package/docs/docs/classes/QTree.html +0 -185
  38. package/docs/docs/classes/RawCLUT.html +0 -143
  39. package/docs/docs/classes/TilesCache.html +0 -108
  40. package/docs/docs/enums/TileType.html +0 -80
  41. package/docs/docs/functions/WXLOG.html +0 -127
  42. package/docs/docs/functions/WxCreateLegend.html +0 -135
  43. package/docs/docs/functions/WxGetColorSchemes.html +0 -122
  44. package/docs/docs/functions/WxGetColorStyles.html +0 -122
  45. package/docs/docs/functions/WxTilesLogging.html +0 -130
  46. package/docs/docs/interfaces/CachedUriLoaderPromiseFunc.html +0 -108
  47. package/docs/docs/interfaces/ColorStylesIncomplete.html +0 -125
  48. package/docs/docs/interfaces/Converter.html +0 -81
  49. package/docs/docs/interfaces/DataPicture.html +0 -95
  50. package/docs/docs/interfaces/IntegralPare.html +0 -81
  51. package/docs/docs/interfaces/SLinePoint.html +0 -77
  52. package/docs/docs/interfaces/Tree.html +0 -74
  53. package/docs/docs/interfaces/WxAPIOptions.html +0 -173
  54. package/docs/docs/interfaces/WxAllBoundariesMeta.html +0 -90
  55. package/docs/docs/interfaces/WxAllDatasetsShortMetas.html +0 -125
  56. package/docs/docs/interfaces/WxBoundaryMeta.html +0 -99
  57. package/docs/docs/interfaces/WxColorSchemes.html +0 -126
  58. package/docs/docs/interfaces/WxColorStyleStrict.html +0 -359
  59. package/docs/docs/interfaces/WxColorStyleWeak.html +0 -388
  60. package/docs/docs/interfaces/WxColorStylesStrict.html +0 -74
  61. package/docs/docs/interfaces/WxColorStylesWeakMixed.html +0 -125
  62. package/docs/docs/interfaces/WxData.html +0 -85
  63. package/docs/docs/interfaces/WxDataSetManagerOptions.html +0 -117
  64. package/docs/docs/interfaces/WxDatasetMeta.html +0 -144
  65. package/docs/docs/interfaces/WxDatasetShortMeta.html +0 -91
  66. package/docs/docs/interfaces/WxLayerAPI.html +0 -375
  67. package/docs/docs/interfaces/WxLayerBaseAPI.html +0 -242
  68. package/docs/docs/interfaces/WxLayerOptions.html +0 -113
  69. package/docs/docs/interfaces/WxLegend.html +0 -118
  70. package/docs/docs/interfaces/WxLngLat.html +0 -81
  71. package/docs/docs/interfaces/WxRasterData.html +0 -118
  72. package/docs/docs/interfaces/WxRequestInit.html +0 -70
  73. package/docs/docs/interfaces/WxTick.html +0 -100
  74. package/docs/docs/interfaces/WxTileInfo.html +0 -142
  75. package/docs/docs/interfaces/WxUnits.html +0 -125
  76. package/docs/docs/interfaces/WxVariableMeta.html +0 -109
  77. package/docs/docs/interfaces/WxVariablesMetas.html +0 -125
  78. package/docs/docs/interfaces/XYZ.html +0 -84
  79. package/docs/docs/types/DataIntegrals.html +0 -118
  80. package/docs/docs/types/DataPictures.html +0 -118
  81. package/docs/docs/types/ListenerMethod.html +0 -134
  82. package/docs/docs/types/SLine.html +0 -118
  83. package/docs/docs/types/SubTrees.html +0 -118
  84. package/docs/docs/types/SubTreesN.html +0 -118
  85. package/docs/docs/types/TreeN.html +0 -118
  86. package/docs/docs/types/WxDate.html +0 -125
  87. package/docs/docs/types/WxEventType.html +0 -121
  88. package/docs/docs/types/WxInstances.html +0 -118
  89. package/docs/docs/types/WxLayerVarsNames.html +0 -118
  90. package/docs/docs/types/WxURIs.html +0 -118
  91. package/docs/docs/types/WxUnitTuple.html +0 -118
@@ -1,18 +1,18 @@
1
- (()=>{var ua=Object.create;var mo=Object.defineProperty;var ca=Object.getOwnPropertyDescriptor;var da=Object.getOwnPropertyNames;var fa=Object.getPrototypeOf,ma=Object.prototype.hasOwnProperty;var pa=(s,o)=>()=>(o||s((o={exports:{}}).exports,o),o.exports);var _a=(s,o,a,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of da(o))!ma.call(s,u)&&u!==a&&mo(s,u,{get:()=>o[u],enumerable:!(l=ca(o,u))||l.enumerable});return s};var po=(s,o,a)=>(a=s!=null?ua(fa(s)):{},_a(o||!s||!s.__esModule?mo(a,"default",{value:s,enumerable:!0}):a,s));var Ki=pa((ii,To)=>{(function(s,o){typeof ii=="object"&&typeof To<"u"?o(ii):typeof define=="function"&&define.amd?define(["exports"],o):(s=typeof globalThis<"u"?globalThis:s||self,o(s.leaflet={}))})(ii,function(s){"use strict";var o="1.9.3";function a(t){var e,i,n,r;for(i=1,n=arguments.length;i<n;i++){r=arguments[i];for(e in r)t[e]=r[e]}return t}var l=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function u(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var c=0;function f(t){return"_leaflet_id"in t||(t._leaflet_id=++c),t._leaflet_id}function m(t,e,i){var n,r,h,d;return d=function(){n=!1,r&&(h.apply(i,r),r=!1)},h=function(){n?r=arguments:(t.apply(i,arguments),setTimeout(d,e),n=!0)},h}function y(t,e,i){var n=e[1],r=e[0],h=n-r;return t===n&&i?t:((t-r)%h+h)%h+r}function _(){return!1}function g(t,e){if(e===!1)return t;var i=Math.pow(10,e===void 0?6:e);return Math.round(t*i)/i}function x(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function T(t){return x(t).split(/\s+/)}function b(t,e){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?l(t.options):{});for(var i in e)t.options[i]=e[i];return t.options}function M(t,e,i){var n=[];for(var r in t)n.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(t[r]));return(!e||e.indexOf("?")===-1?"?":"&")+n.join("&")}var C=/\{ *([\w_ -]+) *\}/g;function S(t,e){return t.replace(C,function(i,n){var r=e[n];if(r===void 0)throw new Error("No value provided for variable "+i);return typeof r=="function"&&(r=r(e)),r})}var W=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function O(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var E="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Z(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var V=0;function F(t){var e=+new Date,i=Math.max(0,16-(e-V));return V=e+i,window.setTimeout(t,i)}var H=window.requestAnimationFrame||Z("RequestAnimationFrame")||F,it=window.cancelAnimationFrame||Z("CancelAnimationFrame")||Z("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function q(t,e,i){if(i&&H===F)t.call(e);else return H.call(window,u(t,e))}function G(t){t&&it.call(window,t)}var Me={__proto__:null,extend:a,create:l,bind:u,get lastId(){return c},stamp:f,throttle:m,wrapNum:y,falseFn:_,formatNum:g,trim:x,splitWords:T,setOptions:b,getParamString:M,template:S,isArray:W,indexOf:O,emptyImageUrl:E,requestFn:H,cancelFn:it,requestAnimFrame:q,cancelAnimFrame:G};function pt(){}pt.extend=function(t){var e=function(){b(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,n=l(i);n.constructor=e,e.prototype=n;for(var r in this)Object.prototype.hasOwnProperty.call(this,r)&&r!=="prototype"&&r!=="__super__"&&(e[r]=this[r]);return t.statics&&a(e,t.statics),t.includes&&(ht(t.includes),a.apply(null,[n].concat(t.includes))),a(n,t),delete n.statics,delete n.includes,n.options&&(n.options=i.options?l(i.options):{},a(n.options,t.options)),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var h=0,d=n._initHooks.length;h<d;h++)n._initHooks[h].call(this)}},e},pt.include=function(t){var e=this.prototype.options;return a(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},pt.mergeOptions=function(t){return a(this.prototype.options,t),this},pt.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i=typeof t=="function"?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};function ht(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=W(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)}}var rt={on:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e);else{t=T(t);for(var r=0,h=t.length;r<h;r++)this._on(t[r],e,i)}return this},off:function(t,e,i){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var n in t)this._off(n,t[n],e);else{t=T(t);for(var r=arguments.length===1,h=0,d=t.length;h<d;h++)r?this._off(t[h]):this._off(t[h],e,i)}return this},_on:function(t,e,i,n){if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}if(this._listens(t,e,i)===!1){i===this&&(i=void 0);var r={fn:e,ctx:i};n&&(r.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(r)}},_off:function(t,e,i){var n,r,h;if(this._events&&(n=this._events[t],!!n)){if(arguments.length===1){if(this._firingCount)for(r=0,h=n.length;r<h;r++)n[r].fn=_;delete this._events[t];return}if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}var d=this._listens(t,e,i);if(d!==!1){var p=n[d];this._firingCount&&(p.fn=_,this._events[t]=n=n.slice()),n.splice(d,1)}}},fire:function(t,e,i){if(!this.listens(t,i))return this;var n=a({},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 h=0,d=r.length;h<d;h++){var p=r[h],v=p.fn;p.once&&this.off(t,v,p.ctx),v.call(p.ctx||this,n)}this._firingCount--}}return i&&this._propagateEvent(n),this},listens:function(t,e,i,n){typeof t!="string"&&console.warn('"string" type argument expected');var r=e;typeof e!="function"&&(n=!!e,r=void 0,i=void 0);var h=this._events&&this._events[t];if(h&&h.length&&this._listens(t,r,i)!==!1)return!0;if(n){for(var d in this._eventParents)if(this._eventParents[d].listens(t,e,i,n))return!0}return!1},_listens:function(t,e,i){if(!this._events)return!1;var n=this._events[t]||[];if(!e)return!!n.length;i===this&&(i=void 0);for(var r=0,h=n.length;r<h;r++)if(n[r].fn===e&&n[r].ctx===i)return r;return!1},once:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e,!0);else{t=T(t);for(var r=0,h=t.length;r<h;r++)this._on(t[r],e,i,!0)}return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[f(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[f(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,a({layer:t.target,propagatedFrom:t.target},t),!0)}};rt.addEventListener=rt.on,rt.removeEventListener=rt.clearAllEventListeners=rt.off,rt.addOneTimeEventListener=rt.once,rt.fireEvent=rt.fire,rt.hasEventListeners=rt.listens;var It=pt.extend(rt);function A(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var Se=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};A.prototype={clone:function(){return new A(this.x,this.y)},add:function(t){return this.clone()._add(B(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(B(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 A(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new A(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=Se(this.x),this.y=Se(this.y),this},distanceTo:function(t){t=B(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=B(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=B(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+g(this.x)+", "+g(this.y)+")"}};function B(t,e,i){return t instanceof A?t:W(t)?new A(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new A(t.x,t.y):new A(t,e,i)}function K(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n<r;n++)this.extend(i[n])}K.prototype={extend:function(t){var e,i;if(!t)return this;if(t instanceof A||typeof t[0]=="number"||"x"in t)e=i=B(t);else if(t=at(t),e=t.min,i=t.max,!e||!i)return this;return!this.min&&!this.max?(this.min=e.clone(),this.max=i.clone()):(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},getCenter:function(t){return B((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return B(this.min.x,this.max.y)},getTopRight:function(){return B(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,i;return typeof t[0]=="number"||t instanceof A?t=B(t):t=at(t),t instanceof K?(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:function(t){t=at(t);var e=this.min,i=this.max,n=t.min,r=t.max,h=r.x>=e.x&&n.x<=i.x,d=r.y>=e.y&&n.y<=i.y;return h&&d},overlaps:function(t){t=at(t);var e=this.min,i=this.max,n=t.min,r=t.max,h=r.x>e.x&&n.x<i.x,d=r.y>e.y&&n.y<i.y;return h&&d},isValid:function(){return!!(this.min&&this.max)},pad:function(t){var e=this.min,i=this.max,n=Math.abs(e.x-i.x)*t,r=Math.abs(e.y-i.y)*t;return at(B(e.x-n,e.y-r),B(i.x+n,i.y+r))},equals:function(t){return t?(t=at(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight())):!1}};function at(t,e){return!t||t instanceof K?t:new K(t,e)}function st(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n<r;n++)this.extend(i[n])}st.prototype={extend:function(t){var e=this._southWest,i=this._northEast,n,r;if(t instanceof X)n=t,r=t;else if(t instanceof st){if(n=t._southWest,r=t._northEast,!n||!r)return this}else return t?this.extend(j(t)||nt(t)):this;return!e&&!i?(this._southWest=new X(n.lat,n.lng),this._northEast=new X(r.lat,r.lng)):(e.lat=Math.min(n.lat,e.lat),e.lng=Math.min(n.lng,e.lng),i.lat=Math.max(r.lat,i.lat),i.lng=Math.max(r.lng,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,r=Math.abs(e.lng-i.lng)*t;return new st(new X(e.lat-n,e.lng-r),new X(i.lat+n,i.lng+r))},getCenter:function(){return new X((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 X(this.getNorth(),this.getWest())},getSouthEast:function(){return new X(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){typeof t[0]=="number"||t instanceof X||"lat"in t?t=j(t):t=nt(t);var e=this._southWest,i=this._northEast,n,r;return t instanceof st?(n=t.getSouthWest(),r=t.getNorthEast()):n=r=t,n.lat>=e.lat&&r.lat<=i.lat&&n.lng>=e.lng&&r.lng<=i.lng},intersects:function(t){t=nt(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),h=r.lat>=e.lat&&n.lat<=i.lat,d=r.lng>=e.lng&&n.lng<=i.lng;return h&&d},overlaps:function(t){t=nt(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),h=r.lat>e.lat&&n.lat<i.lat,d=r.lng>e.lng&&n.lng<i.lng;return h&&d},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return t?(t=nt(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function nt(t,e){return t instanceof st?t:new st(t,e)}function X(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,i!==void 0&&(this.alt=+i)}X.prototype={equals:function(t,e){if(!t)return!1;t=j(t);var i=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return i<=(e===void 0?1e-9:e)},toString:function(t){return"LatLng("+g(this.lat,t)+", "+g(this.lng,t)+")"},distanceTo:function(t){return Wt.distance(this,j(t))},wrap:function(){return Wt.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return nt([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new X(this.lat,this.lng,this.alt)}};function j(t,e,i){return t instanceof X?t:W(t)&&typeof t[0]!="object"?t.length===3?new X(t[0],t[1],t[2]):t.length===2?new X(t[0],t[1]):null:t==null?t:typeof t=="object"&&"lat"in t?new X(t.lat,"lng"in t?t.lng:t.lon,t.alt):e===void 0?null:new X(t,e,i)}var bt={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},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,i=this.scale(t),n=this.transformation.transform(e.min,i),r=this.transformation.transform(e.max,i);return new K(n,r)},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?y(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?y(t.lat,this.wrapLat,!0):t.lat,n=t.alt;return new X(i,e,n)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,r=e.lng-i.lng;if(n===0&&r===0)return t;var h=t.getSouthWest(),d=t.getNorthEast(),p=new X(h.lat-n,h.lng-r),v=new X(d.lat-n,d.lng-r);return new st(p,v)}},Wt=a({},bt,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,r=e.lat*i,h=Math.sin((e.lat-t.lat)*i/2),d=Math.sin((e.lng-t.lng)*i/2),p=h*h+Math.cos(n)*Math.cos(r)*d*d,v=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return this.R*v}}),nn=6378137,ci={R:nn,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),r=Math.sin(n*e);return new A(this.R*t.lng*e,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(t){var e=180/Math.PI;return new X((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=nn*Math.PI;return new K([-t,-t],[t,t])}()};function di(t,e,i,n){if(W(t)){this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3];return}this._a=t,this._b=e,this._c=i,this._d=n}di.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 A((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};function Jt(t,e,i,n){return new di(t,e,i,n)}var fi=a({},Wt,{code:"EPSG:3857",projection:ci,transformation:function(){var t=.5/(Math.PI*ci.R);return Jt(t,.5,-t,.5)}()}),No=a({},fi,{code:"EPSG:900913"});function on(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function rn(t,e){var i="",n,r,h,d,p,v;for(n=0,h=t.length;n<h;n++){for(p=t[n],r=0,d=p.length;r<d;r++)v=p[r],i+=(r?"L":"M")+v.x+" "+v.y;i+=e?D.svg?"z":"x":""}return i||"M0 0"}var mi=document.documentElement.style,Pe="ActiveXObject"in window,Fo=Pe&&!document.addEventListener,an="msLaunchUri"in navigator&&!("documentMode"in document),pi=_t("webkit"),sn=_t("android"),ln=_t("android 2")||_t("android 3"),Uo=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Ho=sn&&_t("Google")&&Uo<537&&!("AudioNode"in window),_i=!!window.opera,hn=!an&&_t("chrome"),un=_t("gecko")&&!pi&&!_i&&!Pe,$o=!hn&&_t("safari"),cn=_t("phantom"),dn="OTransition"in mi,Vo=navigator.platform.indexOf("Win")===0,fn=Pe&&"transition"in mi,gi="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!ln,mn="MozPerspective"in mi,qo=!window.L_DISABLE_3D&&(fn||gi||mn)&&!dn&&!cn,Qt=typeof orientation<"u"||_t("mobile"),Go=Qt&&pi,Xo=Qt&&gi,pn=!window.PointerEvent&&window.MSPointerEvent,_n=!!(window.PointerEvent||pn),gn="ontouchstart"in window||!!window.TouchEvent,jo=!window.L_NO_TOUCH&&(gn||_n),Yo=Qt&&_i,Ko=Qt&&un,Jo=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Qo=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",_,e),window.removeEventListener("testPassiveEventSupport",_,e)}catch{}return t}(),tr=function(){return!!document.createElement("canvas").getContext}(),vi=!!(document.createElementNS&&on("svg").createSVGRect),er=!!vi&&function(){var t=document.createElement("div");return t.innerHTML="<svg/>",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),ir=!vi&&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&&typeof e.adj=="object"}catch{return!1}}(),nr=navigator.platform.indexOf("Mac")===0,or=navigator.platform.indexOf("Linux")===0;function _t(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var D={ie:Pe,ielt9:Fo,edge:an,webkit:pi,android:sn,android23:ln,androidStock:Ho,opera:_i,chrome:hn,gecko:un,safari:$o,phantom:cn,opera12:dn,win:Vo,ie3d:fn,webkit3d:gi,gecko3d:mn,any3d:qo,mobile:Qt,mobileWebkit:Go,mobileWebkit3d:Xo,msPointer:pn,pointer:_n,touch:jo,touchNative:gn,mobileOpera:Yo,mobileGecko:Ko,retina:Jo,passiveEvents:Qo,canvas:tr,svg:vi,vml:ir,inlineSvg:er,mac:nr,linux:or},vn=D.msPointer?"MSPointerDown":"pointerdown",yn=D.msPointer?"MSPointerMove":"pointermove",xn=D.msPointer?"MSPointerUp":"pointerup",bn=D.msPointer?"MSPointerCancel":"pointercancel",yi={touchstart:vn,touchmove:yn,touchend:xn,touchcancel:bn},wn={touchstart:ur,touchmove:Ce,touchend:Ce,touchcancel:Ce},Ft={},Ln=!1;function rr(t,e,i){return e==="touchstart"&&hr(),wn[e]?(i=wn[e].bind(this,i),t.addEventListener(yi[e],i,!1),i):(console.warn("wrong event specified:",e),_)}function ar(t,e,i){if(!yi[e]){console.warn("wrong event specified:",e);return}t.removeEventListener(yi[e],i,!1)}function sr(t){Ft[t.pointerId]=t}function lr(t){Ft[t.pointerId]&&(Ft[t.pointerId]=t)}function Tn(t){delete Ft[t.pointerId]}function hr(){Ln||(document.addEventListener(vn,sr,!0),document.addEventListener(yn,lr,!0),document.addEventListener(xn,Tn,!0),document.addEventListener(bn,Tn,!0),Ln=!0)}function Ce(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){e.touches=[];for(var i in Ft)e.touches.push(Ft[i]);e.changedTouches=[e],t(e)}}function ur(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&ot(e),Ce(t,e)}function cr(t){var e={},i,n;for(n in t)i=t[n],e[n]=i&&i.bind?i.bind(t):i;return t=e,e.type="dblclick",e.detail=2,e.isTrusted=!1,e._simulated=!0,e}var dr=200;function fr(t,e){t.addEventListener("dblclick",e);var i=0,n;function r(h){if(h.detail!==1){n=h.detail;return}if(!(h.pointerType==="mouse"||h.sourceCapabilities&&!h.sourceCapabilities.firesTouchEvents)){var d=In(h);if(!(d.some(function(v){return v instanceof HTMLLabelElement&&v.attributes.for})&&!d.some(function(v){return v instanceof HTMLInputElement||v instanceof HTMLSelectElement}))){var p=Date.now();p-i<=dr?(n++,n===2&&e(cr(h))):n=1,i=p}}}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}function mr(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var xi=De(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),te=De(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Mn=te==="webkitTransition"||te==="OTransition"?te+"End":"transitionend";function Sn(t){return typeof t=="string"?document.getElementById(t):t}function ee(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||i==="auto")&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return i==="auto"?null:i}function $(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function J(t){var e=t.parentNode;e&&e.removeChild(t)}function Ie(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Ut(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function Ht(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function bi(t,e){if(t.classList!==void 0)return t.classList.contains(e);var i=We(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function R(t,e){if(t.classList!==void 0)for(var i=T(e),n=0,r=i.length;n<r;n++)t.classList.add(i[n]);else if(!bi(t,e)){var h=We(t);wi(t,(h?h+" ":"")+e)}}function Q(t,e){t.classList!==void 0?t.classList.remove(e):wi(t,x((" "+We(t)+" ").replace(" "+e+" "," ")))}function wi(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e}function We(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal}function ut(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&pr(t,e)}function pr(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch{if(e===1)return}e=Math.round(e*100),i?(i.Enabled=e!==100,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function De(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function At(t,e,i){var n=e||new A(0,0);t.style[xi]=(D.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function tt(t,e){t._leaflet_pos=e,D.any3d?At(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Bt(t){return t._leaflet_pos||new A(0,0)}var ie,ne,Li;if("onselectstart"in document)ie=function(){z(window,"selectstart",ot)},ne=function(){Y(window,"selectstart",ot)};else{var oe=De(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);ie=function(){if(oe){var t=document.documentElement.style;Li=t[oe],t[oe]="none"}},ne=function(){oe&&(document.documentElement.style[oe]=Li,Li=void 0)}}function Ti(){z(window,"dragstart",ot)}function Mi(){Y(window,"dragstart",ot)}var ke,Si;function Pi(t){for(;t.tabIndex===-1;)t=t.parentNode;t.style&&(Ee(),ke=t,Si=t.style.outline,t.style.outline="none",z(window,"keydown",Ee))}function Ee(){ke&&(ke.style.outline=Si,ke=void 0,Si=void 0,Y(window,"keydown",Ee))}function Pn(t){do t=t.parentNode;while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function Ci(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var _r={__proto__:null,TRANSFORM:xi,TRANSITION:te,TRANSITION_END:Mn,get:Sn,getStyle:ee,create:$,remove:J,empty:Ie,toFront:Ut,toBack:Ht,hasClass:bi,addClass:R,removeClass:Q,setClass:wi,getClass:We,setOpacity:ut,testProp:De,setTransform:At,setPosition:tt,getPosition:Bt,get disableTextSelection(){return ie},get enableTextSelection(){return ne},disableImageDrag:Ti,enableImageDrag:Mi,preventOutline:Pi,restoreOutline:Ee,getSizedParentNode:Pn,getScale:Ci};function z(t,e,i,n){if(e&&typeof e=="object")for(var r in e)Wi(t,r,e[r],i);else{e=T(e);for(var h=0,d=e.length;h<d;h++)Wi(t,e[h],i,n)}return this}var gt="_leaflet_events";function Y(t,e,i,n){if(arguments.length===1)Cn(t),delete t[gt];else if(e&&typeof e=="object")for(var r in e)Di(t,r,e[r],i);else if(e=T(e),arguments.length===2)Cn(t,function(p){return O(e,p)!==-1});else for(var h=0,d=e.length;h<d;h++)Di(t,e[h],i,n);return this}function Cn(t,e){for(var i in t[gt]){var n=i.split(/\d/)[0];(!e||e(n))&&Di(t,n,null,null,i)}}var Ii={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Wi(t,e,i,n){var r=e+f(i)+(n?"_"+f(n):"");if(t[gt]&&t[gt][r])return this;var h=function(p){return i.call(n||t,p||window.event)},d=h;!D.touchNative&&D.pointer&&e.indexOf("touch")===0?h=rr(t,e,h):D.touch&&e==="dblclick"?h=fr(t,h):"addEventListener"in t?e==="touchstart"||e==="touchmove"||e==="wheel"||e==="mousewheel"?t.addEventListener(Ii[e]||e,h,D.passiveEvents?{passive:!1}:!1):e==="mouseenter"||e==="mouseleave"?(h=function(p){p=p||window.event,Ei(t,p)&&d(p)},t.addEventListener(Ii[e],h,!1)):t.addEventListener(e,d,!1):t.attachEvent("on"+e,h),t[gt]=t[gt]||{},t[gt][r]=h}function Di(t,e,i,n,r){r=r||e+f(i)+(n?"_"+f(n):"");var h=t[gt]&&t[gt][r];if(!h)return this;!D.touchNative&&D.pointer&&e.indexOf("touch")===0?ar(t,e,h):D.touch&&e==="dblclick"?mr(t,h):"removeEventListener"in t?t.removeEventListener(Ii[e]||e,h,!1):t.detachEvent("on"+e,h),t[gt][r]=null}function Zt(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function ki(t){return Wi(t,"wheel",Zt),this}function re(t){return z(t,"mousedown touchstart dblclick contextmenu",Zt),t._leaflet_disable_click=!0,this}function ot(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ot(t){return ot(t),Zt(t),this}function In(t){if(t.composedPath)return t.composedPath();for(var e=[],i=t.target;i;)e.push(i),i=i.parentNode;return e}function Wn(t,e){if(!e)return new A(t.clientX,t.clientY);var i=Ci(e),n=i.boundingClientRect;return new A((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var gr=D.linux&&D.chrome?window.devicePixelRatio:D.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Dn(t){return D.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/gr:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function Ei(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch{return!1}return i!==t}var vr={__proto__:null,on:z,off:Y,stopPropagation:Zt,disableScrollPropagation:ki,disableClickPropagation:re,preventDefault:ot,stop:Ot,getPropagationPath:In,getMousePosition:Wn,getWheelDelta:Dn,isExternalTarget:Ei,addListener:z,removeListener:Y},kn=It.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Bt(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=q(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=this._duration*1e3;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),tt(this._el,i),this.fire("step")},_complete:function(){G(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),U=It.extend({options:{crs:fi,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=b(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=u(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),e.zoom!==void 0&&(this._zoom=this._limitZoom(e.zoom)),e.center&&e.zoom!==void 0&&this.setView(j(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=te&&D.any3d&&!D.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),z(this._proxy,Mn,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){if(e=e===void 0?this._zoom:this._limitZoom(e),t=this._limitCenter(j(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&i!==!0){i.animate!==void 0&&(i.zoom=a({animate:i.animate},i.zoom),i.pan=a({animate:i.animate,duration:i.duration},i.pan));var n=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan);if(n)return clearTimeout(this._sizeTimer),this}return 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||(D.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(D.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),r=this.getSize().divideBy(2),h=t instanceof A?t:this.latLngToContainerPoint(t),d=h.subtract(r).multiplyBy(1-1/n),p=this.containerPointToLatLng(r.add(d));return this.setView(p,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():nt(t);var i=B(e.paddingTopLeft||e.padding||[0,0]),n=B(e.paddingBottomRight||e.padding||[0,0]),r=this.getBoundsZoom(t,!1,i.add(n));if(r=typeof e.maxZoom=="number"?Math.min(e.maxZoom,r):r,r===1/0)return{center:t.getCenter(),zoom:r};var h=n.subtract(i).divideBy(2),d=this.project(t.getSouthWest(),r),p=this.project(t.getNorthEast(),r),v=this.unproject(d.add(p).divideBy(2).add(h),r);return{center:v,zoom:r}},fitBounds:function(t,e){if(t=nt(t),!t.isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.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(t=B(t).round(),e=e||{},!t.x&&!t.y)return this.fire("moveend");if(e.animate!==!0&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new kn,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),e.animate!==!1){R(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(i=i||{},i.animate===!1||!D.any3d)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),r=this.project(t),h=this.getSize(),d=this._zoom;t=j(t),e=e===void 0?d:e;var p=Math.max(h.x,h.y),v=p*this.getZoomScale(d,e),w=r.distanceTo(n)||1,I=1.42,k=I*I;function N(et){var qe=et?-1:1,aa=et?v:p,sa=v*v-p*p+qe*k*k*w*w,la=2*aa*k*w,$i=sa/la,fo=Math.sqrt($i*$i+1)-$i,ha=fo<1e-9?-18:Math.log(fo);return ha}function dt(et){return(Math.exp(et)-Math.exp(-et))/2}function Rt(et){return(Math.exp(et)+Math.exp(-et))/2}function Ve(et){return dt(et)/Rt(et)}var Et=N(0);function Hi(et){return p*(Rt(Et)/Rt(Et+I*et))}function ia(et){return p*(Rt(Et)*Ve(Et+I*et)-dt(Et))/k}function na(et){return 1-Math.pow(1-et,1.5)}var oa=Date.now(),uo=(N(1)-Et)/I,ra=i.duration?1e3*i.duration:1e3*uo*.8;function co(){var et=(Date.now()-oa)/ra,qe=na(et)*uo;et<=1?(this._flyToFrame=q(co,this),this._move(this.unproject(n.add(r.subtract(n).multiplyBy(ia(qe)/w)),d),this.getScaleZoom(p/Hi(qe),d),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),co.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return t=nt(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 i=this.getCenter(),n=this._limitCenter(i,this._zoom,nt(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var i=B(e.paddingTopLeft||e.padding||[0,0]),n=B(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),h=this.project(t),d=this.getPixelBounds(),p=at([d.min.add(i),d.max.subtract(n)]),v=p.getSize();if(!p.contains(h)){this._enforcingBounds=!0;var w=h.subtract(p.getCenter()),I=p.extend(h).getSize().subtract(v);r.x+=w.x<0?-I.x:I.x,r.y+=w.y<0?-I.y:I.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=a({animate:!1,pan:!0},t===!0?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),r=i.divideBy(2).round(),h=n.subtract(r);return!h.x&&!h.y?this:(t.animate&&t.pan?this.panBy(h):(t.pan&&this._rawPanBy(h),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(u(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=a({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=u(this._handleGeolocationResponse,this),i=u(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,i=t.message||(e===1?"permission denied":e===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=t.coords.latitude,i=t.coords.longitude,n=new X(e,i),r=n.toBounds(t.coords.accuracy*2),h=this._locateOptions;if(h.setView){var d=this.getBoundsZoom(r);this.setView(n,h.maxZoom?Math.min(d,h.maxZoom):d)}var p={latlng:n,bounds:r,timestamp:t.timestamp};for(var v in t.coords)typeof t.coords[v]=="number"&&(p[v]=t.coords[v]);this.fire("locationfound",p)}},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.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{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),J(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(G(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)J(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),n=$("div",i,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(),e=this.unproject(t.getBottomLeft()),i=this.unproject(t.getTopRight());return new st(e,i)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=nt(t),i=B(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),h=this.getMaxZoom(),d=t.getNorthWest(),p=t.getSouthEast(),v=this.getSize().subtract(i),w=at(this.project(p,n),this.project(d,n)).getSize(),I=D.any3d?this.options.zoomSnap:1,k=v.x/w.x,N=v.y/w.y,dt=e?Math.max(k,N):Math.min(k,N);return n=this.getScaleZoom(dt,n),I&&(n=Math.round(n/(I/100))*(I/100),n=e?Math.ceil(n/I)*I:Math.floor(n/I)*I),Math.max(r,Math.min(h,n))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new A(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new K(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=e===void 0?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=e===void 0?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.latLngToPoint(j(t),e)},unproject:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.pointToLatLng(B(t),e)},layerPointToLatLng:function(t){var e=B(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(j(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(j(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(nt(t))},distance:function(t,e){return this.options.crs.distance(j(t),j(e))},containerPointToLayerPoint:function(t){return B(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return B(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(B(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(j(t)))},mouseEventToContainerPoint:function(t){return Wn(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=Sn(t);if(e){if(e._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");z(e,"scroll",this._onScroll,this),this._containerId=f(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&D.any3d,R(t,"leaflet-container"+(D.touch?" leaflet-touch":"")+(D.retina?" leaflet-retina":"")+(D.ielt9?" leaflet-oldie":"")+(D.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=ee(t,"position");e!=="absolute"&&e!=="relative"&&e!=="fixed"&&e!=="sticky"&&(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),tt(this._mapPane,new A(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(R(t.markerPane,"leaflet-zoom-hide"),R(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){tt(this._mapPane,new A(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var r=this._zoom!==e;this._moveStart(r,i)._move(t,e)._moveEnd(r),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i,n){e===void 0&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((r||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return G(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){tt(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[f(this._container)]=this;var e=t?Y:z;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),D.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){G(this._resizeRequest),this._resizeRequest=q(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 i=[],n,r=e==="mouseout"||e==="mouseover",h=t.target||t.srcElement,d=!1;h;){if(n=this._targets[f(h)],n&&(e==="click"||e==="preclick")&&this._draggableMoved(n)){d=!0;break}if(n&&n.listens(e,!0)&&(r&&!Ei(h,t)||(i.push(n),r))||h===this._container)break;h=h.parentNode}return!i.length&&!d&&!r&&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||t.type==="click"&&this._isClickDisabled(e))){var i=t.type;i==="mousedown"&&Pi(e),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if(t.type==="click"){var n=a({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}var r=this._findEventTargets(t,e);if(i){for(var h=[],d=0;d<i.length;d++)i[d].listens(e,!0)&&h.push(i[d]);r=h.concat(r)}if(r.length){e==="contextmenu"&&ot(t);var p=r[0],v={originalEvent:t};if(t.type!=="keypress"&&t.type!=="keydown"&&t.type!=="keyup"){var w=p.getLatLng&&(!p._radius||p._radius<=10);v.containerPoint=w?this.latLngToContainerPoint(p.getLatLng()):this.mouseEventToContainerPoint(t),v.layerPoint=this.containerPointToLayerPoint(v.containerPoint),v.latlng=w?p.getLatLng():this.layerPointToLatLng(v.layerPoint)}for(d=0;d<r.length;d++)if(r[d].fire(e,v,!0),v.originalEvent._stopped||r[d].options.bubblingMouseEvents===!1&&O(this._mouseEvents,e)!==-1)return}},_draggableMoved:function(t){return t=t.dragging&&t.dragging.enabled()?t:this,t.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 Bt(this._mapPane)||new A(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){var i=t&&e!==void 0?this._getNewPixelOrigin(t,e):this.getPixelOrigin();return i.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return at([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),r=this.getSize().divideBy(2),h=new K(n.subtract(r),n.add(r)),d=this._getBoundsOffset(h,i,e);return Math.abs(d.x)<=1&&Math.abs(d.y)<=1?t:this.unproject(n.add(d),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new K(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=at(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),r=n.min.subtract(t.min),h=n.max.subtract(t.max),d=this._rebound(r.x,-h.x),p=this._rebound(r.y,-h.y);return new A(d,p)},_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(),i=this.getMaxZoom(),n=D.any3d?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Q(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return(e&&e.animate)!==!0&&!this.getSize().contains(i)?!1:(this.panBy(i,e),!0)},_createAnimProxy:function(){var t=this._proxy=$("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(e){var i=xi,n=this._proxy.style[i];At(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){J(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();At(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,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/n);return i.animate!==!0&&!this.getSize().contains(r)?!1:(q(function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)},this),!0)},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,R(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(u(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Q(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 yr(t,e){return new U(t,e)}var ft=pt.extend({options:{position:"topright"},initialize:function(t){b(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),i=this.getPosition(),n=t._controlCorners[i];return R(e,"leaflet-control"),i.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(J(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()}}),ae=function(t){return new ft(t)};U.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=$("div",e+"control-container",this._container);function n(r,h){var d=e+r+" "+e+h;t[r+h]=$("div",d,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)J(this._controlCorners[t]);J(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var En=ft.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){b(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1;for(var n in t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!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 ft.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(f(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){R(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?(R(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):Q(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Q(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=$("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),re(e),ki(e);var n=this._section=$("section",t+"-list");i&&(this._map.on("click",this.collapse,this),z(e,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var r=this._layersLink=$("a",t+"-toggle",e);r.href="#",r.title="Layers",r.setAttribute("role","button"),z(r,{keydown:function(h){h.keyCode===13&&this._expandSafely()},click:function(h){ot(h),this._expandSafely()}},this),i||this.expand(),this._baseLayersList=$("div",t+"-base",n),this._separator=$("div",t+"-separator",n),this._overlaysList=$("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&f(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(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(u(function(n,r){return this.options.sortFunction(n.layer,r.layer,n.name,r.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Ie(this._baseLayersList),Ie(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,r=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,r+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&r>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(f(t.target)),i=e.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),n;t.overlay?(n=document.createElement("input"),n.type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=i):n=this._createRadioElement("leaflet-base-layers_"+f(this),i),this._layerControlInputs.push(n),n.layerId=f(t.layer),z(n,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var h=document.createElement("span");e.appendChild(h),h.appendChild(n),h.appendChild(r);var d=t.overlay?this._overlaysList:this._baseLayersList;return d.appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t=this._layerControlInputs,e,i,n=[],r=[];this._handlingClick=!0;for(var h=t.length-1;h>=0;h--)e=t[h],i=this._getLayer(e.layerId).layer,e.checked?n.push(i):e.checked||r.push(i);for(h=0;h<r.length;h++)this._map.hasLayer(r[h])&&this._map.removeLayer(r[h]);for(h=0;h<n.length;h++)this._map.hasLayer(n[h])||this._map.addLayer(n[h]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t=this._layerControlInputs,e,i,n=this._map.getZoom(),r=t.length-1;r>=0;r--)e=t[r],i=this._getLayer(e.layerId).layer,e.disabled=i.options.minZoom!==void 0&&n<i.options.minZoom||i.options.maxZoom!==void 0&&n>i.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;z(t,"click",ot),this.expand(),setTimeout(function(){Y(t,"click",ot)})}}),xr=function(t,e,i){return new En(t,e,i)},Ai=ft.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=$("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},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,i,n,r){var h=$("a",i,n);return h.innerHTML=t,h.href="#",h.title=e,h.setAttribute("role","button"),h.setAttribute("aria-label",e),re(h),z(h,"click",Ot),z(h,"click",r,this),z(h,"click",this._refocusOnMap,this),h},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";Q(this._zoomInButton,e),Q(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(R(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(R(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});U.mergeOptions({zoomControl:!0}),U.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ai,this.addControl(this.zoomControl))});var br=function(t){return new Ai(t)},An=ft.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=$("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=$("div",e,i)),t.imperial&&(this._iScale=$("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_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),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e=t*3.2808399,i,n,r;e>5280?(i=e/5280,n=this._getRoundNum(i),this._updateScale(this._iScale,n+" mi",n/i)):(r=this._getRoundNum(e),this._updateScale(this._iScale,r+" ft",r/e))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,e*i}}),wr=function(t){return new An(t)},Lr='<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>',Bi=ft.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(D.inlineSvg?Lr+" ":"")+"Leaflet</a>"},initialize:function(t){b(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=$("div","leaflet-control-attribution"),re(this._container);for(var e in 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 i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(' <span aria-hidden="true">|</span> ')}}});U.mergeOptions({attributionControl:!0}),U.addInitHook(function(){this.options.attributionControl&&new Bi().addTo(this)});var Tr=function(t){return new Bi(t)};ft.Layers=En,ft.Zoom=Ai,ft.Scale=An,ft.Attribution=Bi,ae.layers=xr,ae.zoom=br,ae.scale=wr,ae.attribution=Tr;var vt=pt.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});vt.addTo=function(t,e){return t.addHandler(e,this),this};var Mr={Events:rt},Bn=D.touch?"touchstart mousedown":"mousedown",Dt=It.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){b(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(z(this._dragStartTarget,Bn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Dt._dragging===this&&this.finishDrag(!0),Y(this._dragStartTarget,Bn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!bi(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){Dt._dragging===this&&this.finishDrag();return}if(!(Dt._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(Dt._dragging=this,this._preventOutline&&Pi(this._element),Ti(),ie(),!this._moving)){this.fire("down");var e=t.touches?t.touches[0]:t,i=Pn(this._element);this._startPoint=new A(e.clientX,e.clientY),this._startPos=Bt(this._element),this._parentScale=Ci(i);var n=t.type==="mousedown";z(document,n?"mousemove":"touchmove",this._onMove,this),z(document,n?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var e=t.touches&&t.touches.length===1?t.touches[0]:t,i=new A(e.clientX,e.clientY)._subtract(this._startPoint);!i.x&&!i.y||Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,ot(t),this._moved||(this.fire("dragstart"),this._moved=!0,R(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),R(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,this._lastEvent=t,this._updatePosition())}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),tt(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){Q(document.body,"leaflet-dragging"),this._lastTarget&&(Q(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Y(document,"mousemove touchmove",this._onMove,this),Y(document,"mouseup touchend touchcancel",this._onUp,this),Mi(),ne(),this._moved&&this._moving&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)}),this._moving=!1,Dt._dragging=!1}});function Zn(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Cr(t,i),t=Pr(t,i),t}function On(t,e,i){return Math.sqrt(se(t,e,i,!0))}function Sr(t,e,i){return se(t,e,i)}function Pr(t,e){var i=t.length,n=typeof Uint8Array!=void 0+""?Uint8Array:Array,r=new n(i);r[0]=r[i-1]=1,Zi(t,r,e,0,i-1);var h,d=[];for(h=0;h<i;h++)r[h]&&d.push(t[h]);return d}function Zi(t,e,i,n,r){var h=0,d,p,v;for(p=n+1;p<=r-1;p++)v=se(t[p],t[n],t[r],!0),v>h&&(d=p,h=v);h>i&&(e[d]=1,Zi(t,e,i,n,d),Zi(t,e,i,d,r))}function Cr(t,e){for(var i=[t[0]],n=1,r=0,h=t.length;n<h;n++)Ir(t[n],t[r])>e&&(i.push(t[n]),r=n);return r<h-1&&i.push(t[h-1]),i}var zn;function Rn(t,e,i,n,r){var h=n?zn:zt(t,i),d=zt(e,i),p,v,w;for(zn=d;;){if(!(h|d))return[t,e];if(h&d)return!1;p=h||d,v=Ae(t,e,p,i,r),w=zt(v,i),p===h?(t=v,h=w):(e=v,d=w)}}function Ae(t,e,i,n,r){var h=e.x-t.x,d=e.y-t.y,p=n.min,v=n.max,w,I;return i&8?(w=t.x+h*(v.y-t.y)/d,I=v.y):i&4?(w=t.x+h*(p.y-t.y)/d,I=p.y):i&2?(w=v.x,I=t.y+d*(v.x-t.x)/h):i&1&&(w=p.x,I=t.y+d*(p.x-t.x)/h),new A(w,I,r)}function zt(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Ir(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function se(t,e,i,n){var r=e.x,h=e.y,d=i.x-r,p=i.y-h,v=d*d+p*p,w;return v>0&&(w=((t.x-r)*d+(t.y-h)*p)/v,w>1?(r=i.x,h=i.y):w>0&&(r+=d*w,h+=p*w)),d=t.x-r,p=t.y-h,n?d*d+p*p:new A(r,h)}function ct(t){return!W(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Nn(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),ct(t)}function Fn(t,e){var i,n,r,h,d,p,v,w;if(!t||t.length===0)throw new Error("latlngs not passed");ct(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var I=[];for(var k in t)I.push(e.project(j(t[k])));var N=I.length;for(i=0,n=0;i<N-1;i++)n+=I[i].distanceTo(I[i+1])/2;if(n===0)w=I[0];else for(i=0,h=0;i<N-1;i++)if(d=I[i],p=I[i+1],r=d.distanceTo(p),h+=r,h>n){v=(h-n)/r,w=[p.x-v*(p.x-d.x),p.y-v*(p.y-d.y)];break}return e.unproject(B(w))}var Wr={__proto__:null,simplify:Zn,pointToSegmentDistance:On,closestPointOnSegment:Sr,clipSegment:Rn,_getEdgeIntersection:Ae,_getBitCode:zt,_sqClosestPointOnSegment:se,isFlat:ct,_flat:Nn,polylineCenter:Fn};function Un(t,e,i){var n,r=[1,4,2,8],h,d,p,v,w,I,k,N;for(h=0,I=t.length;h<I;h++)t[h]._code=zt(t[h],e);for(p=0;p<4;p++){for(k=r[p],n=[],h=0,I=t.length,d=I-1;h<I;d=h++)v=t[h],w=t[d],v._code&k?w._code&k||(N=Ae(w,v,k,e,i),N._code=zt(N,e),n.push(N)):(w._code&k&&(N=Ae(w,v,k,e,i),N._code=zt(N,e),n.push(N)),n.push(v));t=n}return t}function Hn(t,e){var i,n,r,h,d,p,v,w,I;if(!t||t.length===0)throw new Error("latlngs not passed");ct(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var k=[];for(var N in t)k.push(e.project(j(t[N])));var dt=k.length;for(p=v=w=0,i=0,n=dt-1;i<dt;n=i++)r=k[i],h=k[n],d=r.y*h.x-h.y*r.x,v+=(r.x+h.x)*d,w+=(r.y+h.y)*d,p+=d*3;return p===0?I=k[0]:I=[v/p,w/p],e.unproject(B(I))}var Dr={__proto__:null,clipPolygon:Un,polygonCenter:Hn},Oi={project:function(t){return new A(t.lng,t.lat)},unproject:function(t){return new X(t.y,t.x)},bounds:new K([-180,-90],[180,90])},zi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new K([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,r=this.R_MINOR/i,h=Math.sqrt(1-r*r),d=h*Math.sin(n),p=Math.tan(Math.PI/4-n/2)/Math.pow((1-d)/(1+d),h/2);return n=-i*Math.log(Math.max(p,1e-10)),new A(t.lng*e*i,n)},unproject:function(t){for(var e=180/Math.PI,i=this.R,n=this.R_MINOR/i,r=Math.sqrt(1-n*n),h=Math.exp(-t.y/i),d=Math.PI/2-2*Math.atan(h),p=0,v=.1,w;p<15&&Math.abs(v)>1e-7;p++)w=r*Math.sin(d),w=Math.pow((1-w)/(1+w),r/2),v=Math.PI/2-2*Math.atan(h*w)-d,d+=v;return new X(d*e,t.x*e/i)}},kr={__proto__:null,LonLat:Oi,Mercator:zi,SphericalMercator:ci},Er=a({},Wt,{code:"EPSG:3395",projection:zi,transformation:function(){var t=.5/(Math.PI*zi.R);return Jt(t,.5,-t,.5)}()}),$n=a({},Wt,{code:"EPSG:4326",projection:Oi,transformation:Jt(1/180,1,-1/180,.5)}),Ar=a({},bt,{projection:Oi,transformation:Jt(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 i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});bt.Earth=Wt,bt.EPSG3395=Er,bt.EPSG3857=fi,bt.EPSG900913=No,bt.EPSG4326=$n,bt.Simple=Ar;var mt=It.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[f(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[f(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 i=this.getEvents();e.on(i,this),this.once("remove",function(){e.off(i,this)},this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});U.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=f(t);return this._layers[e]?this:(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var e=f(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 f(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){t=t?W(t)?t:[t]:[];for(var e=0,i=t.length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){(!isNaN(t.options.maxZoom)||!isNaN(t.options.minZoom))&&(this._zoomBoundLayers[f(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=f(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var r=this._zoomBoundLayers[n].options;t=r.minZoom===void 0?t:Math.min(t,r.minZoom),e=r.maxZoom===void 0?e:Math.max(e,r.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var $t=mt.extend({initialize:function(t,e){b(this,e),this._layers={};var i,n;if(t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},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){var e=typeof t=="number"?t:this.getLayerId(t);return e in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e=Array.prototype.slice.call(arguments,1),i,n;for(i in this._layers)n=this._layers[i],n[t]&&n[t].apply(n,e);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);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 f(t)}}),Br=function(t,e){return new $t(t,e)},wt=$t.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),$t.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),$t.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 st;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Zr=function(t,e){return new wt(t,e)},Vt=pt.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){b(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if(t==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&e.tagName==="IMG"?e:null);return this._setIconStyles(n,t),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];typeof n=="number"&&(n=[n,n]);var r=B(n),h=B(e==="shadow"&&i.shadowAnchor||i.iconAnchor||r&&r.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),h&&(t.style.marginLeft=-h.x+"px",t.style.marginTop=-h.y+"px"),r&&(t.style.width=r.x+"px",t.style.height=r.y+"px")},_createImg:function(t,e){return e=e||document.createElement("img"),e.src=t,e},_getIconUrl:function(t){return D.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Or(t){return new Vt(t)}var le=Vt.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 typeof le.imagePath!="string"&&(le.imagePath=this._detectIconPath()),(this.options.imagePath||le.imagePath)+Vt.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var e=function(i,n,r){var h=n.exec(i);return h&&h[r]};return t=e(t,/^url\((['"])?(.+)\1\)$/,2),t&&e(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=$("div","leaflet-default-icon-path",document.body),e=ee(t,"background-image")||ee(t,"backgroundImage");if(document.body.removeChild(t),e=this._stripUrl(e),e)return e;var i=document.querySelector('link[href$="leaflet.css"]');return i?i.href.substring(0,i.href.length-11-1):""}}),Vn=vt.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new Dt(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),R(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&&Q(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,h=Bt(e._icon),d=i.getPixelBounds(),p=i.getPixelOrigin(),v=at(d.min._subtract(p).add(r),d.max._subtract(p).subtract(r));if(!v.contains(h)){var w=B((Math.max(v.max.x,h.x)-v.max.x)/(d.max.x-v.max.x)-(Math.min(v.min.x,h.x)-v.min.x)/(d.min.x-v.min.x),(Math.max(v.max.y,h.y)-v.max.y)/(d.max.y-v.max.y)-(Math.min(v.min.y,h.y)-v.min.y)/(d.min.y-v.min.y)).multiplyBy(n);i.panBy(w,{animate:!1}),this._draggable._newPos._add(w),this._draggable._startPos._add(w),tt(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=q(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&&(G(this._panRequest),this._panRequest=q(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=Bt(e._icon),r=e._map.layerPointToLatLng(n);i&&tt(i,n),e._latlng=r,t.latlng=r,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){G(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Be=mt.extend({options:{icon:new le,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){b(this,e),this._latlng=j(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=j(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"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),i.tagName==="IMG"&&(i.alt=t.alt||"")),R(i,e),t.keyboard&&(i.tabIndex="0",i.setAttribute("role","button")),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&z(i,"focus",this._panOnFocus,this);var r=t.icon.createShadow(this._shadow),h=!1;r!==this._shadow&&(this._removeShadow(),h=!0),r&&(R(r,e),r.alt=""),this._shadow=r,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&h&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Y(this._icon,"focus",this._panOnFocus,this),J(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&J(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&tt(this._icon,t),this._shadow&&tt(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&&(R(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Vn)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Vn(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&&ut(this._icon,t),this._shadow&&ut(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,i=e.iconSize?B(e.iconSize):B(0,0),n=e.iconAnchor?B(e.iconAnchor):B(0,0);t.panInside(this._latlng,{paddingTopLeft:n,paddingBottomRight:i.subtract(n)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function zr(t,e){return new Be(t,e)}var kt=mt.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 b(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)}}),Ze=kt.extend({options:{fill:!0,radius:10},initialize:function(t,e){b(this,e),this._latlng=j(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=j(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 kt.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,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new K(this._point.subtract(n),this._point.add(n))},_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 Rr(t,e){return new Ze(t,e)}var Ri=Ze.extend({initialize:function(t,e,i){if(typeof e=="number"&&(e=a({},i,{radius:e})),b(this,e),this._latlng=j(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 st(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:kt.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===Wt.distance){var r=Math.PI/180,h=this._mRadius/Wt.R/r,d=i.project([e+h,t]),p=i.project([e-h,t]),v=d.add(p).divideBy(2),w=i.unproject(v).lat,I=Math.acos((Math.cos(h*r)-Math.sin(e*r)*Math.sin(w*r))/(Math.cos(e*r)*Math.cos(w*r)))/r;(isNaN(I)||I===0)&&(I=h/Math.cos(Math.PI/180*e)),this._point=v.subtract(i.getPixelOrigin()),this._radius=isNaN(I)?0:v.x-i.project([w,t-I]).x,this._radiusY=v.y-d.y}else{var k=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(k).x}this._updateBounds()}});function Nr(t,e,i){return new Ri(t,e,i)}var Lt=kt.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){b(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=1/0,i=null,n=se,r,h,d=0,p=this._parts.length;d<p;d++)for(var v=this._parts[d],w=1,I=v.length;w<I;w++){r=v[w-1],h=v[w];var k=n(t,r,h,!0);k<e&&(e=k,i=n(t,r,h))}return i&&(i.distance=Math.sqrt(e)),i},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Fn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=j(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new st,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return ct(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=ct(t),n=0,r=t.length;n<r;n++)i?(e[n]=j(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new K;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 A(t,t);this._rawPxBounds&&(this._pxBounds=new K([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]))},_projectLatlngs:function(t,e,i){var n=t[0]instanceof X,r=t.length,h,d;if(n){for(d=[],h=0;h<r;h++)d[h]=this._map.latLngToLayerPoint(t[h]),i.extend(d[h]);e.push(d)}else for(h=0;h<r;h++)this._projectLatlngs(t[h],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}var e=this._parts,i,n,r,h,d,p,v;for(i=0,r=0,h=this._rings.length;i<h;i++)for(v=this._rings[i],n=0,d=v.length;n<d-1;n++)p=Rn(v[n],v[n+1],t,n,!0),p&&(e[r]=e[r]||[],e[r].push(p[0]),(p[1]!==v[n+1]||n===d-2)&&(e[r].push(p[1]),r++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=Zn(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,r,h,d,p,v=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,h=this._parts.length;i<h;i++)for(p=this._parts[i],n=0,d=p.length,r=d-1;n<d;r=n++)if(!(!e&&n===0)&&On(t,p[r],p[n])<=v)return!0;return!1}});function Fr(t,e){return new Lt(t,e)}Lt._flat=Nn;var qt=Lt.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 Hn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var e=Lt.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof X&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){Lt.prototype._setLatLngs.call(this,t),ct(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return ct(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new A(e,e);if(t=new K(t.min.subtract(i),t.max.add(i)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var n=0,r=this._rings.length,h;n<r;n++)h=Un(this._rings[n],t,!0),h.length&&this._parts.push(h)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e=!1,i,n,r,h,d,p,v,w;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(h=0,v=this._parts.length;h<v;h++)for(i=this._parts[h],d=0,w=i.length,p=w-1;d<w;p=d++)n=i[d],r=i[p],n.y>t.y!=r.y>t.y&&t.x<(r.x-n.x)*(t.y-n.y)/(r.y-n.y)+n.x&&(e=!e);return e||Lt.prototype._containsPoint.call(this,t,!0)}});function Ur(t,e){return new qt(t,e)}var Tt=wt.extend({initialize:function(t,e){b(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e=W(t)?t:t.features,i,n,r;if(e){for(i=0,n=e.length;i<n;i++)r=e[i],(r.geometries||r.geometry||r.features||r.coordinates)&&this.addData(r);return this}var h=this.options;if(h.filter&&!h.filter(t))return this;var d=Oe(t,h);return d?(d.feature=Ne(t),d.defaultOptions=d.options,this.resetStyle(d),h.onEachFeature&&h.onEachFeature(t,d),this.addLayer(d)):this},resetStyle:function(t){return t===void 0?this.eachLayer(this.resetStyle,this):(t.options=a({},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&&(typeof e=="function"&&(e=e(t.feature)),t.setStyle(e))}});function Oe(t,e){var i=t.type==="Feature"?t.geometry:t,n=i?i.coordinates:null,r=[],h=e&&e.pointToLayer,d=e&&e.coordsToLatLng||Ni,p,v,w,I;if(!n&&!i)return null;switch(i.type){case"Point":return p=d(n),qn(h,t,p,e);case"MultiPoint":for(w=0,I=n.length;w<I;w++)p=d(n[w]),r.push(qn(h,t,p,e));return new wt(r);case"LineString":case"MultiLineString":return v=ze(n,i.type==="LineString"?0:1,d),new Lt(v,e);case"Polygon":case"MultiPolygon":return v=ze(n,i.type==="Polygon"?1:2,d),new qt(v,e);case"GeometryCollection":for(w=0,I=i.geometries.length;w<I;w++){var k=Oe({geometry:i.geometries[w],type:"Feature",properties:t.properties},e);k&&r.push(k)}return new wt(r);case"FeatureCollection":for(w=0,I=i.features.length;w<I;w++){var N=Oe(i.features[w],e);N&&r.push(N)}return new wt(r);default:throw new Error("Invalid GeoJSON object.")}}function qn(t,e,i,n){return t?t(e,i):new Be(i,n&&n.markersInheritOptions&&n)}function Ni(t){return new X(t[1],t[0],t[2])}function ze(t,e,i){for(var n=[],r=0,h=t.length,d;r<h;r++)d=e?ze(t[r],e-1,i):(i||Ni)(t[r]),n.push(d);return n}function Fi(t,e){return t=j(t),t.alt!==void 0?[g(t.lng,e),g(t.lat,e),g(t.alt,e)]:[g(t.lng,e),g(t.lat,e)]}function Re(t,e,i,n){for(var r=[],h=0,d=t.length;h<d;h++)r.push(e?Re(t[h],ct(t[h])?0:e-1,i,n):Fi(t[h],n));return!e&&i&&r.push(r[0].slice()),r}function Gt(t,e){return t.feature?a({},t.feature,{geometry:e}):Ne(e)}function Ne(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var Ui={toGeoJSON:function(t){return Gt(this,{type:"Point",coordinates:Fi(this.getLatLng(),t)})}};Be.include(Ui),Ri.include(Ui),Ze.include(Ui),Lt.include({toGeoJSON:function(t){var e=!ct(this._latlngs),i=Re(this._latlngs,e?1:0,!1,t);return Gt(this,{type:(e?"Multi":"")+"LineString",coordinates:i})}}),qt.include({toGeoJSON:function(t){var e=!ct(this._latlngs),i=e&&!ct(this._latlngs[0]),n=Re(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),Gt(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),$t.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(i){e.push(i.toGeoJSON(t).geometry.coordinates)}),Gt(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(e==="MultiPoint")return this.toMultiPoint(t);var i=e==="GeometryCollection",n=[];return this.eachLayer(function(r){if(r.toGeoJSON){var h=r.toGeoJSON(t);if(i)n.push(h.geometry);else{var d=Ne(h);d.type==="FeatureCollection"?n.push.apply(n,d.features):n.push(d)}}}),i?Gt(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});function Gn(t,e){return new Tt(t,e)}var Hr=Gn,Fe=mt.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=nt(e),b(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(R(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){J(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&&Ut(this._image),this},bringToBack:function(){return this._map&&Ht(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=nt(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=this._url.tagName==="IMG",e=this._image=t?this._url:$("img");if(R(e,"leaflet-image-layer"),this._zoomAnimated&&R(e,"leaflet-zoom-animated"),this.options.className&&R(e,this.options.className),e.onselectstart=_,e.onmousemove=_,e.onload=u(this.fire,this,"load"),e.onerror=u(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(e.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=e.src;return}e.src=this._url,e.alt=this.options.alt},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;At(this._image,i,e)},_reset:function(){var t=this._image,e=new K(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();tt(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){ut(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(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()}}),$r=function(t,e,i){return new Fe(t,e,i)},Xn=Fe.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",e=this._image=t?this._url:$("video");if(R(e,"leaflet-image-layer"),this._zoomAnimated&&R(e,"leaflet-zoom-animated"),this.options.className&&R(e,this.options.className),e.onselectstart=_,e.onmousemove=_,e.onloadeddata=u(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],r=0;r<i.length;r++)n.push(i[r].src);this._url=i.length>0?n:[e.src];return}W(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 h=0;h<this._url.length;h++){var d=$("source");d.src=this._url[h],e.appendChild(d)}}});function Vr(t,e,i){return new Xn(t,e,i)}var jn=Fe.extend({_initImage:function(){var t=this._image=this._url;R(t,"leaflet-image-layer"),this._zoomAnimated&&R(t,"leaflet-zoom-animated"),this.options.className&&R(t,this.options.className),t.onselectstart=_,t.onmousemove=_}});function qr(t,e,i){return new jn(t,e,i)}var yt=mt.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,e){t&&(t instanceof X||W(t))?(this._latlng=j(t),b(this,e)):(b(this,t),this._source=e),this.options.content&&(this._content=this.options.content)},openOn:function(t){return t=arguments.length?t:this._source._map,t.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&&ut(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&ut(this._container,1),this.bringToFront(),this.options.interactive&&(R(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(ut(this._container,0),this._removeTimeout=setTimeout(u(J,void 0,this._container),200)):J(this._container),this.options.interactive&&(Q(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=j(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&&Ut(this._container),this},bringToBack:function(){return this._map&&Ht(this._container),this},_prepareOpen:function(t){var e=this._source;if(!e._map)return!1;if(e instanceof wt){e=null;var i=this._source._layers;for(var n in i)if(i[n]._map){e=i[n];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)t=e.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,e=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof e=="string")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=B(this.options.offset),i=this._getAnchor();this._zoomAnimated?tt(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}});U.include({_initOverlay:function(t,e,i,n){var r=e;return r instanceof t||(r=new t(n).setContent(e)),i&&r.setLatLng(i),r}}),mt.include({_initOverlay:function(t,e,i,n){var r=i;return r instanceof t?(b(r,n),r._source=this):(r=e&&!n?e:new t(n,this),r.setContent(i)),r}});var Ue=yt.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,!t.hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,yt.prototype.openOn.call(this,t)},onAdd:function(t){yt.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof kt||this._source.on("preclick",Zt))},onRemove:function(t){yt.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof kt||this._source.off("preclick",Zt))},getEvents:function(){var t=yt.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?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=$("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=$("div",t+"-content-wrapper",e);if(this._contentNode=$("div",t+"-content",i),re(e),ki(this._contentNode),z(e,"contextmenu",Zt),this._tipContainer=$("div",t+"-tip-container",e),this._tip=$("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=$("a",t+"-close-button",e);n.setAttribute("role","button"),n.setAttribute("aria-label","Close popup"),n.href="#close",n.innerHTML='<span aria-hidden="true">&#215;</span>',z(n,"click",function(r){ot(r),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,r=this.options.maxHeight,h="leaflet-popup-scrolled";r&&n>r?(e.height=r+"px",R(t,h)):Q(t,h),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();tt(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,e=parseInt(ee(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,r=new A(this._containerLeft,-i-this._containerBottom);r._add(Bt(this._container));var h=t.layerPointToContainerPoint(r),d=B(this.options.autoPanPadding),p=B(this.options.autoPanPaddingTopLeft||d),v=B(this.options.autoPanPaddingBottomRight||d),w=t.getSize(),I=0,k=0;h.x+n+v.x>w.x&&(I=h.x+n-w.x+v.x),h.x-I-p.x<0&&(I=h.x-p.x),h.y+i+v.y>w.y&&(k=h.y+i-w.y+v.y),h.y-k-p.y<0&&(k=h.y-p.y),(I||k)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([I,k]))}},_getAnchor:function(){return B(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Gr=function(t,e){return new Ue(t,e)};U.mergeOptions({closePopupOnClick:!0}),U.include({openPopup:function(t,e,i){return this._initOverlay(Ue,t,e,i).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),mt.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Ue,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 wt||(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():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){Ot(t);var e=t.layer||t.target;if(this._popup._source===e&&!(e instanceof kt)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=e,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var He=yt.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){yt.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){yt.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=yt.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",e=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=$("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+f(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i,n=this._map,r=this._container,h=n.latLngToContainerPoint(n.getCenter()),d=n.layerPointToContainerPoint(t),p=this.options.direction,v=r.offsetWidth,w=r.offsetHeight,I=B(this.options.offset),k=this._getAnchor();p==="top"?(e=v/2,i=w):p==="bottom"?(e=v/2,i=0):p==="center"?(e=v/2,i=w/2):p==="right"?(e=0,i=w/2):p==="left"?(e=v,i=w/2):d.x<h.x?(p="right",e=0,i=w/2):(p="left",e=v+(I.x+k.x)*2,i=w/2),t=t.subtract(B(e,i,!0)).add(I).add(k),Q(r,"leaflet-tooltip-right"),Q(r,"leaflet-tooltip-left"),Q(r,"leaflet-tooltip-top"),Q(r,"leaflet-tooltip-bottom"),R(r,"leaflet-tooltip-"+p),tt(r,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&ut(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return B(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Xr=function(t,e){return new He(t,e)};U.include({openTooltip:function(t,e,i){return this._initOverlay(He,t,e,i).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),mt.include({bindTooltip:function(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(He,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",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,i.click=this._openTooltip,this._map?this._addFocusListeners():i.add=this._addFocusListeners),this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof wt||(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=t.getElement();e&&(z(e,"focus",function(){this._tooltip._source=t,this.openTooltip()},this),z(e,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var e=t.getElement();e&&e.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){!this._tooltip||!this._map||this._map.dragging&&this._map.dragging.moving()||(this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0))},_moveTooltip:function(t){var e=t.latlng,i,n;this._tooltip.options.sticky&&t.originalEvent&&(i=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(i),e=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(e)}});var Yn=Vt.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&t.tagName==="DIV"?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(Ie(e),e.appendChild(i.html)):e.innerHTML=i.html!==!1?i.html:"",i.bgPos){var n=B(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function jr(t){return new Yn(t)}Vt.Default=le;var he=mt.extend({options:{tileSize:256,opacity:1,updateWhenIdle:D.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){b(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),J(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Ut(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Ht(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=m(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 A?t:new A(t,t)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e=this.getPane().children,i=-t(-1/0,1/0),n=0,r=e.length,h;n<r;n++)h=e[n].style.zIndex,e[n]!==this._container&&h&&(i=t(i,+h));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!D.ielt9){ut(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var r=this._tiles[n];if(!(!r.current||!r.loaded)){var h=Math.min(1,(t-r.loaded)/200);ut(r.el,h),h<1?e=!0:(r.active?i=!0:this._onOpaqueTile(r),r.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(G(this._fadeFrame),this._fadeFrame=q(this._updateOpacity,this))}},_onOpaqueTile:_,_initContainer:function(){this._container||(this._container=$("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(t!==void 0){for(var i in this._levels)i=Number(i),this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(J(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],r=this._map;return n||(n=this._levels[t]={},n.el=$("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=r.project(r.unproject(r.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,r.getCenter(),r.getZoom()),_(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:_,_onRemoveLevel:_,_onCreateLevel:_,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom){this._removeAllTiles();return}for(t in this._tiles)e=this._tiles[t],e.retain=e.current;for(t in this._tiles)if(e=this._tiles[t],e.current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.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)J(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var r=Math.floor(t/2),h=Math.floor(e/2),d=i-1,p=new A(+r,+h);p.z=+d;var v=this._tileCoordsToKey(p),w=this._tiles[v];return w&&w.active?(w.retain=!0,!0):(w&&w.loaded&&(w.retain=!0),d>n?this._retainParent(r,h,d,n):!1)},_retainChildren:function(t,e,i,n){for(var r=2*t;r<2*t+2;r++)for(var h=2*e;h<2*e+2;h++){var d=new A(r,h);d.z=i+1;var p=this._tileCoordsToKey(d),v=this._tiles[p];if(v&&v.active){v.retain=!0;continue}else v&&v.loaded&&(v.retain=!0);i+1<n&&this._retainChildren(r,h,i+1,n)}},_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 e.minNativeZoom!==void 0&&t<e.minNativeZoom?e.minNativeZoom:e.maxNativeZoom!==void 0&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var r=Math.round(e);this.options.maxZoom!==void 0&&r>this.options.maxZoom||this.options.minZoom!==void 0&&r<this.options.minZoom?r=void 0:r=this._clampZoom(r);var h=this.options.updateWhenZooming&&r!==this._tileZoom;(!n||h)&&(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),r!==void 0&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),r=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();D.any3d?At(t.el,r,n):tt(t.el,r)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),r=e.project(t,this._tileZoom).floor(),h=e.getSize().divideBy(n*2);return new K(r.subtract(h),r.add(h))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(t===void 0&&(t=e.getCenter()),this._tileZoom!==void 0){var n=this._getTiledPixelBounds(t),r=this._pxBoundsToTileRange(n),h=r.getCenter(),d=[],p=this.options.keepBuffer,v=new K(r.getBottomLeft().subtract([p,-p]),r.getTopRight().add([p,-p]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var w in this._tiles){var I=this._tiles[w].coords;(I.z!==this._tileZoom||!v.contains(new A(I.x,I.y)))&&(this._tiles[w].current=!1)}if(Math.abs(i-this._tileZoom)>1){this._setView(t,i);return}for(var k=r.min.y;k<=r.max.y;k++)for(var N=r.min.x;N<=r.max.x;N++){var dt=new A(N,k);if(dt.z=this._tileZoom,!!this._isValidTile(dt)){var Rt=this._tiles[this._tileCoordsToKey(dt)];Rt?Rt.current=!0:d.push(dt)}}if(d.sort(function(Et,Hi){return Et.distanceTo(h)-Hi.distanceTo(h)}),d.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Ve=document.createDocumentFragment();for(N=0;N<d.length;N++)this._addTile(d[N],Ve);this._level.el.appendChild(Ve)}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return nt(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),r=n.add(i),h=e.unproject(n,t.z),d=e.unproject(r,t.z);return[h,d]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new st(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new A(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(J(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){R(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=_,t.onmousemove=_,D.ielt9&&this.options.opacity<1&&ut(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),r=this.createTile(this._wrapCoords(t),u(this._tileReady,this,t));this._initTile(r),this.createTile.length<2&&q(u(this._tileReady,this,t,null,r)),tt(r,i),this._tiles[n]={el:r,coords:t,current:!0},e.appendChild(r),this.fire("tileloadstart",{tile:r,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);i=this._tiles[n],i&&(i.loaded=+new Date,this._map._fadeAnimated?(ut(i.el,0),G(this._fadeFrame),this._fadeFrame=q(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(R(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),D.ielt9||!this._map._fadeAnimated?q(this._pruneTiles,this):setTimeout(u(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new A(this._wrapX?y(t.x,this._wrapX):t.x,this._wrapY?y(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new K(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 Yr(t){return new he(t)}var Xt=he.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=b(this,e),e.detectRetina&&D.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),typeof e.subdomains=="string"&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&e===void 0&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return z(i,"load",u(this._tileOnLoad,this,e,i)),z(i,"error",u(this._tileOnError,this,e,i)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(i.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:D.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 S(this._url,a(e,this.options))},_tileOnLoad:function(t,e){D.ielt9?setTimeout(u(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,i=this.options.zoomReverse,n=this.options.zoomOffset;return i&&(t=e-t),t+n},_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,e.onload=_,e.onerror=_,!e.complete)){e.src=E;var i=this._tiles[t].coords;J(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:i})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",E),he.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(!(!this._map||i&&i.getAttribute("src")===E))return he.prototype._tileReady.call(this,t,e,i)}});function Kn(t,e){return new Xt(t,e)}var Jn=Xt.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=a({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);e=b(this,e);var r=e.detectRetina&&D.retina?2:1,h=this.getTileSize();i.width=h.x*r,i.height=h.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,Xt.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=at(i.project(e[0]),i.project(e[1])),r=n.min,h=n.max,d=(this._wmsVersion>=1.3&&this._crs===$n?[r.y,r.x,h.y,h.x]:[r.x,r.y,h.x,h.y]).join(","),p=Xt.prototype.getTileUrl.call(this,t);return p+M(this.wmsParams,p,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+d},setParams:function(t,e){return a(this.wmsParams,t),e||this.redraw(),this}});function Kr(t,e){return new Jn(t,e)}Xt.WMS=Jn,Kn.wms=Kr;var Mt=mt.extend({options:{padding:.1},initialize:function(t){b(this,t),f(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&R(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 i=this._map.getZoomScale(e,this._zoom),n=this._map.getSize().multiplyBy(.5+this.options.padding),r=this._map.project(this._center,e),h=n.multiplyBy(-i).add(r).subtract(this._map._getNewPixelOrigin(t,e));D.any3d?At(this._container,h,i):tt(this._container,h)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in 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(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new K(i,i.add(e.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Qn=Mt.extend({options:{tolerance:0},getEvents:function(){var t=Mt.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Mt.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");z(t,"mousemove",this._onMouseMove,this),z(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),z(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){G(this._redrawRequest),delete this._ctx,J(this._container),Y(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var e in this._layers)t=this._layers[e],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Mt.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=D.retina?2:1;tt(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",D.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Mt.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[f(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,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[f(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(typeof t.options.dashArray=="string"){var e=t.options.dashArray.split(/[, ]+/),i=[],n,r;for(r=0;r<e.length;r++){if(n=Number(e[r]),isNaN(n))return;i.push(n)}t.options._dashArray=i}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||q(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new K,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 i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,r,h,d=t._parts,p=d.length,v=this._ctx;if(p){for(v.beginPath(),i=0;i<p;i++){for(n=0,r=d[i].length;n<r;n++)h=d[i][n],v[n?"lineTo":"moveTo"](h.x,h.y);e&&v.closePath()}this._fillStroke(v,t)}}},_updateCircle:function(t){if(!(!this._drawing||t._empty())){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),r=(Math.max(Math.round(t._radiusY),1)||n)/n;r!==1&&(i.save(),i.scale(1,r)),i.beginPath(),i.arc(e.x,e.y/r,n,0,Math.PI*2,!1),r!==1&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&i.weight!==0&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e=this._map.mouseEventToLayerPoint(t),i,n,r=this._drawFirst;r;r=r.next)i=r.layer,i.options.interactive&&i._containsPoint(e)&&(!(t.type==="click"||t.type==="preclick")||!this._map._draggableMoved(i))&&(n=i);this._fireEvent(n?[n]:!1,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&&(Q(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var i,n,r=this._drawFirst;r;r=r.next)i=r.layer,i.options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(R(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,t),this._mouseHoverThrottled=!0,setTimeout(u(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;if(i)i.prev=n;else return;n?n.next=i:i&&(this._drawFirst=i),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 i=e.next,n=e.prev;if(n)n.next=i;else return;i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t)}}});function to(t){return D.canvas?new Qn(t):null}var ue=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Jr={_initContainer:function(){this._container=$("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Mt.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=ue("shape");R(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=ue("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[f(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;J(e),t.removeInteractiveTarget(e),delete this._layers[f(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,r=t._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(e||(e=t._stroke=ue("stroke")),r.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=W(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(r.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=ue("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,"+65535*360)},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){Ut(t._container)},_bringToBack:function(t){Ht(t._container)}},$e=D.vml?ue:on,ce=Mt.extend({_initContainer:function(){this._container=$e("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=$e("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){J(this._container),Y(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Mt.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;(!this._svgSize||!this._svgSize.equals(e))&&(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),tt(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=$e("path");t.options.className&&R(e,t.options.className),t.options.interactive&&R(e,"leaflet-interactive"),this._updateStyle(t),this._layers[f(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){J(t._path),t.removeInteractiveTarget(t._path),delete this._layers[f(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,rn(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n=Math.max(Math.round(t._radiusY),1)||i,r="a"+i+","+n+" 0 1,0 ",h=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+r+i*2+",0 "+r+-i*2+",0 ";this._setPath(t,h)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){Ut(t._path)},_bringToBack:function(t){Ht(t._path)}});D.vml&&ce.include(Jr);function eo(t){return D.svg||D.vml?new ce(t):null}U.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(t==="overlayPane"||t===void 0)return!1;var e=this._paneRenderers[t];return e===void 0&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&to(t)||eo(t)}});var io=qt.extend({initialize:function(t,e){qt.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=nt(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Qr(t,e){return new io(t,e)}ce.create=$e,ce.pointsToPath=rn,Tt.geometryToLayer=Oe,Tt.coordsToLatLng=Ni,Tt.coordsToLatLngs=ze,Tt.latLngToCoords=Fi,Tt.latLngsToCoords=Re,Tt.getFeature=Gt,Tt.asFeature=Ne,U.mergeOptions({boxZoom:!0});var no=vt.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(){z(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Y(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){J(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),ie(),Ti(),this._startPoint=this._map.mouseEventToContainerPoint(t),z(document,{contextmenu:Ot,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=$("div","leaflet-zoom-box",this._container),R(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new K(this._point,this._startPoint),i=e.getSize();tt(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(J(this._box),Q(this._container,"leaflet-crosshair")),ne(),Mi(),Y(document,{contextmenu:Ot,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(u(this._resetState,this),0);var e=new st(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});U.addInitHook("addHandler","boxZoom",no),U.mergeOptions({doubleClickZoom:!0});var oo=vt.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,i=e.getZoom(),n=e.options.zoomDelta,r=t.originalEvent.shiftKey?i-n:i+n;e.options.doubleClickZoom==="center"?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});U.addInitHook("addHandler","doubleClickZoom",oo),U.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ro=vt.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new Dt(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))}R(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Q(this._map._container,"leaflet-grab"),Q(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=nt(this._map.options.maxBounds);this._offsetLimit=at(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,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),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),i=this._initialWorldOffset,n=this._draggable._newPos.x,r=(n-e+i)%t+e-i,h=(n+e+i)%t-e-i,d=Math.abs(r+i)<Math.abs(h+i)?r:h;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=d},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||t.noInertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),h=(this._lastTime-this._times[0])/1e3,d=i.easeLinearity,p=r.multiplyBy(d/h),v=p.distanceTo([0,0]),w=Math.min(i.inertiaMaxSpeed,v),I=p.multiplyBy(w/v),k=w/(i.inertiaDeceleration*d),N=I.multiplyBy(-k/2).round();!N.x&&!N.y?e.fire("moveend"):(N=e._limitOffset(N,e.options.maxBounds),q(function(){e.panBy(N,{duration:k,easeLinearity:d,noMoveStart:!0,animate:!0})}))}}});U.addInitHook("addHandler","dragging",ro),U.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ao=vt.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"),z(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(),Y(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,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e=this._panKeys={},i=this.keyCodes,n,r;for(n=0,r=i.left.length;n<r;n++)e[i.left[n]]=[-1*t,0];for(n=0,r=i.right.length;n<r;n++)e[i.right[n]]=[t,0];for(n=0,r=i.down.length;n<r;n++)e[i.down[n]]=[0,t];for(n=0,r=i.up.length;n<r;n++)e[i.up[n]]=[0,-1*t]},_setZoomDelta:function(t){var e=this._zoomKeys={},i=this.keyCodes,n,r;for(n=0,r=i.zoomIn.length;n<r;n++)e[i.zoomIn[n]]=t;for(n=0,r=i.zoomOut.length;n<r;n++)e[i.zoomOut[n]]=-t},_addHooks:function(){z(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Y(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=t.keyCode,i=this._map,n;if(e in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(n=this._panKeys[e],t.shiftKey&&(n=B(n).multiplyBy(3)),i.options.maxBounds&&(n=i._limitOffset(B(n),i.options.maxBounds)),i.options.worldCopyJump){var r=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(n)));i.panTo(r)}else i.panBy(n)}else if(e in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[e]);else if(e===27&&i._popup&&i._popup.options.closeOnEscapeKey)i.closePopup();else return;Ot(t)}}});U.addInitHook("addHandler","keyboard",ao),U.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var so=vt.extend({addHooks:function(){z(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Y(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Dn(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(u(this._performZoom,this),n),Ot(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(this._map.options.wheelPxPerZoomLevel*4),r=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,h=i?Math.ceil(r/i)*i:r,d=t._limitZoom(e+(this._delta>0?h:-h))-e;this._delta=0,this._startTime=null,d&&(t.options.scrollWheelZoom==="center"?t.setZoom(e+d):t.setZoomAround(this._lastMousePos,e+d))}});U.addInitHook("addHandler","scrollWheelZoom",so);var ta=600;U.mergeOptions({tapHold:D.touchNative&&D.safari&&D.mobile,tapTolerance:15});var lo=vt.extend({addHooks:function(){z(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Y(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var e=t.touches[0];this._startPos=this._newPos=new A(e.clientX,e.clientY),this._holdTimeout=setTimeout(u(function(){this._cancel(),this._isTapValid()&&(z(document,"touchend",ot),z(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))},this),ta),z(document,"touchend touchcancel contextmenu",this._cancel,this),z(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){Y(document,"touchend",ot),Y(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),Y(document,"touchend touchcancel contextmenu",this._cancel,this),Y(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new A(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var i=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});i._simulated=!0,e.target.dispatchEvent(i)}});U.addInitHook("addHandler","tapHold",lo),U.mergeOptions({touchZoom:D.touch,bounceAtZoomLimits:!0});var ho=vt.extend({addHooks:function(){R(this._map._container,"leaflet-touch-zoom"),z(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Q(this._map._container,"leaflet-touch-zoom"),Y(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(!(!t.touches||t.touches.length!==2||e._animatingZoom||this._zooming)){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),e.options.touchZoom!=="center"&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),z(document,"touchmove",this._onTouchMove,this),z(document,"touchend touchcancel",this._onTouchEnd,this),ot(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),r=i.distanceTo(n)/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)),e.options.touchZoom==="center"){if(this._center=this._startLatLng,r===1)return}else{var h=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(r===1&&h.x===0&&h.y===0)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(h),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),G(this._animRequest);var d=u(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=q(d,this,!0),ot(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,G(this._animRequest),Y(document,"touchmove",this._onTouchMove,this),Y(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))}});U.addInitHook("addHandler","touchZoom",ho),U.BoxZoom=no,U.DoubleClickZoom=oo,U.Drag=ro,U.Keyboard=ao,U.ScrollWheelZoom=so,U.TapHold=lo,U.TouchZoom=ho,s.Bounds=K,s.Browser=D,s.CRS=bt,s.Canvas=Qn,s.Circle=Ri,s.CircleMarker=Ze,s.Class=pt,s.Control=ft,s.DivIcon=Yn,s.DivOverlay=yt,s.DomEvent=vr,s.DomUtil=_r,s.Draggable=Dt,s.Evented=It,s.FeatureGroup=wt,s.GeoJSON=Tt,s.GridLayer=he,s.Handler=vt,s.Icon=Vt,s.ImageOverlay=Fe,s.LatLng=X,s.LatLngBounds=st,s.Layer=mt,s.LayerGroup=$t,s.LineUtil=Wr,s.Map=U,s.Marker=Be,s.Mixin=Mr,s.Path=kt,s.Point=A,s.PolyUtil=Dr,s.Polygon=qt,s.Polyline=Lt,s.Popup=Ue,s.PosAnimation=kn,s.Projection=kr,s.Rectangle=io,s.Renderer=Mt,s.SVG=ce,s.SVGOverlay=jn,s.TileLayer=Xt,s.Tooltip=He,s.Transformation=di,s.Util=Me,s.VideoOverlay=Xn,s.bind=u,s.bounds=at,s.canvas=to,s.circle=Nr,s.circleMarker=Rr,s.control=ae,s.divIcon=jr,s.extend=a,s.featureGroup=Zr,s.geoJSON=Gn,s.geoJson=Hr,s.gridLayer=Yr,s.icon=Or,s.imageOverlay=$r,s.latLng=j,s.latLngBounds=nt,s.layerGroup=Br,s.map=yr,s.marker=zr,s.point=B,s.polygon=Ur,s.polyline=Fr,s.popup=Gr,s.rectangle=Qr,s.setOptions=b,s.stamp=f,s.svg=eo,s.svgOverlay=qr,s.tileLayer=Kn,s.tooltip=Xr,s.transformation=Jt,s.version=o,s.videoOverlay=Vr;var ea=window.L;s.noConflict=function(){return window.L=ea,this},window.L=s})});var de=class{constructor(o,a,l){this.wxapi=o;this._busy=!1;let u=document.createElement("div");u.className="mapboxgl-ctrl leaflet-control",u.style.borderStyle="solid",u.style.borderColor="#000",u.style.backgroundColor="#aaaaaaaa",u.style.padding="5px",u.style.display="flex",u.style.flexDirection="column",this._div=u;let c=document.createElement("label");c.innerText="Dataset",u.appendChild(c),this.datasets=document.createElement("select"),u.appendChild(this.datasets),this.fillDatasets(a,l),this.datasets.addEventListener("change",async()=>{if(this._busy)return;this.setBusy(!0);let m=this.datasets.value;await this.fillVariables();let y=this.variables.value;await this.onchange?.(this.datasets.value,this.variables.value),this.datasets.value=m,this.variables.value=y,this.setBusy(!1)});let f=document.createElement("label");f.innerText="Variable",u.appendChild(f),this.variables=document.createElement("select"),u.appendChild(this.variables),this.variables.addEventListener("change",async()=>{if(this._busy)return;this.setBusy(!0);let m=this.variables.value;await this.onchange?.(this.datasets.value,this.variables.value),this.variables.value=m,this.setBusy(!1)}),this.datasets.value=a||"",this.variables.value=l||""}setBusy(o){this._busy=o,this._div.style.backgroundColor=o?"yellow":"lightgray"}async fillDatasets(o,a){this.datasets.options.length=0;let l=await this.wxapi.getAllDatasetsNames();for(let u of l){let c=document.createElement("option");c.value=u,c.text=u,this.datasets.appendChild(c)}o&&(this.datasets.value=o),await this.fillVariables(a)}async fillVariables(o){this.variables.options.length=0;let a=this.datasets.value,l=await this.wxapi.getDatasetAllVariables(a);if(l)for(let u of l){let c=document.createElement("option");c.value=u,c.text=u,this.variables.appendChild(c)}o&&this.variables.options.length&&(this.variables.value=o)}onAdd(){return this._div}onRemove(){this._div.parentNode?.removeChild(this._div)}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var fe=class{constructor(){this.pos={lng:0,lat:0};let o=document.createElement("div");o.className="mapboxgl-ctrl leaflet-control",o.style.borderStyle="solid",o.style.borderColor="#000",o.style.backgroundColor="#aaaaaaaa",o.style.padding="5px",this.div=o}onAdd(){return this.div}onRemove(){this.div.parentNode?.removeChild(this.div)}update(o,a,l){if(l&&(this.pos=l),!o){this.div.innerHTML="";return}let{min:u,max:c,units:f}=o.getCurrentVariableMeta(),{datasetName:m}=o.wxdatasetManager,y=o.wxdatasetManager.getInstanceMeta(o.getTime()),{sourceID:_,baseAtmosphericModel:g,model:x}=y;this.div.innerHTML=`lnglat=(${this.pos.lng.toFixed(2)}, ${this.pos.lat.toFixed(2)})<br>`,this.div.innerHTML+=_&&`sourceID=${_}<br>`||"",this.div.innerHTML+=g&&`baseAtmosphericModel=${g}<br>`||"",this.div.innerHTML+=x&&`model=${x}<br>`||"",this.div.innerHTML+=`dataset=${m}<br>
1
+ (()=>{var ca=Object.create;var po=Object.defineProperty;var da=Object.getOwnPropertyDescriptor;var fa=Object.getOwnPropertyNames;var ma=Object.getPrototypeOf,pa=Object.prototype.hasOwnProperty;var _a=(s,o)=>()=>(o||s((o={exports:{}}).exports,o),o.exports);var ga=(s,o,a,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of fa(o))!pa.call(s,u)&&u!==a&&po(s,u,{get:()=>o[u],enumerable:!(l=da(o,u))||l.enumerable});return s};var _o=(s,o,a)=>(a=s!=null?ca(ma(s)):{},ga(o||!s||!s.__esModule?po(a,"default",{value:s,enumerable:!0}):a,s));var tn=_a((oi,Eo)=>{(function(s,o){typeof oi=="object"&&typeof Eo<"u"?o(oi):typeof define=="function"&&define.amd?define(["exports"],o):(s=typeof globalThis<"u"?globalThis:s||self,o(s.leaflet={}))})(oi,function(s){"use strict";var o="1.9.4";function a(t){var e,i,n,r;for(i=1,n=arguments.length;i<n;i++){r=arguments[i];for(e in r)t[e]=r[e]}return t}var l=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function u(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var c=0;function d(t){return"_leaflet_id"in t||(t._leaflet_id=++c),t._leaflet_id}function _(t,e,i){var n,r,h,f;return f=function(){n=!1,r&&(h.apply(i,r),r=!1)},h=function(){n?r=arguments:(t.apply(i,arguments),setTimeout(f,e),n=!0)},h}function g(t,e,i){var n=e[1],r=e[0],h=n-r;return t===n&&i?t:((t-r)%h+h)%h+r}function m(){return!1}function v(t,e){if(e===!1)return t;var i=Math.pow(10,e===void 0?6:e);return Math.round(t*i)/i}function x(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function T(t){return x(t).split(/\s+/)}function b(t,e){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?l(t.options):{});for(var i in e)t.options[i]=e[i];return t.options}function M(t,e,i){var n=[];for(var r in t)n.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(t[r]));return(!e||e.indexOf("?")===-1?"?":"&")+n.join("&")}var C=/\{ *([\w_ -]+) *\}/g;function S(t,e){return t.replace(C,function(i,n){var r=e[n];if(r===void 0)throw new Error("No value provided for variable "+i);return typeof r=="function"&&(r=r(e)),r})}var W=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function Z(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var A="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function O(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var V=0;function F(t){var e=+new Date,i=Math.max(0,16-(e-V));return V=e+i,window.setTimeout(t,i)}var K=window.requestAnimationFrame||O("RequestAnimationFrame")||F,X=window.cancelAnimationFrame||O("CancelAnimationFrame")||O("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function j(t,e,i){if(i&&K===F)t.call(e);else return K.call(window,u(t,e))}function q(t){t&&X.call(window,t)}var Lt={__proto__:null,extend:a,create:l,bind:u,get lastId(){return c},stamp:d,throttle:_,wrapNum:g,falseFn:m,formatNum:v,trim:x,splitWords:T,setOptions:b,getParamString:M,template:S,isArray:W,indexOf:Z,emptyImageUrl:A,requestFn:K,cancelFn:X,requestAnimFrame:j,cancelAnimFrame:q};function dt(){}dt.extend=function(t){var e=function(){b(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,n=l(i);n.constructor=e,e.prototype=n;for(var r in this)Object.prototype.hasOwnProperty.call(this,r)&&r!=="prototype"&&r!=="__super__"&&(e[r]=this[r]);return t.statics&&a(e,t.statics),t.includes&&(nn(t.includes),a.apply(null,[n].concat(t.includes))),a(n,t),delete n.statics,delete n.includes,n.options&&(n.options=i.options?l(i.options):{},a(n.options,t.options)),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var h=0,f=n._initHooks.length;h<f;h++)n._initHooks[h].call(this)}},e},dt.include=function(t){var e=this.prototype.options;return a(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},dt.mergeOptions=function(t){return a(this.prototype.options,t),this},dt.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i=typeof t=="function"?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};function nn(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=W(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)}}var J={on:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e);else{t=T(t);for(var r=0,h=t.length;r<h;r++)this._on(t[r],e,i)}return this},off:function(t,e,i){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var n in t)this._off(n,t[n],e);else{t=T(t);for(var r=arguments.length===1,h=0,f=t.length;h<f;h++)r?this._off(t[h]):this._off(t[h],e,i)}return this},_on:function(t,e,i,n){if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}if(this._listens(t,e,i)===!1){i===this&&(i=void 0);var r={fn:e,ctx:i};n&&(r.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(r)}},_off:function(t,e,i){var n,r,h;if(this._events&&(n=this._events[t],!!n)){if(arguments.length===1){if(this._firingCount)for(r=0,h=n.length;r<h;r++)n[r].fn=m;delete this._events[t];return}if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}var f=this._listens(t,e,i);if(f!==!1){var p=n[f];this._firingCount&&(p.fn=m,this._events[t]=n=n.slice()),n.splice(f,1)}}},fire:function(t,e,i){if(!this.listens(t,i))return this;var n=a({},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 h=0,f=r.length;h<f;h++){var p=r[h],y=p.fn;p.once&&this.off(t,y,p.ctx),y.call(p.ctx||this,n)}this._firingCount--}}return i&&this._propagateEvent(n),this},listens:function(t,e,i,n){typeof t!="string"&&console.warn('"string" type argument expected');var r=e;typeof e!="function"&&(n=!!e,r=void 0,i=void 0);var h=this._events&&this._events[t];if(h&&h.length&&this._listens(t,r,i)!==!1)return!0;if(n){for(var f in this._eventParents)if(this._eventParents[f].listens(t,e,i,n))return!0}return!1},_listens:function(t,e,i){if(!this._events)return!1;var n=this._events[t]||[];if(!e)return!!n.length;i===this&&(i=void 0);for(var r=0,h=n.length;r<h;r++)if(n[r].fn===e&&n[r].ctx===i)return r;return!1},once:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e,!0);else{t=T(t);for(var r=0,h=t.length;r<h;r++)this._on(t[r],e,i,!0)}return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[d(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[d(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,a({layer:t.target,propagatedFrom:t.target},t),!0)}};J.addEventListener=J.on,J.removeEventListener=J.clearAllEventListeners=J.off,J.addOneTimeEventListener=J.once,J.fireEvent=J.fire,J.hasEventListeners=J.listens;var kt=dt.extend(J);function B(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var te=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};B.prototype={clone:function(){return new B(this.x,this.y)},add:function(t){return this.clone()._add(E(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(E(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 B(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new B(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=te(this.x),this.y=te(this.y),this},distanceTo:function(t){t=E(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=E(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=E(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+v(this.x)+", "+v(this.y)+")"}};function E(t,e,i){return t instanceof B?t:W(t)?new B(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new B(t.x,t.y):new B(t,e,i)}function Q(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n<r;n++)this.extend(i[n])}Q.prototype={extend:function(t){var e,i;if(!t)return this;if(t instanceof B||typeof t[0]=="number"||"x"in t)e=i=E(t);else if(t=lt(t),e=t.min,i=t.max,!e||!i)return this;return!this.min&&!this.max?(this.min=e.clone(),this.max=i.clone()):(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},getCenter:function(t){return E((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return E(this.min.x,this.max.y)},getTopRight:function(){return E(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,i;return typeof t[0]=="number"||t instanceof B?t=E(t):t=lt(t),t instanceof Q?(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:function(t){t=lt(t);var e=this.min,i=this.max,n=t.min,r=t.max,h=r.x>=e.x&&n.x<=i.x,f=r.y>=e.y&&n.y<=i.y;return h&&f},overlaps:function(t){t=lt(t);var e=this.min,i=this.max,n=t.min,r=t.max,h=r.x>e.x&&n.x<i.x,f=r.y>e.y&&n.y<i.y;return h&&f},isValid:function(){return!!(this.min&&this.max)},pad:function(t){var e=this.min,i=this.max,n=Math.abs(e.x-i.x)*t,r=Math.abs(e.y-i.y)*t;return lt(E(e.x-n,e.y-r),E(i.x+n,i.y+r))},equals:function(t){return t?(t=lt(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight())):!1}};function lt(t,e){return!t||t instanceof Q?t:new Q(t,e)}function ht(t,e){if(t)for(var i=e?[t,e]:t,n=0,r=i.length;n<r;n++)this.extend(i[n])}ht.prototype={extend:function(t){var e=this._southWest,i=this._northEast,n,r;if(t instanceof G)n=t,r=t;else if(t instanceof ht){if(n=t._southWest,r=t._northEast,!n||!r)return this}else return t?this.extend(H(t)||it(t)):this;return!e&&!i?(this._southWest=new G(n.lat,n.lng),this._northEast=new G(r.lat,r.lng)):(e.lat=Math.min(n.lat,e.lat),e.lng=Math.min(n.lng,e.lng),i.lat=Math.max(r.lat,i.lat),i.lng=Math.max(r.lng,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,r=Math.abs(e.lng-i.lng)*t;return new ht(new G(e.lat-n,e.lng-r),new G(i.lat+n,i.lng+r))},getCenter:function(){return new G((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 G(this.getNorth(),this.getWest())},getSouthEast:function(){return new G(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){typeof t[0]=="number"||t instanceof G||"lat"in t?t=H(t):t=it(t);var e=this._southWest,i=this._northEast,n,r;return t instanceof ht?(n=t.getSouthWest(),r=t.getNorthEast()):n=r=t,n.lat>=e.lat&&r.lat<=i.lat&&n.lng>=e.lng&&r.lng<=i.lng},intersects:function(t){t=it(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),h=r.lat>=e.lat&&n.lat<=i.lat,f=r.lng>=e.lng&&n.lng<=i.lng;return h&&f},overlaps:function(t){t=it(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=t.getNorthEast(),h=r.lat>e.lat&&n.lat<i.lat,f=r.lng>e.lng&&n.lng<i.lng;return h&&f},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return t?(t=it(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function it(t,e){return t instanceof ht?t:new ht(t,e)}function G(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,i!==void 0&&(this.alt=+i)}G.prototype={equals:function(t,e){if(!t)return!1;t=H(t);var i=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return i<=(e===void 0?1e-9:e)},toString:function(t){return"LatLng("+v(this.lat,t)+", "+v(this.lng,t)+")"},distanceTo:function(t){return Et.distance(this,H(t))},wrap:function(){return Et.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return it([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new G(this.lat,this.lng,this.alt)}};function H(t,e,i){return t instanceof G?t:W(t)&&typeof t[0]!="object"?t.length===3?new G(t[0],t[1],t[2]):t.length===2?new G(t[0],t[1]):null:t==null?t:typeof t=="object"&&"lat"in t?new G(t.lat,"lng"in t?t.lng:t.lon,t.alt):e===void 0?null:new G(t,e,i)}var Mt={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},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,i=this.scale(t),n=this.transformation.transform(e.min,i),r=this.transformation.transform(e.max,i);return new Q(n,r)},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?g(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?g(t.lat,this.wrapLat,!0):t.lat,n=t.alt;return new G(i,e,n)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,r=e.lng-i.lng;if(n===0&&r===0)return t;var h=t.getSouthWest(),f=t.getNorthEast(),p=new G(h.lat-n,h.lng-r),y=new G(f.lat-n,f.lng-r);return new ht(p,y)}},Et=a({},Mt,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,r=e.lat*i,h=Math.sin((e.lat-t.lat)*i/2),f=Math.sin((e.lng-t.lng)*i/2),p=h*h+Math.cos(n)*Math.cos(r)*f*f,y=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return this.R*y}}),on=6378137,hi={R:on,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),r=Math.sin(n*e);return new B(this.R*t.lng*e,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(t){var e=180/Math.PI;return new G((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){var t=on*Math.PI;return new Q([-t,-t],[t,t])}()};function ui(t,e,i,n){if(W(t)){this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3];return}this._a=t,this._b=e,this._c=i,this._d=n}ui.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 B((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};function ee(t,e,i,n){return new ui(t,e,i,n)}var ci=a({},Et,{code:"EPSG:3857",projection:hi,transformation:function(){var t=.5/(Math.PI*hi.R);return ee(t,.5,-t,.5)}()}),Fo=a({},ci,{code:"EPSG:900913"});function rn(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function an(t,e){var i="",n,r,h,f,p,y;for(n=0,h=t.length;n<h;n++){for(p=t[n],r=0,f=p.length;r<f;r++)y=p[r],i+=(r?"L":"M")+y.x+" "+y.y;i+=e?D.svg?"z":"x":""}return i||"M0 0"}var di=document.documentElement.style,Se="ActiveXObject"in window,Ho=Se&&!document.addEventListener,sn="msLaunchUri"in navigator&&!("documentMode"in document),fi=yt("webkit"),ln=yt("android"),hn=yt("android 2")||yt("android 3"),Uo=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),$o=ln&&yt("Google")&&Uo<537&&!("AudioNode"in window),mi=!!window.opera,un=!sn&&yt("chrome"),cn=yt("gecko")&&!fi&&!mi&&!Se,Vo=!un&&yt("safari"),dn=yt("phantom"),fn="OTransition"in di,qo=navigator.platform.indexOf("Win")===0,mn=Se&&"transition"in di,pi="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!hn,pn="MozPerspective"in di,Go=!window.L_DISABLE_3D&&(mn||pi||pn)&&!fn&&!dn,ie=typeof orientation<"u"||yt("mobile"),Xo=ie&&fi,jo=ie&&pi,_n=!window.PointerEvent&&window.MSPointerEvent,gn=!!(window.PointerEvent||_n),vn="ontouchstart"in window||!!window.TouchEvent,Yo=!window.L_NO_TOUCH&&(vn||gn),Ko=ie&&mi,Jo=ie&&cn,Qo=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,tr=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",m,e),window.removeEventListener("testPassiveEventSupport",m,e)}catch{}return t}(),er=function(){return!!document.createElement("canvas").getContext}(),_i=!!(document.createElementNS&&rn("svg").createSVGRect),ir=!!_i&&function(){var t=document.createElement("div");return t.innerHTML="<svg/>",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),nr=!_i&&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&&typeof e.adj=="object"}catch{return!1}}(),or=navigator.platform.indexOf("Mac")===0,rr=navigator.platform.indexOf("Linux")===0;function yt(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var D={ie:Se,ielt9:Ho,edge:sn,webkit:fi,android:ln,android23:hn,androidStock:$o,opera:mi,chrome:un,gecko:cn,safari:Vo,phantom:dn,opera12:fn,win:qo,ie3d:mn,webkit3d:pi,gecko3d:pn,any3d:Go,mobile:ie,mobileWebkit:Xo,mobileWebkit3d:jo,msPointer:_n,pointer:gn,touch:Yo,touchNative:vn,mobileOpera:Ko,mobileGecko:Jo,retina:Qo,passiveEvents:tr,canvas:er,svg:_i,vml:nr,inlineSvg:ir,mac:or,linux:rr},yn=D.msPointer?"MSPointerDown":"pointerdown",xn=D.msPointer?"MSPointerMove":"pointermove",bn=D.msPointer?"MSPointerUp":"pointerup",wn=D.msPointer?"MSPointerCancel":"pointercancel",gi={touchstart:yn,touchmove:xn,touchend:bn,touchcancel:wn},Tn={touchstart:cr,touchmove:Pe,touchend:Pe,touchcancel:Pe},Ht={},Ln=!1;function ar(t,e,i){return e==="touchstart"&&ur(),Tn[e]?(i=Tn[e].bind(this,i),t.addEventListener(gi[e],i,!1),i):(console.warn("wrong event specified:",e),m)}function sr(t,e,i){if(!gi[e]){console.warn("wrong event specified:",e);return}t.removeEventListener(gi[e],i,!1)}function lr(t){Ht[t.pointerId]=t}function hr(t){Ht[t.pointerId]&&(Ht[t.pointerId]=t)}function Mn(t){delete Ht[t.pointerId]}function ur(){Ln||(document.addEventListener(yn,lr,!0),document.addEventListener(xn,hr,!0),document.addEventListener(bn,Mn,!0),document.addEventListener(wn,Mn,!0),Ln=!0)}function Pe(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){e.touches=[];for(var i in Ht)e.touches.push(Ht[i]);e.changedTouches=[e],t(e)}}function cr(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&at(e),Pe(t,e)}function dr(t){var e={},i,n;for(n in t)i=t[n],e[n]=i&&i.bind?i.bind(t):i;return t=e,e.type="dblclick",e.detail=2,e.isTrusted=!1,e._simulated=!0,e}var fr=200;function mr(t,e){t.addEventListener("dblclick",e);var i=0,n;function r(h){if(h.detail!==1){n=h.detail;return}if(!(h.pointerType==="mouse"||h.sourceCapabilities&&!h.sourceCapabilities.firesTouchEvents)){var f=Wn(h);if(!(f.some(function(y){return y instanceof HTMLLabelElement&&y.attributes.for})&&!f.some(function(y){return y instanceof HTMLInputElement||y instanceof HTMLSelectElement}))){var p=Date.now();p-i<=fr?(n++,n===2&&e(dr(h))):n=1,i=p}}}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}function pr(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var vi=We(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ne=We(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Sn=ne==="webkitTransition"||ne==="OTransition"?ne+"End":"transitionend";function Pn(t){return typeof t=="string"?document.getElementById(t):t}function oe(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||i==="auto")&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return i==="auto"?null:i}function $(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function tt(t){var e=t.parentNode;e&&e.removeChild(t)}function Ce(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Ut(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function $t(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function yi(t,e){if(t.classList!==void 0)return t.classList.contains(e);var i=Ie(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function R(t,e){if(t.classList!==void 0)for(var i=T(e),n=0,r=i.length;n<r;n++)t.classList.add(i[n]);else if(!yi(t,e)){var h=Ie(t);xi(t,(h?h+" ":"")+e)}}function et(t,e){t.classList!==void 0?t.classList.remove(e):xi(t,x((" "+Ie(t)+" ").replace(" "+e+" "," ")))}function xi(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e}function Ie(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal}function ft(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&_r(t,e)}function _r(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch{if(e===1)return}e=Math.round(e*100),i?(i.Enabled=e!==100,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function We(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ot(t,e,i){var n=e||new B(0,0);t.style[vi]=(D.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function nt(t,e){t._leaflet_pos=e,D.any3d?Ot(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function zt(t){return t._leaflet_pos||new B(0,0)}var re,ae,bi;if("onselectstart"in document)re=function(){z(window,"selectstart",at)},ae=function(){Y(window,"selectstart",at)};else{var se=We(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);re=function(){if(se){var t=document.documentElement.style;bi=t[se],t[se]="none"}},ae=function(){se&&(document.documentElement.style[se]=bi,bi=void 0)}}function wi(){z(window,"dragstart",at)}function Ti(){Y(window,"dragstart",at)}var De,Li;function Mi(t){for(;t.tabIndex===-1;)t=t.parentNode;t.style&&(ke(),De=t,Li=t.style.outlineStyle,t.style.outlineStyle="none",z(window,"keydown",ke))}function ke(){De&&(De.style.outlineStyle=Li,De=void 0,Li=void 0,Y(window,"keydown",ke))}function Cn(t){do t=t.parentNode;while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function Si(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var gr={__proto__:null,TRANSFORM:vi,TRANSITION:ne,TRANSITION_END:Sn,get:Pn,getStyle:oe,create:$,remove:tt,empty:Ce,toFront:Ut,toBack:$t,hasClass:yi,addClass:R,removeClass:et,setClass:xi,getClass:Ie,setOpacity:ft,testProp:We,setTransform:Ot,setPosition:nt,getPosition:zt,get disableTextSelection(){return re},get enableTextSelection(){return ae},disableImageDrag:wi,enableImageDrag:Ti,preventOutline:Mi,restoreOutline:ke,getSizedParentNode:Cn,getScale:Si};function z(t,e,i,n){if(e&&typeof e=="object")for(var r in e)Ci(t,r,e[r],i);else{e=T(e);for(var h=0,f=e.length;h<f;h++)Ci(t,e[h],i,n)}return this}var xt="_leaflet_events";function Y(t,e,i,n){if(arguments.length===1)In(t),delete t[xt];else if(e&&typeof e=="object")for(var r in e)Ii(t,r,e[r],i);else if(e=T(e),arguments.length===2)In(t,function(p){return Z(e,p)!==-1});else for(var h=0,f=e.length;h<f;h++)Ii(t,e[h],i,n);return this}function In(t,e){for(var i in t[xt]){var n=i.split(/\d/)[0];(!e||e(n))&&Ii(t,n,null,null,i)}}var Pi={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Ci(t,e,i,n){var r=e+d(i)+(n?"_"+d(n):"");if(t[xt]&&t[xt][r])return this;var h=function(p){return i.call(n||t,p||window.event)},f=h;!D.touchNative&&D.pointer&&e.indexOf("touch")===0?h=ar(t,e,h):D.touch&&e==="dblclick"?h=mr(t,h):"addEventListener"in t?e==="touchstart"||e==="touchmove"||e==="wheel"||e==="mousewheel"?t.addEventListener(Pi[e]||e,h,D.passiveEvents?{passive:!1}:!1):e==="mouseenter"||e==="mouseleave"?(h=function(p){p=p||window.event,Di(t,p)&&f(p)},t.addEventListener(Pi[e],h,!1)):t.addEventListener(e,f,!1):t.attachEvent("on"+e,h),t[xt]=t[xt]||{},t[xt][r]=h}function Ii(t,e,i,n,r){r=r||e+d(i)+(n?"_"+d(n):"");var h=t[xt]&&t[xt][r];if(!h)return this;!D.touchNative&&D.pointer&&e.indexOf("touch")===0?sr(t,e,h):D.touch&&e==="dblclick"?pr(t,h):"removeEventListener"in t?t.removeEventListener(Pi[e]||e,h,!1):t.detachEvent("on"+e,h),t[xt][r]=null}function Rt(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function Wi(t){return Ci(t,"wheel",Rt),this}function le(t){return z(t,"mousedown touchstart dblclick contextmenu",Rt),t._leaflet_disable_click=!0,this}function at(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Nt(t){return at(t),Rt(t),this}function Wn(t){if(t.composedPath)return t.composedPath();for(var e=[],i=t.target;i;)e.push(i),i=i.parentNode;return e}function Dn(t,e){if(!e)return new B(t.clientX,t.clientY);var i=Si(e),n=i.boundingClientRect;return new B((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var vr=D.linux&&D.chrome?window.devicePixelRatio:D.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function kn(t){return D.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/vr:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function Di(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch{return!1}return i!==t}var yr={__proto__:null,on:z,off:Y,stopPropagation:Rt,disableScrollPropagation:Wi,disableClickPropagation:le,preventDefault:at,stop:Nt,getPropagationPath:Wn,getMousePosition:Dn,getWheelDelta:kn,isExternalTarget:Di,addListener:z,removeListener:Y},En=kt.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=zt(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=j(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=this._duration*1e3;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),nt(this._el,i),this.fire("step")},_complete:function(){q(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),U=kt.extend({options:{crs:ci,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=b(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=u(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),e.zoom!==void 0&&(this._zoom=this._limitZoom(e.zoom)),e.center&&e.zoom!==void 0&&this.setView(H(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ne&&D.any3d&&!D.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),z(this._proxy,Sn,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){if(e=e===void 0?this._zoom:this._limitZoom(e),t=this._limitCenter(H(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&i!==!0){i.animate!==void 0&&(i.zoom=a({animate:i.animate},i.zoom),i.pan=a({animate:i.animate,duration:i.duration},i.pan));var n=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan);if(n)return clearTimeout(this._sizeTimer),this}return 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||(D.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(D.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),r=this.getSize().divideBy(2),h=t instanceof B?t:this.latLngToContainerPoint(t),f=h.subtract(r).multiplyBy(1-1/n),p=this.containerPointToLatLng(r.add(f));return this.setView(p,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():it(t);var i=E(e.paddingTopLeft||e.padding||[0,0]),n=E(e.paddingBottomRight||e.padding||[0,0]),r=this.getBoundsZoom(t,!1,i.add(n));if(r=typeof e.maxZoom=="number"?Math.min(e.maxZoom,r):r,r===1/0)return{center:t.getCenter(),zoom:r};var h=n.subtract(i).divideBy(2),f=this.project(t.getSouthWest(),r),p=this.project(t.getNorthEast(),r),y=this.unproject(f.add(p).divideBy(2).add(h),r);return{center:y,zoom:r}},fitBounds:function(t,e){if(t=it(t),!t.isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.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(t=E(t).round(),e=e||{},!t.x&&!t.y)return this.fire("moveend");if(e.animate!==!0&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new En,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),e.animate!==!1){R(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(i=i||{},i.animate===!1||!D.any3d)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),r=this.project(t),h=this.getSize(),f=this._zoom;t=H(t),e=e===void 0?f:e;var p=Math.max(h.x,h.y),y=p*this.getZoomScale(f,e),w=r.distanceTo(n)||1,I=1.42,k=I*I;function N(ot){var $e=ot?-1:1,sa=ot?y:p,la=y*y-p*p+$e*k*k*w*w,ha=2*sa*k*w,Hi=la/ha,mo=Math.sqrt(Hi*Hi+1)-Hi,ua=mo<1e-9?-18:Math.log(mo);return ua}function st(ot){return(Math.exp(ot)-Math.exp(-ot))/2}function rt(ot){return(Math.exp(ot)+Math.exp(-ot))/2}function pt(ot){return st(ot)/rt(ot)}var ut=N(0);function Yt(ot){return p*(rt(ut)/rt(ut+I*ot))}function na(ot){return p*(rt(ut)*pt(ut+I*ot)-st(ut))/k}function oa(ot){return 1-Math.pow(1-ot,1.5)}var ra=Date.now(),co=(N(1)-ut)/I,aa=i.duration?1e3*i.duration:1e3*co*.8;function fo(){var ot=(Date.now()-ra)/aa,$e=oa(ot)*co;ot<=1?(this._flyToFrame=j(fo,this),this._move(this.unproject(n.add(r.subtract(n).multiplyBy(na($e)/w)),f),this.getScaleZoom(p/Yt($e),f),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),fo.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return t=it(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 i=this.getCenter(),n=this._limitCenter(i,this._zoom,it(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var i=E(e.paddingTopLeft||e.padding||[0,0]),n=E(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),h=this.project(t),f=this.getPixelBounds(),p=lt([f.min.add(i),f.max.subtract(n)]),y=p.getSize();if(!p.contains(h)){this._enforcingBounds=!0;var w=h.subtract(p.getCenter()),I=p.extend(h).getSize().subtract(y);r.x+=w.x<0?-I.x:I.x,r.y+=w.y<0?-I.y:I.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=a({animate:!1,pan:!0},t===!0?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),r=i.divideBy(2).round(),h=n.subtract(r);return!h.x&&!h.y?this:(t.animate&&t.pan?this.panBy(h):(t.pan&&this._rawPanBy(h),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(u(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=a({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=u(this._handleGeolocationResponse,this),i=u(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,i=t.message||(e===1?"permission denied":e===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=t.coords.latitude,i=t.coords.longitude,n=new G(e,i),r=n.toBounds(t.coords.accuracy*2),h=this._locateOptions;if(h.setView){var f=this.getBoundsZoom(r);this.setView(n,h.maxZoom?Math.min(f,h.maxZoom):f)}var p={latlng:n,bounds:r,timestamp:t.timestamp};for(var y in t.coords)typeof t.coords[y]=="number"&&(p[y]=t.coords[y]);this.fire("locationfound",p)}},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.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{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),tt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(q(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)tt(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),n=$("div",i,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(),e=this.unproject(t.getBottomLeft()),i=this.unproject(t.getTopRight());return new ht(e,i)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=it(t),i=E(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),h=this.getMaxZoom(),f=t.getNorthWest(),p=t.getSouthEast(),y=this.getSize().subtract(i),w=lt(this.project(p,n),this.project(f,n)).getSize(),I=D.any3d?this.options.zoomSnap:1,k=y.x/w.x,N=y.y/w.y,st=e?Math.max(k,N):Math.min(k,N);return n=this.getScaleZoom(st,n),I&&(n=Math.round(n/(I/100))*(I/100),n=e?Math.ceil(n/I)*I:Math.floor(n/I)*I),Math.max(r,Math.min(h,n))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new B(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new Q(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=e===void 0?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=e===void 0?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.latLngToPoint(H(t),e)},unproject:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.pointToLatLng(E(t),e)},layerPointToLatLng:function(t){var e=E(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(H(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(H(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(it(t))},distance:function(t,e){return this.options.crs.distance(H(t),H(e))},containerPointToLayerPoint:function(t){return E(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return E(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(E(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(H(t)))},mouseEventToContainerPoint:function(t){return Dn(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=Pn(t);if(e){if(e._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");z(e,"scroll",this._onScroll,this),this._containerId=d(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&D.any3d,R(t,"leaflet-container"+(D.touch?" leaflet-touch":"")+(D.retina?" leaflet-retina":"")+(D.ielt9?" leaflet-oldie":"")+(D.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=oe(t,"position");e!=="absolute"&&e!=="relative"&&e!=="fixed"&&e!=="sticky"&&(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),nt(this._mapPane,new B(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(R(t.markerPane,"leaflet-zoom-hide"),R(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){nt(this._mapPane,new B(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var r=this._zoom!==e;this._moveStart(r,i)._move(t,e)._moveEnd(r),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i,n){e===void 0&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((r||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return q(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){nt(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[d(this._container)]=this;var e=t?Y:z;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),D.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){q(this._resizeRequest),this._resizeRequest=j(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 i=[],n,r=e==="mouseout"||e==="mouseover",h=t.target||t.srcElement,f=!1;h;){if(n=this._targets[d(h)],n&&(e==="click"||e==="preclick")&&this._draggableMoved(n)){f=!0;break}if(n&&n.listens(e,!0)&&(r&&!Di(h,t)||(i.push(n),r))||h===this._container)break;h=h.parentNode}return!i.length&&!f&&!r&&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||t.type==="click"&&this._isClickDisabled(e))){var i=t.type;i==="mousedown"&&Mi(e),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if(t.type==="click"){var n=a({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}var r=this._findEventTargets(t,e);if(i){for(var h=[],f=0;f<i.length;f++)i[f].listens(e,!0)&&h.push(i[f]);r=h.concat(r)}if(r.length){e==="contextmenu"&&at(t);var p=r[0],y={originalEvent:t};if(t.type!=="keypress"&&t.type!=="keydown"&&t.type!=="keyup"){var w=p.getLatLng&&(!p._radius||p._radius<=10);y.containerPoint=w?this.latLngToContainerPoint(p.getLatLng()):this.mouseEventToContainerPoint(t),y.layerPoint=this.containerPointToLayerPoint(y.containerPoint),y.latlng=w?p.getLatLng():this.layerPointToLatLng(y.layerPoint)}for(f=0;f<r.length;f++)if(r[f].fire(e,y,!0),y.originalEvent._stopped||r[f].options.bubblingMouseEvents===!1&&Z(this._mouseEvents,e)!==-1)return}},_draggableMoved:function(t){return t=t.dragging&&t.dragging.enabled()?t:this,t.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 zt(this._mapPane)||new B(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){var i=t&&e!==void 0?this._getNewPixelOrigin(t,e):this.getPixelOrigin();return i.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return lt([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),r=this.getSize().divideBy(2),h=new Q(n.subtract(r),n.add(r)),f=this._getBoundsOffset(h,i,e);return Math.abs(f.x)<=1&&Math.abs(f.y)<=1?t:this.unproject(n.add(f),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new Q(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=lt(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),r=n.min.subtract(t.min),h=n.max.subtract(t.max),f=this._rebound(r.x,-h.x),p=this._rebound(r.y,-h.y);return new B(f,p)},_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(),i=this.getMaxZoom(),n=D.any3d?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){et(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return(e&&e.animate)!==!0&&!this.getSize().contains(i)?!1:(this.panBy(i,e),!0)},_createAnimProxy:function(){var t=this._proxy=$("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(e){var i=vi,n=this._proxy.style[i];Ot(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){tt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();Ot(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,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/n);return i.animate!==!0&&!this.getSize().contains(r)?!1:(j(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(t,e,!0)},this),!0)},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,R(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(u(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&et(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 xr(t,e){return new U(t,e)}var _t=dt.extend({options:{position:"topright"},initialize:function(t){b(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),i=this.getPosition(),n=t._controlCorners[i];return R(e,"leaflet-control"),i.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(tt(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()}}),he=function(t){return new _t(t)};U.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=$("div",e+"control-container",this._container);function n(r,h){var f=e+r+" "+e+h;t[r+h]=$("div",f,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)tt(this._controlCorners[t]);tt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var An=_t.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){b(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var n in t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!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 _t.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(d(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){R(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?(R(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):et(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return et(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=$("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),le(e),Wi(e);var n=this._section=$("section",t+"-list");i&&(this._map.on("click",this.collapse,this),z(e,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var r=this._layersLink=$("a",t+"-toggle",e);r.href="#",r.title="Layers",r.setAttribute("role","button"),z(r,{keydown:function(h){h.keyCode===13&&this._expandSafely()},click:function(h){at(h),this._expandSafely()}},this),i||this.expand(),this._baseLayersList=$("div",t+"-base",n),this._separator=$("div",t+"-separator",n),this._overlaysList=$("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&d(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(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(u(function(n,r){return this.options.sortFunction(n.layer,r.layer,n.name,r.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Ce(this._baseLayersList),Ce(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,r=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,r+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&r>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(d(t.target)),i=e.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),n;t.overlay?(n=document.createElement("input"),n.type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=i):n=this._createRadioElement("leaflet-base-layers_"+d(this),i),this._layerControlInputs.push(n),n.layerId=d(t.layer),z(n,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var h=document.createElement("span");e.appendChild(h),h.appendChild(n),h.appendChild(r);var f=t.overlay?this._overlaysList:this._baseLayersList;return f.appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,e,i,n=[],r=[];this._handlingClick=!0;for(var h=t.length-1;h>=0;h--)e=t[h],i=this._getLayer(e.layerId).layer,e.checked?n.push(i):e.checked||r.push(i);for(h=0;h<r.length;h++)this._map.hasLayer(r[h])&&this._map.removeLayer(r[h]);for(h=0;h<n.length;h++)this._map.hasLayer(n[h])||this._map.addLayer(n[h]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t=this._layerControlInputs,e,i,n=this._map.getZoom(),r=t.length-1;r>=0;r--)e=t[r],i=this._getLayer(e.layerId).layer,e.disabled=i.options.minZoom!==void 0&&n<i.options.minZoom||i.options.maxZoom!==void 0&&n>i.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,z(t,"click",at),this.expand();var e=this;setTimeout(function(){Y(t,"click",at),e._preventClick=!1})}}),br=function(t,e,i){return new An(t,e,i)},ki=_t.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=$("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},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,i,n,r){var h=$("a",i,n);return h.innerHTML=t,h.href="#",h.title=e,h.setAttribute("role","button"),h.setAttribute("aria-label",e),le(h),z(h,"click",Nt),z(h,"click",r,this),z(h,"click",this._refocusOnMap,this),h},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";et(this._zoomInButton,e),et(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(R(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(R(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});U.mergeOptions({zoomControl:!0}),U.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ki,this.addControl(this.zoomControl))});var wr=function(t){return new ki(t)},Bn=_t.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=$("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=$("div",e,i)),t.imperial&&(this._iScale=$("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_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),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e=t*3.2808399,i,n,r;e>5280?(i=e/5280,n=this._getRoundNum(i),this._updateScale(this._iScale,n+" mi",n/i)):(r=this._getRoundNum(e),this._updateScale(this._iScale,r+" ft",r/e))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,e*i}}),Tr=function(t){return new Bn(t)},Lr='<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>',Ei=_t.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(D.inlineSvg?Lr+" ":"")+"Leaflet</a>"},initialize:function(t){b(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=$("div","leaflet-control-attribution"),le(this._container);for(var e in 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 i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(' <span aria-hidden="true">|</span> ')}}});U.mergeOptions({attributionControl:!0}),U.addInitHook(function(){this.options.attributionControl&&new Ei().addTo(this)});var Mr=function(t){return new Ei(t)};_t.Layers=An,_t.Zoom=ki,_t.Scale=Bn,_t.Attribution=Ei,he.layers=br,he.zoom=wr,he.scale=Tr,he.attribution=Mr;var bt=dt.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});bt.addTo=function(t,e){return t.addHandler(e,this),this};var Sr={Events:J},Zn=D.touch?"touchstart mousedown":"mousedown",At=kt.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){b(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(z(this._dragStartTarget,Zn,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(At._dragging===this&&this.finishDrag(!0),Y(this._dragStartTarget,Zn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!yi(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){At._dragging===this&&this.finishDrag();return}if(!(At._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(At._dragging=this,this._preventOutline&&Mi(this._element),wi(),re(),!this._moving)){this.fire("down");var e=t.touches?t.touches[0]:t,i=Cn(this._element);this._startPoint=new B(e.clientX,e.clientY),this._startPos=zt(this._element),this._parentScale=Si(i);var n=t.type==="mousedown";z(document,n?"mousemove":"touchmove",this._onMove,this),z(document,n?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var e=t.touches&&t.touches.length===1?t.touches[0]:t,i=new B(e.clientX,e.clientY)._subtract(this._startPoint);!i.x&&!i.y||Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,at(t),this._moved||(this.fire("dragstart"),this._moved=!0,R(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),R(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,this._lastEvent=t,this._updatePosition())}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),nt(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){et(document.body,"leaflet-dragging"),this._lastTarget&&(et(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Y(document,"mousemove touchmove",this._onMove,this),Y(document,"mouseup touchend touchcancel",this._onUp,this),Ti(),ae();var e=this._moved&&this._moving;this._moving=!1,At._dragging=!1,e&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function On(t,e,i){var n,r=[1,4,2,8],h,f,p,y,w,I,k,N;for(h=0,I=t.length;h<I;h++)t[h]._code=Ft(t[h],e);for(p=0;p<4;p++){for(k=r[p],n=[],h=0,I=t.length,f=I-1;h<I;f=h++)y=t[h],w=t[f],y._code&k?w._code&k||(N=Ee(w,y,k,e,i),N._code=Ft(N,e),n.push(N)):(w._code&k&&(N=Ee(w,y,k,e,i),N._code=Ft(N,e),n.push(N)),n.push(y));t=n}return t}function zn(t,e){var i,n,r,h,f,p,y,w,I;if(!t||t.length===0)throw new Error("latlngs not passed");mt(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var k=H([0,0]),N=it(t),st=N.getNorthWest().distanceTo(N.getSouthWest())*N.getNorthEast().distanceTo(N.getNorthWest());st<1700&&(k=Ai(t));var rt=t.length,pt=[];for(i=0;i<rt;i++){var ut=H(t[i]);pt.push(e.project(H([ut.lat-k.lat,ut.lng-k.lng])))}for(p=y=w=0,i=0,n=rt-1;i<rt;n=i++)r=pt[i],h=pt[n],f=r.y*h.x-h.y*r.x,y+=(r.x+h.x)*f,w+=(r.y+h.y)*f,p+=f*3;p===0?I=pt[0]:I=[y/p,w/p];var Yt=e.unproject(E(I));return H([Yt.lat+k.lat,Yt.lng+k.lng])}function Ai(t){for(var e=0,i=0,n=0,r=0;r<t.length;r++){var h=H(t[r]);e+=h.lat,i+=h.lng,n++}return H([e/n,i/n])}var Pr={__proto__:null,clipPolygon:On,polygonCenter:zn,centroid:Ai};function Rn(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=Wr(t,i),t=Ir(t,i),t}function Nn(t,e,i){return Math.sqrt(ue(t,e,i,!0))}function Cr(t,e,i){return ue(t,e,i)}function Ir(t,e){var i=t.length,n=typeof Uint8Array!=void 0+""?Uint8Array:Array,r=new n(i);r[0]=r[i-1]=1,Bi(t,r,e,0,i-1);var h,f=[];for(h=0;h<i;h++)r[h]&&f.push(t[h]);return f}function Bi(t,e,i,n,r){var h=0,f,p,y;for(p=n+1;p<=r-1;p++)y=ue(t[p],t[n],t[r],!0),y>h&&(f=p,h=y);h>i&&(e[f]=1,Bi(t,e,i,n,f),Bi(t,e,i,f,r))}function Wr(t,e){for(var i=[t[0]],n=1,r=0,h=t.length;n<h;n++)Dr(t[n],t[r])>e&&(i.push(t[n]),r=n);return r<h-1&&i.push(t[h-1]),i}var Fn;function Hn(t,e,i,n,r){var h=n?Fn:Ft(t,i),f=Ft(e,i),p,y,w;for(Fn=f;;){if(!(h|f))return[t,e];if(h&f)return!1;p=h||f,y=Ee(t,e,p,i,r),w=Ft(y,i),p===h?(t=y,h=w):(e=y,f=w)}}function Ee(t,e,i,n,r){var h=e.x-t.x,f=e.y-t.y,p=n.min,y=n.max,w,I;return i&8?(w=t.x+h*(y.y-t.y)/f,I=y.y):i&4?(w=t.x+h*(p.y-t.y)/f,I=p.y):i&2?(w=y.x,I=t.y+f*(y.x-t.x)/h):i&1&&(w=p.x,I=t.y+f*(p.x-t.x)/h),new B(w,I,r)}function Ft(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Dr(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function ue(t,e,i,n){var r=e.x,h=e.y,f=i.x-r,p=i.y-h,y=f*f+p*p,w;return y>0&&(w=((t.x-r)*f+(t.y-h)*p)/y,w>1?(r=i.x,h=i.y):w>0&&(r+=f*w,h+=p*w)),f=t.x-r,p=t.y-h,n?f*f+p*p:new B(r,h)}function mt(t){return!W(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Un(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),mt(t)}function $n(t,e){var i,n,r,h,f,p,y,w;if(!t||t.length===0)throw new Error("latlngs not passed");mt(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var I=H([0,0]),k=it(t),N=k.getNorthWest().distanceTo(k.getSouthWest())*k.getNorthEast().distanceTo(k.getNorthWest());N<1700&&(I=Ai(t));var st=t.length,rt=[];for(i=0;i<st;i++){var pt=H(t[i]);rt.push(e.project(H([pt.lat-I.lat,pt.lng-I.lng])))}for(i=0,n=0;i<st-1;i++)n+=rt[i].distanceTo(rt[i+1])/2;if(n===0)w=rt[0];else for(i=0,h=0;i<st-1;i++)if(f=rt[i],p=rt[i+1],r=f.distanceTo(p),h+=r,h>n){y=(h-n)/r,w=[p.x-y*(p.x-f.x),p.y-y*(p.y-f.y)];break}var ut=e.unproject(E(w));return H([ut.lat+I.lat,ut.lng+I.lng])}var kr={__proto__:null,simplify:Rn,pointToSegmentDistance:Nn,closestPointOnSegment:Cr,clipSegment:Hn,_getEdgeIntersection:Ee,_getBitCode:Ft,_sqClosestPointOnSegment:ue,isFlat:mt,_flat:Un,polylineCenter:$n},Zi={project:function(t){return new B(t.lng,t.lat)},unproject:function(t){return new G(t.y,t.x)},bounds:new Q([-180,-90],[180,90])},Oi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Q([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,r=this.R_MINOR/i,h=Math.sqrt(1-r*r),f=h*Math.sin(n),p=Math.tan(Math.PI/4-n/2)/Math.pow((1-f)/(1+f),h/2);return n=-i*Math.log(Math.max(p,1e-10)),new B(t.lng*e*i,n)},unproject:function(t){for(var e=180/Math.PI,i=this.R,n=this.R_MINOR/i,r=Math.sqrt(1-n*n),h=Math.exp(-t.y/i),f=Math.PI/2-2*Math.atan(h),p=0,y=.1,w;p<15&&Math.abs(y)>1e-7;p++)w=r*Math.sin(f),w=Math.pow((1-w)/(1+w),r/2),y=Math.PI/2-2*Math.atan(h*w)-f,f+=y;return new G(f*e,t.x*e/i)}},Er={__proto__:null,LonLat:Zi,Mercator:Oi,SphericalMercator:hi},Ar=a({},Et,{code:"EPSG:3395",projection:Oi,transformation:function(){var t=.5/(Math.PI*Oi.R);return ee(t,.5,-t,.5)}()}),Vn=a({},Et,{code:"EPSG:4326",projection:Zi,transformation:ee(1/180,1,-1/180,.5)}),Br=a({},Mt,{projection:Zi,transformation:ee(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 i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});Mt.Earth=Et,Mt.EPSG3395=Ar,Mt.EPSG3857=ci,Mt.EPSG900913=Fo,Mt.EPSG4326=Vn,Mt.Simple=Br;var gt=kt.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[d(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[d(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 i=this.getEvents();e.on(i,this),this.once("remove",function(){e.off(i,this)},this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});U.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=d(t);return this._layers[e]?this:(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var e=d(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 d(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){t=t?W(t)?t:[t]:[];for(var e=0,i=t.length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){(!isNaN(t.options.maxZoom)||!isNaN(t.options.minZoom))&&(this._zoomBoundLayers[d(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=d(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var r=this._zoomBoundLayers[n].options;t=r.minZoom===void 0?t:Math.min(t,r.minZoom),e=r.maxZoom===void 0?e:Math.max(e,r.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Vt=gt.extend({initialize:function(t,e){b(this,e),this._layers={};var i,n;if(t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},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){var e=typeof t=="number"?t:this.getLayerId(t);return e in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e=Array.prototype.slice.call(arguments,1),i,n;for(i in this._layers)n=this._layers[i],n[t]&&n[t].apply(n,e);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);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 d(t)}}),Zr=function(t,e){return new Vt(t,e)},St=Vt.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Vt.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),Vt.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 ht;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Or=function(t,e){return new St(t,e)},qt=dt.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){b(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if(t==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&e.tagName==="IMG"?e:null);return this._setIconStyles(n,t),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];typeof n=="number"&&(n=[n,n]);var r=E(n),h=E(e==="shadow"&&i.shadowAnchor||i.iconAnchor||r&&r.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),h&&(t.style.marginLeft=-h.x+"px",t.style.marginTop=-h.y+"px"),r&&(t.style.width=r.x+"px",t.style.height=r.y+"px")},_createImg:function(t,e){return e=e||document.createElement("img"),e.src=t,e},_getIconUrl:function(t){return D.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function zr(t){return new qt(t)}var ce=qt.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 typeof ce.imagePath!="string"&&(ce.imagePath=this._detectIconPath()),(this.options.imagePath||ce.imagePath)+qt.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var e=function(i,n,r){var h=n.exec(i);return h&&h[r]};return t=e(t,/^url\((['"])?(.+)\1\)$/,2),t&&e(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=$("div","leaflet-default-icon-path",document.body),e=oe(t,"background-image")||oe(t,"backgroundImage");if(document.body.removeChild(t),e=this._stripUrl(e),e)return e;var i=document.querySelector('link[href$="leaflet.css"]');return i?i.href.substring(0,i.href.length-11-1):""}}),qn=bt.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new At(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),R(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&&et(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,h=zt(e._icon),f=i.getPixelBounds(),p=i.getPixelOrigin(),y=lt(f.min._subtract(p).add(r),f.max._subtract(p).subtract(r));if(!y.contains(h)){var w=E((Math.max(y.max.x,h.x)-y.max.x)/(f.max.x-y.max.x)-(Math.min(y.min.x,h.x)-y.min.x)/(f.min.x-y.min.x),(Math.max(y.max.y,h.y)-y.max.y)/(f.max.y-y.max.y)-(Math.min(y.min.y,h.y)-y.min.y)/(f.min.y-y.min.y)).multiplyBy(n);i.panBy(w,{animate:!1}),this._draggable._newPos._add(w),this._draggable._startPos._add(w),nt(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=j(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&&(q(this._panRequest),this._panRequest=j(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=zt(e._icon),r=e._map.layerPointToLatLng(n);i&&nt(i,n),e._latlng=r,t.latlng=r,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){q(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Ae=gt.extend({options:{icon:new ce,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){b(this,e),this._latlng=H(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=H(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"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),i.tagName==="IMG"&&(i.alt=t.alt||"")),R(i,e),t.keyboard&&(i.tabIndex="0",i.setAttribute("role","button")),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&z(i,"focus",this._panOnFocus,this);var r=t.icon.createShadow(this._shadow),h=!1;r!==this._shadow&&(this._removeShadow(),h=!0),r&&(R(r,e),r.alt=""),this._shadow=r,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&h&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Y(this._icon,"focus",this._panOnFocus,this),tt(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&tt(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&nt(this._icon,t),this._shadow&&nt(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&&(R(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),qn)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new qn(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&&ft(this._icon,t),this._shadow&&ft(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,i=e.iconSize?E(e.iconSize):E(0,0),n=e.iconAnchor?E(e.iconAnchor):E(0,0);t.panInside(this._latlng,{paddingTopLeft:n,paddingBottomRight:i.subtract(n)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Rr(t,e){return new Ae(t,e)}var Bt=gt.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 b(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)}}),Be=Bt.extend({options:{fill:!0,radius:10},initialize:function(t,e){b(this,e),this._latlng=H(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=H(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 Bt.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,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new Q(this._point.subtract(n),this._point.add(n))},_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 Nr(t,e){return new Be(t,e)}var zi=Be.extend({initialize:function(t,e,i){if(typeof e=="number"&&(e=a({},i,{radius:e})),b(this,e),this._latlng=H(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 ht(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:Bt.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===Et.distance){var r=Math.PI/180,h=this._mRadius/Et.R/r,f=i.project([e+h,t]),p=i.project([e-h,t]),y=f.add(p).divideBy(2),w=i.unproject(y).lat,I=Math.acos((Math.cos(h*r)-Math.sin(e*r)*Math.sin(w*r))/(Math.cos(e*r)*Math.cos(w*r)))/r;(isNaN(I)||I===0)&&(I=h/Math.cos(Math.PI/180*e)),this._point=y.subtract(i.getPixelOrigin()),this._radius=isNaN(I)?0:y.x-i.project([w,t-I]).x,this._radiusY=y.y-f.y}else{var k=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(k).x}this._updateBounds()}});function Fr(t,e,i){return new zi(t,e,i)}var Pt=Bt.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){b(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=1/0,i=null,n=ue,r,h,f=0,p=this._parts.length;f<p;f++)for(var y=this._parts[f],w=1,I=y.length;w<I;w++){r=y[w-1],h=y[w];var k=n(t,r,h,!0);k<e&&(e=k,i=n(t,r,h))}return i&&(i.distance=Math.sqrt(e)),i},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return $n(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=H(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new ht,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return mt(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=mt(t),n=0,r=t.length;n<r;n++)i?(e[n]=H(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new Q;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 B(t,t);this._rawPxBounds&&(this._pxBounds=new Q([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]))},_projectLatlngs:function(t,e,i){var n=t[0]instanceof G,r=t.length,h,f;if(n){for(f=[],h=0;h<r;h++)f[h]=this._map.latLngToLayerPoint(t[h]),i.extend(f[h]);e.push(f)}else for(h=0;h<r;h++)this._projectLatlngs(t[h],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}var e=this._parts,i,n,r,h,f,p,y;for(i=0,r=0,h=this._rings.length;i<h;i++)for(y=this._rings[i],n=0,f=y.length;n<f-1;n++)p=Hn(y[n],y[n+1],t,n,!0),p&&(e[r]=e[r]||[],e[r].push(p[0]),(p[1]!==y[n+1]||n===f-2)&&(e[r].push(p[1]),r++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=Rn(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,r,h,f,p,y=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,h=this._parts.length;i<h;i++)for(p=this._parts[i],n=0,f=p.length,r=f-1;n<f;r=n++)if(!(!e&&n===0)&&Nn(t,p[r],p[n])<=y)return!0;return!1}});function Hr(t,e){return new Pt(t,e)}Pt._flat=Un;var Gt=Pt.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 zn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var e=Pt.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof G&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){Pt.prototype._setLatLngs.call(this,t),mt(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return mt(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new B(e,e);if(t=new Q(t.min.subtract(i),t.max.add(i)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var n=0,r=this._rings.length,h;n<r;n++)h=On(this._rings[n],t,!0),h.length&&this._parts.push(h)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e=!1,i,n,r,h,f,p,y,w;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(h=0,y=this._parts.length;h<y;h++)for(i=this._parts[h],f=0,w=i.length,p=w-1;f<w;p=f++)n=i[f],r=i[p],n.y>t.y!=r.y>t.y&&t.x<(r.x-n.x)*(t.y-n.y)/(r.y-n.y)+n.x&&(e=!e);return e||Pt.prototype._containsPoint.call(this,t,!0)}});function Ur(t,e){return new Gt(t,e)}var Ct=St.extend({initialize:function(t,e){b(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e=W(t)?t:t.features,i,n,r;if(e){for(i=0,n=e.length;i<n;i++)r=e[i],(r.geometries||r.geometry||r.features||r.coordinates)&&this.addData(r);return this}var h=this.options;if(h.filter&&!h.filter(t))return this;var f=Ze(t,h);return f?(f.feature=Re(t),f.defaultOptions=f.options,this.resetStyle(f),h.onEachFeature&&h.onEachFeature(t,f),this.addLayer(f)):this},resetStyle:function(t){return t===void 0?this.eachLayer(this.resetStyle,this):(t.options=a({},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&&(typeof e=="function"&&(e=e(t.feature)),t.setStyle(e))}});function Ze(t,e){var i=t.type==="Feature"?t.geometry:t,n=i?i.coordinates:null,r=[],h=e&&e.pointToLayer,f=e&&e.coordsToLatLng||Ri,p,y,w,I;if(!n&&!i)return null;switch(i.type){case"Point":return p=f(n),Gn(h,t,p,e);case"MultiPoint":for(w=0,I=n.length;w<I;w++)p=f(n[w]),r.push(Gn(h,t,p,e));return new St(r);case"LineString":case"MultiLineString":return y=Oe(n,i.type==="LineString"?0:1,f),new Pt(y,e);case"Polygon":case"MultiPolygon":return y=Oe(n,i.type==="Polygon"?1:2,f),new Gt(y,e);case"GeometryCollection":for(w=0,I=i.geometries.length;w<I;w++){var k=Ze({geometry:i.geometries[w],type:"Feature",properties:t.properties},e);k&&r.push(k)}return new St(r);case"FeatureCollection":for(w=0,I=i.features.length;w<I;w++){var N=Ze(i.features[w],e);N&&r.push(N)}return new St(r);default:throw new Error("Invalid GeoJSON object.")}}function Gn(t,e,i,n){return t?t(e,i):new Ae(i,n&&n.markersInheritOptions&&n)}function Ri(t){return new G(t[1],t[0],t[2])}function Oe(t,e,i){for(var n=[],r=0,h=t.length,f;r<h;r++)f=e?Oe(t[r],e-1,i):(i||Ri)(t[r]),n.push(f);return n}function Ni(t,e){return t=H(t),t.alt!==void 0?[v(t.lng,e),v(t.lat,e),v(t.alt,e)]:[v(t.lng,e),v(t.lat,e)]}function ze(t,e,i,n){for(var r=[],h=0,f=t.length;h<f;h++)r.push(e?ze(t[h],mt(t[h])?0:e-1,i,n):Ni(t[h],n));return!e&&i&&r.length>0&&r.push(r[0].slice()),r}function Xt(t,e){return t.feature?a({},t.feature,{geometry:e}):Re(e)}function Re(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var Fi={toGeoJSON:function(t){return Xt(this,{type:"Point",coordinates:Ni(this.getLatLng(),t)})}};Ae.include(Fi),zi.include(Fi),Be.include(Fi),Pt.include({toGeoJSON:function(t){var e=!mt(this._latlngs),i=ze(this._latlngs,e?1:0,!1,t);return Xt(this,{type:(e?"Multi":"")+"LineString",coordinates:i})}}),Gt.include({toGeoJSON:function(t){var e=!mt(this._latlngs),i=e&&!mt(this._latlngs[0]),n=ze(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),Xt(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Vt.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(i){e.push(i.toGeoJSON(t).geometry.coordinates)}),Xt(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(e==="MultiPoint")return this.toMultiPoint(t);var i=e==="GeometryCollection",n=[];return this.eachLayer(function(r){if(r.toGeoJSON){var h=r.toGeoJSON(t);if(i)n.push(h.geometry);else{var f=Re(h);f.type==="FeatureCollection"?n.push.apply(n,f.features):n.push(f)}}}),i?Xt(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});function Xn(t,e){return new Ct(t,e)}var $r=Xn,Ne=gt.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=it(e),b(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(R(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){tt(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&&Ut(this._image),this},bringToBack:function(){return this._map&&$t(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=it(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=this._url.tagName==="IMG",e=this._image=t?this._url:$("img");if(R(e,"leaflet-image-layer"),this._zoomAnimated&&R(e,"leaflet-zoom-animated"),this.options.className&&R(e,this.options.className),e.onselectstart=m,e.onmousemove=m,e.onload=u(this.fire,this,"load"),e.onerror=u(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(e.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=e.src;return}e.src=this._url,e.alt=this.options.alt},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ot(this._image,i,e)},_reset:function(){var t=this._image,e=new Q(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();nt(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){ft(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(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()}}),Vr=function(t,e,i){return new Ne(t,e,i)},jn=Ne.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",e=this._image=t?this._url:$("video");if(R(e,"leaflet-image-layer"),this._zoomAnimated&&R(e,"leaflet-zoom-animated"),this.options.className&&R(e,this.options.className),e.onselectstart=m,e.onmousemove=m,e.onloadeddata=u(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],r=0;r<i.length;r++)n.push(i[r].src);this._url=i.length>0?n:[e.src];return}W(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 h=0;h<this._url.length;h++){var f=$("source");f.src=this._url[h],e.appendChild(f)}}});function qr(t,e,i){return new jn(t,e,i)}var Yn=Ne.extend({_initImage:function(){var t=this._image=this._url;R(t,"leaflet-image-layer"),this._zoomAnimated&&R(t,"leaflet-zoom-animated"),this.options.className&&R(t,this.options.className),t.onselectstart=m,t.onmousemove=m}});function Gr(t,e,i){return new Yn(t,e,i)}var wt=gt.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,e){t&&(t instanceof G||W(t))?(this._latlng=H(t),b(this,e)):(b(this,t),this._source=e),this.options.content&&(this._content=this.options.content)},openOn:function(t){return t=arguments.length?t:this._source._map,t.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&&ft(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&ft(this._container,1),this.bringToFront(),this.options.interactive&&(R(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(ft(this._container,0),this._removeTimeout=setTimeout(u(tt,void 0,this._container),200)):tt(this._container),this.options.interactive&&(et(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=H(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&&Ut(this._container),this},bringToBack:function(){return this._map&&$t(this._container),this},_prepareOpen:function(t){var e=this._source;if(!e._map)return!1;if(e instanceof St){e=null;var i=this._source._layers;for(var n in i)if(i[n]._map){e=i[n];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)t=e.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,e=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof e=="string")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=E(this.options.offset),i=this._getAnchor();this._zoomAnimated?nt(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}});U.include({_initOverlay:function(t,e,i,n){var r=e;return r instanceof t||(r=new t(n).setContent(e)),i&&r.setLatLng(i),r}}),gt.include({_initOverlay:function(t,e,i,n){var r=i;return r instanceof t?(b(r,n),r._source=this):(r=e&&!n?e:new t(n,this),r.setContent(i)),r}});var Fe=wt.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,!t.hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,wt.prototype.openOn.call(this,t)},onAdd:function(t){wt.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Bt||this._source.on("preclick",Rt))},onRemove:function(t){wt.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Bt||this._source.off("preclick",Rt))},getEvents:function(){var t=wt.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?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=$("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=$("div",t+"-content-wrapper",e);if(this._contentNode=$("div",t+"-content",i),le(e),Wi(this._contentNode),z(e,"contextmenu",Rt),this._tipContainer=$("div",t+"-tip-container",e),this._tip=$("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=$("a",t+"-close-button",e);n.setAttribute("role","button"),n.setAttribute("aria-label","Close popup"),n.href="#close",n.innerHTML='<span aria-hidden="true">&#215;</span>',z(n,"click",function(r){at(r),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,r=this.options.maxHeight,h="leaflet-popup-scrolled";r&&n>r?(e.height=r+"px",R(t,h)):et(t,h),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();nt(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,e=parseInt(oe(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,r=new B(this._containerLeft,-i-this._containerBottom);r._add(zt(this._container));var h=t.layerPointToContainerPoint(r),f=E(this.options.autoPanPadding),p=E(this.options.autoPanPaddingTopLeft||f),y=E(this.options.autoPanPaddingBottomRight||f),w=t.getSize(),I=0,k=0;h.x+n+y.x>w.x&&(I=h.x+n-w.x+y.x),h.x-I-p.x<0&&(I=h.x-p.x),h.y+i+y.y>w.y&&(k=h.y+i-w.y+y.y),h.y-k-p.y<0&&(k=h.y-p.y),(I||k)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([I,k]))}},_getAnchor:function(){return E(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Xr=function(t,e){return new Fe(t,e)};U.mergeOptions({closePopupOnClick:!0}),U.include({openPopup:function(t,e,i){return this._initOverlay(Fe,t,e,i).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),gt.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Fe,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 St||(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():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){Nt(t);var e=t.layer||t.target;if(this._popup._source===e&&!(e instanceof Bt)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=e,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var He=wt.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){wt.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){wt.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=wt.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",e=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=$("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+d(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i,n=this._map,r=this._container,h=n.latLngToContainerPoint(n.getCenter()),f=n.layerPointToContainerPoint(t),p=this.options.direction,y=r.offsetWidth,w=r.offsetHeight,I=E(this.options.offset),k=this._getAnchor();p==="top"?(e=y/2,i=w):p==="bottom"?(e=y/2,i=0):p==="center"?(e=y/2,i=w/2):p==="right"?(e=0,i=w/2):p==="left"?(e=y,i=w/2):f.x<h.x?(p="right",e=0,i=w/2):(p="left",e=y+(I.x+k.x)*2,i=w/2),t=t.subtract(E(e,i,!0)).add(I).add(k),et(r,"leaflet-tooltip-right"),et(r,"leaflet-tooltip-left"),et(r,"leaflet-tooltip-top"),et(r,"leaflet-tooltip-bottom"),R(r,"leaflet-tooltip-"+p),nt(r,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&ft(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return E(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),jr=function(t,e){return new He(t,e)};U.include({openTooltip:function(t,e,i){return this._initOverlay(He,t,e,i).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),gt.include({bindTooltip:function(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(He,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",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,i.click=this._openTooltip,this._map?this._addFocusListeners():i.add=this._addFocusListeners),this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof St||(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=typeof t.getElement=="function"&&t.getElement();e&&(z(e,"focus",function(){this._tooltip._source=t,this.openTooltip()},this),z(e,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var e=typeof t.getElement=="function"&&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)});return}this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)}},_moveTooltip:function(t){var e=t.latlng,i,n;this._tooltip.options.sticky&&t.originalEvent&&(i=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(i),e=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(e)}});var Kn=qt.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&t.tagName==="DIV"?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(Ce(e),e.appendChild(i.html)):e.innerHTML=i.html!==!1?i.html:"",i.bgPos){var n=E(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Yr(t){return new Kn(t)}qt.Default=ce;var de=gt.extend({options:{tileSize:256,opacity:1,updateWhenIdle:D.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){b(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),tt(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Ut(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&($t(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=_(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 B?t:new B(t,t)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e=this.getPane().children,i=-t(-1/0,1/0),n=0,r=e.length,h;n<r;n++)h=e[n].style.zIndex,e[n]!==this._container&&h&&(i=t(i,+h));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!D.ielt9){ft(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var r=this._tiles[n];if(!(!r.current||!r.loaded)){var h=Math.min(1,(t-r.loaded)/200);ft(r.el,h),h<1?e=!0:(r.active?i=!0:this._onOpaqueTile(r),r.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(q(this._fadeFrame),this._fadeFrame=j(this._updateOpacity,this))}},_onOpaqueTile:m,_initContainer:function(){this._container||(this._container=$("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(t!==void 0){for(var i in this._levels)i=Number(i),this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(tt(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],r=this._map;return n||(n=this._levels[t]={},n.el=$("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=r.project(r.unproject(r.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,r.getCenter(),r.getZoom()),m(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:m,_onRemoveLevel:m,_onCreateLevel:m,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom){this._removeAllTiles();return}for(t in this._tiles)e=this._tiles[t],e.retain=e.current;for(t in this._tiles)if(e=this._tiles[t],e.current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.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)tt(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var r=Math.floor(t/2),h=Math.floor(e/2),f=i-1,p=new B(+r,+h);p.z=+f;var y=this._tileCoordsToKey(p),w=this._tiles[y];return w&&w.active?(w.retain=!0,!0):(w&&w.loaded&&(w.retain=!0),f>n?this._retainParent(r,h,f,n):!1)},_retainChildren:function(t,e,i,n){for(var r=2*t;r<2*t+2;r++)for(var h=2*e;h<2*e+2;h++){var f=new B(r,h);f.z=i+1;var p=this._tileCoordsToKey(f),y=this._tiles[p];if(y&&y.active){y.retain=!0;continue}else y&&y.loaded&&(y.retain=!0);i+1<n&&this._retainChildren(r,h,i+1,n)}},_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 e.minNativeZoom!==void 0&&t<e.minNativeZoom?e.minNativeZoom:e.maxNativeZoom!==void 0&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var r=Math.round(e);this.options.maxZoom!==void 0&&r>this.options.maxZoom||this.options.minZoom!==void 0&&r<this.options.minZoom?r=void 0:r=this._clampZoom(r);var h=this.options.updateWhenZooming&&r!==this._tileZoom;(!n||h)&&(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),r!==void 0&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),r=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();D.any3d?Ot(t.el,r,n):nt(t.el,r)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),r=e.project(t,this._tileZoom).floor(),h=e.getSize().divideBy(n*2);return new Q(r.subtract(h),r.add(h))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(t===void 0&&(t=e.getCenter()),this._tileZoom!==void 0){var n=this._getTiledPixelBounds(t),r=this._pxBoundsToTileRange(n),h=r.getCenter(),f=[],p=this.options.keepBuffer,y=new Q(r.getBottomLeft().subtract([p,-p]),r.getTopRight().add([p,-p]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var w in this._tiles){var I=this._tiles[w].coords;(I.z!==this._tileZoom||!y.contains(new B(I.x,I.y)))&&(this._tiles[w].current=!1)}if(Math.abs(i-this._tileZoom)>1){this._setView(t,i);return}for(var k=r.min.y;k<=r.max.y;k++)for(var N=r.min.x;N<=r.max.x;N++){var st=new B(N,k);if(st.z=this._tileZoom,!!this._isValidTile(st)){var rt=this._tiles[this._tileCoordsToKey(st)];rt?rt.current=!0:f.push(st)}}if(f.sort(function(ut,Yt){return ut.distanceTo(h)-Yt.distanceTo(h)}),f.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var pt=document.createDocumentFragment();for(N=0;N<f.length;N++)this._addTile(f[N],pt);this._level.el.appendChild(pt)}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return it(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),r=n.add(i),h=e.unproject(n,t.z),f=e.unproject(r,t.z);return[h,f]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new ht(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new B(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(tt(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){R(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=m,t.onmousemove=m,D.ielt9&&this.options.opacity<1&&ft(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),r=this.createTile(this._wrapCoords(t),u(this._tileReady,this,t));this._initTile(r),this.createTile.length<2&&j(u(this._tileReady,this,t,null,r)),nt(r,i),this._tiles[n]={el:r,coords:t,current:!0},e.appendChild(r),this.fire("tileloadstart",{tile:r,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);i=this._tiles[n],i&&(i.loaded=+new Date,this._map._fadeAnimated?(ft(i.el,0),q(this._fadeFrame),this._fadeFrame=j(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(R(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),D.ielt9||!this._map._fadeAnimated?j(this._pruneTiles,this):setTimeout(u(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new B(this._wrapX?g(t.x,this._wrapX):t.x,this._wrapY?g(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new Q(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 Kr(t){return new de(t)}var jt=de.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=b(this,e),e.detectRetina&&D.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),typeof e.subdomains=="string"&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&e===void 0&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return z(i,"load",u(this._tileOnLoad,this,e,i)),z(i,"error",u(this._tileOnError,this,e,i)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(i.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:D.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 S(this._url,a(e,this.options))},_tileOnLoad:function(t,e){D.ielt9?setTimeout(u(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,i=this.options.zoomReverse,n=this.options.zoomOffset;return i&&(t=e-t),t+n},_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,e.onload=m,e.onerror=m,!e.complete)){e.src=A;var i=this._tiles[t].coords;tt(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:i})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",A),de.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(!(!this._map||i&&i.getAttribute("src")===A))return de.prototype._tileReady.call(this,t,e,i)}});function Jn(t,e){return new jt(t,e)}var Qn=jt.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=a({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);e=b(this,e);var r=e.detectRetina&&D.retina?2:1,h=this.getTileSize();i.width=h.x*r,i.height=h.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,jt.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=lt(i.project(e[0]),i.project(e[1])),r=n.min,h=n.max,f=(this._wmsVersion>=1.3&&this._crs===Vn?[r.y,r.x,h.y,h.x]:[r.x,r.y,h.x,h.y]).join(","),p=jt.prototype.getTileUrl.call(this,t);return p+M(this.wmsParams,p,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+f},setParams:function(t,e){return a(this.wmsParams,t),e||this.redraw(),this}});function Jr(t,e){return new Qn(t,e)}jt.WMS=Qn,Jn.wms=Jr;var It=gt.extend({options:{padding:.1},initialize:function(t){b(this,t),d(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),R(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 i=this._map.getZoomScale(e,this._zoom),n=this._map.getSize().multiplyBy(.5+this.options.padding),r=this._map.project(this._center,e),h=n.multiplyBy(-i).add(r).subtract(this._map._getNewPixelOrigin(t,e));D.any3d?Ot(this._container,h,i):nt(this._container,h)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in 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(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new Q(i,i.add(e.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),to=It.extend({options:{tolerance:0},getEvents:function(){var t=It.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){It.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");z(t,"mousemove",this._onMouseMove,this),z(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),z(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){q(this._redrawRequest),delete this._ctx,tt(this._container),Y(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var e in this._layers)t=this._layers[e],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){It.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=D.retina?2:1;nt(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",D.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){It.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[d(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,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[d(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(typeof t.options.dashArray=="string"){var e=t.options.dashArray.split(/[, ]+/),i=[],n,r;for(r=0;r<e.length;r++){if(n=Number(e[r]),isNaN(n))return;i.push(n)}t.options._dashArray=i}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||j(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new Q,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 i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,r,h,f=t._parts,p=f.length,y=this._ctx;if(p){for(y.beginPath(),i=0;i<p;i++){for(n=0,r=f[i].length;n<r;n++)h=f[i][n],y[n?"lineTo":"moveTo"](h.x,h.y);e&&y.closePath()}this._fillStroke(y,t)}}},_updateCircle:function(t){if(!(!this._drawing||t._empty())){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),r=(Math.max(Math.round(t._radiusY),1)||n)/n;r!==1&&(i.save(),i.scale(1,r)),i.beginPath(),i.arc(e.x,e.y/r,n,0,Math.PI*2,!1),r!==1&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&i.weight!==0&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e=this._map.mouseEventToLayerPoint(t),i,n,r=this._drawFirst;r;r=r.next)i=r.layer,i.options.interactive&&i._containsPoint(e)&&(!(t.type==="click"||t.type==="preclick")||!this._map._draggableMoved(i))&&(n=i);this._fireEvent(n?[n]:!1,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&&(et(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var i,n,r=this._drawFirst;r;r=r.next)i=r.layer,i.options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(R(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,t),this._mouseHoverThrottled=!0,setTimeout(u(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;if(i)i.prev=n;else return;n?n.next=i:i&&(this._drawFirst=i),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 i=e.next,n=e.prev;if(n)n.next=i;else return;i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t)}}});function eo(t){return D.canvas?new to(t):null}var fe=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Qr={_initContainer:function(){this._container=$("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(It.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=fe("shape");R(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=fe("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[d(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;tt(e),t.removeInteractiveTarget(e),delete this._layers[d(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,r=t._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(e||(e=t._stroke=fe("stroke")),r.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=W(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(r.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=fe("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,"+65535*360)},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){Ut(t._container)},_bringToBack:function(t){$t(t._container)}},Ue=D.vml?fe:rn,me=It.extend({_initContainer:function(){this._container=Ue("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ue("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){tt(this._container),Y(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){It.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;(!this._svgSize||!this._svgSize.equals(e))&&(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),nt(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=Ue("path");t.options.className&&R(e,t.options.className),t.options.interactive&&R(e,"leaflet-interactive"),this._updateStyle(t),this._layers[d(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){tt(t._path),t.removeInteractiveTarget(t._path),delete this._layers[d(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,an(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n=Math.max(Math.round(t._radiusY),1)||i,r="a"+i+","+n+" 0 1,0 ",h=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+r+i*2+",0 "+r+-i*2+",0 ";this._setPath(t,h)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){Ut(t._path)},_bringToBack:function(t){$t(t._path)}});D.vml&&me.include(Qr);function io(t){return D.svg||D.vml?new me(t):null}U.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(t==="overlayPane"||t===void 0)return!1;var e=this._paneRenderers[t];return e===void 0&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&eo(t)||io(t)}});var no=Gt.extend({initialize:function(t,e){Gt.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=it(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function ta(t,e){return new no(t,e)}me.create=Ue,me.pointsToPath=an,Ct.geometryToLayer=Ze,Ct.coordsToLatLng=Ri,Ct.coordsToLatLngs=Oe,Ct.latLngToCoords=Ni,Ct.latLngsToCoords=ze,Ct.getFeature=Xt,Ct.asFeature=Re,U.mergeOptions({boxZoom:!0});var oo=bt.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(){z(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Y(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){tt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),re(),wi(),this._startPoint=this._map.mouseEventToContainerPoint(t),z(document,{contextmenu:Nt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=$("div","leaflet-zoom-box",this._container),R(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new Q(this._point,this._startPoint),i=e.getSize();nt(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(tt(this._box),et(this._container,"leaflet-crosshair")),ae(),Ti(),Y(document,{contextmenu:Nt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(u(this._resetState,this),0);var e=new ht(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});U.addInitHook("addHandler","boxZoom",oo),U.mergeOptions({doubleClickZoom:!0});var ro=bt.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,i=e.getZoom(),n=e.options.zoomDelta,r=t.originalEvent.shiftKey?i-n:i+n;e.options.doubleClickZoom==="center"?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});U.addInitHook("addHandler","doubleClickZoom",ro),U.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ao=bt.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new At(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))}R(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){et(this._map._container,"leaflet-grab"),et(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=it(this._map.options.maxBounds);this._offsetLimit=lt(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,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),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),i=this._initialWorldOffset,n=this._draggable._newPos.x,r=(n-e+i)%t+e-i,h=(n+e+i)%t-e-i,f=Math.abs(r+i)<Math.abs(h+i)?r:h;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=f},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||t.noInertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),h=(this._lastTime-this._times[0])/1e3,f=i.easeLinearity,p=r.multiplyBy(f/h),y=p.distanceTo([0,0]),w=Math.min(i.inertiaMaxSpeed,y),I=p.multiplyBy(w/y),k=w/(i.inertiaDeceleration*f),N=I.multiplyBy(-k/2).round();!N.x&&!N.y?e.fire("moveend"):(N=e._limitOffset(N,e.options.maxBounds),j(function(){e.panBy(N,{duration:k,easeLinearity:f,noMoveStart:!0,animate:!0})}))}}});U.addInitHook("addHandler","dragging",ao),U.mergeOptions({keyboard:!0,keyboardPanDelta:80});var so=bt.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"),z(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(),Y(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,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e=this._panKeys={},i=this.keyCodes,n,r;for(n=0,r=i.left.length;n<r;n++)e[i.left[n]]=[-1*t,0];for(n=0,r=i.right.length;n<r;n++)e[i.right[n]]=[t,0];for(n=0,r=i.down.length;n<r;n++)e[i.down[n]]=[0,t];for(n=0,r=i.up.length;n<r;n++)e[i.up[n]]=[0,-1*t]},_setZoomDelta:function(t){var e=this._zoomKeys={},i=this.keyCodes,n,r;for(n=0,r=i.zoomIn.length;n<r;n++)e[i.zoomIn[n]]=t;for(n=0,r=i.zoomOut.length;n<r;n++)e[i.zoomOut[n]]=-t},_addHooks:function(){z(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Y(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=t.keyCode,i=this._map,n;if(e in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(n=this._panKeys[e],t.shiftKey&&(n=E(n).multiplyBy(3)),i.options.maxBounds&&(n=i._limitOffset(E(n),i.options.maxBounds)),i.options.worldCopyJump){var r=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(n)));i.panTo(r)}else i.panBy(n)}else if(e in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[e]);else if(e===27&&i._popup&&i._popup.options.closeOnEscapeKey)i.closePopup();else return;Nt(t)}}});U.addInitHook("addHandler","keyboard",so),U.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var lo=bt.extend({addHooks:function(){z(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Y(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=kn(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(u(this._performZoom,this),n),Nt(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(this._map.options.wheelPxPerZoomLevel*4),r=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,h=i?Math.ceil(r/i)*i:r,f=t._limitZoom(e+(this._delta>0?h:-h))-e;this._delta=0,this._startTime=null,f&&(t.options.scrollWheelZoom==="center"?t.setZoom(e+f):t.setZoomAround(this._lastMousePos,e+f))}});U.addInitHook("addHandler","scrollWheelZoom",lo);var ea=600;U.mergeOptions({tapHold:D.touchNative&&D.safari&&D.mobile,tapTolerance:15});var ho=bt.extend({addHooks:function(){z(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Y(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var e=t.touches[0];this._startPos=this._newPos=new B(e.clientX,e.clientY),this._holdTimeout=setTimeout(u(function(){this._cancel(),this._isTapValid()&&(z(document,"touchend",at),z(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))},this),ea),z(document,"touchend touchcancel contextmenu",this._cancel,this),z(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){Y(document,"touchend",at),Y(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),Y(document,"touchend touchcancel contextmenu",this._cancel,this),Y(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new B(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var i=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});i._simulated=!0,e.target.dispatchEvent(i)}});U.addInitHook("addHandler","tapHold",ho),U.mergeOptions({touchZoom:D.touch,bounceAtZoomLimits:!0});var uo=bt.extend({addHooks:function(){R(this._map._container,"leaflet-touch-zoom"),z(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){et(this._map._container,"leaflet-touch-zoom"),Y(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(!(!t.touches||t.touches.length!==2||e._animatingZoom||this._zooming)){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),e.options.touchZoom!=="center"&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),z(document,"touchmove",this._onTouchMove,this),z(document,"touchend touchcancel",this._onTouchEnd,this),at(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),r=i.distanceTo(n)/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)),e.options.touchZoom==="center"){if(this._center=this._startLatLng,r===1)return}else{var h=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(r===1&&h.x===0&&h.y===0)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(h),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),q(this._animRequest);var f=u(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=j(f,this,!0),at(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,q(this._animRequest),Y(document,"touchmove",this._onTouchMove,this),Y(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))}});U.addInitHook("addHandler","touchZoom",uo),U.BoxZoom=oo,U.DoubleClickZoom=ro,U.Drag=ao,U.Keyboard=so,U.ScrollWheelZoom=lo,U.TapHold=ho,U.TouchZoom=uo,s.Bounds=Q,s.Browser=D,s.CRS=Mt,s.Canvas=to,s.Circle=zi,s.CircleMarker=Be,s.Class=dt,s.Control=_t,s.DivIcon=Kn,s.DivOverlay=wt,s.DomEvent=yr,s.DomUtil=gr,s.Draggable=At,s.Evented=kt,s.FeatureGroup=St,s.GeoJSON=Ct,s.GridLayer=de,s.Handler=bt,s.Icon=qt,s.ImageOverlay=Ne,s.LatLng=G,s.LatLngBounds=ht,s.Layer=gt,s.LayerGroup=Vt,s.LineUtil=kr,s.Map=U,s.Marker=Ae,s.Mixin=Sr,s.Path=Bt,s.Point=B,s.PolyUtil=Pr,s.Polygon=Gt,s.Polyline=Pt,s.Popup=Fe,s.PosAnimation=En,s.Projection=Er,s.Rectangle=no,s.Renderer=It,s.SVG=me,s.SVGOverlay=Yn,s.TileLayer=jt,s.Tooltip=He,s.Transformation=ui,s.Util=Lt,s.VideoOverlay=jn,s.bind=u,s.bounds=lt,s.canvas=eo,s.circle=Fr,s.circleMarker=Nr,s.control=he,s.divIcon=Yr,s.extend=a,s.featureGroup=Or,s.geoJSON=Xn,s.geoJson=$r,s.gridLayer=Kr,s.icon=zr,s.imageOverlay=Vr,s.latLng=H,s.latLngBounds=it,s.layerGroup=Zr,s.map=xr,s.marker=Rr,s.point=E,s.polygon=Ur,s.polyline=Hr,s.popup=Xr,s.rectangle=ta,s.setOptions=b,s.stamp=d,s.svg=io,s.svgOverlay=Gr,s.tileLayer=Jn,s.tooltip=jr,s.transformation=ee,s.version=o,s.videoOverlay=qr;var ia=window.L;s.noConflict=function(){return window.L=ia,this},window.L=s})});var pe=class{constructor(o,a,l,u={}){this.wxapi=o;this._busy=!1;let c=document.createElement("div");c.className="mapboxgl-ctrl leaflet-control",c.style.borderStyle="solid",c.style.borderColor="#000",c.style.backgroundColor="#aaaaaaaa",c.style.padding="5px",c.style.display="flex",c.style.flexDirection="column",this._div=c;let d=document.createElement("label");d.innerText="Filter",c.appendChild(d),this.filter=document.createElement("input"),this.filter.type="text",this.filter.placeholder="Type to filter datasets...",this.filter.style.marginBottom="5px",c.appendChild(this.filter),this.filter.addEventListener("input",()=>{let m=this.filter.value.trim(),v;try{v=new RegExp(m,"i")}catch{v=new RegExp(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i")}for(let x of Array.from(this.datasets.options)){let T=v.test(x.text);x.style.display=T?"":"none"}});let _=document.createElement("label");_.innerText="Dataset",c.appendChild(_),this.datasets=document.createElement("select"),c.appendChild(this.datasets),this.fillDatasets(a,l,u),this.datasets.addEventListener("change",async()=>{if(this._busy)return;this.setBusy(!0);let m=this.datasets.value;await this.fillVariables();let v=this.variables.value;await this.onchange?.(this.datasets.value,this.variables.value),this.datasets.value=m,this.variables.value=v,this.setBusy(!1)});let g=document.createElement("label");g.innerText="Variable",c.appendChild(g),this.variables=document.createElement("select"),c.appendChild(this.variables),this.variables.addEventListener("change",async()=>{if(this._busy)return;this.setBusy(!0);let m=this.variables.value;await this.onchange?.(this.datasets.value,this.variables.value),this.variables.value=m,this.setBusy(!1)}),this.datasets.value=a||"",this.variables.value=l||""}setBusy(o){this._busy=o,this._div.style.backgroundColor=o?"yellow":"lightgray"}async fillDatasets(o,a,l){this.datasets.options.length=0;let u=await this.wxapi.getAllDatasetsNames();for(let c of u){let d=document.createElement("option");d.value=c,d.text=c,this.datasets.appendChild(d)}o&&(this.datasets.value=o),await this.fillVariables(a),l?.filter&&(this.filter.value=l.filter)}async fillVariables(o){this.variables.options.length=0;let a=this.datasets.value,l=await this.wxapi.getDatasetAllVariables(a);if(l)for(let u of l){let c=document.createElement("option");c.value=u,c.text=u,this.variables.appendChild(c)}o&&this.variables.options.length&&(this.variables.value=o)}onAdd(){return this._div}onRemove(){this._div.parentNode?.removeChild(this._div)}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var _e=class{constructor(){this.pos={lng:0,lat:0};let o=document.createElement("div");o.className="mapboxgl-ctrl leaflet-control",o.style.borderStyle="solid",o.style.borderColor="#000",o.style.backgroundColor="#aaaaaaaa",o.style.padding="5px",this.div=o}onAdd(){return this.div}onRemove(){this.div.parentNode?.removeChild(this.div)}update(o,a,l){if(l&&(this.pos=l),!o){this.div.innerHTML="";return}let{min:u,max:c,units:d}=o.getCurrentVariableMeta(),{datasetName:_}=o.wxdatasetManager,g=o.wxdatasetManager.getInstanceMeta(o.getTime()),{sourceID:m,baseAtmosphericModel:v,model:x}=g;this.div.innerHTML=`lnglat=(${this.pos.lng.toFixed(2)}, ${this.pos.lat.toFixed(2)})<br>`,this.div.innerHTML+=m&&`sourceID=${m}<br>`||"",this.div.innerHTML+=v&&`baseAtmosphericModel=${v}<br>`||"",this.div.innerHTML+=x&&`model=${x}<br>`||"",this.div.innerHTML+=`dataset=${_}<br>
2
2
  variables=${o.getVariablesNames()}<br>
3
3
  time=${o.getTime()}<br>
4
- min=${u.toFixed(2)} ${f}, max=${c.toFixed(2)} ${f}<br>`;let T=o.getLayerInfoAtLatLon(this.pos,a);T?this.div.innerHTML+=`style=${T.inStyleUnits.map(b=>b.toFixed(2))} ${T.styleUnits}<br>
5
- source=${T.data.map(b=>b.toFixed(2))} ${T.dataUnits}<br>`:this.div.innerHTML+="style=outside<br>source=outside<br>"}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var Vi={none:["#00000000","#00000000"],diverging_blue_red:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow_zero:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow_wrap:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],rainbow_backwards:["#0000ffff","#00ffffff","#00ff00ff","#ffff00ff","#ff0000ff","#ff00ffff"],rainbow_backwards_zero:["#0000ff00","#0000ffff","#00ffffff","#00ff00ff","#ffff00ff","#ff0000ff","#ff00ffff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebird_zero:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],black_white:["#000000ff","#ffffffff"],white_black:["#ffffffff","#000000ff"],reddish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"],black:["#000000ff","#000000ff"],white:["#ffffffff","#ffffffff"],transparent:["#ffffff00"],peach_red_zero:["#fdd49f00","#fdd49fff","#d7301fff"]};var me={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"none",isolineText:!0,isolineTextSizeEm:1.1,isolineTextBackground:!1,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"none",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"diverging_blue_red",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none",gl:{animationIntensity:5,animationSpeed:1,noiseTexturePow:5,vectorFieldFactor:1,wavesCount:4}},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,isolineTextSizeEm:1.1,isolineTextBackground:!1,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}};var qi={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]};var jt={_units:qi,_colorSchemes:Vi,_colorStylesUnrolled:me,wxlogging:!1};function _o({colorStyles:s={},units:o={},colorSchemes:a={}}={}){P("WxTile lib setup: start"),jt._units=Object.assign({},qi,o),jt._colorSchemes=Object.assign({},a,Vi);let l=Object.assign({},s,me);jt._colorStylesUnrolled=ga(l),P("WxTile lib setup: styles unrolled"),(async()=>{try{await document.fonts.load("32px barbs"),await document.fonts.load("32px arrows")}catch{P("WxTile lib setup: fonts not loaded")}})(),P("WxTile lib setup is done.")}function St(){return jt._colorStylesUnrolled}function pe(){return jt._colorSchemes}function Xe(s,o,a){P("makeConverter: From=",s," To=",o);let l=C=>C;if(l.trivial=!0,s===o)return P("Trivial converter"),l;let u=Object.assign({},jt._units,a),c=u[s],f=u[o];if(!c||!f)return P("Inconvertible units. Trivial converter"),l;let[m,y,_]=c,[g,x,T]=f;if(m!==g||!y||!x)return P("Inconvertible units. Trivial converter"),l;let b=y/x,M=((_||0)-(T||0))/x;return M?C=>b*C+M:C=>b*C}function ga(s){let o=Object.assign({},me);for(let c in s){let f=s[c];if(Array.isArray(f))for(let m=0;m<f.length;++m)o[`${c}[${m}]`]=Object.assign({},f[m]);else o[c]=Object.assign({},f)}let a=Object.assign({},me.base),l=(c,f)=>{if(f==="base")return a;let m=c[f];if(!m)return a;(!m.parent||!(m.parent in c))&&(m.parent="base");let y=l(c,m.parent);return Object.assign(m,Object.assign({},y,m,{parent:"base"}))},u={base:a};for(let c in o)u[c]=l(o,c);return u}function je(s){let o=new Map,a=(l,...u)=>{let c=o.get(l);if(c)return c;let f=s(l,...u);return o.set(l,f),f.catch(m=>m.name==="AbortError"&&o.delete(l)),f};return a.clearCache=()=>o.clear(),a}async function va(s,o){let a=await fetch(s,o);if(a.status!==200&&a.status!==304)throw{name:"Tile loading failed",reason:a.headers.get("x-reason"),status:a.status};return await createImageBitmap(await a.blob(),{premultiplyAlpha:"none"})}var Ge=class{constructor(o,a,l,u){this.raw=o;this.dmin=a;this.dmax=l;this.dmul=u;this.radius=0}get integral(){return this.integral_||(this.integral_=ba(this.raw)),this.integral_}};function Yt(s,o,a=!0){let l=Object.assign(document.createElement("canvas"),{width:s,height:o,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:a});if(!l)throw new Error("Cannot get canvas context");return l}function ya(s){let{width:o,height:a}=s,l=Yt(o,a);return l.drawImage(s,0,0),l.getImageData(0,0,o,a)}async function Gi(s,o){return ya(await va(s,o))}function xa(s){s.data[34]<1&&P("Warning: image is in too old format. Check the version of the Splitter.");let o=new Uint16Array(s.data.buffer),a=new Uint16Array(o.length/2);for(let y=0;y<a.length;y++)a[y]=o[y*2];let l=new Uint8Array(8);for(let y=0;y<8;++y)l[y]=s.data[y*4+2];let u=new DataView(l.buffer),c=u.getFloat32(0,!0),f=u.getFloat32(4,!0),m=(f-c)/65535;return new Ge(a,c,f,m)}async function go(s,o){return xa(await Gi(s,o))}function ba(s){let o=new Uint32Array(66564),a=new Uint32Array(258*258);o[0]=s[0],a[0]=s[0]?1:0;for(let l=1;l<258;++l){o[l]=s[l]+o[l-1],a[l]=(s[l]?1:0)+a[l-1];let u=258*l;o[u]=s[u]+o[u-258],a[u]=(s[u]?1:0)+a[u-258]}for(let l=1;l<258;++l)for(let u=1;u<258;++u){let c=258*l+u;o[c]=s[c]+o[c-258]+o[c-1]-o[c-259],a[c]=(s[c]?1:0)+a[c-258]+a[c-1]-a[c-259]}return{integral:o,integralNZ:a[66563]===66564?null:a}}function wa(s){let{integral:o}=s.integral;s.raw[0]=o[0];for(let a=1;a<258;a++){s.raw[a]=o[a]-o[a-1],s.raw[258*a]=o[258*a]-o[258*(a-1)];for(let l=1;l<258;l++){let u=258*a+l;s.raw[u]=o[u-259]+o[u]-o[u-258]-o[u-1]}}return s}function vo(s,o){let a=o<0?0:o;if(a===s.radius)return s;if(s.radius=a,!a)return wa(s);let{integral:l,integralNZ:u}=s.integral;for(let c=2;c<256;c++)for(let f=2;f<256;f++){let m=258*c+f;if(!s.raw[m])continue;let y=Math.min(a,f-1,256-f),_=Math.min(a,c-1,256-c),g=258*(c-_-1)+f,x=258*(c+_)+f,T;if(u){let O=u[g-y-1],E=u[g+y],Z=u[x-y-1],V=u[x+y];T=O+V-E-Z}else T=(2*y+1)*(2*_+1);let b=l[g-y-1],M=l[g+y],C=l[x-y-1],S=l[x+y],W=b+S-M-C;s.raw[m]=W/T}for(let c=2;c<256;c++){let f=258+c;if(s.raw[f]){let g=c,x=Math.min(a,g-1,256-g),T=258+g,b;if(u){let F=u[T-x-1];b=0+u[T+x]-0-F}else b=(2*x+1)*2;let M=0,C=0,S=l[T-x-1],W=l[T+x],E=(M+W-C-S)/b;s.raw[f-258]=E,s.raw[f]=E}let m=258*256+c;if(s.raw[m]){let g=c,x=Math.min(a,g-1,256-g),T=258*255+g,b=258*257+g,M=l[T-x-1],C=l[T+x],S=l[b-x-1],W=l[b+x],O=M+W-C-S,E;if(u){let V=u[T-x-1],F=u[T+x],H=u[b-x-1],it=u[b+x];E=V+it-F-H}else E=(2*x+1)*2;let Z=O/E;s.raw[m]=Z,s.raw[m+258]=Z}let y=258*c+1;if(s.raw[y]){let g=c,x=Math.min(a,g-1,256-g),T=258*(g-x-1)+1,b=258*(g+x)+1,M;if(u){let F=u[T],H=0;M=0+u[b]-F-H}else M=(2*x+1)*2;let C=0,S=l[T],W=0,O=l[b],Z=(C+O-S-W)/M;s.raw[y-1]=Z,s.raw[y]=Z}let _=258*c+256;if(s.raw[_]){let g=c,x=Math.min(a,g-1,256-g),T=258*(g-x-1)+256,b=258*(g+x)+256,M;if(u){let V=u[T-1],F=u[T+1],H=u[b-1],it=u[b+1];M=V+it-F-H}else M=2*(2*x+1);let C=l[T-1],S=l[T+1],W=l[b-1],O=l[b+1],Z=(C+O-S-W)/M;s.raw[_]=Z,s.raw[_+1]=Z}}return s}function lt(s){let o=s>>0&255,a=s>>8&255,l=s>>16&255,u=o.toString(16),c=a.toString(16),f=l.toString(16);return u=u.length===2?u:`0${u}`,c=c.length===2?c:`0${c}`,f=f.length===2?f:`0${f}`,`#${u}${c}${f}`}function Pt(s){if(s[0]==="#"){if(s.length===4)return+`0xff${s[3]}${s[3]}${s[2]}${s[2]}${s[1]}${s[1]}`;if(s.length===7)return+`0xff${s[5]}${s[6]}${s[3]}${s[4]}${s[1]}${s[2]}`;if(s.length===9)return+`0x${s[7]}${s[8]}${s[5]}${s[6]}${s[3]}${s[4]}${s[1]}${s[2]}`}return P("wrong color format",s),0}async function Ct(s,o){let a=await fetch(s,o);if(!a.ok)throw new Error(`error:${s} - ${a.statusText}`);return a.json()}function Xi(s,o,a){let l=s>>0&255,u=s>>8&255,c=s>>16&255,f=s>>>24,m=o>>0&255,y=o>>8&255,_=o>>16&255,g=o>>>24,x=l+a*(m-l),T=u+a*(y-u),b=c+a*(_-c),M=f+a*(g-f);return x|T<<8|b<<16|M<<24}function yo(s,o,a){let l=[];for(let u=0;u<a;++u)l.push(u*(o-s)/(a-1)+s);return l}var P=(...s)=>{};function ji(s){return s[0]==="#"&&s.length===4?`#${s[1]}${s[1]}${s[2]}${s[2]}${s[3]}${s[3]}`:s}function Ye(s,{x:o,y:a,z:l}){return s.replace("{x}",`${o}`).replace("{y}",`${a}`).replace("{z}",`${l}`)}function Ke({x:s,y:o,z:a}){return`${a}-${s}-${o}`}function La(s,o,a){return s>a?a:s<o?o:s}var Je=class{constructor(o,a,[l,u],c){P("RawCLUT.constructor"),this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let f;this.DataToStyle=Xe(a,o.units,o.extraUnits),this.DataToStyle.trivial&&(o.units=a),c&&(this.DataToKnots=Xe(a,"knot"));let m=Xe(o.units,a,o.extraUnits),y=S=>~~(65535*La((m(S)-l)/(u-l),0,1));if(o.colorMap?.length)f=o.colorMap.sort((S,W)=>S[0]-W[0]).map(([S])=>y(S));else{o.levels||=yo(this.DataToStyle(l),this.DataToStyle(u),10),o.levels.sort((W,O)=>W-O);let S=pe();o.colors||=S[o.colorScheme]||["#ffffffff","#000000ff"],f=o.levels.map(y)}let _=u-l,g=Qe(65536,o);this.ticks=g.ticks;let x=g.ticks[0].data,b=g.ticks[g.ticks.length-1].data-x,M=o.showBelowMin?g.colors[0]:0,C=o.showAboveMax?g.colors[65535]:0;this.colorsI[0]=0;for(let S=1;S<65536;++S){let W=this.DataToStyle(_*S/65535+l),O=Math.round(65535*(W-x)/b);this.colorsI[S]=O<=0?M:O>65535?C:g.colors[O]}for(let S=0;S<f[0];++S)this.levelIndex[S]=0;for(let S=0;S<f.length-1;S++)for(let W=f[S];W<f[S+1]+1;++W)this.levelIndex[W]=S;for(let S=f[f.length-1];S<65536;++S)this.levelIndex[S]=f.length-1}};function xo(s){if(s!==0&&-.1<s&&s<.1)return s.toExponential(2);let o=s.toString();return o.split(".")[1]?.length>2?s.toFixed(2):o}function Qe(s,o){let a={size:s,showBelowMin:o.showBelowMin,showAboveMax:o.showAboveMax,units:o.units,colors:new Uint32Array(s),ticks:[]},{colorMap:l,levels:u,colors:c}=o,f=o.fill!=="solid";if(l){let T=l[0][0],b=(s-1)/(l[l.length-1][0]-T);a.ticks=l.map(([M,C])=>({data:M,dataString:xo(M),color:C,pos:~~((M-T)*b)}));for(let M=0;M<l.length-1;M++){let C=a.ticks[M].pos,S=a.ticks[M+1].pos,W=Pt(l[M][1]),O=f?Pt(l[M+1][1]):0;for(let E=C;E<S;++E)a.colors[E]=f?Xi(W,O,(E-C)/(S-C)):W}return a.colors[s-1]=Pt(l[l.length-1][1]),a}if(!c||!u)return a;let m=0,y=0,_=-1;for(let T=0;T<s;++T){let b=T*(c.length-1)/s;_!==~~b&&(_=~~b,m=Pt(c[_]),y=c.length>_+1?Pt(c[_+1]):m),a.colors[T]=f?Xi(m,y,b-_):m}a.colors[s-1]=Pt(c[c.length-1]);let g=u[0],x=(s-1)/(u[u.length-1]-g);return a.ticks=u.map(T=>{let b=~~((T-g)*x);return{data:T,dataString:xo(T),pos:b,color:lt(a.colors[b])}}),a}var _e=class{constructor(){let o=document.createElement("div");o.className="mapboxgl-ctrl leaflet-control",o.style.borderStyle="solid",o.style.borderColor="#000",o.style.backgroundColor="#aaaaaaaa",o.style.padding="5px",this._div=o,this._canvas=document.createElement("canvas"),this._canvas.width=600,this._canvas.height=40,o.appendChild(this._canvas)}onAdd(){return this._div}onRemove(){this._div.parentNode?.removeChild(this._div)}drawLegend(o){let{_canvas:a}=this,{width:l,height:u}=a,c=16+u>>2,f=Qe(l-50,o),m=a.getContext("2d");if(!m)throw new Error("Failed to get 2D context from canvas");let y=m.createImageData(l,u),_=new Uint32Array(y.data.buffer);_.fill(-1);let g=2,x=2,T=g+l*x,b=c>>1;if(f.showBelowMin){let M=f.colors[0];if(M)for(let C=0;C<b;++C)for(let S=b;S<b+C;++S)_[T+C+S*l]=M,_[T+C+(b*2-S)*l]=M}for(let M=0;M<f.size;++M)for(let C=0;C<c;++C)f.colors[0]&&(_[g+M+b+(C+x+1)*l]=f.colors[M]);if(f.showAboveMax){let M=f.colors[f.colors.length-1];if(M)for(let C=0;C<=b;++C)for(let S=b;S<b+C;++S)_[T+b*2+f.size-C+S*l]=M,_[T+b*2+f.size-C+(b*2-S)*l]=M}m.putImageData(y,0,0),m.font="8px sans-serif",m.beginPath();for(let M of f.ticks)m.strokeStyle="#000",m.moveTo(M.pos+b+g+1,x+3),m.lineTo(M.pos+b+g+1,c),m.fillText(M.dataString,M.pos+b+g+1,c+11);m.font="12px sans-serif",m.fillText(`(${f.units})`,13,u-5),m.stroke(),m.strokeStyle="#888",m.strokeRect(1,1,l-3,u-2)}clear(){let{_canvas:o}=this,{width:a,height:l}=o,u=o.getContext("2d");if(!u)throw new Error("Failed to get 2D context from canvas");u.clearRect(0,0,a,l)}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var ge=class{constructor(){this.parent=document.createElement("div"),this.parent.className="mapboxgl-ctrl leaflet-control",this.parent.style.borderStyle="solid",this.parent.style.borderColor="#000",this.parent.style.backgroundColor="#aaaaaaaa",this.parent.style.padding="5px",this.parent.onmousemove=this.parent.ondblclick=this.parent.onclick=_=>_.stopPropagation?.();let{base:o}=St();this.styleBase=o;let a=xt(this.parent,"div",{onclick:onwheel,ondblclick:onwheel,onwheel,onmousedown,onmouseup}),l=xt(a,"button",{id:"customStyleButton",style:"height: 1.5em; background-color: gray",innerText:"Custom Style"}),u=xt(a,"div",{id:"customStyleDiv",style:"display: none; border-color: black; border-style: solid; border-width: 2px; background-color: rgba(135, 206, 250, 0.8)"});l.addEventListener("click",()=>{u.style.display!=="none"?(u.style.display="none",l.innerHTML="show Custom Style Editor"):(u.style.display="flex",l.innerHTML="update Custom Style & Hide")}),this.editorTextAreaEl=xt(u,"textarea",{id:"customStyleTextArea",style:"width: 20vw;"}),this.editorTextAreaEl.readOnly=!0,this.editorDivEl=xt(u,"div");let c=(_,g=!0)=>{xt(this.editorDivEl,"label",{htmlFor:_,id:`${_}Label`,className:`${_}LabelClass`,textContent:_.replace(/Input|Select$/i,"")}),g&&xt(this.editorDivEl,"br",{})},f=({id:_,type:g,min:x,max:T,step:b,onEvent:M="change",br:C=!0})=>{let S=xt(this.editorDivEl,"input",{id:_,className:`${_}Class`,type:g,min:x,max:T,step:b});return M!=="none"&&S.addEventListener(M,()=>this._onDivChange()),c(_,C),S},m=({id:_,opts:g,onEvent:x="change",br:T=!0})=>{let b=xt(this.editorDivEl,"select",{id:_,className:`${_}Class`});x!=="none"&&b.addEventListener(x,()=>this._onDivChange());for(let M of g)b.options.add(xt(b,"option",{value:M,text:M}));return c(_,T),b.selectedIndex=0,b},y=_=>{let g=m({id:`${_}Select`,br:!1,opts:["inverted","fill","none","custom"]}),x=f({id:`${_}Input`,type:"color",onEvent:"none"});return x.addEventListener("change",()=>{g.value="custom",this._onDivChange()}),[g,x]};this.parentInput=f({id:"parentInput",type:"text"}),this.nameInput=f({id:"nameInput",type:"text"}),this.fillSelect=m({id:"fillSelect",opts:["gradient","solid","none"]}),[this.isolineColorSelect,this.isolineColorInput]=y("isolineColor"),this.isolineTextInput=f({id:"isolineTextInput",type:"checkbox"}),this.vectorFactorInput=f({id:"vectorFactorInput",type:"number",min:"0.1",max:"10",step:"0.1"}),this.vectorTypeSelect=m({id:"vectorTypeSelect",opts:["arrows","barbs","none"]}),[this.vectorColorSelect,this.vectorColorInput]=y("vectorColor"),[this.streamLineColorSelect,this.streamLineColorInput]=y("streamLineColor"),this.streamLineSpeedFactorInput=f({id:"streamLineSpeedFactorInput",type:"range",onEvent:"input",min:"0.1",max:"10",step:"0.1"}),this.streamLineStaticInput=f({id:"streamLineStaticInput",type:"checkbox"}),this.showBelowMinInput=f({id:"showBelowMinInput",type:"checkbox"}),this.showAboveMaxInput=f({id:"showAboveMaxInput",type:"checkbox"}),this.colorSchemeSelect=m({id:"colorSchemeSelect",opts:Object.keys(pe()),onEvent:"none"}),this.colorSchemeSelect.addEventListener("change",()=>{let{colors:_,...g}=this.getStyle(),x=g;this._setStyleToTextArea(x),this.colorsInput.value="",this._onDivChange()}),this.colorsInput=f({id:"colorsInput",type:"text"}),this.colorMapInput=f({id:"colorMapInput",type:"text"}),this.levelsInput=f({id:"levelsInput",type:"text"}),this.blurRadiusInput=f({id:"blurRadiusInput",type:"range",onEvent:"input",min:"0",max:"10",step:"1"}),this.addDegreesInput=f({id:"addDegreesInput",type:"number",min:"0",max:"360",step:"1"}),this.unitsInput=f({id:"unitsInput",type:"text"}),this.extraUnitsInput=f({id:"extraUnitsInput",type:"text"}),this.maskSelect=m({id:"maskSelect",opts:["none","sea","land"]}),this.animationSpeed=f({id:"animationSpeed",type:"range",onEvent:"input",min:"0.1",max:"10",step:"0.1"}),this.noiseTexturePow=f({id:"noiseTexturePow",type:"range",onEvent:"input",min:"5",max:"8",step:"1"}),this.vectorFieldFactor=f({id:"vectorFieldFactor",type:"range",onEvent:"input",min:"0.1",max:"3",step:"0.1"}),this.animationIntensity=f({id:"animationIntensity",type:"range",onEvent:"input",min:"0.1",max:"10",step:"0.1"}),this.wavesCount=f({id:"wavesCount",type:"range",onEvent:"input",min:"2",max:"10",step:"1"})}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}onAdd(){return this.parent}onRemove(){this.parent.parentNode?.removeChild(this.parent)}getStyle(){return this._getStyleFromDiv()}setStyle(o){if(o.colorMap){let{colors:a,levels:l,...u}=o;this._setStyleToDiv(u)}else this._setStyleToDiv(o);this._setStyleToTextArea(this._getStyleFromDiv())}_getStyleFromDiv(){let o=u=>{try{return this[u].value?JSON.parse(this[u].value):void 0}catch(c){console.log(u," : parsing error: ",c);return}},a=(u,c)=>u.value==="custom"?c.value:u.value||void 0;return{parent:this.parentInput.value||void 0,name:this.nameInput.value||void 0,fill:this.fillSelect.value||void 0,isolineColor:a(this.isolineColorSelect,this.isolineColorInput),isolineText:this.isolineTextInput.checked,vectorType:this.vectorTypeSelect.value||void 0,vectorColor:a(this.vectorColorSelect,this.vectorColorInput),vectorFactor:+this.vectorFactorInput.value,streamLineColor:a(this.streamLineColorSelect,this.streamLineColorInput),streamLineSpeedFactor:+this.streamLineSpeedFactorInput.value,streamLineStatic:this.streamLineStaticInput.checked,showBelowMin:this.showBelowMinInput.checked,showAboveMax:this.showAboveMaxInput.checked,colorScheme:this.colorSchemeSelect.value||void 0,colors:o("colorsInput"),colorMap:o("colorMapInput"),levels:o("levelsInput"),blurRadius:+this.blurRadiusInput.value,addDegrees:+this.addDegreesInput.value,units:this.unitsInput.value||void 0,extraUnits:o("extraUnitsInput"),mask:this.maskSelect.value||void 0,gl:{animationSpeed:+this.animationSpeed.value||void 0,noiseTexturePow:+this.noiseTexturePow.value||void 0,vectorFieldFactor:+this.vectorFieldFactor.value||void 0,animationIntensity:+this.animationIntensity.value||void 0,wavesCount:+this.wavesCount.value||void 0}}}_setStyleToTextArea(o){this.editorTextAreaEl.value=JSON.stringify(Yi(o),null,2)}_setStyleToDiv(o){this.parentInput.value=o.parent||"",this.nameInput.value=o.name||"",this.fillSelect.value=o.fill||"",this.isolineColorSelect.value=o.isolineColor?.[0]==="#"?"custom":o.isolineColor||"",this.isolineColorInput.value=o.isolineColor?.[0]==="#"?o.isolineColor:"#000000",this.isolineTextInput.checked=o.isolineText||!1,this.vectorTypeSelect.value=o.vectorType||"",this.vectorColorSelect.value=o.vectorColor?.[0]==="#"?"custom":o.vectorColor||"",this.vectorColorInput.value=o.vectorColor?.[0]==="#"?o.vectorColor:"#000000",this.vectorFactorInput.value=o.vectorFactor?.toString()||"1",this.streamLineColorSelect.value=o.streamLineColor?.[0]==="#"?"custom":o.streamLineColor||"",this.streamLineColorInput.value=o.streamLineColor?.[0]==="#"?o.streamLineColor:"#000000",this.streamLineSpeedFactorInput.value=o.streamLineSpeedFactor?.toString()||"1",this.streamLineStaticInput.checked=o.streamLineStatic||!1,this.showBelowMinInput.checked=o.showBelowMin||!1,this.showAboveMaxInput.checked=o.showAboveMax||!1,this.colorSchemeSelect.value=o.colorScheme||"",this.colorsInput.value=o.colors?.length?JSON.stringify(o.colors):"",this.colorMapInput.value=o.colorMap?.length?JSON.stringify(o.colorMap):"",this.levelsInput.value=o.levels?.length?JSON.stringify(o.levels.map(a=>+a.toFixed(2))):"",this.blurRadiusInput.value=o.blurRadius?.toString()||"",this.addDegreesInput.value=o.addDegrees?.toString()||"",this.unitsInput.value=o.units||"",this.extraUnitsInput.value=o.extraUnits?JSON.stringify(o.extraUnits):"",this.maskSelect.value=o.mask||"",o.gl?.animationSpeed&&(this.animationSpeed.value=o.gl.animationSpeed.toString()),o.gl?.noiseTexturePow&&(this.noiseTexturePow.value=o.gl.noiseTexturePow.toString()),o.gl?.vectorFieldFactor&&(this.vectorFieldFactor.value=o.gl.vectorFieldFactor.toString()),o.gl?.animationIntensity&&(this.animationIntensity.value=o.gl.animationIntensity.toString()),o.gl?.wavesCount&&(this.wavesCount.value=o.gl.wavesCount.toString())}_onDivChange(){let o=this._getStyleFromDiv();for(let a of Object.keys(o))(o[a]===void 0||o[a]===""||o[a].length===0)&&delete o[a];this._setStyleToTextArea(o),this.onchange?.(this.getStyle())}};function xt(s,o,a){let l=document.createElement(o);return Object.assign(l,a),s?.appendChild(l),l}function Yi(s){return Array.isArray(s)?s.map(Yi):typeof s=="object"&&s!==null?Object.keys(s).sort((a,l)=>{let u=a.toUpperCase(),c=l.toUpperCase();return u===c?0:u>c?1:-1}).reduce((a,l)=>(a[l]=Yi(s[l]),a),{}):s}var ve=class{constructor(o,a){this.delay=o;this.wxsource=a;this.onchange=()=>{};let l=document.createElement("div");l.className="mapboxgl-ctrl leaflet-control",l.style.borderStyle="solid",l.style.borderColor="#000",l.style.backgroundColor="#aaaaaaaa",l.style.padding="5px",l.style.display="flex",l.style.flexDirection="column",this._div=l,l.innerText="Time animation",this.buttonPlayStop=document.createElement("button"),l.appendChild(this.buttonPlayStop),this.timesEl=document.createElement("select"),l.appendChild(this.timesEl),this.timesEl.onchange=async()=>{this.timesEl.style.backgroundColor!=="yellow"&&(this.timesEl.style.backgroundColor="yellow",this.timesEl.value=await this.wxsource?.setTime(this.timesEl.value)||"",this.onchange(this.timesEl.value),this.timesEl.style.backgroundColor="white")},this.wxsource&&this.updateSource(this.wxsource),this.buttonPlayStop.innerHTML="Start";let u=0,c={abortController:new AbortController};this.buttonPlayStop.onclick=async()=>{if(this.buttonPlayStop.innerHTML==="Start"){this.buttonPlayStop.innerHTML="Stop";let f=async()=>{if(this.wxsource){if(this.timesEl.style.backgroundColor="yellow",this.buttonPlayStop.innerHTML==="Stop"){let m=u++%this.wxsource.getAllTimes().length;await this.wxsource.setTime(m,c.abortController),setTimeout(f,this.delay)}else await this.wxsource.unsetCoarseLevel();this.timesEl.value=this.wxsource.getTime()||"",this.onchange(this.timesEl.value),this.timesEl.style.backgroundColor="white"}};await this.wxsource?.setCoarseLevel(2),f()}else c.abortController.abort(),c.abortController=new AbortController,this.buttonPlayStop.innerHTML="Start"}}setTimes(o){this.timesEl.options.length=0;for(let a=0;a<o.length;a++){let l=document.createElement("option");l.value=o[a],l.text=o[a],this.timesEl.appendChild(l)}this.onchange(this.timesEl.value)}updateSource(o){this.buttonPlayStop.innerHTML="Start",this.wxsource=o;let a=this.wxsource?.getAllTimes()||[];this.setTimes(a),this.timesEl.value=this.wxsource?.getTime()||"",this.onchange(this.timesEl.value),o?.on("changed",()=>this.updateSource(o))}onAdd(){return this._div}onRemove(){this._div.parentNode?.removeChild(this._div)}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var Ta="A".charCodeAt(0);var ye=class{constructor(o,a){this._qtree={};this._qtreedepth=0;P("QTree.constructor"),this._ready=this._load(o,a)}get ready(){return this._ready}async _load(o,a){if(o!=="none"){try{let l=await Ct(o,a);this._qtree=bo(l,{pos:0})}catch(l){throw new Error(`Failed to load QTree: ${l.message}`)}this._qtreedepth=wo(this._qtree),P(`QTree.load: qtreedepth=${this._qtreedepth}`)}}check(o){let a=o.z-this._qtreedepth,l=a>=0,u=l?{x:o.x>>a,y:o.y>>a,z:this._qtreedepth}:{...o};return Ma(this._qtree,u,l)}};function bo(s,o){let a=s.charCodeAt(o.pos)-Ta;o.pos++;let l=[1,2,4,8].map(u=>a&u?bo(s,o):void 0);return l.some(u=>u)?{nodes:l}:{}}function wo(s){return s?.nodes?1+Math.max(...s.nodes.map(wo)):0}function Ma(s,o,a){let l=s;for(;l;){if(a&&o.z===0)return"mixed";if(!l.nodes)return"sea";if(o.z===0)return"mixed";o.z--,l=l.nodes[(o.y>>o.z&1)<<1|o.x>>o.z&1]}return"land"}var ti=class{constructor(o){this.wxAPI=o;this.allDatasetsShortMetas={};this.ready=this.updateAll()}updateAll(){return this.ready=Ct(`${this.wxAPI.dataServerURL}meta.json`,this.wxAPI.requestInit),this.ready.then(o=>{this.allDatasetsShortMetas=o}),this.ready}async updateOne(o){try{let a=`${this.wxAPI.dataServerURL+o}/meta.json`,l=await Ct(a,this.wxAPI.requestInit);return Object.assign(this.allDatasetsShortMetas,l)}catch{return this.updateAll()}}};var ei=class{constructor({dataServerURL:o,ext:a="webp",maskURL:l="none",maskChannel:u="R",maskDepth:c=11,qtreeURL:f="none",requestInit:m,colorStyles:y,units:_,colorSchemes:g}){if(P("WxAPI.constructor",o),_o({colorStyles:y,units:_,colorSchemes:g}),f==="auto"&&(f=`${o}masks/11+1.seamask.qtree`),l==="auto"&&(l=`${o}masks/{z}/{x}/{y}.${a}`),this.dataServerURL=o,this.ext=a,this.requestInit=m,this.maskURL=l,this.maskChannel=u==="R"?0:u==="G"?1:u==="B"?2:u==="A"?3:0,this.maskDepth=c,this.maskURL!=="none"){let x=je(Gi);this.loadMaskFunc=T=>x(Ye(this.maskURL,T),m)}else this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));this._allDatasetsManager=new ti(this),this.qtree=new ye(f,m),this.initDone=Promise.all([this._allDatasetsManager.ready,this.qtree.ready]).then(()=>P("WxAPI.constructor initDone"))}async createDatasetManagerOptions(o){await this.initDone,await this._allDatasetsManager.updateOne(o),P("WxAPI.createDatasetManager",o);let a=this._allDatasetsManager.allDatasetsShortMetas[o],l=a?.instance;if(!l)throw new Error(`Dataset/instance not found:${o}`);let u=a.instanced,c,f=`${this.dataServerURL+o}/`;try{c=await Ct(`${f}metafull.json`,this.requestInit)}catch{P("Can't load metafull.json. Trying old infrastructure with NGINX");let g=await Ct(`${f}instances.json`,this.requestInit);if(!Array.isArray(g)||!g.length)throw new Error("instances.json is not an array or empty");c=await Promise.all(g.reverse().map(async x=>Object.assign(await Ct(`${f+x}/meta.json`,this.requestInit),{instance:x})))}let m=c[0],y=u&&new Map(c.map(_=>[_.instance,_]));return{datasetName:o,datasetCurrentInstance:l,datasetCurrentMeta:m,instanced:u,metas:y,wxAPI:this}}async getDatasetAllVariables(o){return await this.initDone,P("WxAPI.getDatasetVariables",o),this._allDatasetsManager.allDatasetsShortMetas[o]?.variables}async filterDatasetsByVariableName(o){await this.initDone,P("WxAPI.filterDatasetsByVariableName:",o);let{allDatasetsShortMetas:a}=this._allDatasetsManager;return Object.keys(a).filter(l=>a[l]?.variables.includes(o))}async getAllDatasetsNames(){return await this.initDone,P("WxAPI.getAllDatasetsNames"),Object.keys(this._allDatasetsManager.allDatasetsShortMetas)}};function Lo(s){return class extends s{constructor(){super(...arguments);this._animation=!1;this._animationSeed=0;this._needUpdateDSManager=!1}get wxdatasetManager(){return P(`WxLayerBaseImplementation.wxdatasetManager (${this.id})`),this._layer.wxdatasetManager}getCurrentVariableMeta(){return P(`WxLayerBaseImplementation.getCurrentVariableMeta (${this.id})`),{...this._layer.currentVariableMeta}}getDatasetMeta(){return this._layer.wxdatasetManager.getInstanceMeta(this.getTime())}getMetadata(){return P(`WxLayerBaseImplementation.getMetadata (${this.id})`),{...this._layer.currentVariableMeta}}getVariablesNames(){return P(`WxLayerBaseImplementation.getVariables (${this.id})`),[...this._layer.variables]}clearCache(){P(`WxLayerBaseImplementation.clearCache (${this.id})`),this._layer.clearCache()}getCache(){return this._layer.tilesRasterCache}getCurrentStyleObjectCopy(){return P(`WxLayerBaseImplementation.getCurrentStyleObjectCopy (${this.id})`),this._layer.getCurrentStyleObjectCopy()}getTime(){return P(`WxLayerBaseImplementation.getTime (${this.id})`),this._layer.getTime()}getAllTimes(){return P(`WxLayerBaseImplementation.getTimes (${this.id})`),this._layer.wxdatasetManager.getAllTimes()}async setTime(a,l,u){P(`WxLayerBaseImplementation.setTime (${this.id}) time=${a}`);let c=this.getTime();return this._layer.setURLsAndTime(a),await this._reloadVisible(l,u),l?.signal?.aborted&&this._layer.setURLsAndTime(c),this.getTime()}async preloadTime(a,l){return P(`WxLayerBaseImplementation.preloadTime (${this.id}) time=${a}`),this._layer.preloadTime(a,this.coveringTiles(),l)}startAnimation(){if(this._animation){P(`WxLayerBaseImplementation.startAnimation (${this.id}) already started`);return}if(this._layer.nonanimatable){P(`WxLayerBaseImplementation.startAnimation (${this.id}) nonanimatable`);return}P(`WxLayerBaseImplementation.startAnimation (${this.id})`),this._animation=!0;let a=async l=>{if(P(`WxLayerBaseImplementation.startAnimation (${this.id}) animationStep`),!this._animation||this._layer.nonanimatable){this._animation=!1;return}this._animationSeed=l,await this._redrawTiles(),requestAnimationFrame(a)};requestAnimationFrame(a)}async stopAnimation(){return P(`WxLayerBaseImplementation.stopAnimation (${this.id})`),this._animation=!1,this._redrawTiles()}async setCoarseLevel(a=2){this._layer.coarseLevel=Math.max(0,Math.min(a,this.wxdatasetManager.getMaxZoom()))}async unsetCoarseLevel(){return this._layer.coarseLevel=0,this._reloadVisible()}async setStyleByName(a,l=!0){return P(`WxLayerBaseImplementation.setStyleByName (${this.id}) wxstyleName=${a} reload=${l}`),this.updateCurrentStyleObject(St()[a],l)}async updateCurrentStyleObject(a,l=!0,u){if(P(`WxLayerBaseImplementation.updateCurrentStyleObject (${this.id}) style=${a} reload=${l}`),this._layer.updateCurrentStyleObject(a),this.startAnimation(),l)return this._reloadVisible(u)}_redrawTiles(){return this._redrawRequested?this._redrawRequested:(this._redrawRequested=new Promise(a=>{requestAnimationFrame(()=>{P(`WxTileSource _redrawTiles (${this.id})`),this.update(),a(),this._redrawRequested=void 0})}),this._redrawRequested)}async _reloadVisible(a,l){}coveringTiles(){return[]}update(){}async _loadTileHelper(a,l){if(!this._needUpdateDSManager)try{return await this._layer.loadTile(a,l)}catch(u){if(u.name==="AbortError")throw u;u.reason==="instance-not-found"&&!this._needUpdateDSManager&&(this._needUpdateDSManager=!0,P(`WxTileSource.loadTile (${this.id}) instance-not-found. Trying to update wxdatasetManager and load again.`),this.wxdatasetManager.update().then(()=>{this._needUpdateDSManager=!1,this.setTime(this.getTime()).then(()=>this.fire("changed",this))}).catch(c=>{P(`WxTileSource.loadTile (${this.id}) instance-not-found. wxdatasetManager update failed.`,c)}))}return null}}}var Eo=po(Ki());var xe=class extends Map{clear(){P("TilesCache.clear()");for(let o of this.values()){if(!o.rd)return;o.rd.gl.deleteTexture(o.rd.vectorTextureU),o.rd.gl.deleteTexture(o.rd.vectorTextureV)}super.clear()}};var Sa=2*Math.PI*6378137/256,ni=2*Math.PI*6378137/2;function Pa(s,o){let a=s/ni*180,l=o/ni*180;return l=180/Math.PI*(2*Math.atan(Math.exp(l*Math.PI/180))-Math.PI/2),[l,a]}function Ca(s,o,a){let l=Ia(a),u=s*l-ni,c=o*l-ni;return[u,c]}function Ia(s){return Sa/2**s}function Ji(s,o,a){let[l,u]=Pa(...Ca(s,o,a));return[u,-l]}function Mo(s,o){return[s*256,o*256]}function Qi(s,o,a){let l=((o-s)%360+540)%360-180;return(s+l*a+360)%360}function Wa(s,o,a,l,u,c,f,m){let y=s,_=o,g=a,x=l;switch((y?1:0)|(_?2:0)|(g?4:0)|(x?8:0)){case 0:return 0;case 1:return y;case 2:return _;case 3:g=y,x=_;break;case 4:return g;case 5:_=y,x=g;break;case 6:x=_+g>>1,y=x;break;case 7:x=_+g>>1;break;case 8:return x;case 9:_=y+x>>1,g=_;break;case 10:y=_,g=x;break;case 11:g=y+x>>1;break;case 12:y=g,_=x;break;case 13:_=y+x>>1;break;case 14:y=_+g>>1;break}y=f+m*y,_=f+m*_,g=f+m*g,x=f+m*x;let b=Qi(y,_,u),M=Qi(g,x,u),C=(Qi(b,M,c)-f)/m;return C<1?1:C}function So(s,o,a,l,u,c,f,m){switch((s?1:0)|(o?2:0)|(a?4:0)|(l?8:0)){case 7:return u+c<1?u*(o-s)+c*(a-s)+s:0;case 14:return u+c<1?0:u*(l-a)+c*(l-o)+o+a-l;case 11:return c<u?(1-u)*(s-o)+c*(l-o)+o:0;case 13:return c<u?0:(1-u)*(a-l)+c*(a-s)+s+l-a;case 15:return u+c<1?u*(o-s)+c*(a-s)+s:u*(l-a)+c*(l-o)+o+a-l;default:return 0}}function Po(s,o,a){let l=1/2**a.z,u=a.x*256*l-.5,c=a.y*256*l-.5,{raw:f,dmin:m,dmax:y,dmul:_}=o,g={raw:new Uint16Array(258*258),dmin:m,dmax:y,dmul:_},{raw:x}=g;for(let T=-1,b=0,M=c-l+1;T<=256;T++,M+=l){let C=Math.floor(M),S=M-C,W=C*258;for(let O=-1,E=u-l+1;O<=256;O++,b++,E+=l){let Z=Math.floor(E),V=E-Z,F=Z+W,H=f[F],it=f[F+1],q=f[F+258],G=f[F+258+1];x[b]=s(H,it,q,G,V,S,m,_)}}return g}function Co(s,o,a){if(!o)return s;let l=g=>g<0?0:g>254?254:g,u=1/2**o.z,c=o.x*256*u-.5,f=o.y*256*u-.5,{data:m}=s,y=new ImageData(256,256),{data:_}=y;for(let g=0,x=a,T=f;g<256;g++,T+=u){let b=~~l(T),M=T-b,C=b*256;for(let S=0,W=c;S<256;S++,x+=4,W+=u){let O=~~l(W),E=W-O,Z=(O+C)*4+a,V=m[Z],F=m[Z+4],H=m[Z+4*256],it=m[Z+4*256+4],q=So(V,F,H,it,E,M,0,0);_[x]=q>127?255:0}}return y}function Io(s,o){return o?Po(So,s,o):s}function Wo(s,o){return o?Po(Wa,s,o):s}function Do(s,{data:o},a,l){let u=l==="sea",{raw:c}=s;for(let f=a,m=259,y=0;y<256;m+=2,y++)for(let _=0;_<256;_++,m++,f+=4)u===!o[f]&&(c[m]=0);return s}function ko(s){let[o,a]=Mo(s.x,s.y),[l,u]=Ji(o,a,s.z),[c,f]=Ji(o+256,a+256,s.z);return{west:l,north:u,east:c,south:f}}function tn(s,o){let a=s.z-o;if(a<=0)return{upCoords:s};let l={x:s.x>>>a,y:s.y>>>a,z:o},u={x:s.x&(1<<a)-1,y:s.y&(1<<a)-1,z:a};return{upCoords:l,subCoords:u}}var oi=class{constructor(o){this._loadDataFunc=je(go);this._layer=o}async load(o,a){let l=await this.cacheLoad(o,this._layer.tilesURIs,a);if(!l)return null;let{rawdata:u,subCoords:c,tileType:f}=l,{units:m}=this._layer.currentVariableMeta,y=m==="degree"?Wo:Io,_=x=>y(vo(x,this._layer.style.blurRadius),c),g=u.map(_);return this._vectorMagnitudesPrepare(g),await this._applyMask(g,o,f,!c&&u.length===1),{data:g,slines:this._createStreamLines(g)}}async cacheLoad(o,a,l){if(!this._checkInsideBoundaries(o))return null;let u=this._checkTypeAndMask(o);if(!u)return null;let{upCoords:c,subCoords:f}=tn(o,this._layer.getCoarseMaxZoom()),m=a.map(g=>Ye(g,c)),y=Object.assign({},this._layer.wxdatasetManager.wxAPI.requestInit,{signal:l?.signal});return{rawdata:await Promise.all(m.map(g=>this._loadDataFunc(g,y))),subCoords:f,tileType:u}}clearCache(){this._loadDataFunc.clearCache()}async _applyMask(o,a,l,u){let{style:c}=this._layer;if((c.mask==="land"||c.mask==="sea")&&l==="mixed"){if(u){let{raw:y,dmin:_,dmax:g,dmul:x}=o[0];o[0]={raw:new Uint16Array(y),dmin:_,dmax:g,dmul:x}}let f,{wxAPI:m}=this._layer.wxdatasetManager;try{let{upCoords:y,subCoords:_}=tn(a,m.maskDepth);f=await m.loadMaskFunc(y),f=Co(f,_,m.maskChannel)}catch{c.mask=void 0,P("Can't load Mask. Masking is disabled");return}Do(o[0],f,m.maskChannel,c.mask)}}_vectorMagnitudesPrepare(o){if(o.length===1)return;o.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[a,l,u]=o;a.dmax=1.42*Math.max(-l.dmin,l.dmax,-u.dmin,u.dmax),a.dmul=(a.dmax-a.dmin)/65535;for(let c=0;c<258*258;++c){if(!l.raw[c]||!u.raw[c])continue;let f=l.dmin+l.dmul*l.raw[c],m=u.dmin+u.dmul*u.raw[c];a.raw[c]=Math.sqrt(m*m+f*f)/a.dmul}}_checkTypeAndMask(o){let{mask:a}=this._layer.style;if(a==="land"||a==="sea"){let l=this._layer.wxdatasetManager.wxAPI.qtree.check(o);return a===l?void 0:l}return"mixed"}_checkInsideBoundaries(o){let a=this._layer.getBoundaries();if(a?.boundaries180){let l=ko(o),u=c=>!(l.west>c.east||c.west>l.east||l.south>c.north||c.south>l.north);if(!a.boundaries180.some(u))return!1}return!0}_createStreamLines(o){if(o.length!==3)return[];let{style:a}=this._layer;if(a.streamLineColor==="none")return[];let l=[],[u,c,f]=o,m=(a.streamLineSpeedFactor||1)/u.dmax,y=a.addDegrees?.017453292519943*a.addDegrees:0,_=a.streamLineGridStep||64,g=a.streamLineSteps||300;for(let x=0;x<=256;x+=_)for(let T=0;T<=256;T+=_){if(!u.raw[1+T+(1+x)*258])continue;let b=[],M=T,C=x,S=-1,W=0,O=0;for(let V=0;V<=g&&M>=0&&M<=256&&C>=0&&C<=256;V++){V%(g/10)||b.push({x:~~M,y:~~C});let F=~~M+1+(~~C+1)*258;if(F!==S){if(!u.raw[F])break;S=F;let H=u.dmin+u.raw[F]*u.dmul,it=c.dmin+c.raw[F]*c.dmul,q=f.dmin+f.raw[F]*f.dmul,G=Math.atan2(it,q)+y;W=m*H*Math.sin(G),O=m*H*Math.cos(G)}M+=W,C-=O}let E=T,Z=x;S=-1;for(let V=1;V<=g&&E>=0&&E<=256&&Z>=0&&Z<=256;V++){V%(g/10)||b.unshift({x:~~E,y:~~Z});let F=~~E+1+(~~Z+1)*258;if(F!==S){if(!u.raw[F])break;S=F;let H=u.dmin+u.raw[F]*u.dmul,it=c.dmin+c.raw[F]*c.dmul,q=f.dmin+f.raw[F]*f.dmul,G=Math.atan2(it,q)+y;W=m*H*Math.sin(G),O=m*H*Math.cos(G)}E-=W,Z+=O}b.length>2&&l.push(b)}return l}};var ri=class{constructor(o){this._layer=o}paint({data:o,ctxFill:a,ctxText:l,ctxStreamLines:u}){let{_layer:c}=this,{units:f}=c.currentVariableMeta,m=new ImageData(256,256),y=new Uint32Array(m.data.buffer);a.clearRect(0,0,256,256),l.clearRect(0,0,256,256),u.clearRect(0,0,256,256),Da(o.data[0],y,c);let _=ka(y,o.data[0],c);a.putImageData(m,0,0),Ea(_,l,c),Za(o.data,l,c),Oa(o.data[0],l,f,c),za(o,l,c)}getPaintedCanvas(o,a,l){return a?(this.imprintVectorAnimationLinesStep(o,l),o.ctxStreamLines.canvas):o.ctxFill.canvas}imprintVectorAnimationLinesStep({data:o,ctxFill:a,ctxStreamLines:l},u){let{_layer:c}=this;l.clearRect(0,0,256,256),l.drawImage(a.canvas,0,0),!(o.slines.length===0||c.style.streamLineStatic||c.style.streamLineColor==="none")&&Ra(o,l,c,u)}};function Da(s,o,{CLUT:a,style:l}){let{raw:u}=s,{colorsI:c}=a;if(l.fill!=="none")for(let f=0,m=0,y=259;f<256;++f,y+=2)for(let _=0;_<256;++_,++m,++y)o[m]=c[u[y]];else o.fill(0)}function ka(s,o,{CLUT:a,style:l}){let{raw:u}=o,{levelIndex:c,colorsI:f}=a,m=[];if(l.isolineColor!=="none"){let y=l.isolineColor[0]==="#"?Pt(l.isolineColor):0;for(let _=0,g=0;_<256;_+=1)for(let x=0;x<256;x+=1){let T=(_+1)*258+(x+1),b=u[T],M=u[T+1],C=u[T+258];if(!b||!M||!C)continue;let S=c[b],W=c[M],O=c[C];if(S!==W||S!==O){let E=Math.max(S,W,O),Z=Math.max(b,M,C),V=_*256+x;switch(l.isolineColor){case"inverted":s[V]=~f[Z]|4278190080;break;case"fill":s[V]=f[Z]|4278190080;break;default:s[V]=y;break}l.isolineText&&!(++g%255)&&x>20&&x<235&&_>20&&_<235&&m.push({x,y:_,d:b,dr:M,db:C,mli:E})}}}return m}function Ea(s,o,{CLUT:a,style:l}){if(s.length){let u=l.isolineTextSizeEm||1.1;o.font=`${u.toString()}em Sans-serif`,o.lineWidth=2,o.strokeStyle="white",o.fillStyle="black",o.textAlign="center",o.textBaseline="middle";let c=o.measureText("-.0123456789"),f=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent,y=1.5*f,_=c.actualBoundingBoxAscent+(y-f)/2,g=1.1,x=u*2.5,T=l.isolineTextBackground?Aa:Ba;for(let{x:b,y:M,d:C,dr:S,db:W,mli:O}of s){let E=Math.atan2(C-S,W-C);o.save(),o.translate(b,M),o.rotate(E<-1.57||E>1.57?E+3.14:E);let Z=a.ticks[O].dataString;T(Z,o,{height:y,hOffset:_,wScale:g,radii:x}),o.fillText(Z,0,0),o.restore()}}}function Aa(s,o,a){o.strokeText(s,0,0)}function Ba(s,o,{height:a,hOffset:l,wScale:u,radii:c}){let f=o.fillStyle;o.fillStyle=o.strokeStyle;let m=u*o.measureText(s).width;o.beginPath(),o.roundRect(-m/2,-l,m,a,c),o.closePath(),o.fill(),o.fillStyle=f}function Za(s,o,{CLUT:a,style:l}){if(!a.DataToKnots||l.vectorColor==="none"||l.vectorType==="none")return;if(s.length!==3)throw new Error("data.length !== 3");let[u,c,f]=s;switch(l.vectorType){case"barbs":o.font="40px barbs";break;case"arrows":o.font="50px arrows";break;default:o.font=l.vectorType}o.textAlign="center",o.textBaseline="middle",o.fillStyle=l.vectorColor;let m=l.addDegrees?.017453292519943*l.addDegrees:0,y=32;for(let _=y/2;_<256;_+=y)for(let g=y/2;g<256;g+=y){let x=g+1+(_+1)*258;if(!u.raw[x])continue;let T=Math.atan2(c.dmin+c.raw[x]*c.dmul,f.dmin+f.raw[x]*f.dmul),b=u.dmin+u.raw[x]*u.dmul,M=l.vectorType!=="barbs"?l.vectorFactor*.5:.2,C=Math.min(~~(a.DataToKnots(b)*M),25)+65,S=String.fromCharCode(C);switch(l.vectorColor){case"inverted":o.fillStyle=lt(~a.colorsI[u.raw[x]]);break;case"fill":o.fillStyle=lt(a.colorsI[u.raw[x]]);break}o.save(),o.translate(g,_),o.rotate(T+m),o.fillText(S,0,0),o.restore()}}function Oa(s,o,a,{CLUT:l,style:u}){if(a!=="degree")return;let c=.017453292519943*u.addDegrees;o.font="50px arrows",o.textAlign="center",o.textBaseline="middle",o.fillStyle=u.vectorColor;let f="L",m=32;for(let y=m/2;y<256;y+=m)for(let _=m/2;_<256;_+=m){let g=_+1+(y+1)*258;if(!s.raw[g])continue;let T=(s.dmin+s.raw[g]*s.dmul+180)*.01745329251;switch(u.vectorColor){case"inverted":o.fillStyle=lt(~l.colorsI[s.raw[g]]);break;case"fill":o.fillStyle=lt(l.colorsI[s.raw[g]]);break}o.save(),o.translate(_,y),o.rotate(T+c),o.fillText(f,0,0),o.restore()}}function za(s,o,{CLUT:a,style:l}){let{data:u,slines:c}=s;if(!c.length||!l.streamLineStatic||l.streamLineColor==="none")return;let f=u[0];o.lineWidth=1,l.streamLineColor[0]==="#"&&(o.strokeStyle=ji(l.streamLineColor));for(let m=c.length;m--;){let y=c[m];for(let _=0;_<y.length-1;++_){let g=y[_],x=y[_+1],T=g.x+1+(g.y+1)*258;switch(l.streamLineColor){case"inverted":o.strokeStyle=lt(~a.colorsI[f.raw[T]]);break;case"fill":o.strokeStyle=lt(a.colorsI[f.raw[T]]);break}o.beginPath(),o.moveTo(g.x,g.y),o.lineTo(x.x,x.y),o.stroke()}}}function Ra(s,o,{CLUT:a,style:l},u){let{data:c,slines:f}=s,m=c[0],y=l.streamLineColor[0]==="#"?ji(l.streamLineColor).substring(0,7):"#000000",_=u>>5;for(let g=0;g<f.length;++g){let x=f[g],T=x.length-1,b=(_+(1+x[0].x)*(1+x[0].y))%30;for(let M=0;M<T;++M){let C=x[M],S=x[M+1],W=1-(b-M)/T;(W<0||W>1)&&(W=0);let O=(~~(W*255)).toString(16).padStart(2,"0"),E=1+~~((1.2-W)*5);o.lineWidth=E;let Z=C.x+1+(C.y+1)*258;switch(l.streamLineColor){case"inverted":y=lt(~a.colorsI[m.raw[Z]]);break;case"fill":y=lt(a.colorsI[m.raw[Z]]);break}o.strokeStyle=y+O,o.beginPath(),o.moveTo(C.x,C.y),o.lineTo(S.x,S.y),o.stroke()}}}var ai=class{constructor(o){this.tilesRasterCache=new xe;this.coarseLevel=0;this._painter=new ri(this);this._loader=new oi(this);if(P(`WxLayer.constructor:
4
+ min=${u.toFixed(2)} ${d}, max=${c.toFixed(2)} ${d}<br>`;let T=o.getLayerInfoAtLatLon(this.pos,a);T?this.div.innerHTML+=`style=${T.inStyleUnits.map(b=>b.toFixed(2))} ${T.styleUnits}<br>
5
+ source=${T.data.map(b=>b.toFixed(2))} ${T.dataUnits}<br>`:this.div.innerHTML+="style=outside<br>source=outside<br>"}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var Ui={none:["#00000000","#00000000"],diverging_blue_red:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow_zero:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow_wrap:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],rainbow_backwards:["#0000ffff","#00ffffff","#00ff00ff","#ffff00ff","#ff0000ff","#ff00ffff"],rainbow_backwards_zero:["#0000ff00","#0000ffff","#00ffffff","#00ff00ff","#ffff00ff","#ff0000ff","#ff00ffff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebird_zero:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],black_white:["#000000ff","#ffffffff"],white_black:["#ffffffff","#000000ff"],reddish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"],black:["#000000ff","#000000ff"],white:["#ffffffff","#ffffffff"],transparent:["#ffffff00"],peach_red_zero:["#fdd49f00","#fdd49fff","#d7301fff"]};var ge={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"none",isolineText:!0,isolineTextSizeEm:1.1,isolineTextBackground:!1,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"none",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"diverging_blue_red",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none",gl:{animationIntensity:5,animationSpeed:1,noiseTexturePow:5,vectorFieldFactor:1,wavesCount:4}},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,isolineTextSizeEm:1.1,isolineTextBackground:!1,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}};var $i={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]};var Kt={_units:$i,_colorSchemes:Ui,_colorStylesUnrolled:ge,wxlogging:!1};function go({colorStyles:s={},units:o={},colorSchemes:a={}}={}){P("WxTile lib setup: start"),Kt._units=Object.assign({},$i,o),Kt._colorSchemes=Object.assign({},a,Ui);let l=Object.assign({},s,ge);Kt._colorStylesUnrolled=va(l),P("WxTile lib setup: styles unrolled"),(async()=>{try{await document.fonts.load("32px barbs"),await document.fonts.load("32px arrows")}catch{P("WxTile lib setup: fonts not loaded")}})(),P("WxTile lib setup is done.")}function Zt(){return Kt._colorStylesUnrolled}function Ve(){return Kt._colorSchemes}function qe(s,o,a){P("makeConverter: From=",s," To=",o);let l=C=>C;if(l.trivial=!0,s===o)return P("Trivial converter"),l;let u=Object.assign({},Kt._units,a),c=u[s],d=u[o];if(!c||!d)return P("Inconvertible units. Trivial converter"),l;let[_,g,m]=c,[v,x,T]=d;if(_!==v||!g||!x)return P("Inconvertible units. Trivial converter"),l;let b=g/x,M=((m||0)-(T||0))/x;return M?C=>b*C+M:C=>b*C}function va(s){let o=Object.assign({},ge);for(let c in s){let d=s[c];if(Array.isArray(d))for(let _=0;_<d.length;++_)o[`${c}[${_}]`]=Object.assign({},d[_]);else o[c]=Object.assign({},d)}let a=Object.assign({},ge.base),l=(c,d)=>{if(d==="base")return a;let _=c[d];if(!_)return a;(!_.parent||!(_.parent in c))&&(_.parent="base");let g=l(c,_.parent);return Object.assign(_,Object.assign({},g,_,{parent:"base"}))},u={base:a};for(let c in o)u[c]=l(o,c);return u}function Ge(s){let o=new Map,a=(l,...u)=>{let c=o.get(l);if(c)return c;let d=s(l,...u);return o.set(l,d),d.catch(_=>_.name==="AbortError"&&o.delete(l)),d};return a.clearCache=()=>o.clear(),a}async function ya(s,o){let a=await fetch(s,o);if(a.status!==200&&a.status!==304)throw{name:"Tile loading failed",reason:a.headers.get("x-reason"),status:a.status};return await createImageBitmap(await a.blob(),{premultiplyAlpha:"none"})}var Vi=class{constructor(o,a,l,u){this.raw=o;this.dmin=a;this.dmax=l;this.dmul=u;this.radius=0}get integral(){return this.integral_||(this.integral_=wa(this.raw)),this.integral_}};function Jt(s,o,a=!0){let l=Object.assign(document.createElement("canvas"),{width:s,height:o,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:a});if(!l)throw new Error("Cannot get canvas context");return l}function xa(s){let{width:o,height:a}=s,l=Jt(o,a);return l.drawImage(s,0,0),l.getImageData(0,0,o,a)}async function qi(s,o){return xa(await ya(s,o))}function ba(s){s.data[34]<1&&P("Warning: image is in too old format. Check the version of the Splitter.");let o=new Uint16Array(s.data.buffer),a=new Uint16Array(o.length/2);for(let g=0;g<a.length;g++)a[g]=o[g*2];let l=new Uint8Array(8);for(let g=0;g<8;++g)l[g]=s.data[g*4+2];let u=new DataView(l.buffer),c=u.getFloat32(0,!0),d=u.getFloat32(4,!0),_=(d-c)/65535;return new Vi(a,c,d,_)}async function vo(s,o){return ba(await qi(s,o))}function wa(s){let o=new Uint32Array(66564),a=new Uint32Array(258*258);o[0]=s[0],a[0]=s[0]?1:0;for(let l=1;l<258;++l){o[l]=s[l]+o[l-1],a[l]=(s[l]?1:0)+a[l-1];let u=258*l;o[u]=s[u]+o[u-258],a[u]=(s[u]?1:0)+a[u-258]}for(let l=1;l<258;++l)for(let u=1;u<258;++u){let c=258*l+u;o[c]=s[c]+o[c-258]+o[c-1]-o[c-259],a[c]=(s[c]?1:0)+a[c-258]+a[c-1]-a[c-259]}return{integral:o,integralNZ:a[66563]===66564?null:a}}function Ta(s){let{integral:o}=s.integral;s.raw[0]=o[0];for(let a=1;a<258;a++){s.raw[a]=o[a]-o[a-1],s.raw[258*a]=o[258*a]-o[258*(a-1)];for(let l=1;l<258;l++){let u=258*a+l;s.raw[u]=o[u-259]+o[u]-o[u-258]-o[u-1]}}return s}function yo(s,o){let a=o<0?0:o;if(a===s.radius)return s;if(s.radius=a,!a)return Ta(s);let{integral:l,integralNZ:u}=s.integral;for(let c=2;c<256;c++)for(let d=2;d<256;d++){let _=258*c+d;if(!s.raw[_])continue;let g=Math.min(a,d-1,256-d),m=Math.min(a,c-1,256-c),v=258*(c-m-1)+d,x=258*(c+m)+d,T;if(u){let Z=u[v-g-1],A=u[v+g],O=u[x-g-1],V=u[x+g];T=Z+V-A-O}else T=(2*g+1)*(2*m+1);let b=l[v-g-1],M=l[v+g],C=l[x-g-1],S=l[x+g],W=b+S-M-C;s.raw[_]=W/T}for(let c=2;c<256;c++){let d=258+c;if(s.raw[d]){let v=c,x=Math.min(a,v-1,256-v),T=258+v,b;if(u){let F=u[T-x-1];b=0+u[T+x]-0-F}else b=(2*x+1)*2;let M=0,C=0,S=l[T-x-1],W=l[T+x],A=(M+W-C-S)/b;s.raw[d-258]=A,s.raw[d]=A}let _=258*256+c;if(s.raw[_]){let v=c,x=Math.min(a,v-1,256-v),T=258*255+v,b=258*257+v,M=l[T-x-1],C=l[T+x],S=l[b-x-1],W=l[b+x],Z=M+W-C-S,A;if(u){let V=u[T-x-1],F=u[T+x],K=u[b-x-1],X=u[b+x];A=V+X-F-K}else A=(2*x+1)*2;let O=Z/A;s.raw[_]=O,s.raw[_+258]=O}let g=258*c+1;if(s.raw[g]){let v=c,x=Math.min(a,v-1,256-v),T=258*(v-x-1)+1,b=258*(v+x)+1,M;if(u){let F=u[T],K=0;M=0+u[b]-F-K}else M=(2*x+1)*2;let C=0,S=l[T],W=0,Z=l[b],O=(C+Z-S-W)/M;s.raw[g-1]=O,s.raw[g]=O}let m=258*c+256;if(s.raw[m]){let v=c,x=Math.min(a,v-1,256-v),T=258*(v-x-1)+256,b=258*(v+x)+256,M;if(u){let V=u[T-1],F=u[T+1],K=u[b-1],X=u[b+1];M=V+X-F-K}else M=2*(2*x+1);let C=l[T-1],S=l[T+1],W=l[b-1],Z=l[b+1],O=(C+Z-S-W)/M;s.raw[m]=O,s.raw[m+1]=O}}return s}function ct(s){let o=s>>0&255,a=s>>8&255,l=s>>16&255,u=o.toString(16),c=a.toString(16),d=l.toString(16);return u=u.length===2?u:`0${u}`,c=c.length===2?c:`0${c}`,d=d.length===2?d:`0${d}`,`#${u}${c}${d}`}function Wt(s){if(s[0]==="#"){if(s.length===4)return+`0xff${s[3]}${s[3]}${s[2]}${s[2]}${s[1]}${s[1]}`;if(s.length===7)return+`0xff${s[5]}${s[6]}${s[3]}${s[4]}${s[1]}${s[2]}`;if(s.length===9)return+`0x${s[7]}${s[8]}${s[5]}${s[6]}${s[3]}${s[4]}${s[1]}${s[2]}`}return P("wrong color format",s),0}async function Dt(s,o){let a=await fetch(s,o);if(!a.ok)throw new Error(`error:${s} - ${a.statusText}`);return a.json()}function Gi(s,o,a){let l=s>>0&255,u=s>>8&255,c=s>>16&255,d=s>>>24,_=o>>0&255,g=o>>8&255,m=o>>16&255,v=o>>>24,x=l+a*(_-l),T=u+a*(g-u),b=c+a*(m-c),M=d+a*(v-d);return x|T<<8|b<<16|M<<24}function xo(s,o,a){let l=[];for(let u=0;u<a;++u)l.push(u*(o-s)/(a-1)+s);return l}var P=(...s)=>{};function Xi(s){return s[0]==="#"&&s.length===4?`#${s[1]}${s[1]}${s[2]}${s[2]}${s[3]}${s[3]}`:s}function Xe(s,{x:o,y:a,z:l}){return s.replace("{x}",`${o}`).replace("{y}",`${a}`).replace("{z}",`${l}`)}function je({x:s,y:o,z:a}){return`${a}-${s}-${o}`}function La(s,o,a){return s>a?a:s<o?o:s}var Ye=class{constructor(o,a,[l,u],c){P("RawCLUT.constructor"),this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let d;this.DataToStyle=qe(a,o.units,o.extraUnits),this.DataToStyle.trivial&&(o.units=a),c&&(this.DataToKnots=qe(a,"knot"));let _=qe(o.units,a,o.extraUnits),g=S=>~~(65535*La((_(S)-l)/(u-l),0,1));if(o.colorMap?.length)d=o.colorMap.sort((S,W)=>S[0]-W[0]).map(([S])=>g(S));else{o.levels||(o.levels=xo(this.DataToStyle(l),this.DataToStyle(u),10)),o.levels.sort((W,Z)=>W-Z);let S=Ve();o.colors||(o.colors=S[o.colorScheme]||["#ffffffff","#000000ff"]),d=o.levels.map(g)}let m=u-l,v=ji(65536,o);this.ticks=v.ticks;let x=v.ticks[0].data,b=v.ticks[v.ticks.length-1].data-x,M=o.showBelowMin?v.colors[0]:0,C=o.showAboveMax?v.colors[65535]:0;this.colorsI[0]=0;for(let S=1;S<65536;++S){let W=this.DataToStyle(m*S/65535+l),Z=Math.round(65535*(W-x)/b);this.colorsI[S]=Z<=0?M:Z>65535?C:v.colors[Z]}for(let S=0;S<d[0];++S)this.levelIndex[S]=0;for(let S=0;S<d.length-1;S++)for(let W=d[S];W<d[S+1]+1;++W)this.levelIndex[W]=S;for(let S=d[d.length-1];S<65536;++S)this.levelIndex[S]=d.length-1}};function bo(s){if(s!==0&&-.1<s&&s<.1)return s.toExponential(2);let o=s.toString();return o.split(".")[1]?.length>2?s.toFixed(2):o}function ji(s,o){let a={size:s,showBelowMin:o.showBelowMin,showAboveMax:o.showAboveMax,units:o.units,colors:new Uint32Array(s),ticks:[]},{colorMap:l,levels:u,colors:c}=o,d=o.fill!=="solid";if(l){let T=l[0][0],b=(s-1)/(l[l.length-1][0]-T);a.ticks=l.map(([M,C])=>({data:M,dataString:bo(M),color:C,pos:~~((M-T)*b)}));for(let M=0;M<l.length-1;M++){let C=a.ticks[M].pos,S=a.ticks[M+1].pos,W=Wt(l[M][1]),Z=d?Wt(l[M+1][1]):0;for(let A=C;A<S;++A)a.colors[A]=d?Gi(W,Z,(A-C)/(S-C)):W}return a.colors[s-1]=Wt(l[l.length-1][1]),a}if(!c||!u)return a;let _=0,g=0,m=-1;for(let T=0;T<s;++T){let b=T*(c.length-1)/s;m!==~~b&&(m=~~b,_=Wt(c[m]),g=c.length>m+1?Wt(c[m+1]):_),a.colors[T]=d?Gi(_,g,b-m):_}a.colors[s-1]=Wt(c[c.length-1]);let v=u[0],x=(s-1)/(u[u.length-1]-v);return a.ticks=u.map(T=>{let b=~~((T-v)*x);return{data:T,dataString:bo(T),pos:b,color:ct(a.colors[b])}}),a}var ve=class{constructor(){let o=document.createElement("div");o.className="mapboxgl-ctrl leaflet-control",o.style.borderStyle="solid",o.style.borderColor="#000",o.style.backgroundColor="#aaaaaaaa",o.style.padding="5px",this._div=o,this._canvas=document.createElement("canvas"),this._canvas.width=600,this._canvas.height=40,o.appendChild(this._canvas)}onAdd(){return this._div}onRemove(){this._div.parentNode?.removeChild(this._div)}drawLegend(o){let{_canvas:a}=this,{width:l,height:u}=a,c=16+u>>2,d=ji(l-50,o),_=a.getContext("2d");if(!_)throw new Error("Failed to get 2D context from canvas");let g=_.createImageData(l,u),m=new Uint32Array(g.data.buffer);m.fill(-1);let v=2,x=2,T=v+l*x,b=c>>1;if(d.showBelowMin){let M=d.colors[0];if(M)for(let C=0;C<b;++C)for(let S=b;S<b+C;++S)m[T+C+S*l]=M,m[T+C+(b*2-S)*l]=M}for(let M=0;M<d.size;++M)for(let C=0;C<c;++C)d.colors[0]&&(m[v+M+b+(C+x+1)*l]=d.colors[M]);if(d.showAboveMax){let M=d.colors[d.colors.length-1];if(M)for(let C=0;C<=b;++C)for(let S=b;S<b+C;++S)m[T+b*2+d.size-C+S*l]=M,m[T+b*2+d.size-C+(b*2-S)*l]=M}_.putImageData(g,0,0),_.font="8px sans-serif",_.beginPath();for(let M of d.ticks)_.strokeStyle="#000",_.moveTo(M.pos+b+v+1,x+3),_.lineTo(M.pos+b+v+1,c),_.fillText(M.dataString,M.pos+b+v+1,c+11);_.font="12px sans-serif",_.fillText(`(${d.units})`,13,u-5),_.stroke(),_.strokeStyle="#888",_.strokeRect(1,1,l-3,u-2)}clear(){let{_canvas:o}=this,{width:a,height:l}=o,u=o.getContext("2d");if(!u)throw new Error("Failed to get 2D context from canvas");u.clearRect(0,0,a,l)}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var ye=class{constructor(){this.parent=document.createElement("div"),this.parent.className="mapboxgl-ctrl leaflet-control",this.parent.style.borderStyle="solid",this.parent.style.borderColor="#000",this.parent.style.backgroundColor="#aaaaaaaa",this.parent.style.padding="5px",this.parent.onmousemove=this.parent.ondblclick=this.parent.onclick=m=>m.stopPropagation?.();let{base:o}=Zt();this.styleBase=o;let a=Tt(this.parent,"div",{onclick:onwheel,ondblclick:onwheel,onwheel,onmousedown,onmouseup}),l=Tt(a,"button",{id:"customStyleButton",style:"height: 1.5em; background-color: gray",innerText:"Custom Style"}),u=Tt(a,"div",{id:"customStyleDiv",style:"display: none; border-color: black; border-style: solid; border-width: 2px; background-color: rgba(135, 206, 250, 0.8)"});l.addEventListener("click",()=>{u.style.display!=="none"?(u.style.display="none",l.innerHTML="show Custom Style Editor"):(u.style.display="flex",l.innerHTML="update Custom Style & Hide")}),this.editorTextAreaEl=Tt(u,"textarea",{id:"customStyleTextArea",style:"width: 20vw;"}),this.editorTextAreaEl.readOnly=!0,this.editorDivEl=Tt(u,"div");let c=(m,v=!0)=>{Tt(this.editorDivEl,"label",{htmlFor:m,id:`${m}Label`,className:`${m}LabelClass`,textContent:m.replace(/Input|Select$/i,"")}),v&&Tt(this.editorDivEl,"br",{})},d=({id:m,type:v,min:x,max:T,step:b,onEvent:M="change",br:C=!0})=>{let S=Tt(this.editorDivEl,"input",{id:m,className:`${m}Class`,type:v,min:x,max:T,step:b});return M!=="none"&&S.addEventListener(M,()=>this._onDivChange()),c(m,C),S},_=({id:m,opts:v,onEvent:x="change",br:T=!0})=>{let b=Tt(this.editorDivEl,"select",{id:m,className:`${m}Class`});x!=="none"&&b.addEventListener(x,()=>this._onDivChange());for(let M of v)b.options.add(Tt(b,"option",{value:M,text:M}));return c(m,T),b.selectedIndex=0,b},g=m=>{let v=_({id:`${m}Select`,br:!1,opts:["inverted","fill","none","custom"]}),x=d({id:`${m}Input`,type:"color",onEvent:"none"});return x.addEventListener("change",()=>{v.value="custom",this._onDivChange()}),[v,x]};this.parentInput=d({id:"parentInput",type:"text"}),this.nameInput=d({id:"nameInput",type:"text"}),this.fillSelect=_({id:"fillSelect",opts:["gradient","solid","none"]}),[this.isolineColorSelect,this.isolineColorInput]=g("isolineColor"),this.isolineTextInput=d({id:"isolineTextInput",type:"checkbox"}),this.vectorFactorInput=d({id:"vectorFactorInput",type:"number",min:"0.1",max:"10",step:"0.1"}),this.vectorTypeSelect=_({id:"vectorTypeSelect",opts:["arrows","barbs","none"]}),[this.vectorColorSelect,this.vectorColorInput]=g("vectorColor"),[this.streamLineColorSelect,this.streamLineColorInput]=g("streamLineColor"),this.streamLineSpeedFactorInput=d({id:"streamLineSpeedFactorInput",type:"range",onEvent:"input",min:"0.1",max:"10",step:"0.1"}),this.streamLineStaticInput=d({id:"streamLineStaticInput",type:"checkbox"}),this.showBelowMinInput=d({id:"showBelowMinInput",type:"checkbox"}),this.showAboveMaxInput=d({id:"showAboveMaxInput",type:"checkbox"}),this.colorSchemeSelect=_({id:"colorSchemeSelect",opts:Object.keys(Ve()),onEvent:"none"}),this.colorSchemeSelect.addEventListener("change",()=>{let{colors:m,...v}=this.getStyle(),x=v;this._setStyleToTextArea(x),this.colorsInput.value="",this._onDivChange()}),this.colorsInput=d({id:"colorsInput",type:"text"}),this.colorMapInput=d({id:"colorMapInput",type:"text"}),this.levelsInput=d({id:"levelsInput",type:"text"}),this.blurRadiusInput=d({id:"blurRadiusInput",type:"range",onEvent:"input",min:"0",max:"10",step:"1"}),this.addDegreesInput=d({id:"addDegreesInput",type:"number",min:"0",max:"360",step:"1"}),this.unitsInput=d({id:"unitsInput",type:"text"}),this.extraUnitsInput=d({id:"extraUnitsInput",type:"text"}),this.maskSelect=_({id:"maskSelect",opts:["none","sea","land"]}),this.animationSpeed=d({id:"animationSpeed",type:"range",onEvent:"input",min:"0.1",max:"10",step:"0.1"}),this.noiseTexturePow=d({id:"noiseTexturePow",type:"range",onEvent:"input",min:"5",max:"8",step:"1"}),this.vectorFieldFactor=d({id:"vectorFieldFactor",type:"range",onEvent:"input",min:"0.1",max:"3",step:"0.1"}),this.animationIntensity=d({id:"animationIntensity",type:"range",onEvent:"input",min:"0.1",max:"10",step:"0.1"}),this.wavesCount=d({id:"wavesCount",type:"range",onEvent:"input",min:"2",max:"10",step:"1"})}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}onAdd(){return this.parent}onRemove(){this.parent.parentNode?.removeChild(this.parent)}getStyle(){return this._getStyleFromDiv()}setStyle(o){if(o.colorMap){let{colors:a,levels:l,...u}=o;this._setStyleToDiv(u)}else this._setStyleToDiv(o);this._setStyleToTextArea(this._getStyleFromDiv())}_getStyleFromDiv(){let o=u=>{try{return this[u].value?JSON.parse(this[u].value):void 0}catch(c){console.log(u," : parsing error: ",c);return}},a=(u,c)=>u.value==="custom"?c.value:u.value||void 0;return{parent:this.parentInput.value||void 0,name:this.nameInput.value||void 0,fill:this.fillSelect.value||void 0,isolineColor:a(this.isolineColorSelect,this.isolineColorInput),isolineText:this.isolineTextInput.checked,vectorType:this.vectorTypeSelect.value||void 0,vectorColor:a(this.vectorColorSelect,this.vectorColorInput),vectorFactor:+this.vectorFactorInput.value,streamLineColor:a(this.streamLineColorSelect,this.streamLineColorInput),streamLineSpeedFactor:+this.streamLineSpeedFactorInput.value,streamLineStatic:this.streamLineStaticInput.checked,showBelowMin:this.showBelowMinInput.checked,showAboveMax:this.showAboveMaxInput.checked,colorScheme:this.colorSchemeSelect.value||void 0,colors:o("colorsInput"),colorMap:o("colorMapInput"),levels:o("levelsInput"),blurRadius:+this.blurRadiusInput.value,addDegrees:+this.addDegreesInput.value,units:this.unitsInput.value||void 0,extraUnits:o("extraUnitsInput"),mask:this.maskSelect.value||void 0,gl:{animationSpeed:+this.animationSpeed.value||void 0,noiseTexturePow:+this.noiseTexturePow.value||void 0,vectorFieldFactor:+this.vectorFieldFactor.value||void 0,animationIntensity:+this.animationIntensity.value||void 0,wavesCount:+this.wavesCount.value||void 0}}}_setStyleToTextArea(o){this.editorTextAreaEl.value=JSON.stringify(Yi(o),null,2)}_setStyleToDiv(o){this.parentInput.value=o.parent||"",this.nameInput.value=o.name||"",this.fillSelect.value=o.fill||"",this.isolineColorSelect.value=o.isolineColor?.[0]==="#"?"custom":o.isolineColor||"",this.isolineColorInput.value=o.isolineColor?.[0]==="#"?o.isolineColor:"#000000",this.isolineTextInput.checked=o.isolineText||!1,this.vectorTypeSelect.value=o.vectorType||"",this.vectorColorSelect.value=o.vectorColor?.[0]==="#"?"custom":o.vectorColor||"",this.vectorColorInput.value=o.vectorColor?.[0]==="#"?o.vectorColor:"#000000",this.vectorFactorInput.value=o.vectorFactor?.toString()||"1",this.streamLineColorSelect.value=o.streamLineColor?.[0]==="#"?"custom":o.streamLineColor||"",this.streamLineColorInput.value=o.streamLineColor?.[0]==="#"?o.streamLineColor:"#000000",this.streamLineSpeedFactorInput.value=o.streamLineSpeedFactor?.toString()||"1",this.streamLineStaticInput.checked=o.streamLineStatic||!1,this.showBelowMinInput.checked=o.showBelowMin||!1,this.showAboveMaxInput.checked=o.showAboveMax||!1,this.colorSchemeSelect.value=o.colorScheme||"",this.colorsInput.value=o.colors?.length?JSON.stringify(o.colors):"",this.colorMapInput.value=o.colorMap?.length?JSON.stringify(o.colorMap):"",this.levelsInput.value=o.levels?.length?JSON.stringify(o.levels.map(a=>+a.toFixed(2))):"",this.blurRadiusInput.value=o.blurRadius?.toString()||"",this.addDegreesInput.value=o.addDegrees?.toString()||"",this.unitsInput.value=o.units||"",this.extraUnitsInput.value=o.extraUnits?JSON.stringify(o.extraUnits):"",this.maskSelect.value=o.mask||"",o.gl?.animationSpeed&&(this.animationSpeed.value=o.gl.animationSpeed.toString()),o.gl?.noiseTexturePow&&(this.noiseTexturePow.value=o.gl.noiseTexturePow.toString()),o.gl?.vectorFieldFactor&&(this.vectorFieldFactor.value=o.gl.vectorFieldFactor.toString()),o.gl?.animationIntensity&&(this.animationIntensity.value=o.gl.animationIntensity.toString()),o.gl?.wavesCount&&(this.wavesCount.value=o.gl.wavesCount.toString())}_onDivChange(){let o=this._getStyleFromDiv();for(let a of Object.keys(o))(o[a]===void 0||o[a]===""||o[a].length===0)&&delete o[a];this._setStyleToTextArea(o),this.onchange?.(this.getStyle())}};function Tt(s,o,a){let l=document.createElement(o);return Object.assign(l,a),s?.appendChild(l),l}function Yi(s){return Array.isArray(s)?s.map(Yi):typeof s=="object"&&s!==null?Object.keys(s).sort((a,l)=>{let u=a.toUpperCase(),c=l.toUpperCase();return u===c?0:u>c?1:-1}).reduce((a,l)=>(a[l]=Yi(s[l]),a),{}):s}var xe=class{constructor(o,a){this.delay=o;this.wxsource=a;this.onchange=()=>{};let l=document.createElement("div");l.className="mapboxgl-ctrl leaflet-control",l.style.borderStyle="solid",l.style.borderColor="#000",l.style.backgroundColor="#aaaaaaaa",l.style.padding="5px",l.style.display="flex",l.style.flexDirection="column",this._div=l,l.innerText="Time animation",this.buttonPlayStop=document.createElement("button"),l.appendChild(this.buttonPlayStop),this.timesEl=document.createElement("select"),l.appendChild(this.timesEl),this.timesEl.onchange=async()=>{this.timesEl.style.backgroundColor!=="yellow"&&(this.timesEl.style.backgroundColor="yellow",this.timesEl.value=await this.wxsource?.setTime(this.timesEl.value)||"",this.onchange(this.timesEl.value),this.timesEl.style.backgroundColor="white")},this.wxsource&&this.updateSource(this.wxsource),this.buttonPlayStop.innerHTML="Start";let u=0,c={abortController:new AbortController};this.buttonPlayStop.onclick=async()=>{if(this.buttonPlayStop.innerHTML==="Start"){this.buttonPlayStop.innerHTML="Stop";let d=async()=>{if(this.wxsource){if(this.timesEl.style.backgroundColor="yellow",this.buttonPlayStop.innerHTML==="Stop"){let _=u++%this.wxsource.getAllTimes().length;await this.wxsource.setTime(_,c.abortController),setTimeout(d,this.delay)}else await this.wxsource.unsetCoarseLevel();this.timesEl.value=this.wxsource.getTime()||"",this.onchange(this.timesEl.value),this.timesEl.style.backgroundColor="white"}};await this.wxsource?.setCoarseLevel(2),d()}else c.abortController.abort(),c.abortController=new AbortController,this.buttonPlayStop.innerHTML="Start"}}setTimes(o){this.timesEl.options.length=0;for(let a=0;a<o.length;a++){let l=document.createElement("option");l.value=o[a],l.text=o[a],this.timesEl.appendChild(l)}this.onchange(this.timesEl.value)}updateSource(o){this.buttonPlayStop.innerHTML="Start",this.wxsource=o;let a=this.wxsource?.getAllTimes()||[];this.setTimes(a),this.timesEl.value=this.wxsource?.getTime()||"",this.onchange(this.timesEl.value),o?.on("changed",()=>this.updateSource(o))}onAdd(){return this._div}onRemove(){this._div.parentNode?.removeChild(this._div)}extender(){return{onAdd:()=>this.onAdd(),onRemove:()=>this.onRemove()}}};var Ma="A".charCodeAt(0);var Ke=class{constructor(o,a){this._qtree={};this._qtreedepth=0;P("QTree.constructor"),this._ready=this._load(o,a)}get ready(){return this._ready}async _load(o,a){if(o!=="none"){try{let l=await Dt(o,a);this._qtree=wo(l,{pos:0})}catch(l){throw new Error(`Failed to load QTree: ${l.message}`)}this._qtreedepth=To(this._qtree),P(`QTree.load: qtreedepth=${this._qtreedepth}`)}}check(o){let a=o.z-this._qtreedepth,l=a>=0,u=l?{x:o.x>>a,y:o.y>>a,z:this._qtreedepth}:{...o};return Sa(this._qtree,u,l)}};function wo(s,o){let a=s.charCodeAt(o.pos)-Ma;o.pos++;let l=[1,2,4,8].map(u=>a&u?wo(s,o):void 0);return l.some(u=>u)?{nodes:l}:{}}function To(s){return s?.nodes?1+Math.max(...s.nodes.map(To)):0}function Sa(s,o,a){let l=s;for(;l;){if(a&&o.z===0)return"mixed";if(!l.nodes)return"sea";if(o.z===0)return"mixed";o.z--,l=l.nodes[(o.y>>o.z&1)<<1|o.x>>o.z&1]}return"land"}var Je=class{constructor(o){this.wxAPI=o;this.allDatasetsShortMetas={};this.ready=this.updateAll()}updateAll(){return this.ready=Dt(`${this.wxAPI.dataServerURL}meta.json`,this.wxAPI.requestInit),this.ready.then(o=>{this.allDatasetsShortMetas=o}),this.ready}async updateOne(o){try{let a=`${this.wxAPI.dataServerURL+o}/meta.json`,l=await Dt(a,this.wxAPI.requestInit);return Object.assign(this.allDatasetsShortMetas,l)}catch{return this.updateAll()}}};var Qe=class{constructor({dataServerURL:o,ext:a="webp",maskURL:l="none",maskChannel:u="R",maskDepth:c=11,qtreeURL:d="none",requestInit:_,colorStyles:g,units:m,colorSchemes:v}){if(P("WxAPI.constructor",o),go({colorStyles:g,units:m,colorSchemes:v}),d==="auto"&&(d=`${o}masks/11+1.seamask.qtree`),l==="auto"&&(l=`${o}masks/{z}/{x}/{y}.${a}`),this.dataServerURL=o,this.ext=a,this.requestInit=_,this.maskURL=l,this.maskChannel=u==="R"?0:u==="G"?1:u==="B"?2:u==="A"?3:0,this.maskDepth=c,this.maskURL!=="none"){let x=Ge(qi);this.loadMaskFunc=T=>x(Xe(this.maskURL,T),_)}else this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));this._allDatasetsManager=new Je(this),this.qtree=new Ke(d,_),this.initDone=Promise.all([this._allDatasetsManager.ready,this.qtree.ready]).then(()=>P("WxAPI.constructor initDone"))}async createDatasetManagerOptions(o){await this.initDone,await this._allDatasetsManager.updateOne(o),P("WxAPI.createDatasetManager",o);let a=this._allDatasetsManager.allDatasetsShortMetas[o],l=a?.instance;if(!l)throw new Error(`Dataset/instance not found:${o}`);let u=a.instanced,c,d=`${this.dataServerURL+o}/`;try{c=await Dt(`${d}metafull.json`,this.requestInit)}catch{P("Can't load metafull.json. Trying old infrastructure with NGINX");let v=await Dt(`${d}instances.json`,this.requestInit);if(!Array.isArray(v)||!v.length)throw new Error("instances.json is not an array or empty");c=await Promise.all(v.reverse().map(async x=>Object.assign(await Dt(`${d+x}/meta.json`,this.requestInit),{instance:x})))}let _=c[0],g=u&&new Map(c.map(m=>[m.instance,m]));return{datasetName:o,datasetCurrentInstance:l,datasetCurrentMeta:_,instanced:u,metas:g,wxAPI:this}}async getDatasetAllVariables(o){return await this.initDone,P("WxAPI.getDatasetVariables",o),this._allDatasetsManager.allDatasetsShortMetas[o]?.variables}async filterDatasetsByVariableName(o){await this.initDone,P("WxAPI.filterDatasetsByVariableName:",o);let{allDatasetsShortMetas:a}=this._allDatasetsManager;return Object.keys(a).filter(l=>a[l]?.variables.includes(o))}async getAllDatasetsNames(){return await this.initDone,P("WxAPI.getAllDatasetsNames"),Object.keys(this._allDatasetsManager.allDatasetsShortMetas)}};function Lo(s){return class extends s{constructor(){super(...arguments);this._animation=!1;this._animationSeed=0;this._needUpdateDSManager=!1}get wxdatasetManager(){return P(`WxLayerBaseImplementation.wxdatasetManager (${this.id})`),this._layer.wxdatasetManager}getCurrentVariableMeta(){return P(`WxLayerBaseImplementation.getCurrentVariableMeta (${this.id})`),{...this._layer.currentVariableMeta}}getDatasetMeta(){return this._layer.wxdatasetManager.getInstanceMeta(this.getTime())}getMetadata(){return P(`WxLayerBaseImplementation.getMetadata (${this.id})`),{...this._layer.currentVariableMeta}}getVariablesNames(){return P(`WxLayerBaseImplementation.getVariables (${this.id})`),[...this._layer.variables]}clearCache(){P(`WxLayerBaseImplementation.clearCache (${this.id})`),this._layer.clearCache()}getCache(){return this._layer.tilesRasterCache}getCurrentStyleObjectCopy(){return P(`WxLayerBaseImplementation.getCurrentStyleObjectCopy (${this.id})`),this._layer.getCurrentStyleObjectCopy()}getTime(){return P(`WxLayerBaseImplementation.getTime (${this.id})`),this._layer.getTime()}getAllTimes(){return P(`WxLayerBaseImplementation.getTimes (${this.id})`),this._layer.wxdatasetManager.getAllTimes()}async setTime(a,l,u){P(`WxLayerBaseImplementation.setTime (${this.id}) time=${a}`);let c=this.getTime();return this._layer.setURLsAndTime(a),await this._reloadVisible(l,u),l?.signal?.aborted&&this._layer.setURLsAndTime(c),this.getTime()}async preloadTime(a,l){return P(`WxLayerBaseImplementation.preloadTime (${this.id}) time=${a}`),this._layer.preloadTime(a,this.coveringTiles(),l)}startAnimation(){if(this._animation){P(`WxLayerBaseImplementation.startAnimation (${this.id}) already started`);return}if(this._layer.nonanimatable){P(`WxLayerBaseImplementation.startAnimation (${this.id}) nonanimatable`);return}P(`WxLayerBaseImplementation.startAnimation (${this.id})`),this._animation=!0;let a=async l=>{if(P(`WxLayerBaseImplementation.startAnimation (${this.id}) animationStep`),!this._animation||this._layer.nonanimatable){this._animation=!1;return}this._animationSeed=l,await this._redrawTiles(),requestAnimationFrame(a)};requestAnimationFrame(a)}async stopAnimation(){return P(`WxLayerBaseImplementation.stopAnimation (${this.id})`),this._animation=!1,this._redrawTiles()}async setCoarseLevel(a=2){this._layer.coarseLevel=Math.max(0,Math.min(a,this.wxdatasetManager.getMaxZoom()))}async unsetCoarseLevel(){return this._layer.coarseLevel=0,this._reloadVisible()}async setStyleByName(a,l=!0){return P(`WxLayerBaseImplementation.setStyleByName (${this.id}) wxstyleName=${a} reload=${l}`),this.updateCurrentStyleObject(Zt()[a],l)}async updateCurrentStyleObject(a,l=!0,u){if(P(`WxLayerBaseImplementation.updateCurrentStyleObject (${this.id}) style=${a} reload=${l}`),this._layer.updateCurrentStyleObject(a),this.startAnimation(),l)return this._reloadVisible(u)}_redrawTiles(){return this._redrawRequested?this._redrawRequested:(this._redrawRequested=new Promise(a=>{requestAnimationFrame(()=>{P(`WxTileSource _redrawTiles (${this.id})`),this.update(),a(),this._redrawRequested=void 0})}),this._redrawRequested)}async _reloadVisible(a,l){}coveringTiles(){return[]}update(){}async _loadTileHelper(a,l){if(!this._needUpdateDSManager)try{return await this._layer.loadTile(a,l)}catch(u){if(u.name==="AbortError")throw u;u.reason==="instance-not-found"&&!this._needUpdateDSManager&&(this._needUpdateDSManager=!0,P(`WxTileSource.loadTile (${this.id}) instance-not-found. Trying to update wxdatasetManager and load again.`),this.wxdatasetManager.update().then(()=>{this._needUpdateDSManager=!1,this.setTime(this.getTime()).then(()=>this.fire("changed",this))}).catch(c=>{P(`WxTileSource.loadTile (${this.id}) instance-not-found. wxdatasetManager update failed.`,c)}))}return null}}}var be=class extends Map{clear(){P("TilesCache.clear()");for(let o of this.values()){if(!o.rd)return;o.rd.gl.deleteTexture(o.rd.vectorTextureU),o.rd.gl.deleteTexture(o.rd.vectorTextureV)}super.clear()}};var Pa=2*Math.PI*6378137/256,ti=2*Math.PI*6378137/2;function Ca(s,o){let a=s/ti*180,l=o/ti*180;return l=180/Math.PI*(2*Math.atan(Math.exp(l*Math.PI/180))-Math.PI/2),[l,a]}function Ia(s,o,a){let l=Wa(a),u=s*l-ti,c=o*l-ti;return[u,c]}function Wa(s){return Pa/2**s}function Ki(s,o,a){let[l,u]=Ca(...Ia(s,o,a));return[u,-l]}function Mo(s,o){return[s*256,o*256]}function Ji(s,o,a){let l=((o-s)%360+540)%360-180;return(s+l*a+360)%360}function Da(s,o,a,l,u,c,d,_){let g=s,m=o,v=a,x=l;switch((g?1:0)|(m?2:0)|(v?4:0)|(x?8:0)){case 0:return 0;case 1:return g;case 2:return m;case 3:v=g,x=m;break;case 4:return v;case 5:m=g,x=v;break;case 6:x=m+v>>1,g=x;break;case 7:x=m+v>>1;break;case 8:return x;case 9:m=g+x>>1,v=m;break;case 10:g=m,v=x;break;case 11:v=g+x>>1;break;case 12:g=v,m=x;break;case 13:m=g+x>>1;break;case 14:g=m+v>>1;break}g=d+_*g,m=d+_*m,v=d+_*v,x=d+_*x;let b=Ji(g,m,u),M=Ji(v,x,u),C=(Ji(b,M,c)-d)/_;return C<1?1:C}function So(s,o,a,l,u,c,d,_){switch((s?1:0)|(o?2:0)|(a?4:0)|(l?8:0)){case 7:return u+c<1?u*(o-s)+c*(a-s)+s:0;case 14:return u+c<1?0:u*(l-a)+c*(l-o)+o+a-l;case 11:return c<u?(1-u)*(s-o)+c*(l-o)+o:0;case 13:return c<u?0:(1-u)*(a-l)+c*(a-s)+s+l-a;case 15:return u+c<1?u*(o-s)+c*(a-s)+s:u*(l-a)+c*(l-o)+o+a-l;default:return 0}}function Po(s,o,a){let l=1/2**a.z,u=a.x*256*l-.5,c=a.y*256*l-.5,{raw:d,dmin:_,dmax:g,dmul:m}=o,v={raw:new Uint16Array(258*258),dmin:_,dmax:g,dmul:m},{raw:x}=v;for(let T=-1,b=0,M=c-l+1;T<=256;T++,M+=l){let C=Math.floor(M),S=M-C,W=C*258;for(let Z=-1,A=u-l+1;Z<=256;Z++,b++,A+=l){let O=Math.floor(A),V=A-O,F=O+W,K=d[F],X=d[F+1],j=d[F+258],q=d[F+258+1];x[b]=s(K,X,j,q,V,S,_,m)}}return v}function Co(s,o,a){if(!o)return s;let l=v=>v<0?0:v>254?254:v,u=1/2**o.z,c=o.x*256*u-.5,d=o.y*256*u-.5,{data:_}=s,g=new ImageData(256,256),{data:m}=g;for(let v=0,x=a,T=d;v<256;v++,T+=u){let b=~~l(T),M=T-b,C=b*256;for(let S=0,W=c;S<256;S++,x+=4,W+=u){let Z=~~l(W),A=W-Z,O=(Z+C)*4+a,V=_[O],F=_[O+4],K=_[O+4*256],X=_[O+4*256+4],j=So(V,F,K,X,A,M,0,0);m[x]=j>127?255:0}}return g}function Io(s,o){return o?Po(So,s,o):s}function Wo(s,o){return o?Po(Da,s,o):s}function Do(s,{data:o},a,l){let u=l==="sea",{raw:c}=s;for(let d=a,_=259,g=0;g<256;_+=2,g++)for(let m=0;m<256;m++,_++,d+=4)u===!o[d]&&(c[_]=0);return s}function ko(s){let[o,a]=Mo(s.x,s.y),[l,u]=Ki(o,a,s.z),[c,d]=Ki(o+256,a+256,s.z);return{west:l,north:u,east:c,south:d}}function Qi(s,o){let a=s.z-o;if(a<=0)return{upCoords:s};let l={x:s.x>>>a,y:s.y>>>a,z:o},u={x:s.x&(1<<a)-1,y:s.y&(1<<a)-1,z:a};return{upCoords:l,subCoords:u}}var ei=class{constructor(o){this._loadDataFunc=Ge(vo);this._layer=o}async load(o,a){let l=await this.cacheLoad(o,this._layer.tilesURIs,a);if(!l)return null;let{rawdata:u,subCoords:c,tileType:d}=l,{units:_}=this._layer.currentVariableMeta,g=_==="degree"?Wo:Io,m=x=>g(yo(x,this._layer.style.blurRadius),c),v=u.map(m);return this._vectorMagnitudesPrepare(v),await this._applyMask(v,o,d,!c&&u.length===1),{data:v,slines:this._createStreamLines(v)}}async cacheLoad(o,a,l){if(!this._checkInsideBoundaries(o))return null;let u=this._checkTypeAndMask(o);if(!u)return null;let{upCoords:c,subCoords:d}=Qi(o,this._layer.getCoarseMaxZoom()),_=a.map(v=>Xe(v,c)),g=Object.assign({},this._layer.wxdatasetManager.wxAPI.requestInit,{signal:l?.signal});return{rawdata:await Promise.all(_.map(v=>this._loadDataFunc(v,g))),subCoords:d,tileType:u}}clearCache(){this._loadDataFunc.clearCache()}async _applyMask(o,a,l,u){let{style:c}=this._layer;if((c.mask==="land"||c.mask==="sea")&&l==="mixed"){if(u){let{raw:g,dmin:m,dmax:v,dmul:x}=o[0];o[0]={raw:new Uint16Array(g),dmin:m,dmax:v,dmul:x}}let d,{wxAPI:_}=this._layer.wxdatasetManager;try{let{upCoords:g,subCoords:m}=Qi(a,_.maskDepth);d=await _.loadMaskFunc(g),d=Co(d,m,_.maskChannel)}catch{c.mask=void 0,P("Can't load Mask. Masking is disabled");return}Do(o[0],d,_.maskChannel,c.mask)}}_vectorMagnitudesPrepare(o){if(o.length===1)return;o.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[a,l,u]=o;a.dmax=1.42*Math.max(-l.dmin,l.dmax,-u.dmin,u.dmax),a.dmul=(a.dmax-a.dmin)/65535;for(let c=0;c<258*258;++c){if(!l.raw[c]||!u.raw[c])continue;let d=l.dmin+l.dmul*l.raw[c],_=u.dmin+u.dmul*u.raw[c];a.raw[c]=Math.sqrt(_*_+d*d)/a.dmul}}_checkTypeAndMask(o){let{mask:a}=this._layer.style;if(a==="land"||a==="sea"){let l=this._layer.wxdatasetManager.wxAPI.qtree.check(o);return a===l?void 0:l}return"mixed"}_checkInsideBoundaries(o){let a=this._layer.getBoundaries();if(a?.boundaries180){let l=ko(o),u=c=>!(l.west>c.east||c.west>l.east||l.south>c.north||c.south>l.north);if(!a.boundaries180.some(u))return!1}return!0}_createStreamLines(o){if(o.length!==3)return[];let{style:a}=this._layer;if(a.streamLineColor==="none")return[];let l=[],[u,c,d]=o,_=(a.streamLineSpeedFactor||1)/u.dmax,g=a.addDegrees?.017453292519943*a.addDegrees:0,m=a.streamLineGridStep||64,v=a.streamLineSteps||300;for(let x=0;x<=256;x+=m)for(let T=0;T<=256;T+=m){if(!u.raw[1+T+(1+x)*258])continue;let b=[],M=T,C=x,S=-1,W=0,Z=0;for(let V=0;V<=v&&M>=0&&M<=256&&C>=0&&C<=256;V++){V%(v/10)||b.push({x:~~M,y:~~C});let F=~~M+1+(~~C+1)*258;if(F!==S){if(!u.raw[F])break;S=F;let K=u.dmin+u.raw[F]*u.dmul,X=c.dmin+c.raw[F]*c.dmul,j=d.dmin+d.raw[F]*d.dmul,q=Math.atan2(X,j)+g;W=_*K*Math.sin(q),Z=_*K*Math.cos(q)}M+=W,C-=Z}let A=T,O=x;S=-1;for(let V=1;V<=v&&A>=0&&A<=256&&O>=0&&O<=256;V++){V%(v/10)||b.unshift({x:~~A,y:~~O});let F=~~A+1+(~~O+1)*258;if(F!==S){if(!u.raw[F])break;S=F;let K=u.dmin+u.raw[F]*u.dmul,X=c.dmin+c.raw[F]*c.dmul,j=d.dmin+d.raw[F]*d.dmul,q=Math.atan2(X,j)+g;W=_*K*Math.sin(q),Z=_*K*Math.cos(q)}A-=W,O+=Z}b.length>2&&l.push(b)}return l}};var ii=class{constructor(o){this._layer=o}paint({data:o,ctxFill:a,ctxText:l,ctxStreamLines:u}){let{_layer:c}=this,{units:d}=c.currentVariableMeta,_=new ImageData(256,256),g=new Uint32Array(_.data.buffer);a.clearRect(0,0,256,256),l.clearRect(0,0,256,256),u.clearRect(0,0,256,256),ka(o.data[0],g,c);let m=Ea(g,o.data[0],c);a.putImageData(_,0,0),Aa(m,l,c),Oa(o.data,l,c),za(o.data[0],l,d,c),Ra(o,l,c)}getPaintedCanvas(o,a,l){return a?(this.imprintVectorAnimationLinesStep(o,l),o.ctxStreamLines.canvas):o.ctxFill.canvas}imprintVectorAnimationLinesStep({data:o,ctxFill:a,ctxStreamLines:l},u){let{_layer:c}=this;l.clearRect(0,0,256,256),l.drawImage(a.canvas,0,0),!(o.slines.length===0||c.style.streamLineStatic||c.style.streamLineColor==="none")&&Na(o,l,c,u)}};function ka(s,o,{CLUT:a,style:l}){let{raw:u}=s,{colorsI:c}=a;if(l.fill!=="none")for(let d=0,_=0,g=259;d<256;++d,g+=2)for(let m=0;m<256;++m,++_,++g)o[_]=c[u[g]];else o.fill(0)}function Ea(s,o,{CLUT:a,style:l}){let{raw:u}=o,{levelIndex:c,colorsI:d}=a,_=[];if(l.isolineColor!=="none"){let g=l.isolineColor[0]==="#"?Wt(l.isolineColor):0;for(let m=0,v=0;m<256;m+=1)for(let x=0;x<256;x+=1){let T=(m+1)*258+(x+1),b=u[T],M=u[T+1],C=u[T+258];if(!b||!M||!C)continue;let S=c[b],W=c[M],Z=c[C];if(S!==W||S!==Z){let A=Math.max(S,W,Z),O=Math.max(b,M,C),V=m*256+x;switch(l.isolineColor){case"inverted":s[V]=~d[O]|4278190080;break;case"fill":s[V]=d[O]|4278190080;break;default:s[V]=g;break}l.isolineText&&!(++v%255)&&x>20&&x<235&&m>20&&m<235&&_.push({x,y:m,d:b,dr:M,db:C,mli:A})}}}return _}function Aa(s,o,{CLUT:a,style:l}){if(s.length){let u=l.isolineTextSizeEm||1.1;o.font=`${u.toString()}em Sans-serif`,o.lineWidth=2,o.strokeStyle="white",o.fillStyle="black",o.textAlign="center",o.textBaseline="middle";let c=o.measureText("-.0123456789"),d=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent,g=1.5*d,m=c.actualBoundingBoxAscent+(g-d)/2,v=1.1,x=u*2.5,T=l.isolineTextBackground?Ba:Za;for(let{x:b,y:M,d:C,dr:S,db:W,mli:Z}of s){let A=Math.atan2(C-S,W-C);o.save(),o.translate(b,M),o.rotate(A<-1.57||A>1.57?A+3.14:A);let O=a.ticks[Z].dataString;T(O,o,{height:g,hOffset:m,wScale:v,radii:x}),o.fillText(O,0,0),o.restore()}}}function Ba(s,o,a){o.strokeText(s,0,0)}function Za(s,o,{height:a,hOffset:l,wScale:u,radii:c}){let d=o.fillStyle;o.fillStyle=o.strokeStyle;let _=u*o.measureText(s).width;o.beginPath(),o.roundRect(-_/2,-l,_,a,c),o.closePath(),o.fill(),o.fillStyle=d}function Oa(s,o,{CLUT:a,style:l}){if(!a.DataToKnots||l.vectorColor==="none"||l.vectorType==="none")return;if(s.length!==3)throw new Error("data.length !== 3");let[u,c,d]=s;switch(l.vectorType){case"barbs":o.font="40px barbs";break;case"arrows":o.font="50px arrows";break;default:o.font=l.vectorType}o.textAlign="center",o.textBaseline="middle",o.fillStyle=l.vectorColor;let _=l.addDegrees?.017453292519943*l.addDegrees:0,g=32;for(let m=g/2;m<256;m+=g)for(let v=g/2;v<256;v+=g){let x=v+1+(m+1)*258;if(!u.raw[x])continue;let T=Math.atan2(c.dmin+c.raw[x]*c.dmul,d.dmin+d.raw[x]*d.dmul),b=u.dmin+u.raw[x]*u.dmul,M=l.vectorType!=="barbs"?l.vectorFactor*.5:.2,C=Math.min(~~(a.DataToKnots(b)*M),25)+65,S=String.fromCharCode(C);switch(l.vectorColor){case"inverted":o.fillStyle=ct(~a.colorsI[u.raw[x]]);break;case"fill":o.fillStyle=ct(a.colorsI[u.raw[x]]);break}o.save(),o.translate(v,m),o.rotate(T+_),o.fillText(S,0,0),o.restore()}}function za(s,o,a,{CLUT:l,style:u}){if(a!=="degree")return;let c=.017453292519943*u.addDegrees;o.font="50px arrows",o.textAlign="center",o.textBaseline="middle",o.fillStyle=u.vectorColor;let d="L",_=32;for(let g=_/2;g<256;g+=_)for(let m=_/2;m<256;m+=_){let v=m+1+(g+1)*258;if(!s.raw[v])continue;let T=(s.dmin+s.raw[v]*s.dmul+180)*.01745329251;switch(u.vectorColor){case"inverted":o.fillStyle=ct(~l.colorsI[s.raw[v]]);break;case"fill":o.fillStyle=ct(l.colorsI[s.raw[v]]);break}o.save(),o.translate(m,g),o.rotate(T+c),o.fillText(d,0,0),o.restore()}}function Ra(s,o,{CLUT:a,style:l}){let{data:u,slines:c}=s;if(!c.length||!l.streamLineStatic||l.streamLineColor==="none")return;let d=u[0];o.lineWidth=1,l.streamLineColor[0]==="#"&&(o.strokeStyle=Xi(l.streamLineColor));for(let _=c.length;_--;){let g=c[_];for(let m=0;m<g.length-1;++m){let v=g[m],x=g[m+1],T=v.x+1+(v.y+1)*258;switch(l.streamLineColor){case"inverted":o.strokeStyle=ct(~a.colorsI[d.raw[T]]);break;case"fill":o.strokeStyle=ct(a.colorsI[d.raw[T]]);break}o.beginPath(),o.moveTo(v.x,v.y),o.lineTo(x.x,x.y),o.stroke()}}}function Na(s,o,{CLUT:a,style:l},u){let{data:c,slines:d}=s,_=c[0],g=l.streamLineColor[0]==="#"?Xi(l.streamLineColor).substring(0,7):"#000000",m=u>>5;for(let v=0;v<d.length;++v){let x=d[v],T=x.length-1,b=(m+(1+x[0].x)*(1+x[0].y))%30;for(let M=0;M<T;++M){let C=x[M],S=x[M+1],W=1-(b-M)/T;(W<0||W>1)&&(W=0);let Z=(~~(W*255)).toString(16).padStart(2,"0"),A=1+~~((1.2-W)*5);o.lineWidth=A;let O=C.x+1+(C.y+1)*258;switch(l.streamLineColor){case"inverted":g=ct(~a.colorsI[_.raw[O]]);break;case"fill":g=ct(a.colorsI[_.raw[O]]);break}o.strokeStyle=g+Z,o.beginPath(),o.moveTo(C.x,C.y),o.lineTo(S.x,S.y),o.stroke()}}}var ni=class{constructor(o){this.tilesRasterCache=new be;this.coarseLevel=0;this._painter=new ii(this);this._loader=new ei(this);if(P(`WxLayer.constructor:
6
6
  datasetName: ${o.wxdatasetManager.datasetName},
7
7
  variables: ${o.variables.join(", ")},
8
8
  wxstyleName: ${o.wxstyleName},
9
9
  wxstyle: ${JSON.stringify(o.wxstyle)},
10
- time: ${o.time}`),!o.variables?.length||o.variables.length>2)throw new Error(`datasetName: ${o.wxdatasetManager.datasetName}: only 1 or 2 variables are supported but ${o.variables} was given`);for(let c of o.variables)if(!o.wxdatasetManager.isVariableValid(c))throw new Error(`datasetName: ${o.wxdatasetManager.datasetName}: variable ${c} is not valid`);this.variables=o.variables,this.wxdatasetManager=o.wxdatasetManager,[this.tilesURIs,this._time]=this._createURLsAndTime(o.time);let a=St(),l=a.base,u=o.wxstyleName&&a[o.wxstyleName];this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT({...l,...u,...o.wxstyle})}get nonanimatable(){return P("WxLayer.nonanimatabl()"),this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getMaxZoom(){return P("WxLayer.getMaxZoom"),this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).maxZoom:this.wxdatasetManager.getMaxZoom()}getCoarseMaxZoom(){return P("WxLayer.getCoarseMaxZoom"),this.getMaxZoom()-this.coarseLevel}getBoundaries(){return this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).boundaries:this.wxdatasetManager.getBoundaries()}getTime(){return P("WxLayer.getTime"),this._time}clearCache(){P("WxLayer.clearCache"),this.tilesRasterCache.clear(),this._loader.clearCache()}getCurrentStyleObjectCopy(){return P("WxLayer.getCurrentStyleObjectCopy"),Object.assign({},this.style)}updateCurrentStyleObject(o){P(`WxLayer.updateCurrentStyleObject ${JSON.stringify(o)}`),[this.style,this.CLUT]=this._createStyleAndCLUT(o)}getTileData(o,a){let l=this.tilesRasterCache.get(Ke(o));if(!l)return;let u=this._getPixelInfo(a,l.data.data);if(!u)return;let{raw:c,data:f}=u,m=c.map(g=>this.CLUT.colorsI[g]),y=m.map(lt),_=f.map(g=>this.CLUT.DataToStyle(g));return{data:f,raw:c,rgba:m,hexColor:y,inStyleUnits:_,tilePoint:a,styleUnits:this.style.units,dataUnits:this.currentVariableMeta.units}}setURLsAndTime(o){P(`WxLayer.setURLsAndTime time=${o}`),[this.tilesURIs,this._time]=this._createURLsAndTime(o),this.wxdatasetManager.isInstanced()&&(this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT())}getPaintedCanvas(o,a,l){return this._painter.getPaintedCanvas(o,a,l)}async loadTile(o,a){return this._loadCacheDrawTile(o,this.tilesRasterCache,a)}async preloadTime(o,a,l){P(`WxLayer.preloadTime time=${o}`);let[u]=this._createURLsAndTime(o);await Promise.allSettled(a.map(c=>this._loader.cacheLoad(c,u,l)))}async reloadTiles(o,a){P("WxLayer.reloadTiles");let l=new xe;await Promise.allSettled(o.map(u=>this._loadCacheDrawTile(u,l,a))),a?.signal?.aborted?l.clear():(this.tilesRasterCache.clear(),this.tilesRasterCache=l)}async _loadCacheDrawTile(o,a,l){let u=a.get(Ke(o));if(u)return u;let c=await this._loader.load(o,l);if(!c)return null;let f=Yt(256,256),m=f,y=this.variables.length===2?Yt(256,256):f,_={ctxFill:f,ctxText:m,ctxStreamLines:y,data:c};return this._painter.paint(_),a.set(Ke(o),_),_}_getCurrentVariableMeta(){let o=this.variables.map(f=>{let m=this.wxdatasetManager.getInstanceVariableMeta(f,this._time);if(!m)throw new Error(`datasetName ${this.wxdatasetManager.datasetName}: variable ${f} is not valid`);return m}),{min:a,max:l,units:u,vector:c}=o[0];return this.variables.length>1&&(a=0,l=1.42*Math.max(-o[0].min,o[0].max,-o[1].min,o[1].max)),{min:a,max:l,units:u,vector:c}}_getPixelInfo({x:o,y:a},l){P(`WxLayer._getPixelInfo x=${o} y=${a}`);let u=(a+1)*258+(o+1);if(l?.[0]?.raw?.[u])return{raw:l.map(c=>c.raw[u]),data:l.map(c=>c.raw[u]*c.dmul+c.dmin)}}_createStyleAndCLUT(o){let a=Object.assign({},this.style,o),l=this._prepareCLUT(a);return[a,l]}_prepareCLUT(o){let{min:a,max:l,units:u}=this.currentVariableMeta;return new Je(o,u,[a,l],this.variables.length===2)}_createURLsAndTime(o){let a=this.wxdatasetManager.getNearestValidTime(o);return[this.variables.map(u=>this.wxdatasetManager.createURI(u,a)),a]}};var si=class extends Eo.default.GridLayer{constructor(a,l){super(a);this.id=a.id,this._layer=new ai(l)}};var Ao=Lo(si),li=class{constructor(o,a,l){this.coords=o;this.ctx=a;this.raster_data=l;this.draw(l?.ctxFill.canvas)}draw(o){this.ctx.clearRect(0,0,256,256),o&&this.ctx.drawImage(o,0,0)}},be=class extends Ao{constructor(o,a){super(a,o),P("WxTileSource constructor: ",o)}getLayerInfoAtLatLon(o,a){if(P(`WxTileSource getLayerInfoAtLatLon (${this._layer.wxdatasetManager.datasetName})`,o),!this._map)return;let l=this._map.getZoom(),u=this._map.project(o,l),c=u.divideBy(256).floor(),f=u.subtract(c.multiplyBy(256)).floor();return this._layer.getTileData({x:c.x,y:c.y,z:l},f)}async _reloadVisible(o){if(P(`WxTileSource _reloadVisible (${this._layer.wxdatasetManager.datasetName})`),await this._layer.reloadTiles(this.coveringTiles(),o),o?.signal?.aborted){P(`WxTileSource _reloadVisible (${this._layer.wxdatasetManager.datasetName}) aborted`);return}return await Promise.allSettled(this._ForEachWxTile(async a=>{a.raster_data=null,a.raster_data=await this._layer.loadTile(a.coords)},"_reloadVisible")),this._redrawTiles()}coveringTiles(){P(`WxTileSource coveringTiles (${this._layer.wxdatasetManager.datasetName})`);let o=[];for(let a in this._tiles){let l=this._tiles[a].el?.wxtile;l&&o.push(l.coords)}return o}update(){P(`WxTileSource update (${this._layer.wxdatasetManager.datasetName})`),this._ForEachWxTile(o=>{o.draw(o.raster_data&&this._layer.getPaintedCanvas(o.raster_data,this._animation,this._animationSeed))},"_redrawTiles")}_ForEachWxTile(o,a){P(`WxTileSource _ForEachWxTile (${this._layer.wxdatasetManager.datasetName}) func=${a}`);let l=[];for(let u in this._tiles){let c=this._tiles[u].el?.wxtile;c&&l.push(o(c))}return l}createTile(o,a){let l=Yt(256,256),u=l.canvas;return this._loadTileHelper(o).then(c=>{u.wxtile=new li(o,l,c)}).catch(()=>{u.wxtile=new li(o,l,null)}).finally(a),u}onRemove(o){return super.onRemove(o),P(`WxTileSource onRemove (${this._layer.wxdatasetManager.datasetName})`),this._animation=!1,this}};var hi=class{constructor({datasetName:o,datasetCurrentInstance:a,instanced:l,datasetCurrentMeta:u,metas:c,wxAPI:f}){this.datasetName=o,this._instanced=l,this._datasetCurrentInstance=a,this._datasetCurrentMeta=u,this._metas=c,this.wxAPI=f,P(`WxDataSetManager.constructor: ${this.datasetName}`)}getNearestValidTime(o=Date()){P(`WxDataSetManager.getValidTime: ${this.datasetName}, ${o}`);let a=this.getAllTimes();if(o==="")return a[a.length-1];if(typeof o=="string"){let c=a.indexOf(o);if(c!==-1)return a[c]}if(typeof o=="number"){if(o<=0)return a[0];if(o<a.length)return a[o]}let l=new Date(o).getTime();return Number.isNaN(l)?a[a.length-1]:a.find(c=>new Date(c).getTime()>=l)||a[a.length-1]}getAllTimes(){return P(`WxDataSetManager.getTimes: ${this.datasetName}`),this._instanced||this._datasetCurrentMeta.times}getAllVariables(){return P(`WxDataSetManager.getVariables: ${this.datasetName}`),this._datasetCurrentMeta.variables}getVariableCurrentMeta(o){return P(`WxDataSetManager.getVariableCurrentMeta: ${this.datasetName}, ${o}`),this._datasetCurrentMeta.variablesMeta[o]}getInstanceVariableMeta(o,a){return P(`WxDataSetManager.getInstanceVariableMeta: ${this.datasetName}, ${o}, ${a}`),this.getInstanceMeta(a).variablesMeta[o]}getMaxZoom(){return P(`WxDataSetManager.getMaxZoom: ${this.datasetName}`),this._datasetCurrentMeta.maxZoom}getBoundaries(){return P(`WxDataSetManager.getBoundaries: ${this.datasetName}`),this._datasetCurrentMeta.boundaries}getInstanceMeta(o){return P(`WxDataSetManager.getInstanceMeta: ${this.datasetName}, ${o}`),o&&this._metas?.get(o)||this._datasetCurrentMeta}createURI(o,a,l="webp"){if(P(`WxDataSetManager.createURI: ${this.datasetName}, ${o}, ${a}`),!this.isVariableValid(o))throw new Error(`in dataset ${this.datasetName} variable ${o} not found`);let u=this._instanced?a:this._datasetCurrentInstance;return`${this.wxAPI.dataServerURL+this.datasetName}/${u}/${o}/${a}/{z}/{x}/{y}.${l}`}isVariableValid(o){return P(`WxDataSetManager.checkVariableValid: ${this.datasetName}, ${o}`),this._datasetCurrentMeta.variablesMeta[o]!==void 0}async update(){let o=await this.wxAPI.createDatasetManagerOptions(this.datasetName);this._datasetCurrentInstance=o.datasetCurrentInstance,this._instanced=o.instanced,this._datasetCurrentMeta=o.datasetCurrentMeta,this._metas=o.metas}isInstanced(){return this._instanced!==void 0}_checkCombineVariableIfVector(o){P(`WxDataSetManager.checkCombineVariableIfVector: ${this.datasetName}, ${o}`);let a=this._datasetCurrentMeta.variablesMeta[o];if(!a)throw new Error(`in dataset ${this.datasetName} variable ${o} not found`);return a.vector||[o]}};var we=class extends hi{createSourceLayer(o,a){P(`WxDataSetManager.createSourceLayer: ${this.datasetName}`);let l={...o,variables:this._checkCombineVariableIfVector(o.variable),wxdatasetManager:this};return new be(l,a)}};var Le=class extends ei{async createDatasetManager(o){let a=await this.createDatasetManagerOptions(o);return new we(a)}};var Te=po(Ki());function en(s,o,a,l,u,c){s.flyTo([l,a],o)}function Nt(s,o,a,l,u){let c=u,{base:f}=St();for(let _ in u)u[_]===f[_]&&delete u[_];if(u.gl){for(let _ in u.gl)u.gl[_]===f.gl?.[_]&&delete u.gl[_];if(Object.keys(u.gl).length===0){let{gl:_,...g}=u;c=g}}let m=s.getCenter().wrap(),y=`##${a}/${l}/${o}/${s.getZoom().toFixed(2)}/${m.lng.toFixed(2)}/${m.lat.toFixed(2)}/0/0${c?`/${JSON.stringify(c)}`:""}`;history.replaceState(null,"",y)}async function Bo(){let s=Te.default.map("map",{center:[-40.75,174.5],zoom:7,zoomControl:!1});return Te.default.control.zoom({position:"bottomright"}).addTo(s),s}function Kt(s,o,a){let l=a.replace("-","");s.addControl(new(Te.default.Control.extend(o.extender()))({position:l}))}function Zo(s){return s.latlng.wrap()}function Oo(s,o,a){s.eachLayer(l=>{l.options.id===o&&s.removeLayer(l)})}async function zo(s,o,a){s.addLayer(a),await new Promise(l=>a.once("load",l))}function ui(s,o,a,l,u,c){let f=Te.default.tileLayer(l,{id:o,maxNativeZoom:u,zIndex:a==="baseL"?1:0});s.addLayer(f)}var Na=.8;async function Ro(){let s=await Bo();ui(s,"baseS","baseL","https://tile.openstreetmap.org/{z}/{x}/{y}.png",3),ui(s,"baseS","baseL","https://tiles.metoceanapi.com/base-lines/{z}/{x}/{y}",5);let o="https://tilesdev.metoceanapi.com/data/",a=new Headers,l=new Le({dataServerURL:o,maskURL:"auto",maskChannel:"R",qtreeURL:"auto",requestInit:{headers:a}}),u="obs-radar.rain.nzl.national",c="reflectivity",m=window.location.toString().split("##")[1]?.split("/");u=m?.[0]||u,m?.[1]&&(c=m[1]);let y=m?.[2]||"",_=m&&Number.parseFloat(m[3])||0,g=m&&Number.parseFloat(m[4])||0,x=m&&Number.parseFloat(m[5])||0,T=m&&Number.parseFloat(m[6])||0,b=m&&Number.parseFloat(m[7])||0;m?.length>8&&(m[8]=m.slice(8).join("/"));let M=m?.[8]&&m[8],C={style:{}};try{C.style=M&&{...JSON.parse(decodeURI(M))}}catch{console.log("Can't parse style from URL")}m&&en(s,_,g,x,T,b),s.on("zoom",()=>Nt(s,y,u,c,C.style)),s.on("drag",()=>Nt(s,y,u,c,C.style)),s.on("rotate",()=>Nt(s,y,u,c,C.style)),s.on("pitch",()=>Nt(s,y,u,c,C.style));let S,W=new _e;Kt(s,W,"top-right");let O={id:"wxsource",opacity:Na,attribution:'<a href="https://metoceanapi.github.io/wxtiles-leaflet/docs">WxTiles DOCS</a>'},E=new de(l,u,c);Kt(s,E,"top-left"),E.onchange=async(H,it,q=!0)=>{u=H,c=it,P("apiControl.onchange datasetName=",u,"variable=",c),Oo(s,O.id,S),q&&(C.style={}),S=void 0;let G=await l.createDatasetManager(u),Me=G.getBoundaries();if(Me&&q){let{east:ht,west:rt,north:It,south:A}=Me.boundariesnorm,Se=Math.round(Math.log(360*360/Math.max((ht-rt+360)%360,It-A)/360)/Math.LN2);en(s,Se,(ht+rt)/2,(It+A)/2,0,0)}if(G.getVariableCurrentMeta(c)?.units==="RGB"){let ht=G.getAllTimes();ui(s,O.id,"wxtiles",G.createURI(c,ht[0]),G.getMaxZoom(),G.getBoundaries()?.boundariesnorm),Z.setTimes(ht),W.clear()}else{S=G.createSourceLayer({variable:c,time:y,wxstyle:C.style},O),S.setCoarseLevel(0),await zo(s,"wxtiles",S);let ht=S.getCurrentStyleObjectCopy();W.drawLegend(ht),ht.levels=C.style?.levels,ht.colors=C.style?.colors,await V.onchange?.(ht,!0),Z.updateSource(S)}};let Z=new ve(50);Kt(s,Z,"top-left"),Z.onchange=H=>{y=H,Nt(s,H,u,c,C.style),F.update(S,s)};let V=new ge;Kt(s,V,"top-right"),V.onchange=async(H,it)=>{if(P("customStyleEditorControl.onchange"),!S)return;it||await S.updateCurrentStyleObject(H);let q=S.getCurrentStyleObjectCopy();W.drawLegend(q),q.levels=H?.levels,q.colors=H?.colors,V.setStyle(q),C.style=q,Nt(s,y,u,c,C.style)};let F=new fe;Kt(s,F,"bottom-left"),s.on("mousemove",H=>F.update(S,s,Zo(H))),await E.onchange(u,c,!1)}Ro();})();
10
+ time: ${o.time}`),!o.variables?.length||o.variables.length>2)throw new Error(`datasetName: ${o.wxdatasetManager.datasetName}: only 1 or 2 variables are supported but ${o.variables} was given`);for(let c of o.variables)if(!o.wxdatasetManager.isVariableValid(c))throw new Error(`datasetName: ${o.wxdatasetManager.datasetName}: variable ${c} is not valid`);this.variables=o.variables,this.wxdatasetManager=o.wxdatasetManager,[this.tilesURIs,this._time]=this._createURLsAndTime(o.time);let a=Zt(),l=a.base,u=o.wxstyleName&&a[o.wxstyleName];this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT({...l,...u,...o.wxstyle})}get nonanimatable(){return P("WxLayer.nonanimatabl()"),this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getMaxZoom(){return P("WxLayer.getMaxZoom"),this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).maxZoom:this.wxdatasetManager.getMaxZoom()}getCoarseMaxZoom(){return P("WxLayer.getCoarseMaxZoom"),this.getMaxZoom()-this.coarseLevel}getBoundaries(){return this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).boundaries:this.wxdatasetManager.getBoundaries()}getTime(){return P("WxLayer.getTime"),this._time}clearCache(){P("WxLayer.clearCache"),this.tilesRasterCache.clear(),this._loader.clearCache()}getCurrentStyleObjectCopy(){return P("WxLayer.getCurrentStyleObjectCopy"),Object.assign({},this.style)}updateCurrentStyleObject(o){P(`WxLayer.updateCurrentStyleObject ${JSON.stringify(o)}`),[this.style,this.CLUT]=this._createStyleAndCLUT(o)}getTileData(o,a){let l=this.tilesRasterCache.get(je(o));if(!l)return;let u=this._getPixelInfo(a,l.data.data);if(!u)return;let{raw:c,data:d}=u,_=c.map(v=>this.CLUT.colorsI[v]),g=_.map(ct),m=d.map(v=>this.CLUT.DataToStyle(v));return{data:d,raw:c,rgba:_,hexColor:g,inStyleUnits:m,tilePoint:a,styleUnits:this.style.units,dataUnits:this.currentVariableMeta.units}}setURLsAndTime(o){P(`WxLayer.setURLsAndTime time=${o}`),[this.tilesURIs,this._time]=this._createURLsAndTime(o),this.wxdatasetManager.isInstanced()&&(this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT())}getPaintedCanvas(o,a,l){return this._painter.getPaintedCanvas(o,a,l)}async loadTile(o,a){return this._loadCacheDrawTile(o,this.tilesRasterCache,a)}async preloadTime(o,a,l){P(`WxLayer.preloadTime time=${o}`);let[u]=this._createURLsAndTime(o);await Promise.allSettled(a.map(c=>this._loader.cacheLoad(c,u,l)))}async reloadTiles(o,a){P("WxLayer.reloadTiles");let l=new be;await Promise.allSettled(o.map(u=>this._loadCacheDrawTile(u,l,a))),a?.signal?.aborted?l.clear():(this.tilesRasterCache.clear(),this.tilesRasterCache=l)}async _loadCacheDrawTile(o,a,l){let u=a.get(je(o));if(u)return u;let c=await this._loader.load(o,l);if(!c)return null;let d=Jt(256,256),_=d,g=this.variables.length===2?Jt(256,256):d,m={ctxFill:d,ctxText:_,ctxStreamLines:g,data:c};return this._painter.paint(m),a.set(je(o),m),m}_getCurrentVariableMeta(){let o=this.variables.map(d=>{let _=this.wxdatasetManager.getInstanceVariableMeta(d,this._time);if(!_)throw new Error(`datasetName ${this.wxdatasetManager.datasetName}: variable ${d} is not valid`);return _}),{min:a,max:l,units:u,vector:c}=o[0];return this.variables.length>1&&(a=0,l=1.42*Math.max(-o[0].min,o[0].max,-o[1].min,o[1].max)),{min:a,max:l,units:u,vector:c}}_getPixelInfo({x:o,y:a},l){P(`WxLayer._getPixelInfo x=${o} y=${a}`);let u=(a+1)*258+(o+1);if(l?.[0]?.raw?.[u])return{raw:l.map(c=>c.raw[u]),data:l.map(c=>c.raw[u]*c.dmul+c.dmin)}}_createStyleAndCLUT(o){let a=Object.assign({},this.style,o),l=this._prepareCLUT(a);return[a,l]}_prepareCLUT(o){let{min:a,max:l,units:u}=this.currentVariableMeta;return new Ye(o,u,[a,l],this.variables.length===2)}_createURLsAndTime(o){let a=this.wxdatasetManager.getNearestValidTime(o);return[this.variables.map(u=>this.wxdatasetManager.createURI(u,a)),a]}};var Ao=_o(tn()),ri=class extends Ao.default.GridLayer{constructor(a,l){super(a);this.id=a.id,this._layer=new ni(l)}};var Bo=Lo(ri),ai=class{constructor(o,a,l){this.coords=o;this.ctx=a;this.raster_data=l;this.draw(l?.ctxFill.canvas)}draw(o){this.ctx.clearRect(0,0,256,256),o&&this.ctx.drawImage(o,0,0)}},we=class extends Bo{constructor(o,a){super(a,o),P("WxTileSource constructor: ",o)}getLayerInfoAtLatLon(o,a){if(P(`WxTileSource getLayerInfoAtLatLon (${this._layer.wxdatasetManager.datasetName})`,o),!this._map)return;let l=this._map.getZoom(),u=this._map.project(o,l),c=u.divideBy(256).floor(),d=u.subtract(c.multiplyBy(256)).floor();return this._layer.getTileData({x:c.x,y:c.y,z:l},d)}async _reloadVisible(o){if(P(`WxTileSource _reloadVisible (${this._layer.wxdatasetManager.datasetName})`),await this._layer.reloadTiles(this.coveringTiles(),o),o?.signal?.aborted){P(`WxTileSource _reloadVisible (${this._layer.wxdatasetManager.datasetName}) aborted`);return}return await Promise.allSettled(this._ForEachWxTile(async a=>{a.raster_data=null,a.raster_data=await this._layer.loadTile(a.coords)},"_reloadVisible")),this._redrawTiles()}coveringTiles(){P(`WxTileSource coveringTiles (${this._layer.wxdatasetManager.datasetName})`);let o=[];for(let a in this._tiles){let l=this._tiles[a].el?.wxtile;l&&o.push(l.coords)}return o}update(){P(`WxTileSource update (${this._layer.wxdatasetManager.datasetName})`),this._ForEachWxTile(o=>{o.draw(o.raster_data&&this._layer.getPaintedCanvas(o.raster_data,this._animation,this._animationSeed))},"_redrawTiles")}_ForEachWxTile(o,a){P(`WxTileSource _ForEachWxTile (${this._layer.wxdatasetManager.datasetName}) func=${a}`);let l=[];for(let u in this._tiles){let c=this._tiles[u].el?.wxtile;c&&l.push(o(c))}return l}createTile(o,a){let l=Jt(256,256),u=l.canvas;return this._loadTileHelper(o).then(c=>{u.wxtile=new ai(o,l,c)}).catch(()=>{u.wxtile=new ai(o,l,null)}).finally(a),u}onRemove(o){return super.onRemove(o),P(`WxTileSource onRemove (${this._layer.wxdatasetManager.datasetName})`),this._animation=!1,this}};var si=class{constructor({datasetName:o,datasetCurrentInstance:a,instanced:l,datasetCurrentMeta:u,metas:c,wxAPI:d}){this.datasetName=o,this._instanced=l,this._datasetCurrentInstance=a,this._datasetCurrentMeta=u,this._metas=c,this.wxAPI=d,P(`WxDataSetManager.constructor: ${this.datasetName}`)}getNearestValidTime(o=Date()){P(`WxDataSetManager.getValidTime: ${this.datasetName}, ${o}`);let a=this.getAllTimes();if(o==="")return a[a.length-1];if(typeof o=="string"){let c=a.indexOf(o);if(c!==-1)return a[c]}if(typeof o=="number"){if(o<=0)return a[0];if(o<a.length)return a[o]}let l=new Date(o).getTime();return Number.isNaN(l)?a[a.length-1]:a.find(c=>new Date(c).getTime()>=l)||a[a.length-1]}getAllTimes(){return P(`WxDataSetManager.getTimes: ${this.datasetName}`),this._instanced||this._datasetCurrentMeta.times}getAllVariables(){return P(`WxDataSetManager.getVariables: ${this.datasetName}`),this._datasetCurrentMeta.variables}getVariableCurrentMeta(o){return P(`WxDataSetManager.getVariableCurrentMeta: ${this.datasetName}, ${o}`),this._datasetCurrentMeta.variablesMeta[o]}getInstanceVariableMeta(o,a){return P(`WxDataSetManager.getInstanceVariableMeta: ${this.datasetName}, ${o}, ${a}`),this.getInstanceMeta(a).variablesMeta[o]}getMaxZoom(){return P(`WxDataSetManager.getMaxZoom: ${this.datasetName}`),this._datasetCurrentMeta.maxZoom}getBoundaries(){return P(`WxDataSetManager.getBoundaries: ${this.datasetName}`),this._datasetCurrentMeta.boundaries}getInstanceMeta(o){return P(`WxDataSetManager.getInstanceMeta: ${this.datasetName}, ${o}`),o&&this._metas?.get(o)||this._datasetCurrentMeta}createURI(o,a,l="webp"){if(P(`WxDataSetManager.createURI: ${this.datasetName}, ${o}, ${a}`),!this.isVariableValid(o))throw new Error(`in dataset ${this.datasetName} variable ${o} not found`);let u=this._instanced?a:this._datasetCurrentInstance;return`${this.wxAPI.dataServerURL+this.datasetName}/${u}/${o}/${a}/{z}/{x}/{y}.${l}`}isVariableValid(o){return P(`WxDataSetManager.checkVariableValid: ${this.datasetName}, ${o}`),this._datasetCurrentMeta.variablesMeta[o]!==void 0}async update(){let o=await this.wxAPI.createDatasetManagerOptions(this.datasetName);this._datasetCurrentInstance=o.datasetCurrentInstance,this._instanced=o.instanced,this._datasetCurrentMeta=o.datasetCurrentMeta,this._metas=o.metas}isInstanced(){return this._instanced!==void 0}_checkCombineVariableIfVector(o){P(`WxDataSetManager._checkCombineVariableIfVector: ${this.datasetName}, ${o}`);let a=this._datasetCurrentMeta.variablesMeta[o];if(!a)throw new Error(`in dataset ${this.datasetName} variable ${o} not found`);return a.vector||[o]}};var Te=class extends si{createSourceLayer(o,a){P(`WxDataSetManager.createSourceLayer: ${this.datasetName}`);let l={...o,variables:this._checkCombineVariableIfVector(o.variable),wxdatasetManager:this};return new we(l,a)}};var Le=class extends Qe{async createDatasetManager(o){let a=await this.createDatasetManagerOptions(o);return new Te(a)}};var vt=_o(tn());function en(s,o,a,l,u,c){s.flyTo([l,a],o)}function Me(s,o,a,l,u){let c=u,{base:d}=Zt();for(let m in u)u[m]===d[m]&&delete u[m];if(u.gl){for(let m in u.gl)u.gl[m]===d.gl?.[m]&&delete u.gl[m];if(Object.keys(u.gl).length===0){let{gl:m,...v}=u;c=v}}let _=s.getCenter().wrap(),g=`##${a}/${l}/${o}/${s.getZoom().toFixed(2)}/${_.lng.toFixed(2)}/${_.lat.toFixed(2)}/0/0${c?`/${JSON.stringify(c)}`:""}`;history.replaceState(null,"",g)}async function Zo(){let s=vt.default.map("map",{center:[-40.75,174.5],zoom:7,zoomControl:!1});return vt.default.control.zoom({position:"bottomright"}).addTo(s),s}function Qt(s,o,a){let l=a.replace("-","");s.addControl(new(vt.default.Control.extend(o.extender()))({position:l}))}function Oo(s){return s.latlng.wrap()}function zo(s,o,a){s.eachLayer(l=>{l.options.id===o&&s.removeLayer(l)})}async function Ro(s,o,a){s.addLayer(a),await new Promise(l=>a.once("load",l))}async function Fa(s,o,a,l,u){let c=new AbortController,d=c.signal;u&&u.subscribe(()=>{c.abort()}),await fetch(s,{method:"GET",headers:l,mode:"cors",signal:d}).then(_=>{if(_.ok)return _.blob();throw new Error(`Unexpected response: ${_.status} (${_.type})`)}).then(_=>o(_)).catch(_=>a(_))}vt.default.TileLayerWithHeaders=vt.default.TileLayer.extend({initialize:function(s,o,a,l){vt.default.TileLayer.prototype.initialize.call(this,s,o),this.headers=a,this.abort=l},createTile(s,o){let a=this.getTileUrl(s),l=document.createElement("img");return l.setAttribute("role","presentation"),Fa(a,u=>{if(u.size>0){let c=new FileReader;c.onload=()=>{l.src=c.result},c.readAsDataURL(u),o(null,l)}},u=>console.log(u),this.headers,this.abort),l}});vt.default.tileLayerWithHeaders=function(s,o,a,l){return new vt.default.TileLayerWithHeaders(s,o,a,l)};function li(s,o,a,l,u,c,d){let _={id:o,maxNativeZoom:u,zIndex:a==="baseL"?1:0},g=d?vt.default.tileLayerWithHeaders(l,_,d):vt.default.tileLayer(l,_);s.addLayer(g)}var Ha=.8;async function No(){let s=await Zo(),o=new Headers({"x-api-key":"YHtP155Q1gxENEeESBsmDF"});li(s,"baseS","baseL","https://tile.openstreetmap.org/{z}/{x}/{y}.png",3),li(s,"baseS","baseL","https://tiles.metoceanapi.com/base-lines/{z}/{x}/{y}",5,null,o);let a="https://tilesdev.metoceanapi.com/data/",l=new Le({dataServerURL:a,maskURL:"auto",maskChannel:"R",qtreeURL:"auto",requestInit:{headers:o}}),u="global$",c="gfs.global",d="air.temperature.at-2m",g=window.location.toString().split("##")[1]?.split("/");c=g?.[0]||c,g?.[1]&&(d=g[1]);let m=g?.[2]||"",v=g&&Number.parseFloat(g[3])||0,x=g&&Number.parseFloat(g[4])||0,T=g&&Number.parseFloat(g[5])||0,b=g&&Number.parseFloat(g[6])||0,M=g&&Number.parseFloat(g[7])||0;g?.length>8&&(g[8]=g.slice(8).join("/"));let C=g?.[8]&&g[8],S={style:{}};try{S.style=C&&{...JSON.parse(decodeURI(C))}}catch{console.log("Can't parse style from URL")}g&&en(s,v,x,T,b,M),s.on("zoomend",()=>Me(s,m,c,d,S.style)),s.on("moveend",()=>Me(s,m,c,d,S.style));let W,Z=new ve;Qt(s,Z,"top-right");let A={id:"wxsource",opacity:Ha,attribution:'<a href="https://metoceanapi.github.io/wxtiles-leaflet/docs">WxTiles DOCS</a>'},O=new pe(l,c,d,{filter:u});Qt(s,O,"top-left"),O.onchange=async(X,j,q=!0)=>{c=X,d=j,P("apiControl.onchange datasetName=",c,"variable=",d),zo(s,A.id,W),q&&(S.style={}),W=void 0;let Lt=await l.createDatasetManager(c),dt=Lt.getBoundaries();if(dt&&q){let{east:J,west:kt,north:B,south:te}=dt.boundariesnorm,E=Math.round(Math.log(360*360/Math.max((J-kt+360)%360,B-te)/360)/Math.LN2);en(s,E,(J+kt)/2,(B+te)/2,0,0)}if(Lt.getVariableCurrentMeta(d)?.units==="RGB"){let J=Lt.getAllTimes();li(s,A.id,"wxtiles",Lt.createURI(d,J[0]),Lt.getMaxZoom(),Lt.getBoundaries()?.boundariesnorm,o),V.setTimes(J),Z.clear()}else{W=Lt.createSourceLayer({variable:d,time:m,wxstyle:S.style},A),W.setCoarseLevel(0),await Ro(s,"wxtiles",W);let J=W.getCurrentStyleObjectCopy();Z.drawLegend(J),J.levels=S.style?.levels,J.colors=S.style?.colors,await F.onchange?.(J,!0),V.updateSource(W)}};let V=new xe(50);Qt(s,V,"top-left"),V.onchange=X=>{m=X,Me(s,X,c,d,S.style),K.update(W,s)};let F=new ye;Qt(s,F,"top-right"),F.onchange=async(X,j)=>{if(P("customStyleEditorControl.onchange"),!W)return;j||await W.updateCurrentStyleObject(X);let q=W.getCurrentStyleObjectCopy();Z.drawLegend(q),q.levels=X?.levels,q.colors=X?.colors,F.setStyle(q),S.style=q,Me(s,m,c,d,S.style)};let K=new _e;Qt(s,K,"bottom-left"),s.on("mousemove",X=>K.update(W,s,Oo(X))),await O.onchange(c,d,!1)}No();})();
11
11
  /*! Bundled license information:
12
12
 
13
13
  leaflet/dist/leaflet-src.js:
14
14
  (* @preserve
15
- * Leaflet 1.9.3, a JS library for interactive maps. https://leafletjs.com
16
- * (c) 2010-2022 Vladimir Agafonkin, (c) 2010-2011 CloudMade
15
+ * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
16
+ * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
17
17
  *)
18
18
  */