@florasync/leaflet-geokit 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +195 -0
- package/CHANGELOG.md +5 -0
- package/README.md +7 -1
- package/custom-toolbar.html +165 -0
- package/dist/django/index.js +734 -734
- package/dist/django/index.js.map +1 -1
- package/dist/leaflet-geokit.es.js +1704 -1704
- package/dist/leaflet-geokit.es.js.map +1 -1
- package/dist/leaflet-geokit.external.es.js +1501 -1496
- package/dist/leaflet-geokit.external.es.js.map +1 -1
- package/dist/leaflet-geokit.umd.js +11 -14
- package/dist/leaflet-geokit.umd.js.map +1 -1
- package/dist/preact/{index-DCKj0r6a.js → index-Z22Un5Tg.js} +474 -469
- package/dist/preact/index-Z22Un5Tg.js.map +1 -0
- package/dist/preact/index.js +1 -1
- package/dist/preact-bundled/index.js +731 -731
- package/dist/preact-bundled/index.js.map +1 -1
- package/dist/react/{index-DCKj0r6a.js → index-Z22Un5Tg.js} +474 -469
- package/dist/react/index-Z22Un5Tg.js.map +1 -0
- package/dist/react/index.js +1 -1
- package/dist/react-bundled/index.js +731 -731
- package/dist/react-bundled/index.js.map +1 -1
- package/dist/types/components/LeafletDrawMapElement.d.ts +6 -6
- package/dist/types/django/index.d.ts +2 -2
- package/dist/types/external.d.ts +9 -9
- package/dist/types/index.d.ts +9 -9
- package/dist/types/lib/FeatureStore.d.ts +2 -2
- package/dist/types/lib/LayerRegistry.d.ts +1 -1
- package/dist/types/lib/MapController.d.ts +8 -8
- package/dist/types/lib/layer-cake/LayerCakeManager.d.ts +2 -2
- package/dist/types/lib/layer-style-panel.d.ts +1 -1
- package/dist/types/lib/marker-icons.d.ts +1 -1
- package/dist/types/lib/providers.d.ts +1 -1
- package/dist/types/lib/snapping.d.ts +1 -1
- package/dist/types/lib/tool-buttons.d.ts +1 -1
- package/dist/types/lib/tool-capabilities.d.ts +1 -1
- package/dist/types/lib/toolbar-layout.d.ts +1 -1
- package/dist/types/preact/core.d.ts +2 -2
- package/dist/types/preact/index.d.ts +2 -2
- package/dist/types/preact-bundled/index.d.ts +3 -3
- package/dist/types/react/core.d.ts +2 -2
- package/dist/types/react/index.d.ts +2 -2
- package/dist/types/react-bundled/index.d.ts +3 -3
- package/dist/types/types/events.d.ts +1 -1
- package/dist/types/types/public.d.ts +6 -6
- package/dist/types/utils/geojson-pipeline.d.ts +1 -1
- package/dist/types/utils/geojson.d.ts +1 -1
- package/docs/api-reference.md +249 -0
- package/docs/custom-toolbar.md +168 -0
- package/docs/diagnostics.md +216 -0
- package/docs/grower-measurement.md +23 -0
- package/docs/integration-recipes.md +301 -0
- package/docs/release-verification.md +75 -0
- package/docs/shims/django.md +102 -0
- package/docs/shims/preact.md +98 -0
- package/docs/shims/react.md +98 -0
- package/docs/toolbar-layout.md +158 -0
- package/docs/toolbar-styling.md +2 -2
- package/package.json +15 -4
- package/dist/preact/index-DCKj0r6a.js.map +0 -1
- package/dist/react/index-DCKj0r6a.js.map +0 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
(function(Nt,Ge){typeof exports=="object"&&typeof module!="undefined"?Ge(exports):typeof define=="function"&&define.amd?define(["exports"],Ge):(Nt=typeof globalThis!="undefined"?globalThis:Nt||self,Ge(Nt.LeafletGeoKit={}))})(this,(function(Nt){"use strict";var bm=Object.defineProperty;var xm=(Nt,Ge,ie)=>Ge in Nt?bm(Nt,Ge,{enumerable:!0,configurable:!0,writable:!0,value:ie}):Nt[Ge]=ie;var Q=(Nt,Ge,ie)=>xm(Nt,typeof Ge!="symbol"?Ge+"":Ge,ie);var Wh,jh;function Ge(a,n){for(var i=0;i<n.length;i++){const s=n[i];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in a)){const h=Object.getOwnPropertyDescriptor(s,r);h&&Object.defineProperty(a,r,h.get?h:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}const ie={Ready:"leaflet-draw:ready",Created:"leaflet-draw:created",Edited:"leaflet-draw:edited",Deleted:"leaflet-draw:deleted",Error:"leaflet-draw:error",Ingest:"leaflet-draw:ingest",Export:"leaflet-draw:export"},_i={Status:"leaflet-geokit:status",Diagnostic:"leaflet-geokit:diagnostic",ToolCommand:"leaflet-geokit:tool-command",ToolCommanded:"leaflet-geokit:tool-commanded",ToolStarted:"leaflet-geokit:tool-started",ToolCompleted:"leaflet-geokit:tool-completed",ToolCancelled:"leaflet-geokit:tool-cancelled",ToolFailed:"leaflet-geokit:tool-failed",ToolStateChanged:"leaflet-geokit:tool-state-changed",ToolCapabilitiesChanged:"leaflet-geokit:tool-capabilities-changed",LayersChanged:"leaflet-geokit:layers-changed",LayerStyleRequest:"leaflet-geokit:layer-style-request",LayerCakeSessionStarted:"tool:layer-cake:session-started",LayerCakeSessionChanged:"tool:layer-cake:session-changed",LayerCakeSaved:"tool:layer-cake:saved",LayerCakeCancelled:"tool:layer-cake:cancelled"},Tl={trace:10,debug:20,info:30,warn:40,error:50};function uc(a,n){return a==="silent"?!1:Tl[n]>=Tl[a]}function hc(){try{return new Date().toISOString()}catch{return""}}function Ro(a,n="debug",i=console){let s=n;const r=f=>(...d)=>{try{if(!uc(s,f))return;const m=`[${hc()}][${a}][${f.toUpperCase()}]`,_=i[f];typeof _=="function"?_(m,...d):i.log(m,...d)}catch{}};return{get level(){return s},setLevel(f){s=f},trace:r("trace"),debug:r("debug"),info:r("info"),warn:r("warn"),error:r("error"),child(f){return Ro(`${a}:${f}`,s,i)}}}function Il(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Sr={exports:{}};/* @preserve
|
|
2
|
-
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
|
3
|
-
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
|
4
|
-
*/var cc=Sr.exports,Cl;function Sl(){return Cl||(Cl=1,(function(a,n){(function(i,s){s(n)})(cc,(function(i){var s="1.9.4";function r(o){var c,p,v,k;for(p=1,v=arguments.length;p<v;p++){k=arguments[p];for(c in k)o[c]=k[c]}return o}var h=Object.create||(function(){function o(){}return function(c){return o.prototype=c,new o}})();function f(o,c){var p=Array.prototype.slice;if(o.bind)return o.bind.apply(o,p.call(arguments,1));var v=p.call(arguments,2);return function(){return o.apply(c,v.length?v.concat(p.call(arguments)):arguments)}}var d=0;function m(o){return"_leaflet_id"in o||(o._leaflet_id=++d),o._leaflet_id}function _(o,c,p){var v,k,P,V;return V=function(){v=!1,k&&(P.apply(p,k),k=!1)},P=function(){v?k=arguments:(o.apply(p,arguments),setTimeout(V,c),v=!0)},P}function x(o,c,p){var v=c[1],k=c[0],P=v-k;return o===v&&p?o:((o-k)%P+P)%P+k}function b(){return!1}function E(o,c){if(c===!1)return o;var p=Math.pow(10,c===void 0?6:c);return Math.round(o*p)/p}function C(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function M(o){return C(o).split(/\s+/)}function S(o,c){Object.prototype.hasOwnProperty.call(o,"options")||(o.options=o.options?h(o.options):{});for(var p in c)o.options[p]=c[p];return o.options}function z(o,c,p){var v=[];for(var k in o)v.push(encodeURIComponent(p?k.toUpperCase():k)+"="+encodeURIComponent(o[k]));return(!c||c.indexOf("?")===-1?"?":"&")+v.join("&")}var Z=/\{ *([\w_ -]+) *\}/g;function O(o,c){return o.replace(Z,function(p,v){var k=c[v];if(k===void 0)throw new Error("No value provided for variable "+p);return typeof k=="function"&&(k=k(c)),k})}var q=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"};function j(o,c){for(var p=0;p<o.length;p++)if(o[p]===c)return p;return-1}var X="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function et(o){return window["webkit"+o]||window["moz"+o]||window["ms"+o]}var ot=0;function I(o){var c=+new Date,p=Math.max(0,16-(c-ot));return ot=c+p,window.setTimeout(o,p)}var N=window.requestAnimationFrame||et("RequestAnimationFrame")||I,R=window.cancelAnimationFrame||et("CancelAnimationFrame")||et("CancelRequestAnimationFrame")||function(o){window.clearTimeout(o)};function F(o,c,p){if(p&&N===I)o.call(c);else return N.call(window,f(o,c))}function G(o){o&&R.call(window,o)}var H={__proto__:null,extend:r,create:h,bind:f,get lastId(){return d},stamp:m,throttle:_,wrapNum:x,falseFn:b,formatNum:E,trim:C,splitWords:M,setOptions:S,getParamString:z,template:O,isArray:q,indexOf:j,emptyImageUrl:X,requestFn:N,cancelFn:R,requestAnimFrame:F,cancelAnimFrame:G};function W(){}W.extend=function(o){var c=function(){S(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},p=c.__super__=this.prototype,v=h(p);v.constructor=c,c.prototype=v;for(var k in this)Object.prototype.hasOwnProperty.call(this,k)&&k!=="prototype"&&k!=="__super__"&&(c[k]=this[k]);return o.statics&&r(c,o.statics),o.includes&&(D(o.includes),r.apply(null,[v].concat(o.includes))),r(v,o),delete v.statics,delete v.includes,v.options&&(v.options=p.options?h(p.options):{},r(v.options,o.options)),v._initHooks=[],v.callInitHooks=function(){if(!this._initHooksCalled){p.callInitHooks&&p.callInitHooks.call(this),this._initHooksCalled=!0;for(var P=0,V=v._initHooks.length;P<V;P++)v._initHooks[P].call(this)}},c},W.include=function(o){var c=this.prototype.options;return r(this.prototype,o),o.options&&(this.prototype.options=c,this.mergeOptions(o.options)),this},W.mergeOptions=function(o){return r(this.prototype.options,o),this},W.addInitHook=function(o){var c=Array.prototype.slice.call(arguments,1),p=typeof o=="function"?o:function(){this[o].apply(this,c)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(p),this};function D(o){if(!(typeof L=="undefined"||!L||!L.Mixin)){o=q(o)?o:[o];for(var c=0;c<o.length;c++)o[c]===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 Y={on:function(o,c,p){if(typeof o=="object")for(var v in o)this._on(v,o[v],c);else{o=M(o);for(var k=0,P=o.length;k<P;k++)this._on(o[k],c,p)}return this},off:function(o,c,p){if(!arguments.length)delete this._events;else if(typeof o=="object")for(var v in o)this._off(v,o[v],c);else{o=M(o);for(var k=arguments.length===1,P=0,V=o.length;P<V;P++)k?this._off(o[P]):this._off(o[P],c,p)}return this},_on:function(o,c,p,v){if(typeof c!="function"){console.warn("wrong listener type: "+typeof c);return}if(this._listens(o,c,p)===!1){p===this&&(p=void 0);var k={fn:c,ctx:p};v&&(k.once=!0),this._events=this._events||{},this._events[o]=this._events[o]||[],this._events[o].push(k)}},_off:function(o,c,p){var v,k,P;if(this._events&&(v=this._events[o],!!v)){if(arguments.length===1){if(this._firingCount)for(k=0,P=v.length;k<P;k++)v[k].fn=b;delete this._events[o];return}if(typeof c!="function"){console.warn("wrong listener type: "+typeof c);return}var V=this._listens(o,c,p);if(V!==!1){var nt=v[V];this._firingCount&&(nt.fn=b,this._events[o]=v=v.slice()),v.splice(V,1)}}},fire:function(o,c,p){if(!this.listens(o,p))return this;var v=r({},c,{type:o,target:this,sourceTarget:c&&c.sourceTarget||this});if(this._events){var k=this._events[o];if(k){this._firingCount=this._firingCount+1||1;for(var P=0,V=k.length;P<V;P++){var nt=k[P],st=nt.fn;nt.once&&this.off(o,st,nt.ctx),st.call(nt.ctx||this,v)}this._firingCount--}}return p&&this._propagateEvent(v),this},listens:function(o,c,p,v){typeof o!="string"&&console.warn('"string" type argument expected');var k=c;typeof c!="function"&&(v=!!c,k=void 0,p=void 0);var P=this._events&&this._events[o];if(P&&P.length&&this._listens(o,k,p)!==!1)return!0;if(v){for(var V in this._eventParents)if(this._eventParents[V].listens(o,c,p,v))return!0}return!1},_listens:function(o,c,p){if(!this._events)return!1;var v=this._events[o]||[];if(!c)return!!v.length;p===this&&(p=void 0);for(var k=0,P=v.length;k<P;k++)if(v[k].fn===c&&v[k].ctx===p)return k;return!1},once:function(o,c,p){if(typeof o=="object")for(var v in o)this._on(v,o[v],c,!0);else{o=M(o);for(var k=0,P=o.length;k<P;k++)this._on(o[k],c,p,!0)}return this},addEventParent:function(o){return this._eventParents=this._eventParents||{},this._eventParents[m(o)]=o,this},removeEventParent:function(o){return this._eventParents&&delete this._eventParents[m(o)],this},_propagateEvent:function(o){for(var c in this._eventParents)this._eventParents[c].fire(o.type,r({layer:o.target,propagatedFrom:o.target},o),!0)}};Y.addEventListener=Y.on,Y.removeEventListener=Y.clearAllEventListeners=Y.off,Y.addOneTimeEventListener=Y.once,Y.fireEvent=Y.fire,Y.hasEventListeners=Y.listens;var $=W.extend(Y);function J(o,c,p){this.x=p?Math.round(o):o,this.y=p?Math.round(c):c}var at=Math.trunc||function(o){return o>0?Math.floor(o):Math.ceil(o)};J.prototype={clone:function(){return new J(this.x,this.y)},add:function(o){return this.clone()._add(rt(o))},_add:function(o){return this.x+=o.x,this.y+=o.y,this},subtract:function(o){return this.clone()._subtract(rt(o))},_subtract:function(o){return this.x-=o.x,this.y-=o.y,this},divideBy:function(o){return this.clone()._divideBy(o)},_divideBy:function(o){return this.x/=o,this.y/=o,this},multiplyBy:function(o){return this.clone()._multiplyBy(o)},_multiplyBy:function(o){return this.x*=o,this.y*=o,this},scaleBy:function(o){return new J(this.x*o.x,this.y*o.y)},unscaleBy:function(o){return new J(this.x/o.x,this.y/o.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=at(this.x),this.y=at(this.y),this},distanceTo:function(o){o=rt(o);var c=o.x-this.x,p=o.y-this.y;return Math.sqrt(c*c+p*p)},equals:function(o){return o=rt(o),o.x===this.x&&o.y===this.y},contains:function(o){return o=rt(o),Math.abs(o.x)<=Math.abs(this.x)&&Math.abs(o.y)<=Math.abs(this.y)},toString:function(){return"Point("+E(this.x)+", "+E(this.y)+")"}};function rt(o,c,p){return o instanceof J?o:q(o)?new J(o[0],o[1]):o==null?o:typeof o=="object"&&"x"in o&&"y"in o?new J(o.x,o.y):new J(o,c,p)}function ht(o,c){if(o)for(var p=c?[o,c]:o,v=0,k=p.length;v<k;v++)this.extend(p[v])}ht.prototype={extend:function(o){var c,p;if(!o)return this;if(o instanceof J||typeof o[0]=="number"||"x"in o)c=p=rt(o);else if(o=_t(o),c=o.min,p=o.max,!c||!p)return this;return!this.min&&!this.max?(this.min=c.clone(),this.max=p.clone()):(this.min.x=Math.min(c.x,this.min.x),this.max.x=Math.max(p.x,this.max.x),this.min.y=Math.min(c.y,this.min.y),this.max.y=Math.max(p.y,this.max.y)),this},getCenter:function(o){return rt((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,o)},getBottomLeft:function(){return rt(this.min.x,this.max.y)},getTopRight:function(){return rt(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(o){var c,p;return typeof o[0]=="number"||o instanceof J?o=rt(o):o=_t(o),o instanceof ht?(c=o.min,p=o.max):c=p=o,c.x>=this.min.x&&p.x<=this.max.x&&c.y>=this.min.y&&p.y<=this.max.y},intersects:function(o){o=_t(o);var c=this.min,p=this.max,v=o.min,k=o.max,P=k.x>=c.x&&v.x<=p.x,V=k.y>=c.y&&v.y<=p.y;return P&&V},overlaps:function(o){o=_t(o);var c=this.min,p=this.max,v=o.min,k=o.max,P=k.x>c.x&&v.x<p.x,V=k.y>c.y&&v.y<p.y;return P&&V},isValid:function(){return!!(this.min&&this.max)},pad:function(o){var c=this.min,p=this.max,v=Math.abs(c.x-p.x)*o,k=Math.abs(c.y-p.y)*o;return _t(rt(c.x-v,c.y-k),rt(p.x+v,p.y+k))},equals:function(o){return o?(o=_t(o),this.min.equals(o.getTopLeft())&&this.max.equals(o.getBottomRight())):!1}};function _t(o,c){return!o||o instanceof ht?o:new ht(o,c)}function kt(o,c){if(o)for(var p=c?[o,c]:o,v=0,k=p.length;v<k;v++)this.extend(p[v])}kt.prototype={extend:function(o){var c=this._southWest,p=this._northEast,v,k;if(o instanceof pt)v=o,k=o;else if(o instanceof kt){if(v=o._southWest,k=o._northEast,!v||!k)return this}else return o?this.extend(vt(o)||dt(o)):this;return!c&&!p?(this._southWest=new pt(v.lat,v.lng),this._northEast=new pt(k.lat,k.lng)):(c.lat=Math.min(v.lat,c.lat),c.lng=Math.min(v.lng,c.lng),p.lat=Math.max(k.lat,p.lat),p.lng=Math.max(k.lng,p.lng)),this},pad:function(o){var c=this._southWest,p=this._northEast,v=Math.abs(c.lat-p.lat)*o,k=Math.abs(c.lng-p.lng)*o;return new kt(new pt(c.lat-v,c.lng-k),new pt(p.lat+v,p.lng+k))},getCenter:function(){return new pt((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 pt(this.getNorth(),this.getWest())},getSouthEast:function(){return new pt(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(o){typeof o[0]=="number"||o instanceof pt||"lat"in o?o=vt(o):o=dt(o);var c=this._southWest,p=this._northEast,v,k;return o instanceof kt?(v=o.getSouthWest(),k=o.getNorthEast()):v=k=o,v.lat>=c.lat&&k.lat<=p.lat&&v.lng>=c.lng&&k.lng<=p.lng},intersects:function(o){o=dt(o);var c=this._southWest,p=this._northEast,v=o.getSouthWest(),k=o.getNorthEast(),P=k.lat>=c.lat&&v.lat<=p.lat,V=k.lng>=c.lng&&v.lng<=p.lng;return P&&V},overlaps:function(o){o=dt(o);var c=this._southWest,p=this._northEast,v=o.getSouthWest(),k=o.getNorthEast(),P=k.lat>c.lat&&v.lat<p.lat,V=k.lng>c.lng&&v.lng<p.lng;return P&&V},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(o,c){return o?(o=dt(o),this._southWest.equals(o.getSouthWest(),c)&&this._northEast.equals(o.getNorthEast(),c)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function dt(o,c){return o instanceof kt?o:new kt(o,c)}function pt(o,c,p){if(isNaN(o)||isNaN(c))throw new Error("Invalid LatLng object: ("+o+", "+c+")");this.lat=+o,this.lng=+c,p!==void 0&&(this.alt=+p)}pt.prototype={equals:function(o,c){if(!o)return!1;o=vt(o);var p=Math.max(Math.abs(this.lat-o.lat),Math.abs(this.lng-o.lng));return p<=(c===void 0?1e-9:c)},toString:function(o){return"LatLng("+E(this.lat,o)+", "+E(this.lng,o)+")"},distanceTo:function(o){return tt.distance(this,vt(o))},wrap:function(){return tt.wrapLatLng(this)},toBounds:function(o){var c=180*o/40075017,p=c/Math.cos(Math.PI/180*this.lat);return dt([this.lat-c,this.lng-p],[this.lat+c,this.lng+p])},clone:function(){return new pt(this.lat,this.lng,this.alt)}};function vt(o,c,p){return o instanceof pt?o:q(o)&&typeof o[0]!="object"?o.length===3?new pt(o[0],o[1],o[2]):o.length===2?new pt(o[0],o[1]):null:o==null?o:typeof o=="object"&&"lat"in o?new pt(o.lat,"lng"in o?o.lng:o.lon,o.alt):c===void 0?null:new pt(o,c,p)}var Yt={latLngToPoint:function(o,c){var p=this.projection.project(o),v=this.scale(c);return this.transformation._transform(p,v)},pointToLatLng:function(o,c){var p=this.scale(c),v=this.transformation.untransform(o,p);return this.projection.unproject(v)},project:function(o){return this.projection.project(o)},unproject:function(o){return this.projection.unproject(o)},scale:function(o){return 256*Math.pow(2,o)},zoom:function(o){return Math.log(o/256)/Math.LN2},getProjectedBounds:function(o){if(this.infinite)return null;var c=this.projection.bounds,p=this.scale(o),v=this.transformation.transform(c.min,p),k=this.transformation.transform(c.max,p);return new ht(v,k)},infinite:!1,wrapLatLng:function(o){var c=this.wrapLng?x(o.lng,this.wrapLng,!0):o.lng,p=this.wrapLat?x(o.lat,this.wrapLat,!0):o.lat,v=o.alt;return new pt(p,c,v)},wrapLatLngBounds:function(o){var c=o.getCenter(),p=this.wrapLatLng(c),v=c.lat-p.lat,k=c.lng-p.lng;if(v===0&&k===0)return o;var P=o.getSouthWest(),V=o.getNorthEast(),nt=new pt(P.lat-v,P.lng-k),st=new pt(V.lat-v,V.lng-k);return new kt(nt,st)}},tt=r({},Yt,{wrapLng:[-180,180],R:6371e3,distance:function(o,c){var p=Math.PI/180,v=o.lat*p,k=c.lat*p,P=Math.sin((c.lat-o.lat)*p/2),V=Math.sin((c.lng-o.lng)*p/2),nt=P*P+Math.cos(v)*Math.cos(k)*V*V,st=2*Math.atan2(Math.sqrt(nt),Math.sqrt(1-nt));return this.R*st}}),en=6378137,qt={R:en,MAX_LATITUDE:85.0511287798,project:function(o){var c=Math.PI/180,p=this.MAX_LATITUDE,v=Math.max(Math.min(p,o.lat),-p),k=Math.sin(v*c);return new J(this.R*o.lng*c,this.R*Math.log((1+k)/(1-k))/2)},unproject:function(o){var c=180/Math.PI;return new pt((2*Math.atan(Math.exp(o.y/this.R))-Math.PI/2)*c,o.x*c/this.R)},bounds:(function(){var o=en*Math.PI;return new ht([-o,-o],[o,o])})()};function mt(o,c,p,v){if(q(o)){this._a=o[0],this._b=o[1],this._c=o[2],this._d=o[3];return}this._a=o,this._b=c,this._c=p,this._d=v}mt.prototype={transform:function(o,c){return this._transform(o.clone(),c)},_transform:function(o,c){return c=c||1,o.x=c*(this._a*o.x+this._b),o.y=c*(this._c*o.y+this._d),o},untransform:function(o,c){return c=c||1,new J((o.x/c-this._b)/this._a,(o.y/c-this._d)/this._c)}};function U(o,c,p,v){return new mt(o,c,p,v)}var Wt=r({},tt,{code:"EPSG:3857",projection:qt,transformation:(function(){var o=.5/(Math.PI*qt.R);return U(o,.5,-o,.5)})()}),oe=r({},Wt,{code:"EPSG:900913"});function Ut(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function eo(o,c){var p="",v,k,P,V,nt,st;for(v=0,P=o.length;v<P;v++){for(nt=o[v],k=0,V=nt.length;k<V;k++)st=nt[k],p+=(k?"L":"M")+st.x+" "+st.y;p+=c?xt.svg?"z":"x":""}return p||"M0 0"}var bn=document.documentElement.style,nr="ActiveXObject"in window,ct=nr&&!document.addEventListener,io="msLaunchUri"in navigator&&!("documentMode"in document),rr=pe("webkit"),ki=pe("android"),Es=pe("android 2")||pe("android 3"),St=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),xn=ki&&pe("Google")&&St<537&&!("AudioNode"in window),nn=!!window.opera,or=!io&&pe("chrome"),Et=pe("gecko")&&!rr&&!nn&&!nr,no=!or&&pe("safari"),Dt=pe("phantom"),Tt="OTransition"in bn,al=navigator.platform.indexOf("Win")===0,ti=nr&&"transition"in bn,ro="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Es,Lt="MozPerspective"in bn,ll=!window.L_DISABLE_3D&&(ti||ro||Lt)&&!Tt&&!Dt,wn=typeof orientation!="undefined"||pe("mobile"),oo=wn&&rr,Be=wn&&ro,rn=!window.PointerEvent&&window.MSPointerEvent,Ze=!!(window.PointerEvent||rn),so="ontouchstart"in window||!!window.TouchEvent,sr=!window.L_NO_TOUCH&&(so||Ze),ul=wn&&nn,Ts=wn&&Et,Fi=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ft=(function(){var o=!1;try{var c=Object.defineProperty({},"passive",{get:function(){o=!0}});window.addEventListener("testPassiveEventSupport",b,c),window.removeEventListener("testPassiveEventSupport",b,c)}catch{}return o})(),ar=(function(){return!!document.createElement("canvas").getContext})(),on=!!(document.createElementNS&&Ut("svg").createSVGRect),kn=!!on&&(function(){var o=document.createElement("div");return o.innerHTML="<svg/>",(o.firstChild&&o.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Is=!on&&(function(){try{var o=document.createElement("div");o.innerHTML='<v:shape adj="1"/>';var c=o.firstChild;return c.style.behavior="url(#default#VML)",c&&typeof c.adj=="object"}catch{return!1}})(),ao=navigator.platform.indexOf("Mac")===0,Cs=navigator.platform.indexOf("Linux")===0;function pe(o){return navigator.userAgent.toLowerCase().indexOf(o)>=0}var xt={ie:nr,ielt9:ct,edge:io,webkit:rr,android:ki,android23:Es,androidStock:xn,opera:nn,chrome:or,gecko:Et,safari:no,phantom:Dt,opera12:Tt,win:al,ie3d:ti,webkit3d:ro,gecko3d:Lt,any3d:ll,mobile:wn,mobileWebkit:oo,mobileWebkit3d:Be,msPointer:rn,pointer:Ze,touch:sr,touchNative:so,mobileOpera:ul,mobileGecko:Ts,retina:Fi,passiveEvents:ft,canvas:ar,svg:on,vml:Is,inlineSvg:kn,mac:ao,linux:Cs},Ln=xt.msPointer?"MSPointerDown":"pointerdown",Ss=xt.msPointer?"MSPointerMove":"pointermove",lo=xt.msPointer?"MSPointerUp":"pointerup",Ms=xt.msPointer?"MSPointerCancel":"pointercancel",xe={touchstart:Ln,touchmove:Ss,touchend:lo,touchcancel:Ms},lr={touchstart:cr,touchmove:hr,touchend:hr,touchcancel:hr},ei={},Li=!1;function Gi(o,c,p){return c==="touchstart"&&hl(),lr[c]?(p=lr[c].bind(this,p),o.addEventListener(xe[c],p,!1),p):(console.warn("wrong event specified:",c),b)}function uo(o,c,p){if(!xe[c]){console.warn("wrong event specified:",c);return}o.removeEventListener(xe[c],p,!1)}function ur(o){ei[o.pointerId]=o}function En(o){ei[o.pointerId]&&(ei[o.pointerId]=o)}function se(o){delete ei[o.pointerId]}function hl(){Li||(document.addEventListener(Ln,ur,!0),document.addEventListener(Ss,En,!0),document.addEventListener(lo,se,!0),document.addEventListener(Ms,se,!0),Li=!0)}function hr(o,c){if(c.pointerType!==(c.MSPOINTER_TYPE_MOUSE||"mouse")){c.touches=[];for(var p in ei)c.touches.push(ei[p]);c.changedTouches=[c],o(c)}}function cr(o,c){c.MSPOINTER_TYPE_TOUCH&&c.pointerType===c.MSPOINTER_TYPE_TOUCH&&re(c),hr(o,c)}function Tn(o){var c={},p,v;for(v in o)p=o[v],c[v]=p&&p.bind?p.bind(o):p;return o=c,c.type="dblclick",c.detail=2,c.isTrusted=!1,c._simulated=!0,c}var ho=200;function co(o,c){o.addEventListener("dblclick",c);var p=0,v;function k(P){if(P.detail!==1){v=P.detail;return}if(!(P.pointerType==="mouse"||P.sourceCapabilities&&!P.sourceCapabilities.firesTouchEvents)){var V=ye(P);if(!(V.some(function(st){return st instanceof HTMLLabelElement&&st.attributes.for})&&!V.some(function(st){return st instanceof HTMLInputElement||st instanceof HTMLSelectElement}))){var nt=Date.now();nt-p<=ho?(v++,v===2&&c(Tn(P))):v=1,p=nt}}}return o.addEventListener("click",k),{dblclick:c,simDblclick:k}}function As(o,c){o.removeEventListener("dblclick",c.dblclick),o.removeEventListener("click",c.simDblclick)}var fo=pr(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),we=pr(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Ui=we==="webkitTransition"||we==="OTransition"?we+"End":"transitionend";function fr(o){return typeof o=="string"?document.getElementById(o):o}function ii(o,c){var p=o.style[c]||o.currentStyle&&o.currentStyle[c];if((!p||p==="auto")&&document.defaultView){var v=document.defaultView.getComputedStyle(o,null);p=v?v[c]:null}return p==="auto"?null:p}function Bt(o,c,p){var v=document.createElement(o);return v.className=c||"",p&&p.appendChild(v),v}function $t(o){var c=o.parentNode;c&&c.removeChild(o)}function dr(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function sn(o){var c=o.parentNode;c&&c.lastChild!==o&&c.appendChild(o)}function qi(o){var c=o.parentNode;c&&c.firstChild!==o&&c.insertBefore(o,c.firstChild)}function gr(o,c){if(o.classList!==void 0)return o.classList.contains(c);var p=In(o);return p.length>0&&new RegExp("(^|\\s)"+c+"(\\s|$)").test(p)}function Ct(o,c){if(o.classList!==void 0)for(var p=M(c),v=0,k=p.length;v<k;v++)o.classList.add(p[v]);else if(!gr(o,c)){var P=In(o);ni(o,(P?P+" ":"")+c)}}function Ht(o,c){o.classList!==void 0?o.classList.remove(c):ni(o,C((" "+In(o)+" ").replace(" "+c+" "," ")))}function ni(o,c){o.className.baseVal===void 0?o.className=c:o.className.baseVal=c}function In(o){return o.correspondingElement&&(o=o.correspondingElement),o.className.baseVal===void 0?o.className:o.className.baseVal}function fe(o,c){"opacity"in o.style?o.style.opacity=c:"filter"in o.style&&cl(o,c)}function cl(o,c){var p=!1,v="DXImageTransform.Microsoft.Alpha";try{p=o.filters.item(v)}catch{if(c===1)return}c=Math.round(c*100),p?(p.Enabled=c!==100,p.Opacity=c):o.style.filter+=" progid:"+v+"(opacity="+c+")"}function pr(o){for(var c=document.documentElement.style,p=0;p<o.length;p++)if(o[p]in c)return o[p];return!1}function Zi(o,c,p){var v=c||new J(0,0);o.style[fo]=(xt.ie3d?"translate("+v.x+"px,"+v.y+"px)":"translate3d("+v.x+"px,"+v.y+"px,0)")+(p?" scale("+p+")":"")}function ae(o,c){o._leaflet_pos=c,xt.any3d?Zi(o,c):(o.style.left=c.x+"px",o.style.top=c.y+"px")}function Ei(o){return o._leaflet_pos||new J(0,0)}var gi,an,go;if("onselectstart"in document)gi=function(){Mt(window,"selectstart",re)},an=function(){Xt(window,"selectstart",re)};else{var ln=pr(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);gi=function(){if(ln){var o=document.documentElement.style;go=o[ln],o[ln]="none"}},an=function(){ln&&(document.documentElement.style[ln]=go,go=void 0)}}function po(){Mt(window,"dragstart",re)}function Cn(){Xt(window,"dragstart",re)}var Vt,pi;function mo(o){for(;o.tabIndex===-1;)o=o.parentNode;o.style&&(un(),Vt=o,pi=o.style.outlineStyle,o.style.outlineStyle="none",Mt(window,"keydown",un))}function un(){Vt&&(Vt.style.outlineStyle=pi,Vt=void 0,pi=void 0,Xt(window,"keydown",un))}function Ae(o){do o=o.parentNode;while((!o.offsetWidth||!o.offsetHeight)&&o!==document.body);return o}function Ie(o){var c=o.getBoundingClientRect();return{x:c.width/o.offsetWidth||1,y:c.height/o.offsetHeight||1,boundingClientRect:c}}var mr={__proto__:null,TRANSFORM:fo,TRANSITION:we,TRANSITION_END:Ui,get:fr,getStyle:ii,create:Bt,remove:$t,empty:dr,toFront:sn,toBack:qi,hasClass:gr,addClass:Ct,removeClass:Ht,setClass:ni,getClass:In,setOpacity:fe,testProp:pr,setTransform:Zi,setPosition:ae,getPosition:Ei,get disableTextSelection(){return gi},get enableTextSelection(){return an},disableImageDrag:po,enableImageDrag:Cn,preventOutline:mo,restoreOutline:un,getSizedParentNode:Ae,getScale:Ie};function Mt(o,c,p,v){if(c&&typeof c=="object")for(var k in c)yr(o,k,c[k],p);else{c=M(c);for(var P=0,V=c.length;P<V;P++)yr(o,c[P],p,v)}return this}var ri="_leaflet_events";function Xt(o,c,p,v){if(arguments.length===1)Sn(o),delete o[ri];else if(c&&typeof c=="object")for(var k in c)Ft(o,k,c[k],p);else if(c=M(c),arguments.length===2)Sn(o,function(nt){return j(c,nt)!==-1});else for(var P=0,V=c.length;P<V;P++)Ft(o,c[P],p,v);return this}function Sn(o,c){for(var p in o[ri]){var v=p.split(/\d/)[0];(!c||c(v))&&Ft(o,v,null,null,p)}}var yo={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function yr(o,c,p,v){var k=c+m(p)+(v?"_"+m(v):"");if(o[ri]&&o[ri][k])return this;var P=function(nt){return p.call(v||o,nt||window.event)},V=P;!xt.touchNative&&xt.pointer&&c.indexOf("touch")===0?P=Gi(o,c,P):xt.touch&&c==="dblclick"?P=co(o,P):"addEventListener"in o?c==="touchstart"||c==="touchmove"||c==="wheel"||c==="mousewheel"?o.addEventListener(yo[c]||c,P,xt.passiveEvents?{passive:!1}:!1):c==="mouseenter"||c==="mouseleave"?(P=function(nt){nt=nt||window.event,_r(o,nt)&&V(nt)},o.addEventListener(yo[c],P,!1)):o.addEventListener(c,V,!1):o.attachEvent("on"+c,P),o[ri]=o[ri]||{},o[ri][k]=P}function Ft(o,c,p,v,k){k=k||c+m(p)+(v?"_"+m(v):"");var P=o[ri]&&o[ri][k];if(!P)return this;!xt.touchNative&&xt.pointer&&c.indexOf("touch")===0?uo(o,c,P):xt.touch&&c==="dblclick"?As(o,P):"removeEventListener"in o?o.removeEventListener(yo[c]||c,P,!1):o.detachEvent("on"+c,P),o[ri][k]=null}function me(o){return o.stopPropagation?o.stopPropagation():o.originalEvent?o.originalEvent._stopped=!0:o.cancelBubble=!0,this}function Mn(o){return yr(o,"wheel",me),this}function hn(o){return Mt(o,"mousedown touchstart dblclick contextmenu",me),o._leaflet_disable_click=!0,this}function re(o){return o.preventDefault?o.preventDefault():o.returnValue=!1,this}function Ti(o){return re(o),me(o),this}function ye(o){if(o.composedPath)return o.composedPath();for(var c=[],p=o.target;p;)c.push(p),p=p.parentNode;return c}function _o(o,c){if(!c)return new J(o.clientX,o.clientY);var p=Ie(c),v=p.boundingClientRect;return new J((o.clientX-v.left)/p.x-c.clientLeft,(o.clientY-v.top)/p.y-c.clientTop)}var vo=xt.linux&&xt.chrome?window.devicePixelRatio:xt.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function bo(o){return xt.edge?o.wheelDeltaY/2:o.deltaY&&o.deltaMode===0?-o.deltaY/vo:o.deltaY&&o.deltaMode===1?-o.deltaY*20:o.deltaY&&o.deltaMode===2?-o.deltaY*60:o.deltaX||o.deltaZ?0:o.wheelDelta?(o.wheelDeltaY||o.wheelDelta)/2:o.detail&&Math.abs(o.detail)<32765?-o.detail*20:o.detail?o.detail/-32765*60:0}function _r(o,c){var p=c.relatedTarget;if(!p)return!0;try{for(;p&&p!==o;)p=p.parentNode}catch{return!1}return p!==o}var fl={__proto__:null,on:Mt,off:Xt,stopPropagation:me,disableScrollPropagation:Mn,disableClickPropagation:hn,preventDefault:re,stop:Ti,getPropagationPath:ye,getMousePosition:_o,getWheelDelta:bo,isExternalTarget:_r,addListener:Mt,removeListener:Xt},xo=$.extend({run:function(o,c,p,v){this.stop(),this._el=o,this._inProgress=!0,this._duration=p||.25,this._easeOutPower=1/Math.max(v||.5,.2),this._startPos=Ei(o),this._offset=c.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=F(this._animate,this),this._step()},_step:function(o){var c=+new Date-this._startTime,p=this._duration*1e3;c<p?this._runFrame(this._easeOut(c/p),o):(this._runFrame(1),this._complete())},_runFrame:function(o,c){var p=this._startPos.add(this._offset.multiplyBy(o));c&&p._round(),ae(this._el,p),this.fire("step")},_complete:function(){G(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(o){return 1-Math.pow(1-o,this._easeOutPower)}}),At=$.extend({options:{crs:Wt,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(o,c){c=S(this,c),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(o),this._initLayout(),this._onResize=f(this._onResize,this),this._initEvents(),c.maxBounds&&this.setMaxBounds(c.maxBounds),c.zoom!==void 0&&(this._zoom=this._limitZoom(c.zoom)),c.center&&c.zoom!==void 0&&this.setView(vt(c.center),c.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=we&&xt.any3d&&!xt.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Mt(this._proxy,Ui,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(o,c,p){if(c=c===void 0?this._zoom:this._limitZoom(c),o=this._limitCenter(vt(o),c,this.options.maxBounds),p=p||{},this._stop(),this._loaded&&!p.reset&&p!==!0){p.animate!==void 0&&(p.zoom=r({animate:p.animate},p.zoom),p.pan=r({animate:p.animate,duration:p.duration},p.pan));var v=this._zoom!==c?this._tryAnimatedZoom&&this._tryAnimatedZoom(o,c,p.zoom):this._tryAnimatedPan(o,p.pan);if(v)return clearTimeout(this._sizeTimer),this}return this._resetView(o,c,p.pan&&p.pan.noMoveStart),this},setZoom:function(o,c){return this._loaded?this.setView(this.getCenter(),o,{zoom:c}):(this._zoom=o,this)},zoomIn:function(o,c){return o=o||(xt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+o,c)},zoomOut:function(o,c){return o=o||(xt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-o,c)},setZoomAround:function(o,c,p){var v=this.getZoomScale(c),k=this.getSize().divideBy(2),P=o instanceof J?o:this.latLngToContainerPoint(o),V=P.subtract(k).multiplyBy(1-1/v),nt=this.containerPointToLatLng(k.add(V));return this.setView(nt,c,{zoom:p})},_getBoundsCenterZoom:function(o,c){c=c||{},o=o.getBounds?o.getBounds():dt(o);var p=rt(c.paddingTopLeft||c.padding||[0,0]),v=rt(c.paddingBottomRight||c.padding||[0,0]),k=this.getBoundsZoom(o,!1,p.add(v));if(k=typeof c.maxZoom=="number"?Math.min(c.maxZoom,k):k,k===1/0)return{center:o.getCenter(),zoom:k};var P=v.subtract(p).divideBy(2),V=this.project(o.getSouthWest(),k),nt=this.project(o.getNorthEast(),k),st=this.unproject(V.add(nt).divideBy(2).add(P),k);return{center:st,zoom:k}},fitBounds:function(o,c){if(o=dt(o),!o.isValid())throw new Error("Bounds are not valid.");var p=this._getBoundsCenterZoom(o,c);return this.setView(p.center,p.zoom,c)},fitWorld:function(o){return this.fitBounds([[-90,-180],[90,180]],o)},panTo:function(o,c){return this.setView(o,this._zoom,{pan:c})},panBy:function(o,c){if(o=rt(o).round(),c=c||{},!o.x&&!o.y)return this.fire("moveend");if(c.animate!==!0&&!this.getSize().contains(o))return this._resetView(this.unproject(this.project(this.getCenter()).add(o)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new xo,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),c.noMoveStart||this.fire("movestart"),c.animate!==!1){Ct(this._mapPane,"leaflet-pan-anim");var p=this._getMapPanePos().subtract(o).round();this._panAnim.run(this._mapPane,p,c.duration||.25,c.easeLinearity)}else this._rawPanBy(o),this.fire("move").fire("moveend");return this},flyTo:function(o,c,p){if(p=p||{},p.animate===!1||!xt.any3d)return this.setView(o,c,p);this._stop();var v=this.project(this.getCenter()),k=this.project(o),P=this.getSize(),V=this._zoom;o=vt(o),c=c===void 0?V:c;var nt=Math.max(P.x,P.y),st=nt*this.getZoomScale(V,c),ut=k.distanceTo(v)||1,yt=1.42,It=yt*yt;function Rt(ce){var Ys=ce?-1:1,mm=ce?st:nt,ym=st*st-nt*nt+Ys*It*It*ut*ut,_m=2*mm*It*ut,Ll=ym/_m,ac=Math.sqrt(Ll*Ll+1)-Ll,vm=ac<1e-9?-18:Math.log(ac);return vm}function Oe(ce){return(Math.exp(ce)-Math.exp(-ce))/2}function ve(ce){return(Math.exp(ce)+Math.exp(-ce))/2}function hi(ce){return Oe(ce)/ve(ce)}var Fe=Rt(0);function Cr(ce){return nt*(ve(Fe)/ve(Fe+yt*ce))}function fm(ce){return nt*(ve(Fe)*hi(Fe+yt*ce)-Oe(Fe))/It}function dm(ce){return 1-Math.pow(1-ce,1.5)}var gm=Date.now(),oc=(Rt(1)-Fe)/yt,pm=p.duration?1e3*p.duration:1e3*oc*.8;function sc(){var ce=(Date.now()-gm)/pm,Ys=dm(ce)*oc;ce<=1?(this._flyToFrame=F(sc,this),this._move(this.unproject(v.add(k.subtract(v).multiplyBy(fm(Ys)/ut)),V),this.getScaleZoom(nt/Cr(Ys),V),{flyTo:!0})):this._move(o,c)._moveEnd(!0)}return this._moveStart(!0,p.noMoveStart),sc.call(this),this},flyToBounds:function(o,c){var p=this._getBoundsCenterZoom(o,c);return this.flyTo(p.center,p.zoom,c)},setMaxBounds:function(o){return o=dt(o),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),o.isValid()?(this.options.maxBounds=o,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(o){var c=this.options.minZoom;return this.options.minZoom=o,this._loaded&&c!==o&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(o):this},setMaxZoom:function(o){var c=this.options.maxZoom;return this.options.maxZoom=o,this._loaded&&c!==o&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(o):this},panInsideBounds:function(o,c){this._enforcingBounds=!0;var p=this.getCenter(),v=this._limitCenter(p,this._zoom,dt(o));return p.equals(v)||this.panTo(v,c),this._enforcingBounds=!1,this},panInside:function(o,c){c=c||{};var p=rt(c.paddingTopLeft||c.padding||[0,0]),v=rt(c.paddingBottomRight||c.padding||[0,0]),k=this.project(this.getCenter()),P=this.project(o),V=this.getPixelBounds(),nt=_t([V.min.add(p),V.max.subtract(v)]),st=nt.getSize();if(!nt.contains(P)){this._enforcingBounds=!0;var ut=P.subtract(nt.getCenter()),yt=nt.extend(P).getSize().subtract(st);k.x+=ut.x<0?-yt.x:yt.x,k.y+=ut.y<0?-yt.y:yt.y,this.panTo(this.unproject(k),c),this._enforcingBounds=!1}return this},invalidateSize:function(o){if(!this._loaded)return this;o=r({animate:!1,pan:!0},o===!0?{animate:!0}:o);var c=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var p=this.getSize(),v=c.divideBy(2).round(),k=p.divideBy(2).round(),P=v.subtract(k);return!P.x&&!P.y?this:(o.animate&&o.pan?this.panBy(P):(o.pan&&this._rawPanBy(P),this.fire("move"),o.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(f(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:c,newSize:p}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(o){if(o=this._locateOptions=r({timeout:1e4,watch:!1},o),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var c=f(this._handleGeolocationResponse,this),p=f(this._handleGeolocationError,this);return o.watch?this._locationWatchId=navigator.geolocation.watchPosition(c,p,o):navigator.geolocation.getCurrentPosition(c,p,o),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(o){if(this._container._leaflet_id){var c=o.code,p=o.message||(c===1?"permission denied":c===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:c,message:"Geolocation error: "+p+"."})}},_handleGeolocationResponse:function(o){if(this._container._leaflet_id){var c=o.coords.latitude,p=o.coords.longitude,v=new pt(c,p),k=v.toBounds(o.coords.accuracy*2),P=this._locateOptions;if(P.setView){var V=this.getBoundsZoom(k);this.setView(v,P.maxZoom?Math.min(V,P.maxZoom):V)}var nt={latlng:v,bounds:k,timestamp:o.timestamp};for(var st in o.coords)typeof o.coords[st]=="number"&&(nt[st]=o.coords[st]);this.fire("locationfound",nt)}},addHandler:function(o,c){if(!c)return this;var p=this[o]=new c(this);return this._handlers.push(p),this.options[o]&&p.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(),$t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(G(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var o;for(o in this._layers)this._layers[o].remove();for(o in this._panes)$t(this._panes[o]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(o,c){var p="leaflet-pane"+(o?" leaflet-"+o.replace("Pane","")+"-pane":""),v=Bt("div",p,c||this._mapPane);return o&&(this._panes[o]=v),v},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var o=this.getPixelBounds(),c=this.unproject(o.getBottomLeft()),p=this.unproject(o.getTopRight());return new kt(c,p)},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(o,c,p){o=dt(o),p=rt(p||[0,0]);var v=this.getZoom()||0,k=this.getMinZoom(),P=this.getMaxZoom(),V=o.getNorthWest(),nt=o.getSouthEast(),st=this.getSize().subtract(p),ut=_t(this.project(nt,v),this.project(V,v)).getSize(),yt=xt.any3d?this.options.zoomSnap:1,It=st.x/ut.x,Rt=st.y/ut.y,Oe=c?Math.max(It,Rt):Math.min(It,Rt);return v=this.getScaleZoom(Oe,v),yt&&(v=Math.round(v/(yt/100))*(yt/100),v=c?Math.ceil(v/yt)*yt:Math.floor(v/yt)*yt),Math.max(k,Math.min(P,v))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new J(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(o,c){var p=this._getTopLeftPoint(o,c);return new ht(p,p.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(o){return this.options.crs.getProjectedBounds(o===void 0?this.getZoom():o)},getPane:function(o){return typeof o=="string"?this._panes[o]:o},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(o,c){var p=this.options.crs;return c=c===void 0?this._zoom:c,p.scale(o)/p.scale(c)},getScaleZoom:function(o,c){var p=this.options.crs;c=c===void 0?this._zoom:c;var v=p.zoom(o*p.scale(c));return isNaN(v)?1/0:v},project:function(o,c){return c=c===void 0?this._zoom:c,this.options.crs.latLngToPoint(vt(o),c)},unproject:function(o,c){return c=c===void 0?this._zoom:c,this.options.crs.pointToLatLng(rt(o),c)},layerPointToLatLng:function(o){var c=rt(o).add(this.getPixelOrigin());return this.unproject(c)},latLngToLayerPoint:function(o){var c=this.project(vt(o))._round();return c._subtract(this.getPixelOrigin())},wrapLatLng:function(o){return this.options.crs.wrapLatLng(vt(o))},wrapLatLngBounds:function(o){return this.options.crs.wrapLatLngBounds(dt(o))},distance:function(o,c){return this.options.crs.distance(vt(o),vt(c))},containerPointToLayerPoint:function(o){return rt(o).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(o){return rt(o).add(this._getMapPanePos())},containerPointToLatLng:function(o){var c=this.containerPointToLayerPoint(rt(o));return this.layerPointToLatLng(c)},latLngToContainerPoint:function(o){return this.layerPointToContainerPoint(this.latLngToLayerPoint(vt(o)))},mouseEventToContainerPoint:function(o){return _o(o,this._container)},mouseEventToLayerPoint:function(o){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(o))},mouseEventToLatLng:function(o){return this.layerPointToLatLng(this.mouseEventToLayerPoint(o))},_initContainer:function(o){var c=this._container=fr(o);if(c){if(c._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Mt(c,"scroll",this._onScroll,this),this._containerId=m(c)},_initLayout:function(){var o=this._container;this._fadeAnimated=this.options.fadeAnimation&&xt.any3d,Ct(o,"leaflet-container"+(xt.touch?" leaflet-touch":"")+(xt.retina?" leaflet-retina":"")+(xt.ielt9?" leaflet-oldie":"")+(xt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var c=ii(o,"position");c!=="absolute"&&c!=="relative"&&c!=="fixed"&&c!=="sticky"&&(o.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var o=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ae(this._mapPane,new J(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Ct(o.markerPane,"leaflet-zoom-hide"),Ct(o.shadowPane,"leaflet-zoom-hide"))},_resetView:function(o,c,p){ae(this._mapPane,new J(0,0));var v=!this._loaded;this._loaded=!0,c=this._limitZoom(c),this.fire("viewprereset");var k=this._zoom!==c;this._moveStart(k,p)._move(o,c)._moveEnd(k),this.fire("viewreset"),v&&this.fire("load")},_moveStart:function(o,c){return o&&this.fire("zoomstart"),c||this.fire("movestart"),this},_move:function(o,c,p,v){c===void 0&&(c=this._zoom);var k=this._zoom!==c;return this._zoom=c,this._lastCenter=o,this._pixelOrigin=this._getNewPixelOrigin(o),v?p&&p.pinch&&this.fire("zoom",p):((k||p&&p.pinch)&&this.fire("zoom",p),this.fire("move",p)),this},_moveEnd:function(o){return o&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return G(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(o){ae(this._mapPane,this._getMapPanePos().subtract(o))},_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(o){this._targets={},this._targets[m(this._container)]=this;var c=o?Xt:Mt;c(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&c(window,"resize",this._onResize,this),xt.any3d&&this.options.transform3DLimit&&(o?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){G(this._resizeRequest),this._resizeRequest=F(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var o=this._getMapPanePos();Math.max(Math.abs(o.x),Math.abs(o.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(o,c){for(var p=[],v,k=c==="mouseout"||c==="mouseover",P=o.target||o.srcElement,V=!1;P;){if(v=this._targets[m(P)],v&&(c==="click"||c==="preclick")&&this._draggableMoved(v)){V=!0;break}if(v&&v.listens(c,!0)&&(k&&!_r(P,o)||(p.push(v),k))||P===this._container)break;P=P.parentNode}return!p.length&&!V&&!k&&this.listens(c,!0)&&(p=[this]),p},_isClickDisabled:function(o){for(;o&&o!==this._container;){if(o._leaflet_disable_click)return!0;o=o.parentNode}},_handleDOMEvent:function(o){var c=o.target||o.srcElement;if(!(!this._loaded||c._leaflet_disable_events||o.type==="click"&&this._isClickDisabled(c))){var p=o.type;p==="mousedown"&&mo(c),this._fireDOMEvent(o,p)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(o,c,p){if(o.type==="click"){var v=r({},o);v.type="preclick",this._fireDOMEvent(v,v.type,p)}var k=this._findEventTargets(o,c);if(p){for(var P=[],V=0;V<p.length;V++)p[V].listens(c,!0)&&P.push(p[V]);k=P.concat(k)}if(k.length){c==="contextmenu"&&re(o);var nt=k[0],st={originalEvent:o};if(o.type!=="keypress"&&o.type!=="keydown"&&o.type!=="keyup"){var ut=nt.getLatLng&&(!nt._radius||nt._radius<=10);st.containerPoint=ut?this.latLngToContainerPoint(nt.getLatLng()):this.mouseEventToContainerPoint(o),st.layerPoint=this.containerPointToLayerPoint(st.containerPoint),st.latlng=ut?nt.getLatLng():this.layerPointToLatLng(st.layerPoint)}for(V=0;V<k.length;V++)if(k[V].fire(c,st,!0),st.originalEvent._stopped||k[V].options.bubblingMouseEvents===!1&&j(this._mouseEvents,c)!==-1)return}},_draggableMoved:function(o){return o=o.dragging&&o.dragging.enabled()?o:this,o.dragging&&o.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var o=0,c=this._handlers.length;o<c;o++)this._handlers[o].disable()},whenReady:function(o,c){return this._loaded?o.call(c||this,{target:this}):this.on("load",o,c),this},_getMapPanePos:function(){return Ei(this._mapPane)||new J(0,0)},_moved:function(){var o=this._getMapPanePos();return o&&!o.equals([0,0])},_getTopLeftPoint:function(o,c){var p=o&&c!==void 0?this._getNewPixelOrigin(o,c):this.getPixelOrigin();return p.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(o,c){var p=this.getSize()._divideBy(2);return this.project(o,c)._subtract(p)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(o,c,p){var v=this._getNewPixelOrigin(p,c);return this.project(o,c)._subtract(v)},_latLngBoundsToNewLayerBounds:function(o,c,p){var v=this._getNewPixelOrigin(p,c);return _t([this.project(o.getSouthWest(),c)._subtract(v),this.project(o.getNorthWest(),c)._subtract(v),this.project(o.getSouthEast(),c)._subtract(v),this.project(o.getNorthEast(),c)._subtract(v)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(o){return this.latLngToLayerPoint(o).subtract(this._getCenterLayerPoint())},_limitCenter:function(o,c,p){if(!p)return o;var v=this.project(o,c),k=this.getSize().divideBy(2),P=new ht(v.subtract(k),v.add(k)),V=this._getBoundsOffset(P,p,c);return Math.abs(V.x)<=1&&Math.abs(V.y)<=1?o:this.unproject(v.add(V),c)},_limitOffset:function(o,c){if(!c)return o;var p=this.getPixelBounds(),v=new ht(p.min.add(o),p.max.add(o));return o.add(this._getBoundsOffset(v,c))},_getBoundsOffset:function(o,c,p){var v=_t(this.project(c.getNorthEast(),p),this.project(c.getSouthWest(),p)),k=v.min.subtract(o.min),P=v.max.subtract(o.max),V=this._rebound(k.x,-P.x),nt=this._rebound(k.y,-P.y);return new J(V,nt)},_rebound:function(o,c){return o+c>0?Math.round(o-c)/2:Math.max(0,Math.ceil(o))-Math.max(0,Math.floor(c))},_limitZoom:function(o){var c=this.getMinZoom(),p=this.getMaxZoom(),v=xt.any3d?this.options.zoomSnap:1;return v&&(o=Math.round(o/v)*v),Math.max(c,Math.min(p,o))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ht(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(o,c){var p=this._getCenterOffset(o)._trunc();return(c&&c.animate)!==!0&&!this.getSize().contains(p)?!1:(this.panBy(p,c),!0)},_createAnimProxy:function(){var o=this._proxy=Bt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(o),this.on("zoomanim",function(c){var p=fo,v=this._proxy.style[p];Zi(this._proxy,this.project(c.center,c.zoom),this.getZoomScale(c.zoom,1)),v===this._proxy.style[p]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){$t(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var o=this.getCenter(),c=this.getZoom();Zi(this._proxy,this.project(o,c),this.getZoomScale(c,1))},_catchTransitionEnd:function(o){this._animatingZoom&&o.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(o,c,p){if(this._animatingZoom)return!0;if(p=p||{},!this._zoomAnimated||p.animate===!1||this._nothingToAnimate()||Math.abs(c-this._zoom)>this.options.zoomAnimationThreshold)return!1;var v=this.getZoomScale(c),k=this._getCenterOffset(o)._divideBy(1-1/v);return p.animate!==!0&&!this.getSize().contains(k)?!1:(F(function(){this._moveStart(!0,p.noMoveStart||!1)._animateZoom(o,c,!0)},this),!0)},_animateZoom:function(o,c,p,v){this._mapPane&&(p&&(this._animatingZoom=!0,this._animateToCenter=o,this._animateToZoom=c,Ct(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:o,zoom:c,noUpdate:v}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(f(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Ht(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 vr(o,c){return new At(o,c)}var He=W.extend({options:{position:"topright"},initialize:function(o){S(this,o)},getPosition:function(){return this.options.position},setPosition:function(o){var c=this._map;return c&&c.removeControl(this),this.options.position=o,c&&c.addControl(this),this},getContainer:function(){return this._container},addTo:function(o){this.remove(),this._map=o;var c=this._container=this.onAdd(o),p=this.getPosition(),v=o._controlCorners[p];return Ct(c,"leaflet-control"),p.indexOf("bottom")!==-1?v.insertBefore(c,v.firstChild):v.appendChild(c),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?($t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(o){this._map&&o&&o.screenX>0&&o.screenY>0&&this._map.getContainer().focus()}}),_e=function(o){return new He(o)};At.include({addControl:function(o){return o.addTo(this),this},removeControl:function(o){return o.remove(),this},_initControlPos:function(){var o=this._controlCorners={},c="leaflet-",p=this._controlContainer=Bt("div",c+"control-container",this._container);function v(k,P){var V=c+k+" "+c+P;o[k+P]=Bt("div",V,p)}v("top","left"),v("top","right"),v("bottom","left"),v("bottom","right")},_clearControlPos:function(){for(var o in this._controlCorners)$t(this._controlCorners[o]);$t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Hi=He.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(o,c,p,v){return p<v?-1:v<p?1:0}},initialize:function(o,c,p){S(this,p),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var v in o)this._addLayer(o[v],v);for(v in c)this._addLayer(c[v],v,!0)},onAdd:function(o){this._initLayout(),this._update(),this._map=o,o.on("zoomend",this._checkDisabledLayers,this);for(var c=0;c<this._layers.length;c++)this._layers[c].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(o){return He.prototype.addTo.call(this,o),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var o=0;o<this._layers.length;o++)this._layers[o].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(o,c){return this._addLayer(o,c),this._map?this._update():this},addOverlay:function(o,c){return this._addLayer(o,c,!0),this._map?this._update():this},removeLayer:function(o){o.off("add remove",this._onLayerChange,this);var c=this._getLayer(m(o));return c&&this._layers.splice(this._layers.indexOf(c),1),this._map?this._update():this},expand:function(){Ct(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var o=this._map.getSize().y-(this._container.offsetTop+50);return o<this._section.clientHeight?(Ct(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=o+"px"):Ht(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ht(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var o="leaflet-control-layers",c=this._container=Bt("div",o),p=this.options.collapsed;c.setAttribute("aria-haspopup",!0),hn(c),Mn(c);var v=this._section=Bt("section",o+"-list");p&&(this._map.on("click",this.collapse,this),Mt(c,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var k=this._layersLink=Bt("a",o+"-toggle",c);k.href="#",k.title="Layers",k.setAttribute("role","button"),Mt(k,{keydown:function(P){P.keyCode===13&&this._expandSafely()},click:function(P){re(P),this._expandSafely()}},this),p||this.expand(),this._baseLayersList=Bt("div",o+"-base",v),this._separator=Bt("div",o+"-separator",v),this._overlaysList=Bt("div",o+"-overlays",v),c.appendChild(v)},_getLayer:function(o){for(var c=0;c<this._layers.length;c++)if(this._layers[c]&&m(this._layers[c].layer)===o)return this._layers[c]},_addLayer:function(o,c,p){this._map&&o.on("add remove",this._onLayerChange,this),this._layers.push({layer:o,name:c,overlay:p}),this.options.sortLayers&&this._layers.sort(f(function(v,k){return this.options.sortFunction(v.layer,k.layer,v.name,k.name)},this)),this.options.autoZIndex&&o.setZIndex&&(this._lastZIndex++,o.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;dr(this._baseLayersList),dr(this._overlaysList),this._layerControlInputs=[];var o,c,p,v,k=0;for(p=0;p<this._layers.length;p++)v=this._layers[p],this._addItem(v),c=c||v.overlay,o=o||!v.overlay,k+=v.overlay?0:1;return this.options.hideSingleBase&&(o=o&&k>1,this._baseLayersList.style.display=o?"":"none"),this._separator.style.display=c&&o?"":"none",this},_onLayerChange:function(o){this._handlingClick||this._update();var c=this._getLayer(m(o.target)),p=c.overlay?o.type==="add"?"overlayadd":"overlayremove":o.type==="add"?"baselayerchange":null;p&&this._map.fire(p,c)},_createRadioElement:function(o,c){var p='<input type="radio" class="leaflet-control-layers-selector" name="'+o+'"'+(c?' checked="checked"':"")+"/>",v=document.createElement("div");return v.innerHTML=p,v.firstChild},_addItem:function(o){var c=document.createElement("label"),p=this._map.hasLayer(o.layer),v;o.overlay?(v=document.createElement("input"),v.type="checkbox",v.className="leaflet-control-layers-selector",v.defaultChecked=p):v=this._createRadioElement("leaflet-base-layers_"+m(this),p),this._layerControlInputs.push(v),v.layerId=m(o.layer),Mt(v,"click",this._onInputClick,this);var k=document.createElement("span");k.innerHTML=" "+o.name;var P=document.createElement("span");c.appendChild(P),P.appendChild(v),P.appendChild(k);var V=o.overlay?this._overlaysList:this._baseLayersList;return V.appendChild(c),this._checkDisabledLayers(),c},_onInputClick:function(){if(!this._preventClick){var o=this._layerControlInputs,c,p,v=[],k=[];this._handlingClick=!0;for(var P=o.length-1;P>=0;P--)c=o[P],p=this._getLayer(c.layerId).layer,c.checked?v.push(p):c.checked||k.push(p);for(P=0;P<k.length;P++)this._map.hasLayer(k[P])&&this._map.removeLayer(k[P]);for(P=0;P<v.length;P++)this._map.hasLayer(v[P])||this._map.addLayer(v[P]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var o=this._layerControlInputs,c,p,v=this._map.getZoom(),k=o.length-1;k>=0;k--)c=o[k],p=this._getLayer(c.layerId).layer,c.disabled=p.options.minZoom!==void 0&&v<p.options.minZoom||p.options.maxZoom!==void 0&&v>p.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var o=this._section;this._preventClick=!0,Mt(o,"click",re),this.expand();var c=this;setTimeout(function(){Xt(o,"click",re),c._preventClick=!1})}}),dl=function(o,c,p){return new Hi(o,c,p)},Ii=He.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(o){var c="leaflet-control-zoom",p=Bt("div",c+" leaflet-bar"),v=this.options;return this._zoomInButton=this._createButton(v.zoomInText,v.zoomInTitle,c+"-in",p,this._zoomIn),this._zoomOutButton=this._createButton(v.zoomOutText,v.zoomOutTitle,c+"-out",p,this._zoomOut),this._updateDisabled(),o.on("zoomend zoomlevelschange",this._updateDisabled,this),p},onRemove:function(o){o.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(o){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(o.shiftKey?3:1))},_zoomOut:function(o){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(o.shiftKey?3:1))},_createButton:function(o,c,p,v,k){var P=Bt("a",p,v);return P.innerHTML=o,P.href="#",P.title=c,P.setAttribute("role","button"),P.setAttribute("aria-label",c),hn(P),Mt(P,"click",Ti),Mt(P,"click",k,this),Mt(P,"click",this._refocusOnMap,this),P},_updateDisabled:function(){var o=this._map,c="leaflet-disabled";Ht(this._zoomInButton,c),Ht(this._zoomOutButton,c),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||o._zoom===o.getMinZoom())&&(Ct(this._zoomOutButton,c),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||o._zoom===o.getMaxZoom())&&(Ct(this._zoomInButton,c),this._zoomInButton.setAttribute("aria-disabled","true"))}});At.mergeOptions({zoomControl:!0}),At.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ii,this.addControl(this.zoomControl))});var Ps=function(o){return new Ii(o)},Yi=He.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(o){var c="leaflet-control-scale",p=Bt("div",c),v=this.options;return this._addScales(v,c+"-line",p),o.on(v.updateWhenIdle?"moveend":"move",this._update,this),o.whenReady(this._update,this),p},onRemove:function(o){o.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(o,c,p){o.metric&&(this._mScale=Bt("div",c,p)),o.imperial&&(this._iScale=Bt("div",c,p))},_update:function(){var o=this._map,c=o.getSize().y/2,p=o.distance(o.containerPointToLatLng([0,c]),o.containerPointToLatLng([this.options.maxWidth,c]));this._updateScales(p)},_updateScales:function(o){this.options.metric&&o&&this._updateMetric(o),this.options.imperial&&o&&this._updateImperial(o)},_updateMetric:function(o){var c=this._getRoundNum(o),p=c<1e3?c+" m":c/1e3+" km";this._updateScale(this._mScale,p,c/o)},_updateImperial:function(o){var c=o*3.2808399,p,v,k;c>5280?(p=c/5280,v=this._getRoundNum(p),this._updateScale(this._iScale,v+" mi",v/p)):(k=this._getRoundNum(c),this._updateScale(this._iScale,k+" ft",k/c))},_updateScale:function(o,c,p){o.style.width=Math.round(this.options.maxWidth*p)+"px",o.innerHTML=c},_getRoundNum:function(o){var c=Math.pow(10,(Math.floor(o)+"").length-1),p=o/c;return p=p>=10?10:p>=5?5:p>=3?3:p>=2?2:1,c*p}}),gl=function(o){return new Yi(o)},oi='<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>',br=He.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(xt.inlineSvg?oi+" ":"")+"Leaflet</a>"},initialize:function(o){S(this,o),this._attributions={}},onAdd:function(o){o.attributionControl=this,this._container=Bt("div","leaflet-control-attribution"),hn(this._container);for(var c in o._layers)o._layers[c].getAttribution&&this.addAttribution(o._layers[c].getAttribution());return this._update(),o.on("layeradd",this._addAttribution,this),this._container},onRemove:function(o){o.off("layeradd",this._addAttribution,this)},_addAttribution:function(o){o.layer.getAttribution&&(this.addAttribution(o.layer.getAttribution()),o.layer.once("remove",function(){this.removeAttribution(o.layer.getAttribution())},this))},setPrefix:function(o){return this.options.prefix=o,this._update(),this},addAttribution:function(o){return o?(this._attributions[o]||(this._attributions[o]=0),this._attributions[o]++,this._update(),this):this},removeAttribution:function(o){return o?(this._attributions[o]&&(this._attributions[o]--,this._update()),this):this},_update:function(){if(this._map){var o=[];for(var c in this._attributions)this._attributions[c]&&o.push(c);var p=[];this.options.prefix&&p.push(this.options.prefix),o.length&&p.push(o.join(", ")),this._container.innerHTML=p.join(' <span aria-hidden="true">|</span> ')}}});At.mergeOptions({attributionControl:!0}),At.addInitHook(function(){this.options.attributionControl&&new br().addTo(this)});var pl=function(o){return new br(o)};He.Layers=Hi,He.Zoom=Ii,He.Scale=Yi,He.Attribution=br,_e.layers=dl,_e.zoom=Ps,_e.scale=gl,_e.attribution=pl;var si=W.extend({initialize:function(o){this._map=o},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}});si.addTo=function(o,c){return o.addHandler(c,this),this};var ml={Events:Y},Ns=xt.touch?"touchstart mousedown":"mousedown",Ci=$.extend({options:{clickTolerance:3},initialize:function(o,c,p,v){S(this,v),this._element=o,this._dragStartTarget=c||o,this._preventOutline=p},enable:function(){this._enabled||(Mt(this._dragStartTarget,Ns,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ci._dragging===this&&this.finishDrag(!0),Xt(this._dragStartTarget,Ns,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(o){if(this._enabled&&(this._moved=!1,!gr(this._element,"leaflet-zoom-anim"))){if(o.touches&&o.touches.length!==1){Ci._dragging===this&&this.finishDrag();return}if(!(Ci._dragging||o.shiftKey||o.which!==1&&o.button!==1&&!o.touches)&&(Ci._dragging=this,this._preventOutline&&mo(this._element),po(),gi(),!this._moving)){this.fire("down");var c=o.touches?o.touches[0]:o,p=Ae(this._element);this._startPoint=new J(c.clientX,c.clientY),this._startPos=Ei(this._element),this._parentScale=Ie(p);var v=o.type==="mousedown";Mt(document,v?"mousemove":"touchmove",this._onMove,this),Mt(document,v?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(o){if(this._enabled){if(o.touches&&o.touches.length>1){this._moved=!0;return}var c=o.touches&&o.touches.length===1?o.touches[0]:o,p=new J(c.clientX,c.clientY)._subtract(this._startPoint);!p.x&&!p.y||Math.abs(p.x)+Math.abs(p.y)<this.options.clickTolerance||(p.x/=this._parentScale.x,p.y/=this._parentScale.y,re(o),this._moved||(this.fire("dragstart"),this._moved=!0,Ct(document.body,"leaflet-dragging"),this._lastTarget=o.target||o.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Ct(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(p),this._moving=!0,this._lastEvent=o,this._updatePosition())}},_updatePosition:function(){var o={originalEvent:this._lastEvent};this.fire("predrag",o),ae(this._element,this._newPos),this.fire("drag",o)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(o){Ht(document.body,"leaflet-dragging"),this._lastTarget&&(Ht(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Xt(document,"mousemove touchmove",this._onMove,this),Xt(document,"mouseup touchend touchcancel",this._onUp,this),Cn(),an();var c=this._moved&&this._moving;this._moving=!1,Ci._dragging=!1,c&&this.fire("dragend",{noInertia:o,distance:this._newPos.distanceTo(this._startPos)})}});function Os(o,c,p){var v,k=[1,4,2,8],P,V,nt,st,ut,yt,It,Rt;for(P=0,yt=o.length;P<yt;P++)o[P]._code=he(o[P],c);for(nt=0;nt<4;nt++){for(It=k[nt],v=[],P=0,yt=o.length,V=yt-1;P<yt;V=P++)st=o[P],ut=o[V],st._code&It?ut._code&It||(Rt=An(ut,st,It,c,p),Rt._code=he(Rt,c),v.push(Rt)):(ut._code&It&&(Rt=An(ut,st,It,c,p),Rt._code=he(Rt,c),v.push(Rt)),v.push(st));o=v}return o}function Rs(o,c){var p,v,k,P,V,nt,st,ut,yt;if(!o||o.length===0)throw new Error("latlngs not passed");Ne(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var It=vt([0,0]),Rt=dt(o),Oe=Rt.getNorthWest().distanceTo(Rt.getSouthWest())*Rt.getNorthEast().distanceTo(Rt.getNorthWest());Oe<1700&&(It=mi(o));var ve=o.length,hi=[];for(p=0;p<ve;p++){var Fe=vt(o[p]);hi.push(c.project(vt([Fe.lat-It.lat,Fe.lng-It.lng])))}for(nt=st=ut=0,p=0,v=ve-1;p<ve;v=p++)k=hi[p],P=hi[v],V=k.y*P.x-P.y*k.x,st+=(k.x+P.x)*V,ut+=(k.y+P.y)*V,nt+=V*3;nt===0?yt=hi[0]:yt=[st/nt,ut/nt];var Cr=c.unproject(rt(yt));return vt([Cr.lat+It.lat,Cr.lng+It.lng])}function mi(o){for(var c=0,p=0,v=0,k=0;k<o.length;k++){var P=vt(o[k]);c+=P.lat,p+=P.lng,v++}return vt([c/v,p/v])}var Pe={__proto__:null,clipPolygon:Os,polygonCenter:Rs,centroid:mi};function Ds(o,c){if(!c||!o.length)return o.slice();var p=c*c;return o=Lo(o,p),o=ko(o,p),o}function wo(o,c,p){return Math.sqrt(Nn(o,c,p,!0))}function yl(o,c,p){return Nn(o,c,p)}function ko(o,c){var p=o.length,v=typeof Uint8Array!="undefined"?Uint8Array:Array,k=new v(p);k[0]=k[p-1]=1,xr(o,k,c,0,p-1);var P,V=[];for(P=0;P<p;P++)k[P]&&V.push(o[P]);return V}function xr(o,c,p,v,k){var P=0,V,nt,st;for(nt=v+1;nt<=k-1;nt++)st=Nn(o[nt],o[v],o[k],!0),st>P&&(V=nt,P=st);P>p&&(c[V]=1,xr(o,c,p,v,V),xr(o,c,p,V,k))}function Lo(o,c){for(var p=[o[0]],v=1,k=0,P=o.length;v<P;v++)Pn(o[v],o[k])>c&&(p.push(o[v]),k=v);return k<P-1&&p.push(o[P-1]),p}var Eo;function ze(o,c,p,v,k){var P=v?Eo:he(o,p),V=he(c,p),nt,st,ut;for(Eo=V;;){if(!(P|V))return[o,c];if(P&V)return!1;nt=P||V,st=An(o,c,nt,p,k),ut=he(st,p),nt===P?(o=st,P=ut):(c=st,V=ut)}}function An(o,c,p,v,k){var P=c.x-o.x,V=c.y-o.y,nt=v.min,st=v.max,ut,yt;return p&8?(ut=o.x+P*(st.y-o.y)/V,yt=st.y):p&4?(ut=o.x+P*(nt.y-o.y)/V,yt=nt.y):p&2?(ut=st.x,yt=o.y+V*(st.x-o.x)/P):p&1&&(ut=nt.x,yt=o.y+V*(nt.x-o.x)/P),new J(ut,yt,k)}function he(o,c){var p=0;return o.x<c.min.x?p|=1:o.x>c.max.x&&(p|=2),o.y<c.min.y?p|=4:o.y>c.max.y&&(p|=8),p}function Pn(o,c){var p=c.x-o.x,v=c.y-o.y;return p*p+v*v}function Nn(o,c,p,v){var k=c.x,P=c.y,V=p.x-k,nt=p.y-P,st=V*V+nt*nt,ut;return st>0&&(ut=((o.x-k)*V+(o.y-P)*nt)/st,ut>1?(k=p.x,P=p.y):ut>0&&(k+=V*ut,P+=nt*ut)),V=o.x-k,nt=o.y-P,v?V*V+nt*nt:new J(k,P)}function Ne(o){return!q(o[0])||typeof o[0][0]!="object"&&typeof o[0][0]!="undefined"}function To(o){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ne(o)}function Io(o,c){var p,v,k,P,V,nt,st,ut;if(!o||o.length===0)throw new Error("latlngs not passed");Ne(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var yt=vt([0,0]),It=dt(o),Rt=It.getNorthWest().distanceTo(It.getSouthWest())*It.getNorthEast().distanceTo(It.getNorthWest());Rt<1700&&(yt=mi(o));var Oe=o.length,ve=[];for(p=0;p<Oe;p++){var hi=vt(o[p]);ve.push(c.project(vt([hi.lat-yt.lat,hi.lng-yt.lng])))}for(p=0,v=0;p<Oe-1;p++)v+=ve[p].distanceTo(ve[p+1])/2;if(v===0)ut=ve[0];else for(p=0,P=0;p<Oe-1;p++)if(V=ve[p],nt=ve[p+1],k=V.distanceTo(nt),P+=k,P>v){st=(P-v)/k,ut=[nt.x-st*(nt.x-V.x),nt.y-st*(nt.y-V.y)];break}var Fe=c.unproject(rt(ut));return vt([Fe.lat+yt.lat,Fe.lng+yt.lng])}var Co={__proto__:null,simplify:Ds,pointToSegmentDistance:wo,closestPointOnSegment:yl,clipSegment:ze,_getEdgeIntersection:An,_getBitCode:he,_sqClosestPointOnSegment:Nn,isFlat:Ne,_flat:To,polylineCenter:Io},So={project:function(o){return new J(o.lng,o.lat)},unproject:function(o){return new pt(o.y,o.x)},bounds:new ht([-180,-90],[180,90])},Mo={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ht([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(o){var c=Math.PI/180,p=this.R,v=o.lat*c,k=this.R_MINOR/p,P=Math.sqrt(1-k*k),V=P*Math.sin(v),nt=Math.tan(Math.PI/4-v/2)/Math.pow((1-V)/(1+V),P/2);return v=-p*Math.log(Math.max(nt,1e-10)),new J(o.lng*c*p,v)},unproject:function(o){for(var c=180/Math.PI,p=this.R,v=this.R_MINOR/p,k=Math.sqrt(1-v*v),P=Math.exp(-o.y/p),V=Math.PI/2-2*Math.atan(P),nt=0,st=.1,ut;nt<15&&Math.abs(st)>1e-7;nt++)ut=k*Math.sin(V),ut=Math.pow((1-ut)/(1+ut),k/2),st=Math.PI/2-2*Math.atan(P*ut)-V,V+=st;return new pt(V*c,o.x*c/p)}},_l={__proto__:null,LonLat:So,Mercator:Mo,SphericalMercator:qt},vl=r({},tt,{code:"EPSG:3395",projection:Mo,transformation:(function(){var o=.5/(Math.PI*Mo.R);return U(o,.5,-o,.5)})()}),Bs=r({},tt,{code:"EPSG:4326",projection:So,transformation:U(1/180,1,-1/180,.5)}),bl=r({},Yt,{projection:So,transformation:U(1,0,-1,0),scale:function(o){return Math.pow(2,o)},zoom:function(o){return Math.log(o)/Math.LN2},distance:function(o,c){var p=c.lng-o.lng,v=c.lat-o.lat;return Math.sqrt(p*p+v*v)},infinite:!0});Yt.Earth=tt,Yt.EPSG3395=vl,Yt.EPSG3857=Wt,Yt.EPSG900913=oe,Yt.EPSG4326=Bs,Yt.Simple=bl;var Ye=$.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(o){return o.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(o){return o&&o.removeLayer(this),this},getPane:function(o){return this._map.getPane(o?this.options[o]||o:this.options.pane)},addInteractiveTarget:function(o){return this._map._targets[m(o)]=this,this},removeInteractiveTarget:function(o){return delete this._map._targets[m(o)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(o){var c=o.target;if(c.hasLayer(this)){if(this._map=c,this._zoomAnimated=c._zoomAnimated,this.getEvents){var p=this.getEvents();c.on(p,this),this.once("remove",function(){c.off(p,this)},this)}this.onAdd(c),this.fire("add"),c.fire("layeradd",{layer:this})}}});At.include({addLayer:function(o){if(!o._layerAdd)throw new Error("The provided object is not a Layer.");var c=m(o);return this._layers[c]?this:(this._layers[c]=o,o._mapToAdd=this,o.beforeAdd&&o.beforeAdd(this),this.whenReady(o._layerAdd,o),this)},removeLayer:function(o){var c=m(o);return this._layers[c]?(this._loaded&&o.onRemove(this),delete this._layers[c],this._loaded&&(this.fire("layerremove",{layer:o}),o.fire("remove")),o._map=o._mapToAdd=null,this):this},hasLayer:function(o){return m(o)in this._layers},eachLayer:function(o,c){for(var p in this._layers)o.call(c,this._layers[p]);return this},_addLayers:function(o){o=o?q(o)?o:[o]:[];for(var c=0,p=o.length;c<p;c++)this.addLayer(o[c])},_addZoomLimit:function(o){(!isNaN(o.options.maxZoom)||!isNaN(o.options.minZoom))&&(this._zoomBoundLayers[m(o)]=o,this._updateZoomLevels())},_removeZoomLimit:function(o){var c=m(o);this._zoomBoundLayers[c]&&(delete this._zoomBoundLayers[c],this._updateZoomLevels())},_updateZoomLevels:function(){var o=1/0,c=-1/0,p=this._getZoomSpan();for(var v in this._zoomBoundLayers){var k=this._zoomBoundLayers[v].options;o=k.minZoom===void 0?o:Math.min(o,k.minZoom),c=k.maxZoom===void 0?c:Math.max(c,k.maxZoom)}this._layersMaxZoom=c===-1/0?void 0:c,this._layersMinZoom=o===1/0?void 0:o,p!==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 cn=Ye.extend({initialize:function(o,c){S(this,c),this._layers={};var p,v;if(o)for(p=0,v=o.length;p<v;p++)this.addLayer(o[p])},addLayer:function(o){var c=this.getLayerId(o);return this._layers[c]=o,this._map&&this._map.addLayer(o),this},removeLayer:function(o){var c=o in this._layers?o:this.getLayerId(o);return this._map&&this._layers[c]&&this._map.removeLayer(this._layers[c]),delete this._layers[c],this},hasLayer:function(o){var c=typeof o=="number"?o:this.getLayerId(o);return c in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(o){var c=Array.prototype.slice.call(arguments,1),p,v;for(p in this._layers)v=this._layers[p],v[o]&&v[o].apply(v,c);return this},onAdd:function(o){this.eachLayer(o.addLayer,o)},onRemove:function(o){this.eachLayer(o.removeLayer,o)},eachLayer:function(o,c){for(var p in this._layers)o.call(c,this._layers[p]);return this},getLayer:function(o){return this._layers[o]},getLayers:function(){var o=[];return this.eachLayer(o.push,o),o},setZIndex:function(o){return this.invoke("setZIndex",o)},getLayerId:function(o){return m(o)}}),zs=function(o,c){return new cn(o,c)},yi=cn.extend({addLayer:function(o){return this.hasLayer(o)?this:(o.addEventParent(this),cn.prototype.addLayer.call(this,o),this.fire("layeradd",{layer:o}))},removeLayer:function(o){return this.hasLayer(o)?(o in this._layers&&(o=this._layers[o]),o.removeEventParent(this),cn.prototype.removeLayer.call(this,o),this.fire("layerremove",{layer:o})):this},setStyle:function(o){return this.invoke("setStyle",o)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var o=new kt;for(var c in this._layers){var p=this._layers[c];o.extend(p.getBounds?p.getBounds():p.getLatLng())}return o}}),Fs=function(o,c){return new yi(o,c)},fn=W.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(o){S(this,o)},createIcon:function(o){return this._createIcon("icon",o)},createShadow:function(o){return this._createIcon("shadow",o)},_createIcon:function(o,c){var p=this._getIconUrl(o);if(!p){if(o==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var v=this._createImg(p,c&&c.tagName==="IMG"?c:null);return this._setIconStyles(v,o),(this.options.crossOrigin||this.options.crossOrigin==="")&&(v.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),v},_setIconStyles:function(o,c){var p=this.options,v=p[c+"Size"];typeof v=="number"&&(v=[v,v]);var k=rt(v),P=rt(c==="shadow"&&p.shadowAnchor||p.iconAnchor||k&&k.divideBy(2,!0));o.className="leaflet-marker-"+c+" "+(p.className||""),P&&(o.style.marginLeft=-P.x+"px",o.style.marginTop=-P.y+"px"),k&&(o.style.width=k.x+"px",o.style.height=k.y+"px")},_createImg:function(o,c){return c=c||document.createElement("img"),c.src=o,c},_getIconUrl:function(o){return xt.retina&&this.options[o+"RetinaUrl"]||this.options[o+"Url"]}});function xl(o){return new fn(o)}var On=fn.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(o){return typeof On.imagePath!="string"&&(On.imagePath=this._detectIconPath()),(this.options.imagePath||On.imagePath)+fn.prototype._getIconUrl.call(this,o)},_stripUrl:function(o){var c=function(p,v,k){var P=v.exec(p);return P&&P[k]};return o=c(o,/^url\((['"])?(.+)\1\)$/,2),o&&c(o,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var o=Bt("div","leaflet-default-icon-path",document.body),c=ii(o,"background-image")||ii(o,"backgroundImage");if(document.body.removeChild(o),c=this._stripUrl(c),c)return c;var p=document.querySelector('link[href$="leaflet.css"]');return p?p.href.substring(0,p.href.length-11-1):""}}),Gs=si.extend({initialize:function(o){this._marker=o},addHooks:function(){var o=this._marker._icon;this._draggable||(this._draggable=new Ci(o,o,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Ct(o,"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&&Ht(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(o){var c=this._marker,p=c._map,v=this._marker.options.autoPanSpeed,k=this._marker.options.autoPanPadding,P=Ei(c._icon),V=p.getPixelBounds(),nt=p.getPixelOrigin(),st=_t(V.min._subtract(nt).add(k),V.max._subtract(nt).subtract(k));if(!st.contains(P)){var ut=rt((Math.max(st.max.x,P.x)-st.max.x)/(V.max.x-st.max.x)-(Math.min(st.min.x,P.x)-st.min.x)/(V.min.x-st.min.x),(Math.max(st.max.y,P.y)-st.max.y)/(V.max.y-st.max.y)-(Math.min(st.min.y,P.y)-st.min.y)/(V.min.y-st.min.y)).multiplyBy(v);p.panBy(ut,{animate:!1}),this._draggable._newPos._add(ut),this._draggable._startPos._add(ut),ae(c._icon,this._draggable._newPos),this._onDrag(o),this._panRequest=F(this._adjustPan.bind(this,o))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(o){this._marker.options.autoPan&&(G(this._panRequest),this._panRequest=F(this._adjustPan.bind(this,o)))},_onDrag:function(o){var c=this._marker,p=c._shadow,v=Ei(c._icon),k=c._map.layerPointToLatLng(v);p&&ae(p,v),c._latlng=k,o.latlng=k,o.oldLatLng=this._oldLatLng,c.fire("move",o).fire("drag",o)},_onDragEnd:function(o){G(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",o)}}),wr=Ye.extend({options:{icon:new On,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(o,c){S(this,c),this._latlng=vt(o)},onAdd:function(o){this._zoomAnimated=this._zoomAnimated&&o.options.markerZoomAnimation,this._zoomAnimated&&o.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(o){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&o.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(o){var c=this._latlng;return this._latlng=vt(o),this.update(),this.fire("move",{oldLatLng:c,latlng:this._latlng})},setZIndexOffset:function(o){return this.options.zIndexOffset=o,this.update()},getIcon:function(){return this.options.icon},setIcon:function(o){return this.options.icon=o,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 o=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(o)}return this},_initIcon:function(){var o=this.options,c="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),p=o.icon.createIcon(this._icon),v=!1;p!==this._icon&&(this._icon&&this._removeIcon(),v=!0,o.title&&(p.title=o.title),p.tagName==="IMG"&&(p.alt=o.alt||"")),Ct(p,c),o.keyboard&&(p.tabIndex="0",p.setAttribute("role","button")),this._icon=p,o.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Mt(p,"focus",this._panOnFocus,this);var k=o.icon.createShadow(this._shadow),P=!1;k!==this._shadow&&(this._removeShadow(),P=!0),k&&(Ct(k,c),k.alt=""),this._shadow=k,o.opacity<1&&this._updateOpacity(),v&&this.getPane().appendChild(this._icon),this._initInteraction(),k&&P&&this.getPane(o.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Xt(this._icon,"focus",this._panOnFocus,this),$t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&$t(this._shadow),this._shadow=null},_setPos:function(o){this._icon&&ae(this._icon,o),this._shadow&&ae(this._shadow,o),this._zIndex=o.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(o){this._icon&&(this._icon.style.zIndex=this._zIndex+o)},_animateZoom:function(o){var c=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center).round();this._setPos(c)},_initInteraction:function(){if(this.options.interactive&&(Ct(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Gs)){var o=this.options.draggable;this.dragging&&(o=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Gs(this),o&&this.dragging.enable()}},setOpacity:function(o){return this.options.opacity=o,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var o=this.options.opacity;this._icon&&fe(this._icon,o),this._shadow&&fe(this._shadow,o)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var o=this._map;if(o){var c=this.options.icon.options,p=c.iconSize?rt(c.iconSize):rt(0,0),v=c.iconAnchor?rt(c.iconAnchor):rt(0,0);o.panInside(this._latlng,{paddingTopLeft:v,paddingBottomRight:p.subtract(v)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function wl(o,c){return new wr(o,c)}var Si=Ye.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(o){this._renderer=o.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(o){return S(this,o),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&o&&Object.prototype.hasOwnProperty.call(o,"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)}}),Rn=Si.extend({options:{fill:!0,radius:10},initialize:function(o,c){S(this,c),this._latlng=vt(o),this._radius=this.options.radius},setLatLng:function(o){var c=this._latlng;return this._latlng=vt(o),this.redraw(),this.fire("move",{oldLatLng:c,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(o){return this.options.radius=this._radius=o,this.redraw()},getRadius:function(){return this._radius},setStyle:function(o){var c=o&&o.radius||this._radius;return Si.prototype.setStyle.call(this,o),this.setRadius(c),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var o=this._radius,c=this._radiusY||o,p=this._clickTolerance(),v=[o+p,c+p];this._pxBounds=new ht(this._point.subtract(v),this._point.add(v))},_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(o){return o.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Us(o,c){return new Rn(o,c)}var kr=Rn.extend({initialize:function(o,c,p){if(typeof c=="number"&&(c=r({},p,{radius:c})),S(this,c),this._latlng=vt(o),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(o){return this._mRadius=o,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var o=[this._radius,this._radiusY||this._radius];return new kt(this._map.layerPointToLatLng(this._point.subtract(o)),this._map.layerPointToLatLng(this._point.add(o)))},setStyle:Si.prototype.setStyle,_project:function(){var o=this._latlng.lng,c=this._latlng.lat,p=this._map,v=p.options.crs;if(v.distance===tt.distance){var k=Math.PI/180,P=this._mRadius/tt.R/k,V=p.project([c+P,o]),nt=p.project([c-P,o]),st=V.add(nt).divideBy(2),ut=p.unproject(st).lat,yt=Math.acos((Math.cos(P*k)-Math.sin(c*k)*Math.sin(ut*k))/(Math.cos(c*k)*Math.cos(ut*k)))/k;(isNaN(yt)||yt===0)&&(yt=P/Math.cos(Math.PI/180*c)),this._point=st.subtract(p.getPixelOrigin()),this._radius=isNaN(yt)?0:st.x-p.project([ut,o-yt]).x,this._radiusY=st.y-V.y}else{var It=v.unproject(v.project(this._latlng).subtract([this._mRadius,0]));this._point=p.latLngToLayerPoint(this._latlng),this._radius=this._point.x-p.latLngToLayerPoint(It).x}this._updateBounds()}});function kl(o,c,p){return new kr(o,c,p)}var ai=Si.extend({options:{smoothFactor:1,noClip:!1},initialize:function(o,c){S(this,c),this._setLatLngs(o)},getLatLngs:function(){return this._latlngs},setLatLngs:function(o){return this._setLatLngs(o),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(o){for(var c=1/0,p=null,v=Nn,k,P,V=0,nt=this._parts.length;V<nt;V++)for(var st=this._parts[V],ut=1,yt=st.length;ut<yt;ut++){k=st[ut-1],P=st[ut];var It=v(o,k,P,!0);It<c&&(c=It,p=v(o,k,P))}return p&&(p.distance=Math.sqrt(c)),p},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Io(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(o,c){return c=c||this._defaultShape(),o=vt(o),c.push(o),this._bounds.extend(o),this.redraw()},_setLatLngs:function(o){this._bounds=new kt,this._latlngs=this._convertLatLngs(o)},_defaultShape:function(){return Ne(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(o){for(var c=[],p=Ne(o),v=0,k=o.length;v<k;v++)p?(c[v]=vt(o[v]),this._bounds.extend(c[v])):c[v]=this._convertLatLngs(o[v]);return c},_project:function(){var o=new ht;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,o),this._bounds.isValid()&&o.isValid()&&(this._rawPxBounds=o,this._updateBounds())},_updateBounds:function(){var o=this._clickTolerance(),c=new J(o,o);this._rawPxBounds&&(this._pxBounds=new ht([this._rawPxBounds.min.subtract(c),this._rawPxBounds.max.add(c)]))},_projectLatlngs:function(o,c,p){var v=o[0]instanceof pt,k=o.length,P,V;if(v){for(V=[],P=0;P<k;P++)V[P]=this._map.latLngToLayerPoint(o[P]),p.extend(V[P]);c.push(V)}else for(P=0;P<k;P++)this._projectLatlngs(o[P],c,p)},_clipPoints:function(){var o=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}var c=this._parts,p,v,k,P,V,nt,st;for(p=0,k=0,P=this._rings.length;p<P;p++)for(st=this._rings[p],v=0,V=st.length;v<V-1;v++)nt=ze(st[v],st[v+1],o,v,!0),nt&&(c[k]=c[k]||[],c[k].push(nt[0]),(nt[1]!==st[v+1]||v===V-2)&&(c[k].push(nt[1]),k++))}},_simplifyPoints:function(){for(var o=this._parts,c=this.options.smoothFactor,p=0,v=o.length;p<v;p++)o[p]=Ds(o[p],c)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(o,c){var p,v,k,P,V,nt,st=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(p=0,P=this._parts.length;p<P;p++)for(nt=this._parts[p],v=0,V=nt.length,k=V-1;v<V;k=v++)if(!(!c&&v===0)&&wo(o,nt[k],nt[v])<=st)return!0;return!1}});function Ao(o,c){return new ai(o,c)}ai._flat=To;var dn=ai.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 Rs(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(o){var c=ai.prototype._convertLatLngs.call(this,o),p=c.length;return p>=2&&c[0]instanceof pt&&c[0].equals(c[p-1])&&c.pop(),c},_setLatLngs:function(o){ai.prototype._setLatLngs.call(this,o),Ne(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ne(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var o=this._renderer._bounds,c=this.options.weight,p=new J(c,c);if(o=new ht(o.min.subtract(p),o.max.add(p)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}for(var v=0,k=this._rings.length,P;v<k;v++)P=Os(this._rings[v],o,!0),P.length&&this._parts.push(P)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(o){var c=!1,p,v,k,P,V,nt,st,ut;if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(P=0,st=this._parts.length;P<st;P++)for(p=this._parts[P],V=0,ut=p.length,nt=ut-1;V<ut;nt=V++)v=p[V],k=p[nt],v.y>o.y!=k.y>o.y&&o.x<(k.x-v.x)*(o.y-v.y)/(k.y-v.y)+v.x&&(c=!c);return c||ai.prototype._containsPoint.call(this,o,!0)}});function qs(o,c){return new dn(o,c)}var li=yi.extend({initialize:function(o,c){S(this,c),this._layers={},o&&this.addData(o)},addData:function(o){var c=q(o)?o:o.features,p,v,k;if(c){for(p=0,v=c.length;p<v;p++)k=c[p],(k.geometries||k.geometry||k.features||k.coordinates)&&this.addData(k);return this}var P=this.options;if(P.filter&&!P.filter(o))return this;var V=Lr(o,P);return V?(V.feature=u(o),V.defaultOptions=V.options,this.resetStyle(V),P.onEachFeature&&P.onEachFeature(o,V),this.addLayer(V)):this},resetStyle:function(o){return o===void 0?this.eachLayer(this.resetStyle,this):(o.options=r({},o.defaultOptions),this._setLayerStyle(o,this.options.style),this)},setStyle:function(o){return this.eachLayer(function(c){this._setLayerStyle(c,o)},this)},_setLayerStyle:function(o,c){o.setStyle&&(typeof c=="function"&&(c=c(o.feature)),o.setStyle(c))}});function Lr(o,c){var p=o.type==="Feature"?o.geometry:o,v=p?p.coordinates:null,k=[],P=c&&c.pointToLayer,V=c&&c.coordsToLatLng||Mi,nt,st,ut,yt;if(!v&&!p)return null;switch(p.type){case"Point":return nt=V(v),Zs(P,o,nt,c);case"MultiPoint":for(ut=0,yt=v.length;ut<yt;ut++)nt=V(v[ut]),k.push(Zs(P,o,nt,c));return new yi(k);case"LineString":case"MultiLineString":return st=Er(v,p.type==="LineString"?0:1,V),new ai(st,c);case"Polygon":case"MultiPolygon":return st=Er(v,p.type==="Polygon"?1:2,V),new dn(st,c);case"GeometryCollection":for(ut=0,yt=p.geometries.length;ut<yt;ut++){var It=Lr({geometry:p.geometries[ut],type:"Feature",properties:o.properties},c);It&&k.push(It)}return new yi(k);case"FeatureCollection":for(ut=0,yt=p.features.length;ut<yt;ut++){var Rt=Lr(p.features[ut],c);Rt&&k.push(Rt)}return new yi(k);default:throw new Error("Invalid GeoJSON object.")}}function Zs(o,c,p,v){return o?o(c,p):new wr(p,v&&v.markersInheritOptions&&v)}function Mi(o){return new pt(o[1],o[0],o[2])}function Er(o,c,p){for(var v=[],k=0,P=o.length,V;k<P;k++)V=c?Er(o[k],c-1,p):(p||Mi)(o[k]),v.push(V);return v}function Tr(o,c){return o=vt(o),o.alt!==void 0?[E(o.lng,c),E(o.lat,c),E(o.alt,c)]:[E(o.lng,c),E(o.lat,c)]}function ke(o,c,p,v){for(var k=[],P=0,V=o.length;P<V;P++)k.push(c?ke(o[P],Ne(o[P])?0:c-1,p,v):Tr(o[P],v));return!c&&p&&k.length>0&&k.push(k[0].slice()),k}function Le(o,c){return o.feature?r({},o.feature,{geometry:c}):u(c)}function u(o){return o.type==="Feature"||o.type==="FeatureCollection"?o:{type:"Feature",properties:{},geometry:o}}var t={toGeoJSON:function(o){return Le(this,{type:"Point",coordinates:Tr(this.getLatLng(),o)})}};wr.include(t),kr.include(t),Rn.include(t),ai.include({toGeoJSON:function(o){var c=!Ne(this._latlngs),p=ke(this._latlngs,c?1:0,!1,o);return Le(this,{type:(c?"Multi":"")+"LineString",coordinates:p})}}),dn.include({toGeoJSON:function(o){var c=!Ne(this._latlngs),p=c&&!Ne(this._latlngs[0]),v=ke(this._latlngs,p?2:c?1:0,!0,o);return c||(v=[v]),Le(this,{type:(p?"Multi":"")+"Polygon",coordinates:v})}}),cn.include({toMultiPoint:function(o){var c=[];return this.eachLayer(function(p){c.push(p.toGeoJSON(o).geometry.coordinates)}),Le(this,{type:"MultiPoint",coordinates:c})},toGeoJSON:function(o){var c=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(c==="MultiPoint")return this.toMultiPoint(o);var p=c==="GeometryCollection",v=[];return this.eachLayer(function(k){if(k.toGeoJSON){var P=k.toGeoJSON(o);if(p)v.push(P.geometry);else{var V=u(P);V.type==="FeatureCollection"?v.push.apply(v,V.features):v.push(V)}}}),p?Le(this,{geometries:v,type:"GeometryCollection"}):{type:"FeatureCollection",features:v}}});function e(o,c){return new li(o,c)}var l=e,g=Ye.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(o,c,p){this._url=o,this._bounds=dt(c),S(this,p)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Ct(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){$t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(o){return this.options.opacity=o,this._image&&this._updateOpacity(),this},setStyle:function(o){return o.opacity&&this.setOpacity(o.opacity),this},bringToFront:function(){return this._map&&sn(this._image),this},bringToBack:function(){return this._map&&qi(this._image),this},setUrl:function(o){return this._url=o,this._image&&(this._image.src=o),this},setBounds:function(o){return this._bounds=dt(o),this._map&&this._reset(),this},getEvents:function(){var o={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var o=this._url.tagName==="IMG",c=this._image=o?this._url:Bt("img");if(Ct(c,"leaflet-image-layer"),this._zoomAnimated&&Ct(c,"leaflet-zoom-animated"),this.options.className&&Ct(c,this.options.className),c.onselectstart=b,c.onmousemove=b,c.onload=f(this.fire,this,"load"),c.onerror=f(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(c.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),o){this._url=c.src;return}c.src=this._url,c.alt=this.options.alt},_animateZoom:function(o){var c=this._map.getZoomScale(o.zoom),p=this._map._latLngBoundsToNewLayerBounds(this._bounds,o.zoom,o.center).min;Zi(this._image,p,c)},_reset:function(){var o=this._image,c=new ht(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),p=c.getSize();ae(o,c.min),o.style.width=p.x+"px",o.style.height=p.y+"px"},_updateOpacity:function(){fe(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 o=this.options.errorOverlayUrl;o&&this._url!==o&&(this._url=o,this._image.src=o)},getCenter:function(){return this._bounds.getCenter()}}),y=function(o,c,p){return new g(o,c,p)},w=g.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var o=this._url.tagName==="VIDEO",c=this._image=o?this._url:Bt("video");if(Ct(c,"leaflet-image-layer"),this._zoomAnimated&&Ct(c,"leaflet-zoom-animated"),this.options.className&&Ct(c,this.options.className),c.onselectstart=b,c.onmousemove=b,c.onloadeddata=f(this.fire,this,"load"),o){for(var p=c.getElementsByTagName("source"),v=[],k=0;k<p.length;k++)v.push(p[k].src);this._url=p.length>0?v:[c.src];return}q(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(c.style,"objectFit")&&(c.style.objectFit="fill"),c.autoplay=!!this.options.autoplay,c.loop=!!this.options.loop,c.muted=!!this.options.muted,c.playsInline=!!this.options.playsInline;for(var P=0;P<this._url.length;P++){var V=Bt("source");V.src=this._url[P],c.appendChild(V)}}});function T(o,c,p){return new w(o,c,p)}var A=g.extend({_initImage:function(){var o=this._image=this._url;Ct(o,"leaflet-image-layer"),this._zoomAnimated&&Ct(o,"leaflet-zoom-animated"),this.options.className&&Ct(o,this.options.className),o.onselectstart=b,o.onmousemove=b}});function B(o,c,p){return new A(o,c,p)}var K=Ye.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(o,c){o&&(o instanceof pt||q(o))?(this._latlng=vt(o),S(this,c)):(S(this,o),this._source=c),this.options.content&&(this._content=this.options.content)},openOn:function(o){return o=arguments.length?o:this._source._map,o.hasLayer(this)||o.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(o){return this._map?this.close():(arguments.length?this._source=o:o=this._source,this._prepareOpen(),this.openOn(o._map)),this},onAdd:function(o){this._zoomAnimated=o._zoomAnimated,this._container||this._initLayout(),o._fadeAnimated&&fe(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),o._fadeAnimated&&fe(this._container,1),this.bringToFront(),this.options.interactive&&(Ct(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(o){o._fadeAnimated?(fe(this._container,0),this._removeTimeout=setTimeout(f($t,void 0,this._container),200)):$t(this._container),this.options.interactive&&(Ht(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(o){return this._latlng=vt(o),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(o){return this._content=o,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 o={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&sn(this._container),this},bringToBack:function(){return this._map&&qi(this._container),this},_prepareOpen:function(o){var c=this._source;if(!c._map)return!1;if(c instanceof yi){c=null;var p=this._source._layers;for(var v in p)if(p[v]._map){c=p[v];break}if(!c)return!1;this._source=c}if(!o)if(c.getCenter)o=c.getCenter();else if(c.getLatLng)o=c.getLatLng();else if(c.getBounds)o=c.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(o),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var o=this._contentNode,c=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof c=="string")o.innerHTML=c;else{for(;o.hasChildNodes();)o.removeChild(o.firstChild);o.appendChild(c)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var o=this._map.latLngToLayerPoint(this._latlng),c=rt(this.options.offset),p=this._getAnchor();this._zoomAnimated?ae(this._container,o.add(p)):c=c.add(o).add(p);var v=this._containerBottom=-c.y,k=this._containerLeft=-Math.round(this._containerWidth/2)+c.x;this._container.style.bottom=v+"px",this._container.style.left=k+"px"}},_getAnchor:function(){return[0,0]}});At.include({_initOverlay:function(o,c,p,v){var k=c;return k instanceof o||(k=new o(v).setContent(c)),p&&k.setLatLng(p),k}}),Ye.include({_initOverlay:function(o,c,p,v){var k=p;return k instanceof o?(S(k,v),k._source=this):(k=c&&!v?c:new o(v,this),k.setContent(p)),k}});var it=K.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(o){return o=arguments.length?o:this._source._map,!o.hasLayer(this)&&o._popup&&o._popup.options.autoClose&&o.removeLayer(o._popup),o._popup=this,K.prototype.openOn.call(this,o)},onAdd:function(o){K.prototype.onAdd.call(this,o),o.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Si||this._source.on("preclick",me))},onRemove:function(o){K.prototype.onRemove.call(this,o),o.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Si||this._source.off("preclick",me))},getEvents:function(){var o=K.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(o.preclick=this.close),this.options.keepInView&&(o.moveend=this._adjustPan),o},_initLayout:function(){var o="leaflet-popup",c=this._container=Bt("div",o+" "+(this.options.className||"")+" leaflet-zoom-animated"),p=this._wrapper=Bt("div",o+"-content-wrapper",c);if(this._contentNode=Bt("div",o+"-content",p),hn(c),Mn(this._contentNode),Mt(c,"contextmenu",me),this._tipContainer=Bt("div",o+"-tip-container",c),this._tip=Bt("div",o+"-tip",this._tipContainer),this.options.closeButton){var v=this._closeButton=Bt("a",o+"-close-button",c);v.setAttribute("role","button"),v.setAttribute("aria-label","Close popup"),v.href="#close",v.innerHTML='<span aria-hidden="true">×</span>',Mt(v,"click",function(k){re(k),this.close()},this)}},_updateLayout:function(){var o=this._contentNode,c=o.style;c.width="",c.whiteSpace="nowrap";var p=o.offsetWidth;p=Math.min(p,this.options.maxWidth),p=Math.max(p,this.options.minWidth),c.width=p+1+"px",c.whiteSpace="",c.height="";var v=o.offsetHeight,k=this.options.maxHeight,P="leaflet-popup-scrolled";k&&v>k?(c.height=k+"px",Ct(o,P)):Ht(o,P),this._containerWidth=this._container.offsetWidth},_animateZoom:function(o){var c=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center),p=this._getAnchor();ae(this._container,c.add(p))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var o=this._map,c=parseInt(ii(this._container,"marginBottom"),10)||0,p=this._container.offsetHeight+c,v=this._containerWidth,k=new J(this._containerLeft,-p-this._containerBottom);k._add(Ei(this._container));var P=o.layerPointToContainerPoint(k),V=rt(this.options.autoPanPadding),nt=rt(this.options.autoPanPaddingTopLeft||V),st=rt(this.options.autoPanPaddingBottomRight||V),ut=o.getSize(),yt=0,It=0;P.x+v+st.x>ut.x&&(yt=P.x+v-ut.x+st.x),P.x-yt-nt.x<0&&(yt=P.x-nt.x),P.y+p+st.y>ut.y&&(It=P.y+p-ut.y+st.y),P.y-It-nt.y<0&&(It=P.y-nt.y),(yt||It)&&(this.options.keepInView&&(this._autopanning=!0),o.fire("autopanstart").panBy([yt,It]))}},_getAnchor:function(){return rt(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),lt=function(o,c){return new it(o,c)};At.mergeOptions({closePopupOnClick:!0}),At.include({openPopup:function(o,c,p){return this._initOverlay(it,o,c,p).openOn(this),this},closePopup:function(o){return o=arguments.length?o:this._popup,o&&o.close(),this}}),Ye.include({bindPopup:function(o,c){return this._popup=this._initOverlay(it,this._popup,o,c),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(o){return this._popup&&(this instanceof yi||(this._popup._source=this),this._popup._prepareOpen(o||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(o){return this._popup&&this._popup.setContent(o),this},getPopup:function(){return this._popup},_openPopup:function(o){if(!(!this._popup||!this._map)){Ti(o);var c=o.layer||o.target;if(this._popup._source===c&&!(c instanceof Si)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(o.latlng);return}this._popup._source=c,this.openPopup(o.latlng)}},_movePopup:function(o){this._popup.setLatLng(o.latlng)},_onKeyPress:function(o){o.originalEvent.keyCode===13&&this._openPopup(o)}});var gt=K.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(o){K.prototype.onAdd.call(this,o),this.setOpacity(this.options.opacity),o.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(o){K.prototype.onRemove.call(this,o),o.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var o=K.prototype.getEvents.call(this);return this.options.permanent||(o.preclick=this.close),o},_initLayout:function(){var o="leaflet-tooltip",c=o+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Bt("div",c),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+m(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(o){var c,p,v=this._map,k=this._container,P=v.latLngToContainerPoint(v.getCenter()),V=v.layerPointToContainerPoint(o),nt=this.options.direction,st=k.offsetWidth,ut=k.offsetHeight,yt=rt(this.options.offset),It=this._getAnchor();nt==="top"?(c=st/2,p=ut):nt==="bottom"?(c=st/2,p=0):nt==="center"?(c=st/2,p=ut/2):nt==="right"?(c=0,p=ut/2):nt==="left"?(c=st,p=ut/2):V.x<P.x?(nt="right",c=0,p=ut/2):(nt="left",c=st+(yt.x+It.x)*2,p=ut/2),o=o.subtract(rt(c,p,!0)).add(yt).add(It),Ht(k,"leaflet-tooltip-right"),Ht(k,"leaflet-tooltip-left"),Ht(k,"leaflet-tooltip-top"),Ht(k,"leaflet-tooltip-bottom"),Ct(k,"leaflet-tooltip-"+nt),ae(k,o)},_updatePosition:function(){var o=this._map.latLngToLayerPoint(this._latlng);this._setPosition(o)},setOpacity:function(o){this.options.opacity=o,this._container&&fe(this._container,o)},_animateZoom:function(o){var c=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center);this._setPosition(c)},_getAnchor:function(){return rt(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),bt=function(o,c){return new gt(o,c)};At.include({openTooltip:function(o,c,p){return this._initOverlay(gt,o,c,p).openOn(this),this},closeTooltip:function(o){return o.close(),this}}),Ye.include({bindTooltip:function(o,c){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(gt,this._tooltip,o,c),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(o){if(!(!o&&this._tooltipHandlersAdded)){var c=o?"off":"on",p={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?p.add=this._openTooltip:(p.mouseover=this._openTooltip,p.mouseout=this.closeTooltip,p.click=this._openTooltip,this._map?this._addFocusListeners():p.add=this._addFocusListeners),this._tooltip.options.sticky&&(p.mousemove=this._moveTooltip),this[c](p),this._tooltipHandlersAdded=!o}},openTooltip:function(o){return this._tooltip&&(this instanceof yi||(this._tooltip._source=this),this._tooltip._prepareOpen(o)&&(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(o){return this._tooltip&&this._tooltip.setContent(o),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(o){var c=typeof o.getElement=="function"&&o.getElement();c&&(Mt(c,"focus",function(){this._tooltip._source=o,this.openTooltip()},this),Mt(c,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(o){var c=typeof o.getElement=="function"&&o.getElement();c&&c.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(o){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var c=this;this._map.once("moveend",function(){c._openOnceFlag=!1,c._openTooltip(o)});return}this._tooltip._source=o.layer||o.target,this.openTooltip(this._tooltip.options.sticky?o.latlng:void 0)}},_moveTooltip:function(o){var c=o.latlng,p,v;this._tooltip.options.sticky&&o.originalEvent&&(p=this._map.mouseEventToContainerPoint(o.originalEvent),v=this._map.containerPointToLayerPoint(p),c=this._map.layerPointToLatLng(v)),this._tooltip.setLatLng(c)}});var wt=fn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(o){var c=o&&o.tagName==="DIV"?o:document.createElement("div"),p=this.options;if(p.html instanceof Element?(dr(c),c.appendChild(p.html)):c.innerHTML=p.html!==!1?p.html:"",p.bgPos){var v=rt(p.bgPos);c.style.backgroundPosition=-v.x+"px "+-v.y+"px"}return this._setIconStyles(c,"icon"),c},createShadow:function(){return null}});function zt(o){return new wt(o)}fn.Default=On;var Ot=Ye.extend({options:{tileSize:256,opacity:1,updateWhenIdle:xt.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(o){S(this,o)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(o){o._addZoomLimit(this)},onRemove:function(o){this._removeAllTiles(),$t(this._container),o._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(sn(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(qi(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(o){return this.options.opacity=o,this._updateOpacity(),this},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var o=this._clampZoom(this._map.getZoom());o!==this._tileZoom&&(this._tileZoom=o,this._updateLevels()),this._update()}return this},getEvents:function(){var o={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)),o.move=this._onMove),this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},createTile:function(){return document.createElement("div")},getTileSize:function(){var o=this.options.tileSize;return o instanceof J?o:new J(o,o)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(o){for(var c=this.getPane().children,p=-o(-1/0,1/0),v=0,k=c.length,P;v<k;v++)P=c[v].style.zIndex,c[v]!==this._container&&P&&(p=o(p,+P));isFinite(p)&&(this.options.zIndex=p+o(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!xt.ielt9){fe(this._container,this.options.opacity);var o=+new Date,c=!1,p=!1;for(var v in this._tiles){var k=this._tiles[v];if(!(!k.current||!k.loaded)){var P=Math.min(1,(o-k.loaded)/200);fe(k.el,P),P<1?c=!0:(k.active?p=!0:this._onOpaqueTile(k),k.active=!0)}}p&&!this._noPrune&&this._pruneTiles(),c&&(G(this._fadeFrame),this._fadeFrame=F(this._updateOpacity,this))}},_onOpaqueTile:b,_initContainer:function(){this._container||(this._container=Bt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var o=this._tileZoom,c=this.options.maxZoom;if(o!==void 0){for(var p in this._levels)p=Number(p),this._levels[p].el.children.length||p===o?(this._levels[p].el.style.zIndex=c-Math.abs(o-p),this._onUpdateLevel(p)):($t(this._levels[p].el),this._removeTilesAtZoom(p),this._onRemoveLevel(p),delete this._levels[p]);var v=this._levels[o],k=this._map;return v||(v=this._levels[o]={},v.el=Bt("div","leaflet-tile-container leaflet-zoom-animated",this._container),v.el.style.zIndex=c,v.origin=k.project(k.unproject(k.getPixelOrigin()),o).round(),v.zoom=o,this._setZoomTransform(v,k.getCenter(),k.getZoom()),b(v.el.offsetWidth),this._onCreateLevel(v)),this._level=v,v}},_onUpdateLevel:b,_onRemoveLevel:b,_onCreateLevel:b,_pruneTiles:function(){if(this._map){var o,c,p=this._map.getZoom();if(p>this.options.maxZoom||p<this.options.minZoom){this._removeAllTiles();return}for(o in this._tiles)c=this._tiles[o],c.retain=c.current;for(o in this._tiles)if(c=this._tiles[o],c.current&&!c.active){var v=c.coords;this._retainParent(v.x,v.y,v.z,v.z-5)||this._retainChildren(v.x,v.y,v.z,v.z+2)}for(o in this._tiles)this._tiles[o].retain||this._removeTile(o)}},_removeTilesAtZoom:function(o){for(var c in this._tiles)this._tiles[c].coords.z===o&&this._removeTile(c)},_removeAllTiles:function(){for(var o in this._tiles)this._removeTile(o)},_invalidateAll:function(){for(var o in this._levels)$t(this._levels[o].el),this._onRemoveLevel(Number(o)),delete this._levels[o];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(o,c,p,v){var k=Math.floor(o/2),P=Math.floor(c/2),V=p-1,nt=new J(+k,+P);nt.z=+V;var st=this._tileCoordsToKey(nt),ut=this._tiles[st];return ut&&ut.active?(ut.retain=!0,!0):(ut&&ut.loaded&&(ut.retain=!0),V>v?this._retainParent(k,P,V,v):!1)},_retainChildren:function(o,c,p,v){for(var k=2*o;k<2*o+2;k++)for(var P=2*c;P<2*c+2;P++){var V=new J(k,P);V.z=p+1;var nt=this._tileCoordsToKey(V),st=this._tiles[nt];if(st&&st.active){st.retain=!0;continue}else st&&st.loaded&&(st.retain=!0);p+1<v&&this._retainChildren(k,P,p+1,v)}},_resetView:function(o){var c=o&&(o.pinch||o.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),c,c)},_animateZoom:function(o){this._setView(o.center,o.zoom,!0,o.noUpdate)},_clampZoom:function(o){var c=this.options;return c.minNativeZoom!==void 0&&o<c.minNativeZoom?c.minNativeZoom:c.maxNativeZoom!==void 0&&c.maxNativeZoom<o?c.maxNativeZoom:o},_setView:function(o,c,p,v){var k=Math.round(c);this.options.maxZoom!==void 0&&k>this.options.maxZoom||this.options.minZoom!==void 0&&k<this.options.minZoom?k=void 0:k=this._clampZoom(k);var P=this.options.updateWhenZooming&&k!==this._tileZoom;(!v||P)&&(this._tileZoom=k,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),k!==void 0&&this._update(o),p||this._pruneTiles(),this._noPrune=!!p),this._setZoomTransforms(o,c)},_setZoomTransforms:function(o,c){for(var p in this._levels)this._setZoomTransform(this._levels[p],o,c)},_setZoomTransform:function(o,c,p){var v=this._map.getZoomScale(p,o.zoom),k=o.origin.multiplyBy(v).subtract(this._map._getNewPixelOrigin(c,p)).round();xt.any3d?Zi(o.el,k,v):ae(o.el,k)},_resetGrid:function(){var o=this._map,c=o.options.crs,p=this._tileSize=this.getTileSize(),v=this._tileZoom,k=this._map.getPixelWorldBounds(this._tileZoom);k&&(this._globalTileRange=this._pxBoundsToTileRange(k)),this._wrapX=c.wrapLng&&!this.options.noWrap&&[Math.floor(o.project([0,c.wrapLng[0]],v).x/p.x),Math.ceil(o.project([0,c.wrapLng[1]],v).x/p.y)],this._wrapY=c.wrapLat&&!this.options.noWrap&&[Math.floor(o.project([c.wrapLat[0],0],v).y/p.x),Math.ceil(o.project([c.wrapLat[1],0],v).y/p.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(o){var c=this._map,p=c._animatingZoom?Math.max(c._animateToZoom,c.getZoom()):c.getZoom(),v=c.getZoomScale(p,this._tileZoom),k=c.project(o,this._tileZoom).floor(),P=c.getSize().divideBy(v*2);return new ht(k.subtract(P),k.add(P))},_update:function(o){var c=this._map;if(c){var p=this._clampZoom(c.getZoom());if(o===void 0&&(o=c.getCenter()),this._tileZoom!==void 0){var v=this._getTiledPixelBounds(o),k=this._pxBoundsToTileRange(v),P=k.getCenter(),V=[],nt=this.options.keepBuffer,st=new ht(k.getBottomLeft().subtract([nt,-nt]),k.getTopRight().add([nt,-nt]));if(!(isFinite(k.min.x)&&isFinite(k.min.y)&&isFinite(k.max.x)&&isFinite(k.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var ut in this._tiles){var yt=this._tiles[ut].coords;(yt.z!==this._tileZoom||!st.contains(new J(yt.x,yt.y)))&&(this._tiles[ut].current=!1)}if(Math.abs(p-this._tileZoom)>1){this._setView(o,p);return}for(var It=k.min.y;It<=k.max.y;It++)for(var Rt=k.min.x;Rt<=k.max.x;Rt++){var Oe=new J(Rt,It);if(Oe.z=this._tileZoom,!!this._isValidTile(Oe)){var ve=this._tiles[this._tileCoordsToKey(Oe)];ve?ve.current=!0:V.push(Oe)}}if(V.sort(function(Fe,Cr){return Fe.distanceTo(P)-Cr.distanceTo(P)}),V.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var hi=document.createDocumentFragment();for(Rt=0;Rt<V.length;Rt++)this._addTile(V[Rt],hi);this._level.el.appendChild(hi)}}}},_isValidTile:function(o){var c=this._map.options.crs;if(!c.infinite){var p=this._globalTileRange;if(!c.wrapLng&&(o.x<p.min.x||o.x>p.max.x)||!c.wrapLat&&(o.y<p.min.y||o.y>p.max.y))return!1}if(!this.options.bounds)return!0;var v=this._tileCoordsToBounds(o);return dt(this.options.bounds).overlaps(v)},_keyToBounds:function(o){return this._tileCoordsToBounds(this._keyToTileCoords(o))},_tileCoordsToNwSe:function(o){var c=this._map,p=this.getTileSize(),v=o.scaleBy(p),k=v.add(p),P=c.unproject(v,o.z),V=c.unproject(k,o.z);return[P,V]},_tileCoordsToBounds:function(o){var c=this._tileCoordsToNwSe(o),p=new kt(c[0],c[1]);return this.options.noWrap||(p=this._map.wrapLatLngBounds(p)),p},_tileCoordsToKey:function(o){return o.x+":"+o.y+":"+o.z},_keyToTileCoords:function(o){var c=o.split(":"),p=new J(+c[0],+c[1]);return p.z=+c[2],p},_removeTile:function(o){var c=this._tiles[o];c&&($t(c.el),delete this._tiles[o],this.fire("tileunload",{tile:c.el,coords:this._keyToTileCoords(o)}))},_initTile:function(o){Ct(o,"leaflet-tile");var c=this.getTileSize();o.style.width=c.x+"px",o.style.height=c.y+"px",o.onselectstart=b,o.onmousemove=b,xt.ielt9&&this.options.opacity<1&&fe(o,this.options.opacity)},_addTile:function(o,c){var p=this._getTilePos(o),v=this._tileCoordsToKey(o),k=this.createTile(this._wrapCoords(o),f(this._tileReady,this,o));this._initTile(k),this.createTile.length<2&&F(f(this._tileReady,this,o,null,k)),ae(k,p),this._tiles[v]={el:k,coords:o,current:!0},c.appendChild(k),this.fire("tileloadstart",{tile:k,coords:o})},_tileReady:function(o,c,p){c&&this.fire("tileerror",{error:c,tile:p,coords:o});var v=this._tileCoordsToKey(o);p=this._tiles[v],p&&(p.loaded=+new Date,this._map._fadeAnimated?(fe(p.el,0),G(this._fadeFrame),this._fadeFrame=F(this._updateOpacity,this)):(p.active=!0,this._pruneTiles()),c||(Ct(p.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:p.el,coords:o})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),xt.ielt9||!this._map._fadeAnimated?F(this._pruneTiles,this):setTimeout(f(this._pruneTiles,this),250)))},_getTilePos:function(o){return o.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(o){var c=new J(this._wrapX?x(o.x,this._wrapX):o.x,this._wrapY?x(o.y,this._wrapY):o.y);return c.z=o.z,c},_pxBoundsToTileRange:function(o){var c=this.getTileSize();return new ht(o.min.unscaleBy(c).floor(),o.max.unscaleBy(c).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var o in this._tiles)if(!this._tiles[o].loaded)return!1;return!0}});function Jt(o){return new Ot(o)}var ee=Ot.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(o,c){this._url=o,c=S(this,c),c.detectRetina&&xt.retina&&c.maxZoom>0?(c.tileSize=Math.floor(c.tileSize/2),c.zoomReverse?(c.zoomOffset--,c.minZoom=Math.min(c.maxZoom,c.minZoom+1)):(c.zoomOffset++,c.maxZoom=Math.max(c.minZoom,c.maxZoom-1)),c.minZoom=Math.max(0,c.minZoom)):c.zoomReverse?c.minZoom=Math.min(c.maxZoom,c.minZoom):c.maxZoom=Math.max(c.minZoom,c.maxZoom),typeof c.subdomains=="string"&&(c.subdomains=c.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(o,c){return this._url===o&&c===void 0&&(c=!0),this._url=o,c||this.redraw(),this},createTile:function(o,c){var p=document.createElement("img");return Mt(p,"load",f(this._tileOnLoad,this,c,p)),Mt(p,"error",f(this._tileOnError,this,c,p)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(p.referrerPolicy=this.options.referrerPolicy),p.alt="",p.src=this.getTileUrl(o),p},getTileUrl:function(o){var c={r:xt.retina?"@2x":"",s:this._getSubdomain(o),x:o.x,y:o.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var p=this._globalTileRange.max.y-o.y;this.options.tms&&(c.y=p),c["-y"]=p}return O(this._url,r(c,this.options))},_tileOnLoad:function(o,c){xt.ielt9?setTimeout(f(o,this,null,c),0):o(null,c)},_tileOnError:function(o,c,p){var v=this.options.errorTileUrl;v&&c.getAttribute("src")!==v&&(c.src=v),o(p,c)},_onTileRemove:function(o){o.tile.onload=null},_getZoomForUrl:function(){var o=this._tileZoom,c=this.options.maxZoom,p=this.options.zoomReverse,v=this.options.zoomOffset;return p&&(o=c-o),o+v},_getSubdomain:function(o){var c=Math.abs(o.x+o.y)%this.options.subdomains.length;return this.options.subdomains[c]},_abortLoading:function(){var o,c;for(o in this._tiles)if(this._tiles[o].coords.z!==this._tileZoom&&(c=this._tiles[o].el,c.onload=b,c.onerror=b,!c.complete)){c.src=X;var p=this._tiles[o].coords;$t(c),delete this._tiles[o],this.fire("tileabort",{tile:c,coords:p})}},_removeTile:function(o){var c=this._tiles[o];if(c)return c.el.setAttribute("src",X),Ot.prototype._removeTile.call(this,o)},_tileReady:function(o,c,p){if(!(!this._map||p&&p.getAttribute("src")===X))return Ot.prototype._tileReady.call(this,o,c,p)}});function de(o,c){return new ee(o,c)}var Ai=ee.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(o,c){this._url=o;var p=r({},this.defaultWmsParams);for(var v in c)v in this.options||(p[v]=c[v]);c=S(this,c);var k=c.detectRetina&&xt.retina?2:1,P=this.getTileSize();p.width=P.x*k,p.height=P.y*k,this.wmsParams=p},onAdd:function(o){this._crs=this.options.crs||o.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var c=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[c]=this._crs.code,ee.prototype.onAdd.call(this,o)},getTileUrl:function(o){var c=this._tileCoordsToNwSe(o),p=this._crs,v=_t(p.project(c[0]),p.project(c[1])),k=v.min,P=v.max,V=(this._wmsVersion>=1.3&&this._crs===Bs?[k.y,k.x,P.y,P.x]:[k.x,k.y,P.x,P.y]).join(","),nt=ee.prototype.getTileUrl.call(this,o);return nt+z(this.wmsParams,nt,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+V},setParams:function(o,c){return r(this.wmsParams,o),c||this.redraw(),this}});function Dn(o,c){return new Ai(o,c)}ee.WMS=Ai,de.wms=Dn;var ui=Ye.extend({options:{padding:.1},initialize:function(o){S(this,o),m(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Ct(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 o={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(o.zoomanim=this._onAnimZoom),o},_onAnimZoom:function(o){this._updateTransform(o.center,o.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(o,c){var p=this._map.getZoomScale(c,this._zoom),v=this._map.getSize().multiplyBy(.5+this.options.padding),k=this._map.project(this._center,c),P=v.multiplyBy(-p).add(k).subtract(this._map._getNewPixelOrigin(o,c));xt.any3d?Zi(this._container,P,p):ae(this._container,P)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var o in this._layers)this._layers[o]._reset()},_onZoomEnd:function(){for(var o in this._layers)this._layers[o]._project()},_updatePaths:function(){for(var o in this._layers)this._layers[o]._update()},_update:function(){var o=this.options.padding,c=this._map.getSize(),p=this._map.containerPointToLayerPoint(c.multiplyBy(-o)).round();this._bounds=new ht(p,p.add(c.multiplyBy(1+o*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Po=ui.extend({options:{tolerance:0},getEvents:function(){var o=ui.prototype.getEvents.call(this);return o.viewprereset=this._onViewPreReset,o},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ui.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var o=this._container=document.createElement("canvas");Mt(o,"mousemove",this._onMouseMove,this),Mt(o,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Mt(o,"mouseout",this._handleMouseOut,this),o._leaflet_disable_events=!0,this._ctx=o.getContext("2d")},_destroyContainer:function(){G(this._redrawRequest),delete this._ctx,$t(this._container),Xt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var o;this._redrawBounds=null;for(var c in this._layers)o=this._layers[c],o._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ui.prototype._update.call(this);var o=this._bounds,c=this._container,p=o.getSize(),v=xt.retina?2:1;ae(c,o.min),c.width=v*p.x,c.height=v*p.y,c.style.width=p.x+"px",c.style.height=p.y+"px",xt.retina&&this._ctx.scale(2,2),this._ctx.translate(-o.min.x,-o.min.y),this.fire("update")}},_reset:function(){ui.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(o){this._updateDashArray(o),this._layers[m(o)]=o;var c=o._order={layer:o,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=c),this._drawLast=c,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(o){this._requestRedraw(o)},_removePath:function(o){var c=o._order,p=c.next,v=c.prev;p?p.prev=v:this._drawLast=v,v?v.next=p:this._drawFirst=p,delete o._order,delete this._layers[m(o)],this._requestRedraw(o)},_updatePath:function(o){this._extendRedrawBounds(o),o._project(),o._update(),this._requestRedraw(o)},_updateStyle:function(o){this._updateDashArray(o),this._requestRedraw(o)},_updateDashArray:function(o){if(typeof o.options.dashArray=="string"){var c=o.options.dashArray.split(/[, ]+/),p=[],v,k;for(k=0;k<c.length;k++){if(v=Number(c[k]),isNaN(v))return;p.push(v)}o.options._dashArray=p}else o.options._dashArray=o.options.dashArray},_requestRedraw:function(o){this._map&&(this._extendRedrawBounds(o),this._redrawRequest=this._redrawRequest||F(this._redraw,this))},_extendRedrawBounds:function(o){if(o._pxBounds){var c=(o.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ht,this._redrawBounds.extend(o._pxBounds.min.subtract([c,c])),this._redrawBounds.extend(o._pxBounds.max.add([c,c]))}},_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 o=this._redrawBounds;if(o){var c=o.getSize();this._ctx.clearRect(o.min.x,o.min.y,c.x,c.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 o,c=this._redrawBounds;if(this._ctx.save(),c){var p=c.getSize();this._ctx.beginPath(),this._ctx.rect(c.min.x,c.min.y,p.x,p.y),this._ctx.clip()}this._drawing=!0;for(var v=this._drawFirst;v;v=v.next)o=v.layer,(!c||o._pxBounds&&o._pxBounds.intersects(c))&&o._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(o,c){if(this._drawing){var p,v,k,P,V=o._parts,nt=V.length,st=this._ctx;if(nt){for(st.beginPath(),p=0;p<nt;p++){for(v=0,k=V[p].length;v<k;v++)P=V[p][v],st[v?"lineTo":"moveTo"](P.x,P.y);c&&st.closePath()}this._fillStroke(st,o)}}},_updateCircle:function(o){if(!(!this._drawing||o._empty())){var c=o._point,p=this._ctx,v=Math.max(Math.round(o._radius),1),k=(Math.max(Math.round(o._radiusY),1)||v)/v;k!==1&&(p.save(),p.scale(1,k)),p.beginPath(),p.arc(c.x,c.y/k,v,0,Math.PI*2,!1),k!==1&&p.restore(),this._fillStroke(p,o)}},_fillStroke:function(o,c){var p=c.options;p.fill&&(o.globalAlpha=p.fillOpacity,o.fillStyle=p.fillColor||p.color,o.fill(p.fillRule||"evenodd")),p.stroke&&p.weight!==0&&(o.setLineDash&&o.setLineDash(c.options&&c.options._dashArray||[]),o.globalAlpha=p.opacity,o.lineWidth=p.weight,o.strokeStyle=p.color,o.lineCap=p.lineCap,o.lineJoin=p.lineJoin,o.stroke())},_onClick:function(o){for(var c=this._map.mouseEventToLayerPoint(o),p,v,k=this._drawFirst;k;k=k.next)p=k.layer,p.options.interactive&&p._containsPoint(c)&&(!(o.type==="click"||o.type==="preclick")||!this._map._draggableMoved(p))&&(v=p);this._fireEvent(v?[v]:!1,o)},_onMouseMove:function(o){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var c=this._map.mouseEventToLayerPoint(o);this._handleMouseHover(o,c)}},_handleMouseOut:function(o){var c=this._hoveredLayer;c&&(Ht(this._container,"leaflet-interactive"),this._fireEvent([c],o,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(o,c){if(!this._mouseHoverThrottled){for(var p,v,k=this._drawFirst;k;k=k.next)p=k.layer,p.options.interactive&&p._containsPoint(c)&&(v=p);v!==this._hoveredLayer&&(this._handleMouseOut(o),v&&(Ct(this._container,"leaflet-interactive"),this._fireEvent([v],o,"mouseover"),this._hoveredLayer=v)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,o),this._mouseHoverThrottled=!0,setTimeout(f(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(o,c,p){this._map._fireDOMEvent(c,p||c.type,o)},_bringToFront:function(o){var c=o._order;if(c){var p=c.next,v=c.prev;if(p)p.prev=v;else return;v?v.next=p:p&&(this._drawFirst=p),c.prev=this._drawLast,this._drawLast.next=c,c.next=null,this._drawLast=c,this._requestRedraw(o)}},_bringToBack:function(o){var c=o._order;if(c){var p=c.next,v=c.prev;if(v)v.next=p;else return;p?p.prev=v:v&&(this._drawLast=v),c.prev=null,c.next=this._drawFirst,this._drawFirst.prev=c,this._drawFirst=c,this._requestRedraw(o)}}});function No(o){return xt.canvas?new Po(o):null}var gn=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(o){return document.createElement("<lvml:"+o+' class="lvml">')}}catch{}return function(o){return document.createElement("<"+o+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Hs={_initContainer:function(){this._container=Bt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ui.prototype._update.call(this),this.fire("update"))},_initPath:function(o){var c=o._container=gn("shape");Ct(c,"leaflet-vml-shape "+(this.options.className||"")),c.coordsize="1 1",o._path=gn("path"),c.appendChild(o._path),this._updateStyle(o),this._layers[m(o)]=o},_addPath:function(o){var c=o._container;this._container.appendChild(c),o.options.interactive&&o.addInteractiveTarget(c)},_removePath:function(o){var c=o._container;$t(c),o.removeInteractiveTarget(c),delete this._layers[m(o)]},_updateStyle:function(o){var c=o._stroke,p=o._fill,v=o.options,k=o._container;k.stroked=!!v.stroke,k.filled=!!v.fill,v.stroke?(c||(c=o._stroke=gn("stroke")),k.appendChild(c),c.weight=v.weight+"px",c.color=v.color,c.opacity=v.opacity,v.dashArray?c.dashStyle=q(v.dashArray)?v.dashArray.join(" "):v.dashArray.replace(/( *, *)/g," "):c.dashStyle="",c.endcap=v.lineCap.replace("butt","flat"),c.joinstyle=v.lineJoin):c&&(k.removeChild(c),o._stroke=null),v.fill?(p||(p=o._fill=gn("fill")),k.appendChild(p),p.color=v.fillColor||v.color,p.opacity=v.fillOpacity):p&&(k.removeChild(p),o._fill=null)},_updateCircle:function(o){var c=o._point.round(),p=Math.round(o._radius),v=Math.round(o._radiusY||p);this._setPath(o,o._empty()?"M0 0":"AL "+c.x+","+c.y+" "+p+","+v+" 0,"+65535*360)},_setPath:function(o,c){o._path.v=c},_bringToFront:function(o){sn(o._container)},_bringToBack:function(o){qi(o._container)}},Bn=xt.vml?gn:Ut,Vi=ui.extend({_initContainer:function(){this._container=Bn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Bn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){$t(this._container),Xt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ui.prototype._update.call(this);var o=this._bounds,c=o.getSize(),p=this._container;(!this._svgSize||!this._svgSize.equals(c))&&(this._svgSize=c,p.setAttribute("width",c.x),p.setAttribute("height",c.y)),ae(p,o.min),p.setAttribute("viewBox",[o.min.x,o.min.y,c.x,c.y].join(" ")),this.fire("update")}},_initPath:function(o){var c=o._path=Bn("path");o.options.className&&Ct(c,o.options.className),o.options.interactive&&Ct(c,"leaflet-interactive"),this._updateStyle(o),this._layers[m(o)]=o},_addPath:function(o){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(o._path),o.addInteractiveTarget(o._path)},_removePath:function(o){$t(o._path),o.removeInteractiveTarget(o._path),delete this._layers[m(o)]},_updatePath:function(o){o._project(),o._update()},_updateStyle:function(o){var c=o._path,p=o.options;c&&(p.stroke?(c.setAttribute("stroke",p.color),c.setAttribute("stroke-opacity",p.opacity),c.setAttribute("stroke-width",p.weight),c.setAttribute("stroke-linecap",p.lineCap),c.setAttribute("stroke-linejoin",p.lineJoin),p.dashArray?c.setAttribute("stroke-dasharray",p.dashArray):c.removeAttribute("stroke-dasharray"),p.dashOffset?c.setAttribute("stroke-dashoffset",p.dashOffset):c.removeAttribute("stroke-dashoffset")):c.setAttribute("stroke","none"),p.fill?(c.setAttribute("fill",p.fillColor||p.color),c.setAttribute("fill-opacity",p.fillOpacity),c.setAttribute("fill-rule",p.fillRule||"evenodd")):c.setAttribute("fill","none"))},_updatePoly:function(o,c){this._setPath(o,eo(o._parts,c))},_updateCircle:function(o){var c=o._point,p=Math.max(Math.round(o._radius),1),v=Math.max(Math.round(o._radiusY),1)||p,k="a"+p+","+v+" 0 1,0 ",P=o._empty()?"M0 0":"M"+(c.x-p)+","+c.y+k+p*2+",0 "+k+-p*2+",0 ";this._setPath(o,P)},_setPath:function(o,c){o._path.setAttribute("d",c)},_bringToFront:function(o){sn(o._path)},_bringToBack:function(o){qi(o._path)}});xt.vml&&Vi.include(Hs);function Ir(o){return xt.svg||xt.vml?new Vi(o):null}At.include({getRenderer:function(o){var c=o.options.renderer||this._getPaneRenderer(o.options.pane)||this.options.renderer||this._renderer;return c||(c=this._renderer=this._createRenderer()),this.hasLayer(c)||this.addLayer(c),c},_getPaneRenderer:function(o){if(o==="overlayPane"||o===void 0)return!1;var c=this._paneRenderers[o];return c===void 0&&(c=this._createRenderer({pane:o}),this._paneRenderers[o]=c),c},_createRenderer:function(o){return this.options.preferCanvas&&No(o)||Ir(o)}});var Kh=dn.extend({initialize:function(o,c){dn.prototype.initialize.call(this,this._boundsToLatLngs(o),c)},setBounds:function(o){return this.setLatLngs(this._boundsToLatLngs(o))},_boundsToLatLngs:function(o){return o=dt(o),[o.getSouthWest(),o.getNorthWest(),o.getNorthEast(),o.getSouthEast()]}});function um(o,c){return new Kh(o,c)}Vi.create=Bn,Vi.pointsToPath=eo,li.geometryToLayer=Lr,li.coordsToLatLng=Mi,li.coordsToLatLngs=Er,li.latLngToCoords=Tr,li.latLngsToCoords=ke,li.getFeature=Le,li.asFeature=u,At.mergeOptions({boxZoom:!0});var Qh=si.extend({initialize:function(o){this._map=o,this._container=o._container,this._pane=o._panes.overlayPane,this._resetStateTimeout=0,o.on("unload",this._destroy,this)},addHooks:function(){Mt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Xt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){$t(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(o){if(!o.shiftKey||o.which!==1&&o.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),gi(),po(),this._startPoint=this._map.mouseEventToContainerPoint(o),Mt(document,{contextmenu:Ti,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(o){this._moved||(this._moved=!0,this._box=Bt("div","leaflet-zoom-box",this._container),Ct(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(o);var c=new ht(this._point,this._startPoint),p=c.getSize();ae(this._box,c.min),this._box.style.width=p.x+"px",this._box.style.height=p.y+"px"},_finish:function(){this._moved&&($t(this._box),Ht(this._container,"leaflet-crosshair")),an(),Cn(),Xt(document,{contextmenu:Ti,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(o){if(!(o.which!==1&&o.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(f(this._resetState,this),0);var c=new kt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(c).fire("boxzoomend",{boxZoomBounds:c})}},_onKeyDown:function(o){o.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});At.addInitHook("addHandler","boxZoom",Qh),At.mergeOptions({doubleClickZoom:!0});var $h=si.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(o){var c=this._map,p=c.getZoom(),v=c.options.zoomDelta,k=o.originalEvent.shiftKey?p-v:p+v;c.options.doubleClickZoom==="center"?c.setZoom(k):c.setZoomAround(o.containerPoint,k)}});At.addInitHook("addHandler","doubleClickZoom",$h),At.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var tc=si.extend({addHooks:function(){if(!this._draggable){var o=this._map;this._draggable=new Ci(o._mapPane,o._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),o.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),o.on("zoomend",this._onZoomEnd,this),o.whenReady(this._onZoomEnd,this))}Ct(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ht(this._map._container,"leaflet-grab"),Ht(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 o=this._map;if(o._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var c=dt(this._map.options.maxBounds);this._offsetLimit=_t(this._map.latLngToContainerPoint(c.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(c.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;o.fire("movestart").fire("dragstart"),o.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(o){if(this._map.options.inertia){var c=this._lastTime=+new Date,p=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(p),this._times.push(c),this._prunePositions(c)}this._map.fire("move",o).fire("drag",o)},_prunePositions:function(o){for(;this._positions.length>1&&o-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var o=this._map.getSize().divideBy(2),c=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=c.subtract(o).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(o,c){return o-(o-c)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var o=this._draggable._newPos.subtract(this._draggable._startPos),c=this._offsetLimit;o.x<c.min.x&&(o.x=this._viscousLimit(o.x,c.min.x)),o.y<c.min.y&&(o.y=this._viscousLimit(o.y,c.min.y)),o.x>c.max.x&&(o.x=this._viscousLimit(o.x,c.max.x)),o.y>c.max.y&&(o.y=this._viscousLimit(o.y,c.max.y)),this._draggable._newPos=this._draggable._startPos.add(o)}},_onPreDragWrap:function(){var o=this._worldWidth,c=Math.round(o/2),p=this._initialWorldOffset,v=this._draggable._newPos.x,k=(v-c+p)%o+c-p,P=(v+c+p)%o-c-p,V=Math.abs(k+p)<Math.abs(P+p)?k:P;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=V},_onDragEnd:function(o){var c=this._map,p=c.options,v=!p.inertia||o.noInertia||this._times.length<2;if(c.fire("dragend",o),v)c.fire("moveend");else{this._prunePositions(+new Date);var k=this._lastPos.subtract(this._positions[0]),P=(this._lastTime-this._times[0])/1e3,V=p.easeLinearity,nt=k.multiplyBy(V/P),st=nt.distanceTo([0,0]),ut=Math.min(p.inertiaMaxSpeed,st),yt=nt.multiplyBy(ut/st),It=ut/(p.inertiaDeceleration*V),Rt=yt.multiplyBy(-It/2).round();!Rt.x&&!Rt.y?c.fire("moveend"):(Rt=c._limitOffset(Rt,c.options.maxBounds),F(function(){c.panBy(Rt,{duration:It,easeLinearity:V,noMoveStart:!0,animate:!0})}))}}});At.addInitHook("addHandler","dragging",tc),At.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ec=si.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(o){this._map=o,this._setPanDelta(o.options.keyboardPanDelta),this._setZoomDelta(o.options.zoomDelta)},addHooks:function(){var o=this._map._container;o.tabIndex<=0&&(o.tabIndex="0"),Mt(o,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Xt(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 o=document.body,c=document.documentElement,p=o.scrollTop||c.scrollTop,v=o.scrollLeft||c.scrollLeft;this._map._container.focus(),window.scrollTo(v,p)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(o){var c=this._panKeys={},p=this.keyCodes,v,k;for(v=0,k=p.left.length;v<k;v++)c[p.left[v]]=[-1*o,0];for(v=0,k=p.right.length;v<k;v++)c[p.right[v]]=[o,0];for(v=0,k=p.down.length;v<k;v++)c[p.down[v]]=[0,o];for(v=0,k=p.up.length;v<k;v++)c[p.up[v]]=[0,-1*o]},_setZoomDelta:function(o){var c=this._zoomKeys={},p=this.keyCodes,v,k;for(v=0,k=p.zoomIn.length;v<k;v++)c[p.zoomIn[v]]=o;for(v=0,k=p.zoomOut.length;v<k;v++)c[p.zoomOut[v]]=-o},_addHooks:function(){Mt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Xt(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(o){if(!(o.altKey||o.ctrlKey||o.metaKey)){var c=o.keyCode,p=this._map,v;if(c in this._panKeys){if(!p._panAnim||!p._panAnim._inProgress)if(v=this._panKeys[c],o.shiftKey&&(v=rt(v).multiplyBy(3)),p.options.maxBounds&&(v=p._limitOffset(rt(v),p.options.maxBounds)),p.options.worldCopyJump){var k=p.wrapLatLng(p.unproject(p.project(p.getCenter()).add(v)));p.panTo(k)}else p.panBy(v)}else if(c in this._zoomKeys)p.setZoom(p.getZoom()+(o.shiftKey?3:1)*this._zoomKeys[c]);else if(c===27&&p._popup&&p._popup.options.closeOnEscapeKey)p.closePopup();else return;Ti(o)}}});At.addInitHook("addHandler","keyboard",ec),At.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var ic=si.extend({addHooks:function(){Mt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Xt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(o){var c=bo(o),p=this._map.options.wheelDebounceTime;this._delta+=c,this._lastMousePos=this._map.mouseEventToContainerPoint(o),this._startTime||(this._startTime=+new Date);var v=Math.max(p-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(f(this._performZoom,this),v),Ti(o)},_performZoom:function(){var o=this._map,c=o.getZoom(),p=this._map.options.zoomSnap||0;o._stop();var v=this._delta/(this._map.options.wheelPxPerZoomLevel*4),k=4*Math.log(2/(1+Math.exp(-Math.abs(v))))/Math.LN2,P=p?Math.ceil(k/p)*p:k,V=o._limitZoom(c+(this._delta>0?P:-P))-c;this._delta=0,this._startTime=null,V&&(o.options.scrollWheelZoom==="center"?o.setZoom(c+V):o.setZoomAround(this._lastMousePos,c+V))}});At.addInitHook("addHandler","scrollWheelZoom",ic);var hm=600;At.mergeOptions({tapHold:xt.touchNative&&xt.safari&&xt.mobile,tapTolerance:15});var nc=si.extend({addHooks:function(){Mt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Xt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(o){if(clearTimeout(this._holdTimeout),o.touches.length===1){var c=o.touches[0];this._startPos=this._newPos=new J(c.clientX,c.clientY),this._holdTimeout=setTimeout(f(function(){this._cancel(),this._isTapValid()&&(Mt(document,"touchend",re),Mt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",c))},this),hm),Mt(document,"touchend touchcancel contextmenu",this._cancel,this),Mt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function o(){Xt(document,"touchend",re),Xt(document,"touchend touchcancel",o)},_cancel:function(){clearTimeout(this._holdTimeout),Xt(document,"touchend touchcancel contextmenu",this._cancel,this),Xt(document,"touchmove",this._onMove,this)},_onMove:function(o){var c=o.touches[0];this._newPos=new J(c.clientX,c.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(o,c){var p=new MouseEvent(o,{bubbles:!0,cancelable:!0,view:window,screenX:c.screenX,screenY:c.screenY,clientX:c.clientX,clientY:c.clientY});p._simulated=!0,c.target.dispatchEvent(p)}});At.addInitHook("addHandler","tapHold",nc),At.mergeOptions({touchZoom:xt.touch,bounceAtZoomLimits:!0});var rc=si.extend({addHooks:function(){Ct(this._map._container,"leaflet-touch-zoom"),Mt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ht(this._map._container,"leaflet-touch-zoom"),Xt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(o){var c=this._map;if(!(!o.touches||o.touches.length!==2||c._animatingZoom||this._zooming)){var p=c.mouseEventToContainerPoint(o.touches[0]),v=c.mouseEventToContainerPoint(o.touches[1]);this._centerPoint=c.getSize()._divideBy(2),this._startLatLng=c.containerPointToLatLng(this._centerPoint),c.options.touchZoom!=="center"&&(this._pinchStartLatLng=c.containerPointToLatLng(p.add(v)._divideBy(2))),this._startDist=p.distanceTo(v),this._startZoom=c.getZoom(),this._moved=!1,this._zooming=!0,c._stop(),Mt(document,"touchmove",this._onTouchMove,this),Mt(document,"touchend touchcancel",this._onTouchEnd,this),re(o)}},_onTouchMove:function(o){if(!(!o.touches||o.touches.length!==2||!this._zooming)){var c=this._map,p=c.mouseEventToContainerPoint(o.touches[0]),v=c.mouseEventToContainerPoint(o.touches[1]),k=p.distanceTo(v)/this._startDist;if(this._zoom=c.getScaleZoom(k,this._startZoom),!c.options.bounceAtZoomLimits&&(this._zoom<c.getMinZoom()&&k<1||this._zoom>c.getMaxZoom()&&k>1)&&(this._zoom=c._limitZoom(this._zoom)),c.options.touchZoom==="center"){if(this._center=this._startLatLng,k===1)return}else{var P=p._add(v)._divideBy(2)._subtract(this._centerPoint);if(k===1&&P.x===0&&P.y===0)return;this._center=c.unproject(c.project(this._pinchStartLatLng,this._zoom).subtract(P),this._zoom)}this._moved||(c._moveStart(!0,!1),this._moved=!0),G(this._animRequest);var V=f(c._move,c,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=F(V,this,!0),re(o)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,G(this._animRequest),Xt(document,"touchmove",this._onTouchMove,this),Xt(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))}});At.addInitHook("addHandler","touchZoom",rc),At.BoxZoom=Qh,At.DoubleClickZoom=$h,At.Drag=tc,At.Keyboard=ec,At.ScrollWheelZoom=ic,At.TapHold=nc,At.TouchZoom=rc,i.Bounds=ht,i.Browser=xt,i.CRS=Yt,i.Canvas=Po,i.Circle=kr,i.CircleMarker=Rn,i.Class=W,i.Control=He,i.DivIcon=wt,i.DivOverlay=K,i.DomEvent=fl,i.DomUtil=mr,i.Draggable=Ci,i.Evented=$,i.FeatureGroup=yi,i.GeoJSON=li,i.GridLayer=Ot,i.Handler=si,i.Icon=fn,i.ImageOverlay=g,i.LatLng=pt,i.LatLngBounds=kt,i.Layer=Ye,i.LayerGroup=cn,i.LineUtil=Co,i.Map=At,i.Marker=wr,i.Mixin=ml,i.Path=Si,i.Point=J,i.PolyUtil=Pe,i.Polygon=dn,i.Polyline=ai,i.Popup=it,i.PosAnimation=xo,i.Projection=_l,i.Rectangle=Kh,i.Renderer=ui,i.SVG=Vi,i.SVGOverlay=A,i.TileLayer=ee,i.Tooltip=gt,i.Transformation=mt,i.Util=H,i.VideoOverlay=w,i.bind=f,i.bounds=_t,i.canvas=No,i.circle=kl,i.circleMarker=Us,i.control=_e,i.divIcon=zt,i.extend=r,i.featureGroup=Fs,i.geoJSON=e,i.geoJson=l,i.gridLayer=Jt,i.icon=xl,i.imageOverlay=y,i.latLng=vt,i.latLngBounds=dt,i.layerGroup=zs,i.map=vr,i.marker=wl,i.point=rt,i.polygon=qs,i.polyline=Ao,i.popup=lt,i.rectangle=um,i.setOptions=S,i.stamp=m,i.svg=Ir,i.svgOverlay=B,i.tileLayer=de,i.tooltip=bt,i.transformation=U,i.version=s,i.videoOverlay=T;var cm=window.L;i.noConflict=function(){return window.L=cm,this},window.L=i}))})(Sr,Sr.exports)),Sr.exports}var le=Sl();const Do=Ge({__proto__:null,default:Il(le)},[le]),fc='.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}',dc=`.leaflet-draw-section{position:relative}.leaflet-draw-toolbar{margin-top:12px}.leaflet-draw-toolbar-top{margin-top:0}.leaflet-draw-toolbar-notop a:first-child{border-top-right-radius:0}.leaflet-draw-toolbar-nobottom a:last-child{border-bottom-right-radius:0}.leaflet-draw-toolbar a{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAAeCAYAAACWuCNnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAG7AAABuwBHnU4NQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAbvSURBVHic7dtdbBxXFQfw/9nZ3SRKwAP7UFFUQOoHqGnUoEAoNghX9tyxVcpD1X0J+WgiUQmpfUB5ACSgG1qJIKASqBIUIauqAbWseIlqb+bOWHVR6y0FKZBEqdIUQROIREGRx3FFvR/38ODZst3a3nE8Ywfv+T2t7hzdM3fle/bOnWtACCGEEEIIIYQQQgghhBBCCCGEEEIIIcRa0EbfgBDdFItFKwzDAa3175LuWylVAvBIR/MxrXUp6Vxx9dp4VyObVEdKKW591lonXgiVUg6AHzPzk9ls9meVSmUh6RzXkz179uQKhcIgM+8CACI6U6vVnp+enm6knXt4ePiuTCbzWQAwxlSDIHg57ZwroDAMnwKwz3XdBzzPG08hxzsTNprQG2lTjtd13WFmfghAP4A+AJcATFiW9YNKpfL3uP0kUliiX4SG1pqUUpx0wXJd9/PMXAGwPWq6yMyPz8/P/7xarf4nyVwt7QV4JWkU52i8YwBu6bh0wRhzJAiCF5POCQCDg4N2Pp//NYDRjkuTxph9QRCESeYrFov5ubm5R5n5AIAPtV1aYOb7BgYGTpZKJeO67lFmPsbM9/i+/8Ja8y6zylhOYquPXhsvAJRKpczMzMwTAIaJ6LFGo+HNzs5eKRQKNxPRAWb+CoAjWuvn4vS35skWFasxAAdbbUlOYqVUPwAPwI4lLr8J4KeWZT1eqVTmksoZ5d2QghUVKx/AlmVCFph5yPf9l5LMCwBKqUksFqszRHQcAJj5GwB2MfOE7/tfTDKf4zjHiejrAE4CuNhqZ+bf2rY9FYbhGBH92/O8o47j3Oj7/uUk86+3XhsvACilHmPmgW3btn3pxIkTVzuvj4yMfNoY85wxZiQIglPd+lvTZIuq5xiAQwCe6evr218ul5tr6bNd9GiiAbyvS+hFrfVHk8oLbEzBih4Dz+G9K6t3IaLXFhYWdib5eBh911UA8wBu1lq/CQBDQ0M3WJb1OoAdRPQZz/NeSSqnUuofAKpa6/vb26MfwacA7AdwFcCdWuu/JpU3yl1C91VHoquNXhvvyMjIx4wxr1iWtbNSqfxruTjHcR4AcMj3/bu79XnNe1hpFyvHcXYT0QS6FysASHR1tVEKhcIguhQrAGDm23K53BcATCWV27KsAWYGgPOtYgUAU1NT/1RKnQewxxjzOQCJFSwANwI4297QtmLfD+AtZr43m83OJ5iz3bGU+l1OT43XGFNk5mdXKlYAYNv2eBiG31dK3aS1vrRSbOZabqRYLFppFisAIKJxAB+MGf56krk30O64gZlMJnZsHMxsoo8fHxoauqHVHn3+BAAQUaxV57Xq2F54i5nvIaJXm81mYoX5etID491JRH/sFlQul5tEdMoYc3u32FUXrLYvObViBQDM/MQqwi8knX8jEJHpHrXIGJNo8WDm1spph2VZgeu6+5RSX7YsK8D/Xnb8Psmcnebm5h7G4uS9ysxutOH8VQC70sy7UTb7eImImTnWlgkzUyaT6fr3v6qC1fGL8EytVjuQRrECANu2fwHg1TixzPyXNO5hvTHz6VWE/znJ3L7vzxBRa9PzDmb+FYBfArgjajvd39+f9vGGKwACZh5te6mwmc8KburxMvO5TCbzqW5xxWLRArDbsqyu8z32HtZSxSrNM0Hlcrnpum6JmZ+NEb4pHglrtdrz+Xz+AoBbu4Ser9fra37d3YEBfBvAkq+XmfmbpVIp9grwWnie9zSAp9PMcT3Z7OPNZrO/aTQaf1BKfbd9X7RTGIaHmPlcnPNYsVZYSikOw7AB4CAzj/f19e1fjwOMnueVEeMxJJfLbYqCNT093TDGHAGw0qHYBQBH0vj+Pc+bYOb3HFRk5nHf9yeTzgfgMhF9uEvMTQD+71/vR3pqvJOTk28AeBJAeXR09P1LxbiuuxfA9wB8LU6fsVdYrUOhtm0fTusxcAlMRN+KziUt5SqAM3v37r00OZnGfFp/QRC86DjOUCaTGWPm2zoun8fiIbuZtPLX6/UH8/n8rQDuippertfrD6aRKyqOR5VS81ji8Z+IbmfmgwB+mEb+9dZr4wWA/v7+R6rV6k+azeYpx3EezeVyJ7dv335lfn7+lkajcZCZDzPzYd/3/xSnv9gFq3UuaR2LFQDA87xAKVUB8BEAZ6N9nrNEdEZr/TcArLVOPG8aJ9jj8n3/pcHBwZ1btmx5519zmPl0vV5/Ie2V7fT09Nujo6Nus9kcA4CtW7ce1lq/nUYu27a/Mzs7CyI6gMVX/u/CzJeZ+Ue2bcc9pb1aXc8lJZms18YLANE2wkOu694N4OFGo3E8DMMPAHiDiCaY+ZOb4YCsEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhEjYfwGO+b5dFNs4OgAAAABJRU5ErkJggg==);background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20viewBox='0%200%20600%2060'%20height='60'%20width='600'%20id='svg4225'%20version='1.1'%20inkscape:version='0.91%20r13725'%20sodipodi:docname='spritesheet.svg'%20inkscape:export-filename='/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png'%20inkscape:export-xdpi='90'%20inkscape:export-ydpi='90'%3e%3cmetadata%20id='metadata4258'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%20/%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%20id='defs4256'%20/%3e%3csodipodi:namedview%20pagecolor='%23ffffff'%20bordercolor='%23666666'%20borderopacity='1'%20objecttolerance='10'%20gridtolerance='10'%20guidetolerance='10'%20inkscape:pageopacity='0'%20inkscape:pageshadow='2'%20inkscape:window-width='1920'%20inkscape:window-height='1056'%20id='namedview4254'%20showgrid='false'%20inkscape:zoom='1.3101852'%20inkscape:cx='237.56928'%20inkscape:cy='7.2419621'%20inkscape:window-x='1920'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4225'%20/%3e%3cg%20id='enabled'%20style='fill:%23464646;fill-opacity:1'%3e%3cg%20id='polyline'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%2018,36%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4229'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2036,18%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4231'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2023.142,39.145%20-2.285,-2.29%2016,-15.998%202.285,2.285%20z'%20id='path4233'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cpath%20id='polygon'%20d='M%20100,24.565%2097.904,39.395%2083.07,42%2076,28.773%2086.463,18%20Z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='rectangle'%20d='m%20140,20%2020,0%200,20%20-20,0%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='circle'%20d='m%20221,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='marker'%20d='m%20270,19%20c%20-4.971,0%20-9,4.029%20-9,9%200,4.971%205.001,12%209,14%204.001,-2%209,-9.029%209,-14%200,-4.971%20-4.029,-9%20-9,-9%20z%20m%200,12.5%20c%20-2.484,0%20-4.5,-2.014%20-4.5,-4.5%200,-2.484%202.016,-4.5%204.5,-4.5%202.485,0%204.5,2.016%204.5,4.5%200,2.486%20-2.015,4.5%20-4.5,4.5%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cg%20id='edit'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20337,30.156%200,0.407%200,5.604%20c%200,1.658%20-1.344,3%20-3,3%20l%20-10,0%20c%20-1.655,0%20-3,-1.342%20-3,-3%20l%200,-10%20c%200,-1.657%201.345,-3%203,-3%20l%206.345,0%203.19,-3.17%20-9.535,0%20c%20-3.313,0%20-6,2.687%20-6,6%20l%200,10%20c%200,3.313%202.687,6%206,6%20l%2010,0%20c%203.314,0%206,-2.687%206,-6%20l%200,-8.809%20-3,2.968'%20id='path4240'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.72,24.637%20-8.892,8.892%20-2.828,0%200,-2.829%208.89,-8.89%20z'%20id='path4242'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.697,17.826%204,0%200,4%20-4,0%20z'%20transform='matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)'%20id='path4244'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cg%20id='remove'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20381,42%2018,0%200,-18%20-18,0%200,18%20z%20m%2014,-16%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z'%20id='path4247'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20395,20%200,-4%20-10,0%200,4%20-6,0%200,2%2022,0%200,-2%20-6,0%20z%20m%20-2,0%20-6,0%200,-2%206,0%200,2%20z'%20id='path4249'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3c/g%3e%3cg%20id='disabled'%20transform='translate(120,0)'%20style='fill:%23bbbbbb'%3e%3cuse%20xlink:href='%23edit'%20id='edit-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3cuse%20xlink:href='%23remove'%20id='remove-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3c/g%3e%3cpath%20style='fill:none;stroke:%23464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1'%20id='circle-3'%20d='m%20581.65725,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20/%3e%3c/svg%3e");background-repeat:no-repeat;background-size:300px 30px;background-clip:padding-box}.leaflet-retina .leaflet-draw-toolbar a{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAA8CAYAAAC6nMS5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAA16SURBVHic7d1/jBxneQfw7zNzvotdn+9sVQkxoRKoammBqqpbk6uT5mLfvHPn42yn1VFRVCEhoFH5IYpoSaUCKi1NcGkcfrbCVRFKEwG2aHLn83pmLvY2CTqT1AmCOBE0EOT4B0nBPw/snb2dp3/sLr6s77i923dud/a+H8ny7tzMo8f3eud99p133gGIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiFYGaXYCRETUPMYYrWe/MAzZX2QQ27d5OpqdABFROxgZGVlz5cqVrzuOc18QBJPNzofsYvvSYrVcgTVftZ2l6npgYODXHMc5oKoHHcfZHQTB2WbnRETpGRkZWVMoFA6IyO2qutX3/R1Z64TnO8fWOwLSzti+mSKDg4M3l0qlnSJyG4CbAFwP4ByAlwE8paoPX3fddcH4+PjP00yk5QqsrDPGvAZAHsBrReRNqvpeY8x/iMg9QRCcaXJ6ZIHv+xtUdReAHQBej/IHGABOAnhORMY6OjoempiYONe0JC3zPM84jjOqqrfi6r/3RQCPAdgXhmHUvOyaa3R01L1w4cJBALdVNq1W1THP87woir7ZzNyocWzf7PA8b4uI7E6S5A9Frqknb6j8eZOIvKNQKPzU9/1/dhznvlwuV0gjn5YbFapW09Vqu/Z9K9u2bdsNruvmUe50axUAfMV13X/I5XInlzcze2x/28lCu1b19fWt7u7u/hCAvwGwboHdL6jq7unp6T1TU1OXlyG9VAwODv5mkiR7Ady6wK6Plkqldz/yyCPfX468bBkaGuqamZm5E8DbReQNANYscMiLIrI1CILnZ280xrwHwL+hck4VkacBDLTS6HVaIxWt/Blm+zauldu3atOmTas2bNjwWRG5s7LplKp+VUQOuq77/bVr17589uzZ9SKy0XGcAVUdFZE/qOx7zHXdXWn0yy31i6sMw/4MyF6BZYy5XlWPiMhvL7BrrKpfcxznE7Uf4ixYqQWW53kbATw060NZr28nSbJzcnLyRBp5pcnzvNtE5CEAvXUecg7ArjAMH00xLWuGhoZuKpVKEwB+p85DXnRd9/ZcLvcDAOjv778un88XAChwtRMWkW+jxTpfYOV1wGxfO1q1fav6+vpWr1u3blxVtwH4uar+/fT09OcW+mJrjBkBcC+AXwdwBoAJw/AZm7m1zC+uUlyNA9g6189buZH7+/t/tbOz8wiANy7isKKqftV13U8eOnToe2nlZttKLLAqJ+qjAF69xBAnZ2Zmbj58+PApm3mlqTJydRTXFldHAUxVXvcBuLnm5+dU9c1RFP1v2jk2YmhoqKtUKj2B+jvfE0mS3D45OflD4OqcHADPh2H4F6h0wp7nva1YLOby+fz5dDKnerB9Vwzxff8BVX0bgFMAdoZheKzeg4eHh9cXi8WvAfAAvOC67ptzudz/WUvOVqBGVO7OmBCR/vn2adWOuL+/v7ezs3MSwKYlhkgAHBSRjwdB8JTF1FKx0gqsymXBxwH8XoOh/ieO41vz+fwVG3mlzRjzKF55WfA8gD8LwzA3ez/P87aLyIMAeqrbVDUfRdHty5Pp0hhjPgDgM9X3qnq/iNwPYM5RCdd1T1RPvLM63+q/ce/sTpiaj+27Mvi+f6eq/iuAi67r9uVyuWcXG6NSjB8B0KeqE1EUvcVWfk3v3OYZuXosjuPt+Xx+ull51WNgYKBHRKIlXDaaS6Kq+6Mo+lMLsVKz0gosz/M+KiKfsBTub8MwvMdSrNQYYzwAYc3m7bXFVZXv+8OqemD2NlUdiKLokbRybJQx5lsANlfefi4Mww/UedyvADgI4I9mbxeRDwdB8C92s0yHrc9wK3922b6Na+X2BYD+/v61nZ2dz6M8cX00DMP9S421ffv2V83MzDwHoNfmucuxEWSpslxcjYyMrHEcZ8xScQUAjoj8vqVYZIHv+xtE5MMWQ941PDy83mK8VIjIW2s2HZ2vuAKAIAgmADyxQIxWM3uu5J56DhgZGVkDYBw1nS+ApwB82VJeZAfbt82tWrXqPSgXV481UlwBwMGDB3+sqncDgIh81EZ+QBMLrKwXV5Uh5NoPYqMyN+m9nanqHVj4bsHF6InjeKfFeKmoLMUw+/2Ct6KLyOM1m2x/NmxbW30RhuGPFtp5jstGVU+JiNdqE57rEYahzB6lWOz7Fsf2be/2hYj8SeXlvTbiFYvFLwK4DOAWY8z1NmI2pcDKcnE1OjraWSgU9uPaD2LDRKSlJwavQCO2A4rIDtsxU7BxsQeoau2Jeak3BDTDL72kUm/n63neaFoJUkPYvm3G9/0NKN9gc7mrq6t2OsOSVGqPSQCuiAzaiLnsBVaWiysAuHDhwn4AQ2nEVtUfpBGXluwNKcRcaBmPVpDMfiMiW+o4pnafZM69MmYxnW9lsj9lCNs3m1T1tSjXL89aXo39WCX+62wEW9YCK+vFVcXLKcbmJcLW8qoUYmZhZOfFmvc3e563fb6djTFvwdUJxfPFyJx6O1/f999a6Xz5ZIwMYftm2o2Vv60+HUVETldeLnoUfy7LVmC1SXEFVf0YgFSeX5QkCQus9tfyIzsicnSObQ/6vj9cu71SXP1nPTGyplAo5FDT+arqk3Ecb5s9J0dV2flmENs3u0REgTmnJjRkVjwrd2Iuy3+adimuACCKotPGmC8A+GvLoZOZmZkXLMekBojIaVX9DcthTy+8S3MlSTIuIu+q2dyjqgeMMU8A+CYAUdUtAOa8izZJkvG081wG19xN5jjO4ByLTLrLlRBZxfbNrjMAICI3LrTjIlVHrqyMjKU+gtVOxVVVHMf/hHkWrGvAiawsQrlSqOqiF61rRkzbOjo6AsxfCG4G8FcAPvhLlih5qVgsWpl42kIyezcZ1YXtmy0/QvlqwG9V1i6zZRMAiIiV+dCpFljtWFwBQOUbzqcth+XlwdZjfRRGRMZsx7St8mT5zzcQ4r52+LKgqp9S1U8B+GTtZSPKPrZvdlXaagrAalU1NmJWCrVtAEqO4xyyETO1S4TtWlxVXbp06b7u7u6/BHCTjXiqygKrxYjIQ6p6L2Y9BqZB51etWtXyBRYAuK77hVKp9H5cnUxarzOu634xjZyWWxRFdzU7B0oP2zfbVPUbIrLFcZwPAfivRuOJyPtUdbWq5m09jzCVEax2L64AYGpq6rKq/qOteI7jsMBqMUEQnFXV3bbiqerdExMT52zFS1Mul7soIovugETkI7lc7mIaORERVRWLxS8BeElVb/F9v6EnR/i+f6Oq3gUAjuPYejSavQLLGKPVP4VC4Wd4ZXF1pKura7Bdiquq3t7efwfwnKVwLLBa0PT09B5U1kZp0BPFYvGzFuIsmyAI7kf5uWz1OhgEwTV3FLaoX5yLKosWLknNsZcayohsYvu2uUo98TEAUNW9vu8vad3CoaGhLlX9BoBeAONBEByxleNyLNPwWBzHOywvBtYS9u3bV1LVj1sKxwKrBU1NTV12XXcXgFMNhDmpqndkcF6SisifAzhRx76n4jh+Byzd3rwMjldfqOqSV+xPkmT2yvzH592RlhvbdwUIw3AvgAcArFPVcHBwcFHPBvZ9f0OpVDqA8qrwL8Rx/E6b+VkvsGqfZ9ROlwXnEkXRfgDfajCMXrx48Yc28iH7crncSVXdrKpPLvZYEXk6SZItURS1/PIMcwmC4KzjOCMAam9dn+0SgJ35fP4ny5SWDQ/Mer3HGLPoTtgYMyIiv3gOmqpmZfRuJWD7rgwax/G7UH7EzcYkSf7bGHNXX1/f6oUO9H1/Z+WcPoDysgw7bJ/DUl8Hq52LqwoVkb9T1WiRx8UoX158RlWfnJqaupxCbmRJFEWn+/r6buvu7v4ggI9g4Ynv50XknkKh8JkMjly9wqFDh77j+/6oqo4BqD1xXRaRPw6CwMZl1GXjuu6XSqXSOwH8LoD1AMaMMecA1PtF53WV4wCUC+menp699jOlpWD7rhz5fP5Kf3//UFdX132q+l4Ad3d3d7/fGPN1EZlQ1e/19PS8dPbs2fWu694kIgOqOqqqm4Dy4rKlUumOw4cPN3KVYk7WVkE1xsx5aSBLT+duhDEmQrkSnssZlIeXnxWRY6p6PI7j41nveFeq4eHh9XEc7xSRnQBej6t3kp5EuWh+OI7jh+dYsDDTfN/frKrjAKpPmv9pkiS7JicnH29mXku1devWV3d0dBxAuRNeMhF5ulgsjqRxgk7DfOfqxWr1czvbtzGt3r5zGRwc7FPV3ap6y0L7ishPAHx63bp1e/bt2xenkQ8LLEuMMZtE5JCqfhfAMwCeSZLkO2vWrDk+NjbGyZHUFjzP2yginwcAVX1fVi99Vo2OjnaeP3/+3SLydgBvBNBd56GXAHxXVR/s7e3dm9YJOg0rqQNm+y5dFtp3HmKM2QxgF8qr9b8GwA0AzgH4MYBjIjJ28eLFkFeOiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIhWgv8Hnffz4dmwY9cAAAAASUVORK5CYII=);background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20viewBox='0%200%20600%2060'%20height='60'%20width='600'%20id='svg4225'%20version='1.1'%20inkscape:version='0.91%20r13725'%20sodipodi:docname='spritesheet.svg'%20inkscape:export-filename='/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png'%20inkscape:export-xdpi='90'%20inkscape:export-ydpi='90'%3e%3cmetadata%20id='metadata4258'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%20/%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%20id='defs4256'%20/%3e%3csodipodi:namedview%20pagecolor='%23ffffff'%20bordercolor='%23666666'%20borderopacity='1'%20objecttolerance='10'%20gridtolerance='10'%20guidetolerance='10'%20inkscape:pageopacity='0'%20inkscape:pageshadow='2'%20inkscape:window-width='1920'%20inkscape:window-height='1056'%20id='namedview4254'%20showgrid='false'%20inkscape:zoom='1.3101852'%20inkscape:cx='237.56928'%20inkscape:cy='7.2419621'%20inkscape:window-x='1920'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4225'%20/%3e%3cg%20id='enabled'%20style='fill:%23464646;fill-opacity:1'%3e%3cg%20id='polyline'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%2018,36%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4229'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2036,18%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4231'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2023.142,39.145%20-2.285,-2.29%2016,-15.998%202.285,2.285%20z'%20id='path4233'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cpath%20id='polygon'%20d='M%20100,24.565%2097.904,39.395%2083.07,42%2076,28.773%2086.463,18%20Z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='rectangle'%20d='m%20140,20%2020,0%200,20%20-20,0%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='circle'%20d='m%20221,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='marker'%20d='m%20270,19%20c%20-4.971,0%20-9,4.029%20-9,9%200,4.971%205.001,12%209,14%204.001,-2%209,-9.029%209,-14%200,-4.971%20-4.029,-9%20-9,-9%20z%20m%200,12.5%20c%20-2.484,0%20-4.5,-2.014%20-4.5,-4.5%200,-2.484%202.016,-4.5%204.5,-4.5%202.485,0%204.5,2.016%204.5,4.5%200,2.486%20-2.015,4.5%20-4.5,4.5%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cg%20id='edit'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20337,30.156%200,0.407%200,5.604%20c%200,1.658%20-1.344,3%20-3,3%20l%20-10,0%20c%20-1.655,0%20-3,-1.342%20-3,-3%20l%200,-10%20c%200,-1.657%201.345,-3%203,-3%20l%206.345,0%203.19,-3.17%20-9.535,0%20c%20-3.313,0%20-6,2.687%20-6,6%20l%200,10%20c%200,3.313%202.687,6%206,6%20l%2010,0%20c%203.314,0%206,-2.687%206,-6%20l%200,-8.809%20-3,2.968'%20id='path4240'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.72,24.637%20-8.892,8.892%20-2.828,0%200,-2.829%208.89,-8.89%20z'%20id='path4242'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.697,17.826%204,0%200,4%20-4,0%20z'%20transform='matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)'%20id='path4244'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cg%20id='remove'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20381,42%2018,0%200,-18%20-18,0%200,18%20z%20m%2014,-16%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z'%20id='path4247'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20395,20%200,-4%20-10,0%200,4%20-6,0%200,2%2022,0%200,-2%20-6,0%20z%20m%20-2,0%20-6,0%200,-2%206,0%200,2%20z'%20id='path4249'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3c/g%3e%3cg%20id='disabled'%20transform='translate(120,0)'%20style='fill:%23bbbbbb'%3e%3cuse%20xlink:href='%23edit'%20id='edit-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3cuse%20xlink:href='%23remove'%20id='remove-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3c/g%3e%3cpath%20style='fill:none;stroke:%23464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1'%20id='circle-3'%20d='m%20581.65725,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20/%3e%3c/svg%3e")}.leaflet-draw a{display:block;text-align:center;text-decoration:none}.leaflet-draw a .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.leaflet-draw-actions{display:none;list-style:none;margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap}.leaflet-touch .leaflet-draw-actions{left:32px}.leaflet-right .leaflet-draw-actions{right:26px;left:auto}.leaflet-touch .leaflet-right .leaflet-draw-actions{right:32px;left:auto}.leaflet-draw-actions li{display:inline-block}.leaflet-draw-actions li:first-child a{border-left:0}.leaflet-draw-actions li:last-child a{-webkit-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.leaflet-right .leaflet-draw-actions li:last-child a{-webkit-border-radius:0;border-radius:0}.leaflet-right .leaflet-draw-actions li:first-child a{-webkit-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.leaflet-draw-actions a{background-color:#919187;border-left:1px solid #AAA;color:#fff;font:11px/19px Helvetica Neue,Arial,Helvetica,sans-serif;line-height:28px;text-decoration:none;padding-left:10px;padding-right:10px;height:28px}.leaflet-touch .leaflet-draw-actions a{font-size:12px;line-height:30px;height:30px}.leaflet-draw-actions-bottom{margin-top:0}.leaflet-draw-actions-top{margin-top:1px}.leaflet-draw-actions-top a,.leaflet-draw-actions-bottom a{height:27px;line-height:27px}.leaflet-draw-actions a:hover{background-color:#a0a098}.leaflet-draw-actions-top.leaflet-draw-actions-bottom a{height:26px;line-height:26px}.leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:-2px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:0 -1px}.leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-31px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-29px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-62px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-60px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-92px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-90px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-122px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-120px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-273px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-271px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-152px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-150px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-182px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-180px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-212px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-210px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-242px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-240px -2px}.leaflet-mouse-marker{background-color:#fff;cursor:crosshair}.leaflet-draw-tooltip{background:#363636;background:#00000080;border:1px solid transparent;-webkit-border-radius:4px;border-radius:4px;color:#fff;font:12px/18px Helvetica Neue,Arial,Helvetica,sans-serif;margin-left:20px;margin-top:-21px;padding:4px 8px;position:absolute;visibility:hidden;white-space:nowrap;z-index:6}.leaflet-draw-tooltip:before{border-right:6px solid black;border-right-color:#00000080;border-top:6px solid transparent;border-bottom:6px solid transparent;content:"";position:absolute;top:7px;left:-7px}.leaflet-error-draw-tooltip{background-color:#f2dede;border:1px solid #e6b6bd;color:#b94a48}.leaflet-error-draw-tooltip:before{border-right-color:#e6b6bd}.leaflet-draw-tooltip-single{margin-top:-12px}.leaflet-draw-tooltip-subtext{color:#f8d5e4}.leaflet-draw-guide-dash{font-size:1%;opacity:.6;position:absolute;width:5px;height:5px}.leaflet-edit-marker-selected{background-color:#fe57a11a;border:4px dashed rgba(254,87,161,.6);-webkit-border-radius:4px;border-radius:4px;box-sizing:content-box}.leaflet-edit-move{cursor:move}.leaflet-edit-resize{cursor:pointer}.leaflet-oldie .leaflet-draw-toolbar{border:1px solid #999}`,gc=".leaflet-ruler{height:35px;width:35px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfhBQoMHg6McuYvAAABwklEQVQ4y43TP0jUYRgH8M/daQpqdujhnwShGiwyipCIoIgWxyIwrqEhnCQoGqKhpoYMg1qCQjg8TC2JCtSkjCgaKisIhyQUwpJssD9KZWRZg6d450/yGV54n/fzfd53eUOCaoNa5QpNGNPr9cKjUAatdsB++co0G1XiiHd+uqnTq8VzI874o9s2Ic1iiEpii9tmnJOdfkOldt/dU+HYolHnjdmpRNzbuVaNL86m4sXqNOrz3kMXHFKYMqd8VREGBToMifqLgwY1yNZirya5knaBqH16fJjNJiWEFSlxy4g980+pMuZkir/UJjLbrvNRPnINaLUygK/yQpuImHp47LOjuKJPOJA/1y4iZsAlyozLs8IO42L/4QlhGrSCy5oCeKH+dM59vVbL9sn6AP5MRzpnVKtN1viRxit1WRvEmVKFrQbTpoddNR3E+aYKuw1lPOapa0GcEf22KzOtejmcG1rkYdjEAn59KU5cDzjt+HI4BSZtVJTazfIsMQOmFAusLr/E53lniickJYIDNcaUL+JhMZPWBUdOeCCaweGOw5k0lFrv2uyRuBxPlLpoBtTK0p3mh+f+dKl6jX6LapRj6XrzD+1bmkFA/dTVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA1LTEwVDEyOjMwOjE0KzAyOjAwUNH5TAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wNS0xMFQxMjozMDoxNCswMjowMCGMQfAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:center}.leaflet-ruler:hover{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=)}.leaflet-ruler-clicked{height:35px;width:35px;background-repeat:no-repeat;background-position:center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=);border-color:#7fff00!important}.leaflet-bar{background-color:#fff}.leaflet-control{cursor:pointer}.result-tooltip{background-color:#fff;border-width:medium;border-color:#de0000;font-size:smaller}.moving-tooltip{background-color:#ffffffb3;background-clip:padding-box;opacity:.5;border:dotted;border-color:red;font-size:smaller}.plus-length{padding-left:45px}",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",_c="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='430'%20height='430'%20style='width:100%25;height:100%25;transform:translate3d(0,0,0);content-visibility:visible'%20viewBox='0%200%20430%20430'%3e%3cdefs%3e%3cclipPath%20id='i'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='e'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='p'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='f'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='m'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='g'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='j'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='h'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cfilter%20id='t'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cfilter%20id='r'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'%20stdDeviation='52.5%2052.5'/%3e%3c/filter%3e%3cfilter%20id='n'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cfilter%20id='k'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cmask%20id='u'%20mask-type='alpha'%3e%3cuse%20xmlns:ns1='http://www.w3.org/1999/xlink'%20ns1:href='%23a'/%3e%3c/mask%3e%3cmask%20id='q'%20mask-type='alpha'%3e%3cuse%20xmlns:ns2='http://www.w3.org/1999/xlink'%20ns2:href='%23b'/%3e%3c/mask%3e%3cmask%20id='o'%20mask-type='alpha'%3e%3cuse%20xmlns:ns3='http://www.w3.org/1999/xlink'%20ns3:href='%23c'/%3e%3c/mask%3e%3cmask%20id='l'%20mask-type='alpha'%3e%3cuse%20xmlns:ns4='http://www.w3.org/1999/xlink'%20ns4:href='%23d'/%3e%3c/mask%3e%3cg%20id='a'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23e)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3cg%20id='b'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='12'%20clip-path='url(%23f)'%20style='display:block'%3e%3cpath%20stroke='%2308A88A'%20d='M44.446-66.518a79.998%2079.998%200%200%200-101.012%209.952A79.998%2079.998%200%201%200%2056.569%2056.569%2080.005%2080.005%200%200%200%2073.91-30.615a80.001%2080.001%200%200%200-29.464-35.903z'%20class='secondary'%20style='display:block'%20transform='translate(215%20214)'/%3e%3cpath%20stroke='%23121331'%20d='m141.409%2025.241%208.727%205.041s0%200%200%200a22.3%2022.3%200%200%201%2010.411%2013.542%2022.32%2022.32%200%200%201-2.221%2016.937l-26.515%2045.924a22.325%2022.325%200%200%201-30.497%208.172l-8.754-5.059a143.414%20143.414%200%200%201-43.718%2025.286v10.108a22.302%2022.302%200%200%201-13.778%2020.612%2022.303%2022.303%200%200%201-8.539%201.696h-53.029a22.303%2022.303%200%200%201-15.779-6.531%2022.302%2022.302%200%200%201-6.537-15.777v-10.073a143.416%20143.416%200%200%201-43.719-25.285l-8.754%205.059a22.325%2022.325%200%200%201-30.497-8.172l-26.523-45.924a22.315%2022.315%200%200%201-2.238-16.943A22.31%2022.31%200%200%201-150.142%2030.3l8.727-5.041a145.097%20145.097%200%200%201%200-50.518l-8.727-5.041a22.294%2022.294%200%200%201-10.409-13.554%2022.306%2022.306%200%200%201%202.238-16.943l26.514-45.924a22.325%2022.325%200%200%201%2030.497-8.172l8.754%205.059a143.416%20143.416%200%200%201%2043.719-25.285v-10.073a22.302%2022.302%200%200%201%206.537-15.777%2022.3%2022.3%200%200%201%2015.779-6.531h53.02a22.307%2022.307%200%200%201%2022.317%2022.308v10.037a143.41%20143.41%200%200%201%2043.718%2025.285l8.754-5.059a22.325%2022.325%200%200%201%2030.497%208.172l26.515%2045.942a22.313%2022.313%200%200%201-1.618%2024.757%2022.294%2022.294%200%200%201-6.554%205.74l-8.727%205.041a145.097%20145.097%200%200%201%200%2050.518z'%20class='primary'%20style='display:block'%20transform='rotate(-120%20169.576%2045.095)'/%3e%3c/g%3e%3cg%20id='c'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23g)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3cg%20id='d'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23h)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3c/defs%3e%3cg%20clip-path='url(%23i)'%3e%3cg%20clip-path='url(%23j)'%20filter='url(%23k)'%20mask='url(%23l)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23m)'%20filter='url(%23n)'%20mask='url(%23o)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23p)'%20mask='url(%23q)'%20style='display:block'%3e%3cg%20filter='url(%23r)'%20transform='rotate(-94%20238.762%20-16.565)%20scale(2.4)'%3e%3cg%20class='design'%3e%3cpath%20fill='%234BE1EC'%20d='M0-250c137.975%200%20250%20112.025%20250%20250S137.975%20250%200%20250-250%20137.975-250%200-137.975-250%200-250z'%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20fill='%23CB5EEE'%20d='M113.242-295.384c97.478%200%20176.5%2079.022%20176.5%20176.5s-79.022%20176.5-176.5%20176.5c-43.948%200-74.396-34.057-105.29-60.631-37.631-32.369-71.21-62.338-71.21-115.869%200-97.478%2079.022-176.5%20176.5-176.5z'%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23s)'%20filter='url(%23t)'%20mask='url(%23u)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Ml="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%20-1.67%2047.336%2047.336'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group_42'%20data-name='Group%2042'%20transform='translate(-172.455%20-364.36)'%3e%3cpath%20id='Rectangle_17'%20data-name='Rectangle%2017'%20d='M4.351,0H40.984a4.351,4.351,0,0,1,4.351,4.351V22.117a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z'%20transform='translate(173.455%20384.243)'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cpath%20id='Path_90'%20data-name='Path%2090'%20d='M218.79,390.249a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.778,3.778,0,0,1-3.777-3.778'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cg%20id='Group_41'%20data-name='Group%2041'%3e%3cpath%20id='Rectangle_18'%20data-name='Rectangle%2018'%20d='M4.351,0H26.473a4.351,4.351,0,0,1,4.351,4.351V17.883a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z'%20transform='translate(180.71%20365.36)'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cpath%20id='Path_91'%20data-name='Path%2091'%20d='M211.234,370.794a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfhBQoMHg6McuYvAAABwklEQVQ4y43TP0jUYRgH8M/daQpqdujhnwShGiwyipCIoIgWxyIwrqEhnCQoGqKhpoYMg1qCQjg8TC2JCtSkjCgaKisIhyQUwpJssD9KZWRZg6d450/yGV54n/fzfd53eUOCaoNa5QpNGNPr9cKjUAatdsB++co0G1XiiHd+uqnTq8VzI874o9s2Ic1iiEpii9tmnJOdfkOldt/dU+HYolHnjdmpRNzbuVaNL86m4sXqNOrz3kMXHFKYMqd8VREGBToMifqLgwY1yNZirya5knaBqH16fJjNJiWEFSlxy4g980+pMuZkir/UJjLbrvNRPnINaLUygK/yQpuImHp47LOjuKJPOJA/1y4iZsAlyozLs8IO42L/4QlhGrSCy5oCeKH+dM59vVbL9sn6AP5MRzpnVKtN1viRxit1WRvEmVKFrQbTpoddNR3E+aYKuw1lPOapa0GcEf22KzOtejmcG1rkYdjEAn59KU5cDzjt+HI4BSZtVJTazfIsMQOmFAusLr/E53lniickJYIDNcaUL+JhMZPWBUdOeCCaweGOw5k0lFrv2uyRuBxPlLpoBtTK0p3mh+f+dKl6jX6LapRj6XrzD+1bmkFA/dTVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA1LTEwVDEyOjMwOjE0KzAyOjAwUNH5TAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wNS0xMFQxMjozMDoxNCswMjowMCGMQfAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=";function xc(a){const n="data-leaflet-styles";if(a.querySelector(`style[${n}]`))return;const i=document.createElement("style");i.setAttribute(n,"true"),i.textContent=`
|
|
1
|
+
(function(Nt,Ge){typeof exports=="object"&&typeof module!="undefined"?Ge(exports):typeof define=="function"&&define.amd?define(["exports"],Ge):(Nt=typeof globalThis!="undefined"?globalThis:Nt||self,Ge(Nt.LeafletGeoKit={}))})(this,(function(Nt){"use strict";var bm=Object.defineProperty;var xm=(Nt,Ge,ie)=>Ge in Nt?bm(Nt,Ge,{enumerable:!0,configurable:!0,writable:!0,value:ie}):Nt[Ge]=ie;var Q=(Nt,Ge,ie)=>xm(Nt,typeof Ge!="symbol"?Ge+"":Ge,ie);var Wh,jh;function Ge(a,n){for(var i=0;i<n.length;i++){const s=n[i];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in a)){const h=Object.getOwnPropertyDescriptor(s,r);h&&Object.defineProperty(a,r,h.get?h:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}const ie={Ready:"leaflet-draw:ready",Created:"leaflet-draw:created",Edited:"leaflet-draw:edited",Deleted:"leaflet-draw:deleted",Error:"leaflet-draw:error",Ingest:"leaflet-draw:ingest",Export:"leaflet-draw:export"},_i={Status:"leaflet-geokit:status",Diagnostic:"leaflet-geokit:diagnostic",ToolCommand:"leaflet-geokit:tool-command",ToolCommanded:"leaflet-geokit:tool-commanded",ToolStarted:"leaflet-geokit:tool-started",ToolCompleted:"leaflet-geokit:tool-completed",ToolCancelled:"leaflet-geokit:tool-cancelled",ToolFailed:"leaflet-geokit:tool-failed",ToolStateChanged:"leaflet-geokit:tool-state-changed",ToolCapabilitiesChanged:"leaflet-geokit:tool-capabilities-changed",LayersChanged:"leaflet-geokit:layers-changed",LayerStyleRequest:"leaflet-geokit:layer-style-request",LayerCakeSessionStarted:"tool:layer-cake:session-started",LayerCakeSessionChanged:"tool:layer-cake:session-changed",LayerCakeSaved:"tool:layer-cake:saved",LayerCakeCancelled:"tool:layer-cake:cancelled"},Tl={trace:10,debug:20,info:30,warn:40,error:50};function uc(a,n){return a==="silent"?!1:Tl[n]>=Tl[a]}function hc(){try{return new Date().toISOString()}catch{return""}}function Ro(a,n="debug",i=console){let s=n;const r=f=>(...d)=>{try{if(!uc(s,f))return;const m=`[${hc()}][${a}][${f.toUpperCase()}]`,_=i[f];typeof _=="function"?_(m,...d):i.log(m,...d)}catch{}};return{get level(){return s},setLevel(f){s=f},trace:r("trace"),debug:r("debug"),info:r("info"),warn:r("warn"),error:r("error"),child(f){return Ro(`${a}:${f}`,s,i)}}}function Il(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Sr={exports:{}};var cc=Sr.exports,Cl;function Sl(){return Cl||(Cl=1,(function(a,n){(function(i,s){s(n)})(cc,(function(i){var s="1.9.4";function r(o){var c,p,v,k;for(p=1,v=arguments.length;p<v;p++){k=arguments[p];for(c in k)o[c]=k[c]}return o}var h=Object.create||(function(){function o(){}return function(c){return o.prototype=c,new o}})();function f(o,c){var p=Array.prototype.slice;if(o.bind)return o.bind.apply(o,p.call(arguments,1));var v=p.call(arguments,2);return function(){return o.apply(c,v.length?v.concat(p.call(arguments)):arguments)}}var d=0;function m(o){return"_leaflet_id"in o||(o._leaflet_id=++d),o._leaflet_id}function _(o,c,p){var v,k,A,V;return V=function(){v=!1,k&&(A.apply(p,k),k=!1)},A=function(){v?k=arguments:(o.apply(p,arguments),setTimeout(V,c),v=!0)},A}function x(o,c,p){var v=c[1],k=c[0],A=v-k;return o===v&&p?o:((o-k)%A+A)%A+k}function b(){return!1}function E(o,c){if(c===!1)return o;var p=Math.pow(10,c===void 0?6:c);return Math.round(o*p)/p}function C(o){return o.trim?o.trim():o.replace(/^\s+|\s+$/g,"")}function S(o){return C(o).split(/\s+/)}function O(o,c){Object.prototype.hasOwnProperty.call(o,"options")||(o.options=o.options?h(o.options):{});for(var p in c)o.options[p]=c[p];return o.options}function N(o,c,p){var v=[];for(var k in o)v.push(encodeURIComponent(p?k.toUpperCase():k)+"="+encodeURIComponent(o[k]));return(!c||c.indexOf("?")===-1?"?":"&")+v.join("&")}var G=/\{ *([\w_ -]+) *\}/g;function D(o,c){return o.replace(G,function(p,v){var k=c[v];if(k===void 0)throw new Error("No value provided for variable "+p);return typeof k=="function"&&(k=k(c)),k})}var U=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"};function W(o,c){for(var p=0;p<o.length;p++)if(o[p]===c)return p;return-1}var X="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function et(o){return window["webkit"+o]||window["moz"+o]||window["ms"+o]}var ot=0;function I(o){var c=+new Date,p=Math.max(0,16-(c-ot));return ot=c+p,window.setTimeout(o,p)}var P=window.requestAnimationFrame||et("RequestAnimationFrame")||I,R=window.cancelAnimationFrame||et("CancelAnimationFrame")||et("CancelRequestAnimationFrame")||function(o){window.clearTimeout(o)};function F(o,c,p){if(p&&P===I)o.call(c);else return P.call(window,f(o,c))}function q(o){o&&R.call(window,o)}var H={__proto__:null,extend:r,create:h,bind:f,get lastId(){return d},stamp:m,throttle:_,wrapNum:x,falseFn:b,formatNum:E,trim:C,splitWords:S,setOptions:O,getParamString:N,template:D,isArray:U,indexOf:W,emptyImageUrl:X,requestFn:P,cancelFn:R,requestAnimFrame:F,cancelAnimFrame:q};function j(){}j.extend=function(o){var c=function(){O(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},p=c.__super__=this.prototype,v=h(p);v.constructor=c,c.prototype=v;for(var k in this)Object.prototype.hasOwnProperty.call(this,k)&&k!=="prototype"&&k!=="__super__"&&(c[k]=this[k]);return o.statics&&r(c,o.statics),o.includes&&(B(o.includes),r.apply(null,[v].concat(o.includes))),r(v,o),delete v.statics,delete v.includes,v.options&&(v.options=p.options?h(p.options):{},r(v.options,o.options)),v._initHooks=[],v.callInitHooks=function(){if(!this._initHooksCalled){p.callInitHooks&&p.callInitHooks.call(this),this._initHooksCalled=!0;for(var A=0,V=v._initHooks.length;A<V;A++)v._initHooks[A].call(this)}},c},j.include=function(o){var c=this.prototype.options;return r(this.prototype,o),o.options&&(this.prototype.options=c,this.mergeOptions(o.options)),this},j.mergeOptions=function(o){return r(this.prototype.options,o),this},j.addInitHook=function(o){var c=Array.prototype.slice.call(arguments,1),p=typeof o=="function"?o:function(){this[o].apply(this,c)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(p),this};function B(o){if(!(typeof L=="undefined"||!L||!L.Mixin)){o=U(o)?o:[o];for(var c=0;c<o.length;c++)o[c]===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 Y={on:function(o,c,p){if(typeof o=="object")for(var v in o)this._on(v,o[v],c);else{o=S(o);for(var k=0,A=o.length;k<A;k++)this._on(o[k],c,p)}return this},off:function(o,c,p){if(!arguments.length)delete this._events;else if(typeof o=="object")for(var v in o)this._off(v,o[v],c);else{o=S(o);for(var k=arguments.length===1,A=0,V=o.length;A<V;A++)k?this._off(o[A]):this._off(o[A],c,p)}return this},_on:function(o,c,p,v){if(typeof c!="function"){console.warn("wrong listener type: "+typeof c);return}if(this._listens(o,c,p)===!1){p===this&&(p=void 0);var k={fn:c,ctx:p};v&&(k.once=!0),this._events=this._events||{},this._events[o]=this._events[o]||[],this._events[o].push(k)}},_off:function(o,c,p){var v,k,A;if(this._events&&(v=this._events[o],!!v)){if(arguments.length===1){if(this._firingCount)for(k=0,A=v.length;k<A;k++)v[k].fn=b;delete this._events[o];return}if(typeof c!="function"){console.warn("wrong listener type: "+typeof c);return}var V=this._listens(o,c,p);if(V!==!1){var nt=v[V];this._firingCount&&(nt.fn=b,this._events[o]=v=v.slice()),v.splice(V,1)}}},fire:function(o,c,p){if(!this.listens(o,p))return this;var v=r({},c,{type:o,target:this,sourceTarget:c&&c.sourceTarget||this});if(this._events){var k=this._events[o];if(k){this._firingCount=this._firingCount+1||1;for(var A=0,V=k.length;A<V;A++){var nt=k[A],st=nt.fn;nt.once&&this.off(o,st,nt.ctx),st.call(nt.ctx||this,v)}this._firingCount--}}return p&&this._propagateEvent(v),this},listens:function(o,c,p,v){typeof o!="string"&&console.warn('"string" type argument expected');var k=c;typeof c!="function"&&(v=!!c,k=void 0,p=void 0);var A=this._events&&this._events[o];if(A&&A.length&&this._listens(o,k,p)!==!1)return!0;if(v){for(var V in this._eventParents)if(this._eventParents[V].listens(o,c,p,v))return!0}return!1},_listens:function(o,c,p){if(!this._events)return!1;var v=this._events[o]||[];if(!c)return!!v.length;p===this&&(p=void 0);for(var k=0,A=v.length;k<A;k++)if(v[k].fn===c&&v[k].ctx===p)return k;return!1},once:function(o,c,p){if(typeof o=="object")for(var v in o)this._on(v,o[v],c,!0);else{o=S(o);for(var k=0,A=o.length;k<A;k++)this._on(o[k],c,p,!0)}return this},addEventParent:function(o){return this._eventParents=this._eventParents||{},this._eventParents[m(o)]=o,this},removeEventParent:function(o){return this._eventParents&&delete this._eventParents[m(o)],this},_propagateEvent:function(o){for(var c in this._eventParents)this._eventParents[c].fire(o.type,r({layer:o.target,propagatedFrom:o.target},o),!0)}};Y.addEventListener=Y.on,Y.removeEventListener=Y.clearAllEventListeners=Y.off,Y.addOneTimeEventListener=Y.once,Y.fireEvent=Y.fire,Y.hasEventListeners=Y.listens;var $=j.extend(Y);function J(o,c,p){this.x=p?Math.round(o):o,this.y=p?Math.round(c):c}var at=Math.trunc||function(o){return o>0?Math.floor(o):Math.ceil(o)};J.prototype={clone:function(){return new J(this.x,this.y)},add:function(o){return this.clone()._add(rt(o))},_add:function(o){return this.x+=o.x,this.y+=o.y,this},subtract:function(o){return this.clone()._subtract(rt(o))},_subtract:function(o){return this.x-=o.x,this.y-=o.y,this},divideBy:function(o){return this.clone()._divideBy(o)},_divideBy:function(o){return this.x/=o,this.y/=o,this},multiplyBy:function(o){return this.clone()._multiplyBy(o)},_multiplyBy:function(o){return this.x*=o,this.y*=o,this},scaleBy:function(o){return new J(this.x*o.x,this.y*o.y)},unscaleBy:function(o){return new J(this.x/o.x,this.y/o.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=at(this.x),this.y=at(this.y),this},distanceTo:function(o){o=rt(o);var c=o.x-this.x,p=o.y-this.y;return Math.sqrt(c*c+p*p)},equals:function(o){return o=rt(o),o.x===this.x&&o.y===this.y},contains:function(o){return o=rt(o),Math.abs(o.x)<=Math.abs(this.x)&&Math.abs(o.y)<=Math.abs(this.y)},toString:function(){return"Point("+E(this.x)+", "+E(this.y)+")"}};function rt(o,c,p){return o instanceof J?o:U(o)?new J(o[0],o[1]):o==null?o:typeof o=="object"&&"x"in o&&"y"in o?new J(o.x,o.y):new J(o,c,p)}function ht(o,c){if(o)for(var p=c?[o,c]:o,v=0,k=p.length;v<k;v++)this.extend(p[v])}ht.prototype={extend:function(o){var c,p;if(!o)return this;if(o instanceof J||typeof o[0]=="number"||"x"in o)c=p=rt(o);else if(o=_t(o),c=o.min,p=o.max,!c||!p)return this;return!this.min&&!this.max?(this.min=c.clone(),this.max=p.clone()):(this.min.x=Math.min(c.x,this.min.x),this.max.x=Math.max(p.x,this.max.x),this.min.y=Math.min(c.y,this.min.y),this.max.y=Math.max(p.y,this.max.y)),this},getCenter:function(o){return rt((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,o)},getBottomLeft:function(){return rt(this.min.x,this.max.y)},getTopRight:function(){return rt(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(o){var c,p;return typeof o[0]=="number"||o instanceof J?o=rt(o):o=_t(o),o instanceof ht?(c=o.min,p=o.max):c=p=o,c.x>=this.min.x&&p.x<=this.max.x&&c.y>=this.min.y&&p.y<=this.max.y},intersects:function(o){o=_t(o);var c=this.min,p=this.max,v=o.min,k=o.max,A=k.x>=c.x&&v.x<=p.x,V=k.y>=c.y&&v.y<=p.y;return A&&V},overlaps:function(o){o=_t(o);var c=this.min,p=this.max,v=o.min,k=o.max,A=k.x>c.x&&v.x<p.x,V=k.y>c.y&&v.y<p.y;return A&&V},isValid:function(){return!!(this.min&&this.max)},pad:function(o){var c=this.min,p=this.max,v=Math.abs(c.x-p.x)*o,k=Math.abs(c.y-p.y)*o;return _t(rt(c.x-v,c.y-k),rt(p.x+v,p.y+k))},equals:function(o){return o?(o=_t(o),this.min.equals(o.getTopLeft())&&this.max.equals(o.getBottomRight())):!1}};function _t(o,c){return!o||o instanceof ht?o:new ht(o,c)}function kt(o,c){if(o)for(var p=c?[o,c]:o,v=0,k=p.length;v<k;v++)this.extend(p[v])}kt.prototype={extend:function(o){var c=this._southWest,p=this._northEast,v,k;if(o instanceof pt)v=o,k=o;else if(o instanceof kt){if(v=o._southWest,k=o._northEast,!v||!k)return this}else return o?this.extend(vt(o)||dt(o)):this;return!c&&!p?(this._southWest=new pt(v.lat,v.lng),this._northEast=new pt(k.lat,k.lng)):(c.lat=Math.min(v.lat,c.lat),c.lng=Math.min(v.lng,c.lng),p.lat=Math.max(k.lat,p.lat),p.lng=Math.max(k.lng,p.lng)),this},pad:function(o){var c=this._southWest,p=this._northEast,v=Math.abs(c.lat-p.lat)*o,k=Math.abs(c.lng-p.lng)*o;return new kt(new pt(c.lat-v,c.lng-k),new pt(p.lat+v,p.lng+k))},getCenter:function(){return new pt((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 pt(this.getNorth(),this.getWest())},getSouthEast:function(){return new pt(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(o){typeof o[0]=="number"||o instanceof pt||"lat"in o?o=vt(o):o=dt(o);var c=this._southWest,p=this._northEast,v,k;return o instanceof kt?(v=o.getSouthWest(),k=o.getNorthEast()):v=k=o,v.lat>=c.lat&&k.lat<=p.lat&&v.lng>=c.lng&&k.lng<=p.lng},intersects:function(o){o=dt(o);var c=this._southWest,p=this._northEast,v=o.getSouthWest(),k=o.getNorthEast(),A=k.lat>=c.lat&&v.lat<=p.lat,V=k.lng>=c.lng&&v.lng<=p.lng;return A&&V},overlaps:function(o){o=dt(o);var c=this._southWest,p=this._northEast,v=o.getSouthWest(),k=o.getNorthEast(),A=k.lat>c.lat&&v.lat<p.lat,V=k.lng>c.lng&&v.lng<p.lng;return A&&V},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(o,c){return o?(o=dt(o),this._southWest.equals(o.getSouthWest(),c)&&this._northEast.equals(o.getNorthEast(),c)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function dt(o,c){return o instanceof kt?o:new kt(o,c)}function pt(o,c,p){if(isNaN(o)||isNaN(c))throw new Error("Invalid LatLng object: ("+o+", "+c+")");this.lat=+o,this.lng=+c,p!==void 0&&(this.alt=+p)}pt.prototype={equals:function(o,c){if(!o)return!1;o=vt(o);var p=Math.max(Math.abs(this.lat-o.lat),Math.abs(this.lng-o.lng));return p<=(c===void 0?1e-9:c)},toString:function(o){return"LatLng("+E(this.lat,o)+", "+E(this.lng,o)+")"},distanceTo:function(o){return tt.distance(this,vt(o))},wrap:function(){return tt.wrapLatLng(this)},toBounds:function(o){var c=180*o/40075017,p=c/Math.cos(Math.PI/180*this.lat);return dt([this.lat-c,this.lng-p],[this.lat+c,this.lng+p])},clone:function(){return new pt(this.lat,this.lng,this.alt)}};function vt(o,c,p){return o instanceof pt?o:U(o)&&typeof o[0]!="object"?o.length===3?new pt(o[0],o[1],o[2]):o.length===2?new pt(o[0],o[1]):null:o==null?o:typeof o=="object"&&"lat"in o?new pt(o.lat,"lng"in o?o.lng:o.lon,o.alt):c===void 0?null:new pt(o,c,p)}var Yt={latLngToPoint:function(o,c){var p=this.projection.project(o),v=this.scale(c);return this.transformation._transform(p,v)},pointToLatLng:function(o,c){var p=this.scale(c),v=this.transformation.untransform(o,p);return this.projection.unproject(v)},project:function(o){return this.projection.project(o)},unproject:function(o){return this.projection.unproject(o)},scale:function(o){return 256*Math.pow(2,o)},zoom:function(o){return Math.log(o/256)/Math.LN2},getProjectedBounds:function(o){if(this.infinite)return null;var c=this.projection.bounds,p=this.scale(o),v=this.transformation.transform(c.min,p),k=this.transformation.transform(c.max,p);return new ht(v,k)},infinite:!1,wrapLatLng:function(o){var c=this.wrapLng?x(o.lng,this.wrapLng,!0):o.lng,p=this.wrapLat?x(o.lat,this.wrapLat,!0):o.lat,v=o.alt;return new pt(p,c,v)},wrapLatLngBounds:function(o){var c=o.getCenter(),p=this.wrapLatLng(c),v=c.lat-p.lat,k=c.lng-p.lng;if(v===0&&k===0)return o;var A=o.getSouthWest(),V=o.getNorthEast(),nt=new pt(A.lat-v,A.lng-k),st=new pt(V.lat-v,V.lng-k);return new kt(nt,st)}},tt=r({},Yt,{wrapLng:[-180,180],R:6371e3,distance:function(o,c){var p=Math.PI/180,v=o.lat*p,k=c.lat*p,A=Math.sin((c.lat-o.lat)*p/2),V=Math.sin((c.lng-o.lng)*p/2),nt=A*A+Math.cos(v)*Math.cos(k)*V*V,st=2*Math.atan2(Math.sqrt(nt),Math.sqrt(1-nt));return this.R*st}}),en=6378137,qt={R:en,MAX_LATITUDE:85.0511287798,project:function(o){var c=Math.PI/180,p=this.MAX_LATITUDE,v=Math.max(Math.min(p,o.lat),-p),k=Math.sin(v*c);return new J(this.R*o.lng*c,this.R*Math.log((1+k)/(1-k))/2)},unproject:function(o){var c=180/Math.PI;return new pt((2*Math.atan(Math.exp(o.y/this.R))-Math.PI/2)*c,o.x*c/this.R)},bounds:(function(){var o=en*Math.PI;return new ht([-o,-o],[o,o])})()};function mt(o,c,p,v){if(U(o)){this._a=o[0],this._b=o[1],this._c=o[2],this._d=o[3];return}this._a=o,this._b=c,this._c=p,this._d=v}mt.prototype={transform:function(o,c){return this._transform(o.clone(),c)},_transform:function(o,c){return c=c||1,o.x=c*(this._a*o.x+this._b),o.y=c*(this._c*o.y+this._d),o},untransform:function(o,c){return c=c||1,new J((o.x/c-this._b)/this._a,(o.y/c-this._d)/this._c)}};function Z(o,c,p,v){return new mt(o,c,p,v)}var Wt=r({},tt,{code:"EPSG:3857",projection:qt,transformation:(function(){var o=.5/(Math.PI*qt.R);return Z(o,.5,-o,.5)})()}),oe=r({},Wt,{code:"EPSG:900913"});function Ut(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function eo(o,c){var p="",v,k,A,V,nt,st;for(v=0,A=o.length;v<A;v++){for(nt=o[v],k=0,V=nt.length;k<V;k++)st=nt[k],p+=(k?"L":"M")+st.x+" "+st.y;p+=c?xt.svg?"z":"x":""}return p||"M0 0"}var bn=document.documentElement.style,nr="ActiveXObject"in window,ct=nr&&!document.addEventListener,io="msLaunchUri"in navigator&&!("documentMode"in document),rr=pe("webkit"),ki=pe("android"),Es=pe("android 2")||pe("android 3"),St=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),xn=ki&&pe("Google")&&St<537&&!("AudioNode"in window),nn=!!window.opera,or=!io&&pe("chrome"),Et=pe("gecko")&&!rr&&!nn&&!nr,no=!or&&pe("safari"),Dt=pe("phantom"),Tt="OTransition"in bn,al=navigator.platform.indexOf("Win")===0,ti=nr&&"transition"in bn,ro="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!Es,Lt="MozPerspective"in bn,ll=!window.L_DISABLE_3D&&(ti||ro||Lt)&&!Tt&&!Dt,wn=typeof orientation!="undefined"||pe("mobile"),oo=wn&&rr,Be=wn&&ro,rn=!window.PointerEvent&&window.MSPointerEvent,Ze=!!(window.PointerEvent||rn),so="ontouchstart"in window||!!window.TouchEvent,sr=!window.L_NO_TOUCH&&(so||Ze),ul=wn&&nn,Ts=wn&&Et,Fi=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ft=(function(){var o=!1;try{var c=Object.defineProperty({},"passive",{get:function(){o=!0}});window.addEventListener("testPassiveEventSupport",b,c),window.removeEventListener("testPassiveEventSupport",b,c)}catch{}return o})(),ar=(function(){return!!document.createElement("canvas").getContext})(),on=!!(document.createElementNS&&Ut("svg").createSVGRect),kn=!!on&&(function(){var o=document.createElement("div");return o.innerHTML="<svg/>",(o.firstChild&&o.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Is=!on&&(function(){try{var o=document.createElement("div");o.innerHTML='<v:shape adj="1"/>';var c=o.firstChild;return c.style.behavior="url(#default#VML)",c&&typeof c.adj=="object"}catch{return!1}})(),ao=navigator.platform.indexOf("Mac")===0,Cs=navigator.platform.indexOf("Linux")===0;function pe(o){return navigator.userAgent.toLowerCase().indexOf(o)>=0}var xt={ie:nr,ielt9:ct,edge:io,webkit:rr,android:ki,android23:Es,androidStock:xn,opera:nn,chrome:or,gecko:Et,safari:no,phantom:Dt,opera12:Tt,win:al,ie3d:ti,webkit3d:ro,gecko3d:Lt,any3d:ll,mobile:wn,mobileWebkit:oo,mobileWebkit3d:Be,msPointer:rn,pointer:Ze,touch:sr,touchNative:so,mobileOpera:ul,mobileGecko:Ts,retina:Fi,passiveEvents:ft,canvas:ar,svg:on,vml:Is,inlineSvg:kn,mac:ao,linux:Cs},Ln=xt.msPointer?"MSPointerDown":"pointerdown",Ss=xt.msPointer?"MSPointerMove":"pointermove",lo=xt.msPointer?"MSPointerUp":"pointerup",Ms=xt.msPointer?"MSPointerCancel":"pointercancel",xe={touchstart:Ln,touchmove:Ss,touchend:lo,touchcancel:Ms},lr={touchstart:cr,touchmove:hr,touchend:hr,touchcancel:hr},ei={},Li=!1;function Gi(o,c,p){return c==="touchstart"&&hl(),lr[c]?(p=lr[c].bind(this,p),o.addEventListener(xe[c],p,!1),p):(console.warn("wrong event specified:",c),b)}function uo(o,c,p){if(!xe[c]){console.warn("wrong event specified:",c);return}o.removeEventListener(xe[c],p,!1)}function ur(o){ei[o.pointerId]=o}function En(o){ei[o.pointerId]&&(ei[o.pointerId]=o)}function se(o){delete ei[o.pointerId]}function hl(){Li||(document.addEventListener(Ln,ur,!0),document.addEventListener(Ss,En,!0),document.addEventListener(lo,se,!0),document.addEventListener(Ms,se,!0),Li=!0)}function hr(o,c){if(c.pointerType!==(c.MSPOINTER_TYPE_MOUSE||"mouse")){c.touches=[];for(var p in ei)c.touches.push(ei[p]);c.changedTouches=[c],o(c)}}function cr(o,c){c.MSPOINTER_TYPE_TOUCH&&c.pointerType===c.MSPOINTER_TYPE_TOUCH&&re(c),hr(o,c)}function Tn(o){var c={},p,v;for(v in o)p=o[v],c[v]=p&&p.bind?p.bind(o):p;return o=c,c.type="dblclick",c.detail=2,c.isTrusted=!1,c._simulated=!0,c}var ho=200;function co(o,c){o.addEventListener("dblclick",c);var p=0,v;function k(A){if(A.detail!==1){v=A.detail;return}if(!(A.pointerType==="mouse"||A.sourceCapabilities&&!A.sourceCapabilities.firesTouchEvents)){var V=ye(A);if(!(V.some(function(st){return st instanceof HTMLLabelElement&&st.attributes.for})&&!V.some(function(st){return st instanceof HTMLInputElement||st instanceof HTMLSelectElement}))){var nt=Date.now();nt-p<=ho?(v++,v===2&&c(Tn(A))):v=1,p=nt}}}return o.addEventListener("click",k),{dblclick:c,simDblclick:k}}function As(o,c){o.removeEventListener("dblclick",c.dblclick),o.removeEventListener("click",c.simDblclick)}var fo=pr(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),we=pr(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Ui=we==="webkitTransition"||we==="OTransition"?we+"End":"transitionend";function fr(o){return typeof o=="string"?document.getElementById(o):o}function ii(o,c){var p=o.style[c]||o.currentStyle&&o.currentStyle[c];if((!p||p==="auto")&&document.defaultView){var v=document.defaultView.getComputedStyle(o,null);p=v?v[c]:null}return p==="auto"?null:p}function Bt(o,c,p){var v=document.createElement(o);return v.className=c||"",p&&p.appendChild(v),v}function $t(o){var c=o.parentNode;c&&c.removeChild(o)}function dr(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function sn(o){var c=o.parentNode;c&&c.lastChild!==o&&c.appendChild(o)}function qi(o){var c=o.parentNode;c&&c.firstChild!==o&&c.insertBefore(o,c.firstChild)}function gr(o,c){if(o.classList!==void 0)return o.classList.contains(c);var p=In(o);return p.length>0&&new RegExp("(^|\\s)"+c+"(\\s|$)").test(p)}function Ct(o,c){if(o.classList!==void 0)for(var p=S(c),v=0,k=p.length;v<k;v++)o.classList.add(p[v]);else if(!gr(o,c)){var A=In(o);ni(o,(A?A+" ":"")+c)}}function Ht(o,c){o.classList!==void 0?o.classList.remove(c):ni(o,C((" "+In(o)+" ").replace(" "+c+" "," ")))}function ni(o,c){o.className.baseVal===void 0?o.className=c:o.className.baseVal=c}function In(o){return o.correspondingElement&&(o=o.correspondingElement),o.className.baseVal===void 0?o.className:o.className.baseVal}function fe(o,c){"opacity"in o.style?o.style.opacity=c:"filter"in o.style&&cl(o,c)}function cl(o,c){var p=!1,v="DXImageTransform.Microsoft.Alpha";try{p=o.filters.item(v)}catch{if(c===1)return}c=Math.round(c*100),p?(p.Enabled=c!==100,p.Opacity=c):o.style.filter+=" progid:"+v+"(opacity="+c+")"}function pr(o){for(var c=document.documentElement.style,p=0;p<o.length;p++)if(o[p]in c)return o[p];return!1}function Zi(o,c,p){var v=c||new J(0,0);o.style[fo]=(xt.ie3d?"translate("+v.x+"px,"+v.y+"px)":"translate3d("+v.x+"px,"+v.y+"px,0)")+(p?" scale("+p+")":"")}function ae(o,c){o._leaflet_pos=c,xt.any3d?Zi(o,c):(o.style.left=c.x+"px",o.style.top=c.y+"px")}function Ei(o){return o._leaflet_pos||new J(0,0)}var gi,an,go;if("onselectstart"in document)gi=function(){Mt(window,"selectstart",re)},an=function(){Xt(window,"selectstart",re)};else{var ln=pr(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);gi=function(){if(ln){var o=document.documentElement.style;go=o[ln],o[ln]="none"}},an=function(){ln&&(document.documentElement.style[ln]=go,go=void 0)}}function po(){Mt(window,"dragstart",re)}function Cn(){Xt(window,"dragstart",re)}var Vt,pi;function mo(o){for(;o.tabIndex===-1;)o=o.parentNode;o.style&&(un(),Vt=o,pi=o.style.outlineStyle,o.style.outlineStyle="none",Mt(window,"keydown",un))}function un(){Vt&&(Vt.style.outlineStyle=pi,Vt=void 0,pi=void 0,Xt(window,"keydown",un))}function Ae(o){do o=o.parentNode;while((!o.offsetWidth||!o.offsetHeight)&&o!==document.body);return o}function Ie(o){var c=o.getBoundingClientRect();return{x:c.width/o.offsetWidth||1,y:c.height/o.offsetHeight||1,boundingClientRect:c}}var mr={__proto__:null,TRANSFORM:fo,TRANSITION:we,TRANSITION_END:Ui,get:fr,getStyle:ii,create:Bt,remove:$t,empty:dr,toFront:sn,toBack:qi,hasClass:gr,addClass:Ct,removeClass:Ht,setClass:ni,getClass:In,setOpacity:fe,testProp:pr,setTransform:Zi,setPosition:ae,getPosition:Ei,get disableTextSelection(){return gi},get enableTextSelection(){return an},disableImageDrag:po,enableImageDrag:Cn,preventOutline:mo,restoreOutline:un,getSizedParentNode:Ae,getScale:Ie};function Mt(o,c,p,v){if(c&&typeof c=="object")for(var k in c)yr(o,k,c[k],p);else{c=S(c);for(var A=0,V=c.length;A<V;A++)yr(o,c[A],p,v)}return this}var ri="_leaflet_events";function Xt(o,c,p,v){if(arguments.length===1)Sn(o),delete o[ri];else if(c&&typeof c=="object")for(var k in c)Ft(o,k,c[k],p);else if(c=S(c),arguments.length===2)Sn(o,function(nt){return W(c,nt)!==-1});else for(var A=0,V=c.length;A<V;A++)Ft(o,c[A],p,v);return this}function Sn(o,c){for(var p in o[ri]){var v=p.split(/\d/)[0];(!c||c(v))&&Ft(o,v,null,null,p)}}var yo={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function yr(o,c,p,v){var k=c+m(p)+(v?"_"+m(v):"");if(o[ri]&&o[ri][k])return this;var A=function(nt){return p.call(v||o,nt||window.event)},V=A;!xt.touchNative&&xt.pointer&&c.indexOf("touch")===0?A=Gi(o,c,A):xt.touch&&c==="dblclick"?A=co(o,A):"addEventListener"in o?c==="touchstart"||c==="touchmove"||c==="wheel"||c==="mousewheel"?o.addEventListener(yo[c]||c,A,xt.passiveEvents?{passive:!1}:!1):c==="mouseenter"||c==="mouseleave"?(A=function(nt){nt=nt||window.event,_r(o,nt)&&V(nt)},o.addEventListener(yo[c],A,!1)):o.addEventListener(c,V,!1):o.attachEvent("on"+c,A),o[ri]=o[ri]||{},o[ri][k]=A}function Ft(o,c,p,v,k){k=k||c+m(p)+(v?"_"+m(v):"");var A=o[ri]&&o[ri][k];if(!A)return this;!xt.touchNative&&xt.pointer&&c.indexOf("touch")===0?uo(o,c,A):xt.touch&&c==="dblclick"?As(o,A):"removeEventListener"in o?o.removeEventListener(yo[c]||c,A,!1):o.detachEvent("on"+c,A),o[ri][k]=null}function me(o){return o.stopPropagation?o.stopPropagation():o.originalEvent?o.originalEvent._stopped=!0:o.cancelBubble=!0,this}function Mn(o){return yr(o,"wheel",me),this}function hn(o){return Mt(o,"mousedown touchstart dblclick contextmenu",me),o._leaflet_disable_click=!0,this}function re(o){return o.preventDefault?o.preventDefault():o.returnValue=!1,this}function Ti(o){return re(o),me(o),this}function ye(o){if(o.composedPath)return o.composedPath();for(var c=[],p=o.target;p;)c.push(p),p=p.parentNode;return c}function _o(o,c){if(!c)return new J(o.clientX,o.clientY);var p=Ie(c),v=p.boundingClientRect;return new J((o.clientX-v.left)/p.x-c.clientLeft,(o.clientY-v.top)/p.y-c.clientTop)}var vo=xt.linux&&xt.chrome?window.devicePixelRatio:xt.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function bo(o){return xt.edge?o.wheelDeltaY/2:o.deltaY&&o.deltaMode===0?-o.deltaY/vo:o.deltaY&&o.deltaMode===1?-o.deltaY*20:o.deltaY&&o.deltaMode===2?-o.deltaY*60:o.deltaX||o.deltaZ?0:o.wheelDelta?(o.wheelDeltaY||o.wheelDelta)/2:o.detail&&Math.abs(o.detail)<32765?-o.detail*20:o.detail?o.detail/-32765*60:0}function _r(o,c){var p=c.relatedTarget;if(!p)return!0;try{for(;p&&p!==o;)p=p.parentNode}catch{return!1}return p!==o}var fl={__proto__:null,on:Mt,off:Xt,stopPropagation:me,disableScrollPropagation:Mn,disableClickPropagation:hn,preventDefault:re,stop:Ti,getPropagationPath:ye,getMousePosition:_o,getWheelDelta:bo,isExternalTarget:_r,addListener:Mt,removeListener:Xt},xo=$.extend({run:function(o,c,p,v){this.stop(),this._el=o,this._inProgress=!0,this._duration=p||.25,this._easeOutPower=1/Math.max(v||.5,.2),this._startPos=Ei(o),this._offset=c.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=F(this._animate,this),this._step()},_step:function(o){var c=+new Date-this._startTime,p=this._duration*1e3;c<p?this._runFrame(this._easeOut(c/p),o):(this._runFrame(1),this._complete())},_runFrame:function(o,c){var p=this._startPos.add(this._offset.multiplyBy(o));c&&p._round(),ae(this._el,p),this.fire("step")},_complete:function(){q(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(o){return 1-Math.pow(1-o,this._easeOutPower)}}),At=$.extend({options:{crs:Wt,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(o,c){c=O(this,c),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(o),this._initLayout(),this._onResize=f(this._onResize,this),this._initEvents(),c.maxBounds&&this.setMaxBounds(c.maxBounds),c.zoom!==void 0&&(this._zoom=this._limitZoom(c.zoom)),c.center&&c.zoom!==void 0&&this.setView(vt(c.center),c.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=we&&xt.any3d&&!xt.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Mt(this._proxy,Ui,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(o,c,p){if(c=c===void 0?this._zoom:this._limitZoom(c),o=this._limitCenter(vt(o),c,this.options.maxBounds),p=p||{},this._stop(),this._loaded&&!p.reset&&p!==!0){p.animate!==void 0&&(p.zoom=r({animate:p.animate},p.zoom),p.pan=r({animate:p.animate,duration:p.duration},p.pan));var v=this._zoom!==c?this._tryAnimatedZoom&&this._tryAnimatedZoom(o,c,p.zoom):this._tryAnimatedPan(o,p.pan);if(v)return clearTimeout(this._sizeTimer),this}return this._resetView(o,c,p.pan&&p.pan.noMoveStart),this},setZoom:function(o,c){return this._loaded?this.setView(this.getCenter(),o,{zoom:c}):(this._zoom=o,this)},zoomIn:function(o,c){return o=o||(xt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+o,c)},zoomOut:function(o,c){return o=o||(xt.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-o,c)},setZoomAround:function(o,c,p){var v=this.getZoomScale(c),k=this.getSize().divideBy(2),A=o instanceof J?o:this.latLngToContainerPoint(o),V=A.subtract(k).multiplyBy(1-1/v),nt=this.containerPointToLatLng(k.add(V));return this.setView(nt,c,{zoom:p})},_getBoundsCenterZoom:function(o,c){c=c||{},o=o.getBounds?o.getBounds():dt(o);var p=rt(c.paddingTopLeft||c.padding||[0,0]),v=rt(c.paddingBottomRight||c.padding||[0,0]),k=this.getBoundsZoom(o,!1,p.add(v));if(k=typeof c.maxZoom=="number"?Math.min(c.maxZoom,k):k,k===1/0)return{center:o.getCenter(),zoom:k};var A=v.subtract(p).divideBy(2),V=this.project(o.getSouthWest(),k),nt=this.project(o.getNorthEast(),k),st=this.unproject(V.add(nt).divideBy(2).add(A),k);return{center:st,zoom:k}},fitBounds:function(o,c){if(o=dt(o),!o.isValid())throw new Error("Bounds are not valid.");var p=this._getBoundsCenterZoom(o,c);return this.setView(p.center,p.zoom,c)},fitWorld:function(o){return this.fitBounds([[-90,-180],[90,180]],o)},panTo:function(o,c){return this.setView(o,this._zoom,{pan:c})},panBy:function(o,c){if(o=rt(o).round(),c=c||{},!o.x&&!o.y)return this.fire("moveend");if(c.animate!==!0&&!this.getSize().contains(o))return this._resetView(this.unproject(this.project(this.getCenter()).add(o)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new xo,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),c.noMoveStart||this.fire("movestart"),c.animate!==!1){Ct(this._mapPane,"leaflet-pan-anim");var p=this._getMapPanePos().subtract(o).round();this._panAnim.run(this._mapPane,p,c.duration||.25,c.easeLinearity)}else this._rawPanBy(o),this.fire("move").fire("moveend");return this},flyTo:function(o,c,p){if(p=p||{},p.animate===!1||!xt.any3d)return this.setView(o,c,p);this._stop();var v=this.project(this.getCenter()),k=this.project(o),A=this.getSize(),V=this._zoom;o=vt(o),c=c===void 0?V:c;var nt=Math.max(A.x,A.y),st=nt*this.getZoomScale(V,c),ut=k.distanceTo(v)||1,yt=1.42,It=yt*yt;function Rt(ce){var Ys=ce?-1:1,mm=ce?st:nt,ym=st*st-nt*nt+Ys*It*It*ut*ut,_m=2*mm*It*ut,Ll=ym/_m,ac=Math.sqrt(Ll*Ll+1)-Ll,vm=ac<1e-9?-18:Math.log(ac);return vm}function Oe(ce){return(Math.exp(ce)-Math.exp(-ce))/2}function ve(ce){return(Math.exp(ce)+Math.exp(-ce))/2}function hi(ce){return Oe(ce)/ve(ce)}var Fe=Rt(0);function Cr(ce){return nt*(ve(Fe)/ve(Fe+yt*ce))}function fm(ce){return nt*(ve(Fe)*hi(Fe+yt*ce)-Oe(Fe))/It}function dm(ce){return 1-Math.pow(1-ce,1.5)}var gm=Date.now(),oc=(Rt(1)-Fe)/yt,pm=p.duration?1e3*p.duration:1e3*oc*.8;function sc(){var ce=(Date.now()-gm)/pm,Ys=dm(ce)*oc;ce<=1?(this._flyToFrame=F(sc,this),this._move(this.unproject(v.add(k.subtract(v).multiplyBy(fm(Ys)/ut)),V),this.getScaleZoom(nt/Cr(Ys),V),{flyTo:!0})):this._move(o,c)._moveEnd(!0)}return this._moveStart(!0,p.noMoveStart),sc.call(this),this},flyToBounds:function(o,c){var p=this._getBoundsCenterZoom(o,c);return this.flyTo(p.center,p.zoom,c)},setMaxBounds:function(o){return o=dt(o),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),o.isValid()?(this.options.maxBounds=o,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(o){var c=this.options.minZoom;return this.options.minZoom=o,this._loaded&&c!==o&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(o):this},setMaxZoom:function(o){var c=this.options.maxZoom;return this.options.maxZoom=o,this._loaded&&c!==o&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(o):this},panInsideBounds:function(o,c){this._enforcingBounds=!0;var p=this.getCenter(),v=this._limitCenter(p,this._zoom,dt(o));return p.equals(v)||this.panTo(v,c),this._enforcingBounds=!1,this},panInside:function(o,c){c=c||{};var p=rt(c.paddingTopLeft||c.padding||[0,0]),v=rt(c.paddingBottomRight||c.padding||[0,0]),k=this.project(this.getCenter()),A=this.project(o),V=this.getPixelBounds(),nt=_t([V.min.add(p),V.max.subtract(v)]),st=nt.getSize();if(!nt.contains(A)){this._enforcingBounds=!0;var ut=A.subtract(nt.getCenter()),yt=nt.extend(A).getSize().subtract(st);k.x+=ut.x<0?-yt.x:yt.x,k.y+=ut.y<0?-yt.y:yt.y,this.panTo(this.unproject(k),c),this._enforcingBounds=!1}return this},invalidateSize:function(o){if(!this._loaded)return this;o=r({animate:!1,pan:!0},o===!0?{animate:!0}:o);var c=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var p=this.getSize(),v=c.divideBy(2).round(),k=p.divideBy(2).round(),A=v.subtract(k);return!A.x&&!A.y?this:(o.animate&&o.pan?this.panBy(A):(o.pan&&this._rawPanBy(A),this.fire("move"),o.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(f(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:c,newSize:p}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(o){if(o=this._locateOptions=r({timeout:1e4,watch:!1},o),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var c=f(this._handleGeolocationResponse,this),p=f(this._handleGeolocationError,this);return o.watch?this._locationWatchId=navigator.geolocation.watchPosition(c,p,o):navigator.geolocation.getCurrentPosition(c,p,o),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(o){if(this._container._leaflet_id){var c=o.code,p=o.message||(c===1?"permission denied":c===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:c,message:"Geolocation error: "+p+"."})}},_handleGeolocationResponse:function(o){if(this._container._leaflet_id){var c=o.coords.latitude,p=o.coords.longitude,v=new pt(c,p),k=v.toBounds(o.coords.accuracy*2),A=this._locateOptions;if(A.setView){var V=this.getBoundsZoom(k);this.setView(v,A.maxZoom?Math.min(V,A.maxZoom):V)}var nt={latlng:v,bounds:k,timestamp:o.timestamp};for(var st in o.coords)typeof o.coords[st]=="number"&&(nt[st]=o.coords[st]);this.fire("locationfound",nt)}},addHandler:function(o,c){if(!c)return this;var p=this[o]=new c(this);return this._handlers.push(p),this.options[o]&&p.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(),$t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(q(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var o;for(o in this._layers)this._layers[o].remove();for(o in this._panes)$t(this._panes[o]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(o,c){var p="leaflet-pane"+(o?" leaflet-"+o.replace("Pane","")+"-pane":""),v=Bt("div",p,c||this._mapPane);return o&&(this._panes[o]=v),v},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var o=this.getPixelBounds(),c=this.unproject(o.getBottomLeft()),p=this.unproject(o.getTopRight());return new kt(c,p)},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(o,c,p){o=dt(o),p=rt(p||[0,0]);var v=this.getZoom()||0,k=this.getMinZoom(),A=this.getMaxZoom(),V=o.getNorthWest(),nt=o.getSouthEast(),st=this.getSize().subtract(p),ut=_t(this.project(nt,v),this.project(V,v)).getSize(),yt=xt.any3d?this.options.zoomSnap:1,It=st.x/ut.x,Rt=st.y/ut.y,Oe=c?Math.max(It,Rt):Math.min(It,Rt);return v=this.getScaleZoom(Oe,v),yt&&(v=Math.round(v/(yt/100))*(yt/100),v=c?Math.ceil(v/yt)*yt:Math.floor(v/yt)*yt),Math.max(k,Math.min(A,v))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new J(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(o,c){var p=this._getTopLeftPoint(o,c);return new ht(p,p.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(o){return this.options.crs.getProjectedBounds(o===void 0?this.getZoom():o)},getPane:function(o){return typeof o=="string"?this._panes[o]:o},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(o,c){var p=this.options.crs;return c=c===void 0?this._zoom:c,p.scale(o)/p.scale(c)},getScaleZoom:function(o,c){var p=this.options.crs;c=c===void 0?this._zoom:c;var v=p.zoom(o*p.scale(c));return isNaN(v)?1/0:v},project:function(o,c){return c=c===void 0?this._zoom:c,this.options.crs.latLngToPoint(vt(o),c)},unproject:function(o,c){return c=c===void 0?this._zoom:c,this.options.crs.pointToLatLng(rt(o),c)},layerPointToLatLng:function(o){var c=rt(o).add(this.getPixelOrigin());return this.unproject(c)},latLngToLayerPoint:function(o){var c=this.project(vt(o))._round();return c._subtract(this.getPixelOrigin())},wrapLatLng:function(o){return this.options.crs.wrapLatLng(vt(o))},wrapLatLngBounds:function(o){return this.options.crs.wrapLatLngBounds(dt(o))},distance:function(o,c){return this.options.crs.distance(vt(o),vt(c))},containerPointToLayerPoint:function(o){return rt(o).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(o){return rt(o).add(this._getMapPanePos())},containerPointToLatLng:function(o){var c=this.containerPointToLayerPoint(rt(o));return this.layerPointToLatLng(c)},latLngToContainerPoint:function(o){return this.layerPointToContainerPoint(this.latLngToLayerPoint(vt(o)))},mouseEventToContainerPoint:function(o){return _o(o,this._container)},mouseEventToLayerPoint:function(o){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(o))},mouseEventToLatLng:function(o){return this.layerPointToLatLng(this.mouseEventToLayerPoint(o))},_initContainer:function(o){var c=this._container=fr(o);if(c){if(c._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Mt(c,"scroll",this._onScroll,this),this._containerId=m(c)},_initLayout:function(){var o=this._container;this._fadeAnimated=this.options.fadeAnimation&&xt.any3d,Ct(o,"leaflet-container"+(xt.touch?" leaflet-touch":"")+(xt.retina?" leaflet-retina":"")+(xt.ielt9?" leaflet-oldie":"")+(xt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var c=ii(o,"position");c!=="absolute"&&c!=="relative"&&c!=="fixed"&&c!=="sticky"&&(o.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var o=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ae(this._mapPane,new J(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Ct(o.markerPane,"leaflet-zoom-hide"),Ct(o.shadowPane,"leaflet-zoom-hide"))},_resetView:function(o,c,p){ae(this._mapPane,new J(0,0));var v=!this._loaded;this._loaded=!0,c=this._limitZoom(c),this.fire("viewprereset");var k=this._zoom!==c;this._moveStart(k,p)._move(o,c)._moveEnd(k),this.fire("viewreset"),v&&this.fire("load")},_moveStart:function(o,c){return o&&this.fire("zoomstart"),c||this.fire("movestart"),this},_move:function(o,c,p,v){c===void 0&&(c=this._zoom);var k=this._zoom!==c;return this._zoom=c,this._lastCenter=o,this._pixelOrigin=this._getNewPixelOrigin(o),v?p&&p.pinch&&this.fire("zoom",p):((k||p&&p.pinch)&&this.fire("zoom",p),this.fire("move",p)),this},_moveEnd:function(o){return o&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return q(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(o){ae(this._mapPane,this._getMapPanePos().subtract(o))},_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(o){this._targets={},this._targets[m(this._container)]=this;var c=o?Xt:Mt;c(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&c(window,"resize",this._onResize,this),xt.any3d&&this.options.transform3DLimit&&(o?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){q(this._resizeRequest),this._resizeRequest=F(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var o=this._getMapPanePos();Math.max(Math.abs(o.x),Math.abs(o.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(o,c){for(var p=[],v,k=c==="mouseout"||c==="mouseover",A=o.target||o.srcElement,V=!1;A;){if(v=this._targets[m(A)],v&&(c==="click"||c==="preclick")&&this._draggableMoved(v)){V=!0;break}if(v&&v.listens(c,!0)&&(k&&!_r(A,o)||(p.push(v),k))||A===this._container)break;A=A.parentNode}return!p.length&&!V&&!k&&this.listens(c,!0)&&(p=[this]),p},_isClickDisabled:function(o){for(;o&&o!==this._container;){if(o._leaflet_disable_click)return!0;o=o.parentNode}},_handleDOMEvent:function(o){var c=o.target||o.srcElement;if(!(!this._loaded||c._leaflet_disable_events||o.type==="click"&&this._isClickDisabled(c))){var p=o.type;p==="mousedown"&&mo(c),this._fireDOMEvent(o,p)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(o,c,p){if(o.type==="click"){var v=r({},o);v.type="preclick",this._fireDOMEvent(v,v.type,p)}var k=this._findEventTargets(o,c);if(p){for(var A=[],V=0;V<p.length;V++)p[V].listens(c,!0)&&A.push(p[V]);k=A.concat(k)}if(k.length){c==="contextmenu"&&re(o);var nt=k[0],st={originalEvent:o};if(o.type!=="keypress"&&o.type!=="keydown"&&o.type!=="keyup"){var ut=nt.getLatLng&&(!nt._radius||nt._radius<=10);st.containerPoint=ut?this.latLngToContainerPoint(nt.getLatLng()):this.mouseEventToContainerPoint(o),st.layerPoint=this.containerPointToLayerPoint(st.containerPoint),st.latlng=ut?nt.getLatLng():this.layerPointToLatLng(st.layerPoint)}for(V=0;V<k.length;V++)if(k[V].fire(c,st,!0),st.originalEvent._stopped||k[V].options.bubblingMouseEvents===!1&&W(this._mouseEvents,c)!==-1)return}},_draggableMoved:function(o){return o=o.dragging&&o.dragging.enabled()?o:this,o.dragging&&o.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var o=0,c=this._handlers.length;o<c;o++)this._handlers[o].disable()},whenReady:function(o,c){return this._loaded?o.call(c||this,{target:this}):this.on("load",o,c),this},_getMapPanePos:function(){return Ei(this._mapPane)||new J(0,0)},_moved:function(){var o=this._getMapPanePos();return o&&!o.equals([0,0])},_getTopLeftPoint:function(o,c){var p=o&&c!==void 0?this._getNewPixelOrigin(o,c):this.getPixelOrigin();return p.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(o,c){var p=this.getSize()._divideBy(2);return this.project(o,c)._subtract(p)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(o,c,p){var v=this._getNewPixelOrigin(p,c);return this.project(o,c)._subtract(v)},_latLngBoundsToNewLayerBounds:function(o,c,p){var v=this._getNewPixelOrigin(p,c);return _t([this.project(o.getSouthWest(),c)._subtract(v),this.project(o.getNorthWest(),c)._subtract(v),this.project(o.getSouthEast(),c)._subtract(v),this.project(o.getNorthEast(),c)._subtract(v)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(o){return this.latLngToLayerPoint(o).subtract(this._getCenterLayerPoint())},_limitCenter:function(o,c,p){if(!p)return o;var v=this.project(o,c),k=this.getSize().divideBy(2),A=new ht(v.subtract(k),v.add(k)),V=this._getBoundsOffset(A,p,c);return Math.abs(V.x)<=1&&Math.abs(V.y)<=1?o:this.unproject(v.add(V),c)},_limitOffset:function(o,c){if(!c)return o;var p=this.getPixelBounds(),v=new ht(p.min.add(o),p.max.add(o));return o.add(this._getBoundsOffset(v,c))},_getBoundsOffset:function(o,c,p){var v=_t(this.project(c.getNorthEast(),p),this.project(c.getSouthWest(),p)),k=v.min.subtract(o.min),A=v.max.subtract(o.max),V=this._rebound(k.x,-A.x),nt=this._rebound(k.y,-A.y);return new J(V,nt)},_rebound:function(o,c){return o+c>0?Math.round(o-c)/2:Math.max(0,Math.ceil(o))-Math.max(0,Math.floor(c))},_limitZoom:function(o){var c=this.getMinZoom(),p=this.getMaxZoom(),v=xt.any3d?this.options.zoomSnap:1;return v&&(o=Math.round(o/v)*v),Math.max(c,Math.min(p,o))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ht(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(o,c){var p=this._getCenterOffset(o)._trunc();return(c&&c.animate)!==!0&&!this.getSize().contains(p)?!1:(this.panBy(p,c),!0)},_createAnimProxy:function(){var o=this._proxy=Bt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(o),this.on("zoomanim",function(c){var p=fo,v=this._proxy.style[p];Zi(this._proxy,this.project(c.center,c.zoom),this.getZoomScale(c.zoom,1)),v===this._proxy.style[p]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){$t(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var o=this.getCenter(),c=this.getZoom();Zi(this._proxy,this.project(o,c),this.getZoomScale(c,1))},_catchTransitionEnd:function(o){this._animatingZoom&&o.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(o,c,p){if(this._animatingZoom)return!0;if(p=p||{},!this._zoomAnimated||p.animate===!1||this._nothingToAnimate()||Math.abs(c-this._zoom)>this.options.zoomAnimationThreshold)return!1;var v=this.getZoomScale(c),k=this._getCenterOffset(o)._divideBy(1-1/v);return p.animate!==!0&&!this.getSize().contains(k)?!1:(F(function(){this._moveStart(!0,p.noMoveStart||!1)._animateZoom(o,c,!0)},this),!0)},_animateZoom:function(o,c,p,v){this._mapPane&&(p&&(this._animatingZoom=!0,this._animateToCenter=o,this._animateToZoom=c,Ct(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:o,zoom:c,noUpdate:v}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(f(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Ht(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 vr(o,c){return new At(o,c)}var He=j.extend({options:{position:"topright"},initialize:function(o){O(this,o)},getPosition:function(){return this.options.position},setPosition:function(o){var c=this._map;return c&&c.removeControl(this),this.options.position=o,c&&c.addControl(this),this},getContainer:function(){return this._container},addTo:function(o){this.remove(),this._map=o;var c=this._container=this.onAdd(o),p=this.getPosition(),v=o._controlCorners[p];return Ct(c,"leaflet-control"),p.indexOf("bottom")!==-1?v.insertBefore(c,v.firstChild):v.appendChild(c),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?($t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(o){this._map&&o&&o.screenX>0&&o.screenY>0&&this._map.getContainer().focus()}}),_e=function(o){return new He(o)};At.include({addControl:function(o){return o.addTo(this),this},removeControl:function(o){return o.remove(),this},_initControlPos:function(){var o=this._controlCorners={},c="leaflet-",p=this._controlContainer=Bt("div",c+"control-container",this._container);function v(k,A){var V=c+k+" "+c+A;o[k+A]=Bt("div",V,p)}v("top","left"),v("top","right"),v("bottom","left"),v("bottom","right")},_clearControlPos:function(){for(var o in this._controlCorners)$t(this._controlCorners[o]);$t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Hi=He.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(o,c,p,v){return p<v?-1:v<p?1:0}},initialize:function(o,c,p){O(this,p),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var v in o)this._addLayer(o[v],v);for(v in c)this._addLayer(c[v],v,!0)},onAdd:function(o){this._initLayout(),this._update(),this._map=o,o.on("zoomend",this._checkDisabledLayers,this);for(var c=0;c<this._layers.length;c++)this._layers[c].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(o){return He.prototype.addTo.call(this,o),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var o=0;o<this._layers.length;o++)this._layers[o].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(o,c){return this._addLayer(o,c),this._map?this._update():this},addOverlay:function(o,c){return this._addLayer(o,c,!0),this._map?this._update():this},removeLayer:function(o){o.off("add remove",this._onLayerChange,this);var c=this._getLayer(m(o));return c&&this._layers.splice(this._layers.indexOf(c),1),this._map?this._update():this},expand:function(){Ct(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var o=this._map.getSize().y-(this._container.offsetTop+50);return o<this._section.clientHeight?(Ct(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=o+"px"):Ht(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Ht(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var o="leaflet-control-layers",c=this._container=Bt("div",o),p=this.options.collapsed;c.setAttribute("aria-haspopup",!0),hn(c),Mn(c);var v=this._section=Bt("section",o+"-list");p&&(this._map.on("click",this.collapse,this),Mt(c,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var k=this._layersLink=Bt("a",o+"-toggle",c);k.href="#",k.title="Layers",k.setAttribute("role","button"),Mt(k,{keydown:function(A){A.keyCode===13&&this._expandSafely()},click:function(A){re(A),this._expandSafely()}},this),p||this.expand(),this._baseLayersList=Bt("div",o+"-base",v),this._separator=Bt("div",o+"-separator",v),this._overlaysList=Bt("div",o+"-overlays",v),c.appendChild(v)},_getLayer:function(o){for(var c=0;c<this._layers.length;c++)if(this._layers[c]&&m(this._layers[c].layer)===o)return this._layers[c]},_addLayer:function(o,c,p){this._map&&o.on("add remove",this._onLayerChange,this),this._layers.push({layer:o,name:c,overlay:p}),this.options.sortLayers&&this._layers.sort(f(function(v,k){return this.options.sortFunction(v.layer,k.layer,v.name,k.name)},this)),this.options.autoZIndex&&o.setZIndex&&(this._lastZIndex++,o.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;dr(this._baseLayersList),dr(this._overlaysList),this._layerControlInputs=[];var o,c,p,v,k=0;for(p=0;p<this._layers.length;p++)v=this._layers[p],this._addItem(v),c=c||v.overlay,o=o||!v.overlay,k+=v.overlay?0:1;return this.options.hideSingleBase&&(o=o&&k>1,this._baseLayersList.style.display=o?"":"none"),this._separator.style.display=c&&o?"":"none",this},_onLayerChange:function(o){this._handlingClick||this._update();var c=this._getLayer(m(o.target)),p=c.overlay?o.type==="add"?"overlayadd":"overlayremove":o.type==="add"?"baselayerchange":null;p&&this._map.fire(p,c)},_createRadioElement:function(o,c){var p='<input type="radio" class="leaflet-control-layers-selector" name="'+o+'"'+(c?' checked="checked"':"")+"/>",v=document.createElement("div");return v.innerHTML=p,v.firstChild},_addItem:function(o){var c=document.createElement("label"),p=this._map.hasLayer(o.layer),v;o.overlay?(v=document.createElement("input"),v.type="checkbox",v.className="leaflet-control-layers-selector",v.defaultChecked=p):v=this._createRadioElement("leaflet-base-layers_"+m(this),p),this._layerControlInputs.push(v),v.layerId=m(o.layer),Mt(v,"click",this._onInputClick,this);var k=document.createElement("span");k.innerHTML=" "+o.name;var A=document.createElement("span");c.appendChild(A),A.appendChild(v),A.appendChild(k);var V=o.overlay?this._overlaysList:this._baseLayersList;return V.appendChild(c),this._checkDisabledLayers(),c},_onInputClick:function(){if(!this._preventClick){var o=this._layerControlInputs,c,p,v=[],k=[];this._handlingClick=!0;for(var A=o.length-1;A>=0;A--)c=o[A],p=this._getLayer(c.layerId).layer,c.checked?v.push(p):c.checked||k.push(p);for(A=0;A<k.length;A++)this._map.hasLayer(k[A])&&this._map.removeLayer(k[A]);for(A=0;A<v.length;A++)this._map.hasLayer(v[A])||this._map.addLayer(v[A]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var o=this._layerControlInputs,c,p,v=this._map.getZoom(),k=o.length-1;k>=0;k--)c=o[k],p=this._getLayer(c.layerId).layer,c.disabled=p.options.minZoom!==void 0&&v<p.options.minZoom||p.options.maxZoom!==void 0&&v>p.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var o=this._section;this._preventClick=!0,Mt(o,"click",re),this.expand();var c=this;setTimeout(function(){Xt(o,"click",re),c._preventClick=!1})}}),dl=function(o,c,p){return new Hi(o,c,p)},Ii=He.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(o){var c="leaflet-control-zoom",p=Bt("div",c+" leaflet-bar"),v=this.options;return this._zoomInButton=this._createButton(v.zoomInText,v.zoomInTitle,c+"-in",p,this._zoomIn),this._zoomOutButton=this._createButton(v.zoomOutText,v.zoomOutTitle,c+"-out",p,this._zoomOut),this._updateDisabled(),o.on("zoomend zoomlevelschange",this._updateDisabled,this),p},onRemove:function(o){o.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(o){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(o.shiftKey?3:1))},_zoomOut:function(o){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(o.shiftKey?3:1))},_createButton:function(o,c,p,v,k){var A=Bt("a",p,v);return A.innerHTML=o,A.href="#",A.title=c,A.setAttribute("role","button"),A.setAttribute("aria-label",c),hn(A),Mt(A,"click",Ti),Mt(A,"click",k,this),Mt(A,"click",this._refocusOnMap,this),A},_updateDisabled:function(){var o=this._map,c="leaflet-disabled";Ht(this._zoomInButton,c),Ht(this._zoomOutButton,c),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||o._zoom===o.getMinZoom())&&(Ct(this._zoomOutButton,c),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||o._zoom===o.getMaxZoom())&&(Ct(this._zoomInButton,c),this._zoomInButton.setAttribute("aria-disabled","true"))}});At.mergeOptions({zoomControl:!0}),At.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ii,this.addControl(this.zoomControl))});var Ps=function(o){return new Ii(o)},Yi=He.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(o){var c="leaflet-control-scale",p=Bt("div",c),v=this.options;return this._addScales(v,c+"-line",p),o.on(v.updateWhenIdle?"moveend":"move",this._update,this),o.whenReady(this._update,this),p},onRemove:function(o){o.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(o,c,p){o.metric&&(this._mScale=Bt("div",c,p)),o.imperial&&(this._iScale=Bt("div",c,p))},_update:function(){var o=this._map,c=o.getSize().y/2,p=o.distance(o.containerPointToLatLng([0,c]),o.containerPointToLatLng([this.options.maxWidth,c]));this._updateScales(p)},_updateScales:function(o){this.options.metric&&o&&this._updateMetric(o),this.options.imperial&&o&&this._updateImperial(o)},_updateMetric:function(o){var c=this._getRoundNum(o),p=c<1e3?c+" m":c/1e3+" km";this._updateScale(this._mScale,p,c/o)},_updateImperial:function(o){var c=o*3.2808399,p,v,k;c>5280?(p=c/5280,v=this._getRoundNum(p),this._updateScale(this._iScale,v+" mi",v/p)):(k=this._getRoundNum(c),this._updateScale(this._iScale,k+" ft",k/c))},_updateScale:function(o,c,p){o.style.width=Math.round(this.options.maxWidth*p)+"px",o.innerHTML=c},_getRoundNum:function(o){var c=Math.pow(10,(Math.floor(o)+"").length-1),p=o/c;return p=p>=10?10:p>=5?5:p>=3?3:p>=2?2:1,c*p}}),gl=function(o){return new Yi(o)},oi='<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>',br=He.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(xt.inlineSvg?oi+" ":"")+"Leaflet</a>"},initialize:function(o){O(this,o),this._attributions={}},onAdd:function(o){o.attributionControl=this,this._container=Bt("div","leaflet-control-attribution"),hn(this._container);for(var c in o._layers)o._layers[c].getAttribution&&this.addAttribution(o._layers[c].getAttribution());return this._update(),o.on("layeradd",this._addAttribution,this),this._container},onRemove:function(o){o.off("layeradd",this._addAttribution,this)},_addAttribution:function(o){o.layer.getAttribution&&(this.addAttribution(o.layer.getAttribution()),o.layer.once("remove",function(){this.removeAttribution(o.layer.getAttribution())},this))},setPrefix:function(o){return this.options.prefix=o,this._update(),this},addAttribution:function(o){return o?(this._attributions[o]||(this._attributions[o]=0),this._attributions[o]++,this._update(),this):this},removeAttribution:function(o){return o?(this._attributions[o]&&(this._attributions[o]--,this._update()),this):this},_update:function(){if(this._map){var o=[];for(var c in this._attributions)this._attributions[c]&&o.push(c);var p=[];this.options.prefix&&p.push(this.options.prefix),o.length&&p.push(o.join(", ")),this._container.innerHTML=p.join(' <span aria-hidden="true">|</span> ')}}});At.mergeOptions({attributionControl:!0}),At.addInitHook(function(){this.options.attributionControl&&new br().addTo(this)});var pl=function(o){return new br(o)};He.Layers=Hi,He.Zoom=Ii,He.Scale=Yi,He.Attribution=br,_e.layers=dl,_e.zoom=Ps,_e.scale=gl,_e.attribution=pl;var si=j.extend({initialize:function(o){this._map=o},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}});si.addTo=function(o,c){return o.addHandler(c,this),this};var ml={Events:Y},Ns=xt.touch?"touchstart mousedown":"mousedown",Ci=$.extend({options:{clickTolerance:3},initialize:function(o,c,p,v){O(this,v),this._element=o,this._dragStartTarget=c||o,this._preventOutline=p},enable:function(){this._enabled||(Mt(this._dragStartTarget,Ns,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Ci._dragging===this&&this.finishDrag(!0),Xt(this._dragStartTarget,Ns,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(o){if(this._enabled&&(this._moved=!1,!gr(this._element,"leaflet-zoom-anim"))){if(o.touches&&o.touches.length!==1){Ci._dragging===this&&this.finishDrag();return}if(!(Ci._dragging||o.shiftKey||o.which!==1&&o.button!==1&&!o.touches)&&(Ci._dragging=this,this._preventOutline&&mo(this._element),po(),gi(),!this._moving)){this.fire("down");var c=o.touches?o.touches[0]:o,p=Ae(this._element);this._startPoint=new J(c.clientX,c.clientY),this._startPos=Ei(this._element),this._parentScale=Ie(p);var v=o.type==="mousedown";Mt(document,v?"mousemove":"touchmove",this._onMove,this),Mt(document,v?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(o){if(this._enabled){if(o.touches&&o.touches.length>1){this._moved=!0;return}var c=o.touches&&o.touches.length===1?o.touches[0]:o,p=new J(c.clientX,c.clientY)._subtract(this._startPoint);!p.x&&!p.y||Math.abs(p.x)+Math.abs(p.y)<this.options.clickTolerance||(p.x/=this._parentScale.x,p.y/=this._parentScale.y,re(o),this._moved||(this.fire("dragstart"),this._moved=!0,Ct(document.body,"leaflet-dragging"),this._lastTarget=o.target||o.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),Ct(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(p),this._moving=!0,this._lastEvent=o,this._updatePosition())}},_updatePosition:function(){var o={originalEvent:this._lastEvent};this.fire("predrag",o),ae(this._element,this._newPos),this.fire("drag",o)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(o){Ht(document.body,"leaflet-dragging"),this._lastTarget&&(Ht(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Xt(document,"mousemove touchmove",this._onMove,this),Xt(document,"mouseup touchend touchcancel",this._onUp,this),Cn(),an();var c=this._moved&&this._moving;this._moving=!1,Ci._dragging=!1,c&&this.fire("dragend",{noInertia:o,distance:this._newPos.distanceTo(this._startPos)})}});function Os(o,c,p){var v,k=[1,4,2,8],A,V,nt,st,ut,yt,It,Rt;for(A=0,yt=o.length;A<yt;A++)o[A]._code=he(o[A],c);for(nt=0;nt<4;nt++){for(It=k[nt],v=[],A=0,yt=o.length,V=yt-1;A<yt;V=A++)st=o[A],ut=o[V],st._code&It?ut._code&It||(Rt=An(ut,st,It,c,p),Rt._code=he(Rt,c),v.push(Rt)):(ut._code&It&&(Rt=An(ut,st,It,c,p),Rt._code=he(Rt,c),v.push(Rt)),v.push(st));o=v}return o}function Rs(o,c){var p,v,k,A,V,nt,st,ut,yt;if(!o||o.length===0)throw new Error("latlngs not passed");Ne(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var It=vt([0,0]),Rt=dt(o),Oe=Rt.getNorthWest().distanceTo(Rt.getSouthWest())*Rt.getNorthEast().distanceTo(Rt.getNorthWest());Oe<1700&&(It=mi(o));var ve=o.length,hi=[];for(p=0;p<ve;p++){var Fe=vt(o[p]);hi.push(c.project(vt([Fe.lat-It.lat,Fe.lng-It.lng])))}for(nt=st=ut=0,p=0,v=ve-1;p<ve;v=p++)k=hi[p],A=hi[v],V=k.y*A.x-A.y*k.x,st+=(k.x+A.x)*V,ut+=(k.y+A.y)*V,nt+=V*3;nt===0?yt=hi[0]:yt=[st/nt,ut/nt];var Cr=c.unproject(rt(yt));return vt([Cr.lat+It.lat,Cr.lng+It.lng])}function mi(o){for(var c=0,p=0,v=0,k=0;k<o.length;k++){var A=vt(o[k]);c+=A.lat,p+=A.lng,v++}return vt([c/v,p/v])}var Pe={__proto__:null,clipPolygon:Os,polygonCenter:Rs,centroid:mi};function Ds(o,c){if(!c||!o.length)return o.slice();var p=c*c;return o=Lo(o,p),o=ko(o,p),o}function wo(o,c,p){return Math.sqrt(Nn(o,c,p,!0))}function yl(o,c,p){return Nn(o,c,p)}function ko(o,c){var p=o.length,v=typeof Uint8Array!="undefined"?Uint8Array:Array,k=new v(p);k[0]=k[p-1]=1,xr(o,k,c,0,p-1);var A,V=[];for(A=0;A<p;A++)k[A]&&V.push(o[A]);return V}function xr(o,c,p,v,k){var A=0,V,nt,st;for(nt=v+1;nt<=k-1;nt++)st=Nn(o[nt],o[v],o[k],!0),st>A&&(V=nt,A=st);A>p&&(c[V]=1,xr(o,c,p,v,V),xr(o,c,p,V,k))}function Lo(o,c){for(var p=[o[0]],v=1,k=0,A=o.length;v<A;v++)Pn(o[v],o[k])>c&&(p.push(o[v]),k=v);return k<A-1&&p.push(o[A-1]),p}var Eo;function ze(o,c,p,v,k){var A=v?Eo:he(o,p),V=he(c,p),nt,st,ut;for(Eo=V;;){if(!(A|V))return[o,c];if(A&V)return!1;nt=A||V,st=An(o,c,nt,p,k),ut=he(st,p),nt===A?(o=st,A=ut):(c=st,V=ut)}}function An(o,c,p,v,k){var A=c.x-o.x,V=c.y-o.y,nt=v.min,st=v.max,ut,yt;return p&8?(ut=o.x+A*(st.y-o.y)/V,yt=st.y):p&4?(ut=o.x+A*(nt.y-o.y)/V,yt=nt.y):p&2?(ut=st.x,yt=o.y+V*(st.x-o.x)/A):p&1&&(ut=nt.x,yt=o.y+V*(nt.x-o.x)/A),new J(ut,yt,k)}function he(o,c){var p=0;return o.x<c.min.x?p|=1:o.x>c.max.x&&(p|=2),o.y<c.min.y?p|=4:o.y>c.max.y&&(p|=8),p}function Pn(o,c){var p=c.x-o.x,v=c.y-o.y;return p*p+v*v}function Nn(o,c,p,v){var k=c.x,A=c.y,V=p.x-k,nt=p.y-A,st=V*V+nt*nt,ut;return st>0&&(ut=((o.x-k)*V+(o.y-A)*nt)/st,ut>1?(k=p.x,A=p.y):ut>0&&(k+=V*ut,A+=nt*ut)),V=o.x-k,nt=o.y-A,v?V*V+nt*nt:new J(k,A)}function Ne(o){return!U(o[0])||typeof o[0][0]!="object"&&typeof o[0][0]!="undefined"}function To(o){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ne(o)}function Io(o,c){var p,v,k,A,V,nt,st,ut;if(!o||o.length===0)throw new Error("latlngs not passed");Ne(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var yt=vt([0,0]),It=dt(o),Rt=It.getNorthWest().distanceTo(It.getSouthWest())*It.getNorthEast().distanceTo(It.getNorthWest());Rt<1700&&(yt=mi(o));var Oe=o.length,ve=[];for(p=0;p<Oe;p++){var hi=vt(o[p]);ve.push(c.project(vt([hi.lat-yt.lat,hi.lng-yt.lng])))}for(p=0,v=0;p<Oe-1;p++)v+=ve[p].distanceTo(ve[p+1])/2;if(v===0)ut=ve[0];else for(p=0,A=0;p<Oe-1;p++)if(V=ve[p],nt=ve[p+1],k=V.distanceTo(nt),A+=k,A>v){st=(A-v)/k,ut=[nt.x-st*(nt.x-V.x),nt.y-st*(nt.y-V.y)];break}var Fe=c.unproject(rt(ut));return vt([Fe.lat+yt.lat,Fe.lng+yt.lng])}var Co={__proto__:null,simplify:Ds,pointToSegmentDistance:wo,closestPointOnSegment:yl,clipSegment:ze,_getEdgeIntersection:An,_getBitCode:he,_sqClosestPointOnSegment:Nn,isFlat:Ne,_flat:To,polylineCenter:Io},So={project:function(o){return new J(o.lng,o.lat)},unproject:function(o){return new pt(o.y,o.x)},bounds:new ht([-180,-90],[180,90])},Mo={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ht([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(o){var c=Math.PI/180,p=this.R,v=o.lat*c,k=this.R_MINOR/p,A=Math.sqrt(1-k*k),V=A*Math.sin(v),nt=Math.tan(Math.PI/4-v/2)/Math.pow((1-V)/(1+V),A/2);return v=-p*Math.log(Math.max(nt,1e-10)),new J(o.lng*c*p,v)},unproject:function(o){for(var c=180/Math.PI,p=this.R,v=this.R_MINOR/p,k=Math.sqrt(1-v*v),A=Math.exp(-o.y/p),V=Math.PI/2-2*Math.atan(A),nt=0,st=.1,ut;nt<15&&Math.abs(st)>1e-7;nt++)ut=k*Math.sin(V),ut=Math.pow((1-ut)/(1+ut),k/2),st=Math.PI/2-2*Math.atan(A*ut)-V,V+=st;return new pt(V*c,o.x*c/p)}},_l={__proto__:null,LonLat:So,Mercator:Mo,SphericalMercator:qt},vl=r({},tt,{code:"EPSG:3395",projection:Mo,transformation:(function(){var o=.5/(Math.PI*Mo.R);return Z(o,.5,-o,.5)})()}),Bs=r({},tt,{code:"EPSG:4326",projection:So,transformation:Z(1/180,1,-1/180,.5)}),bl=r({},Yt,{projection:So,transformation:Z(1,0,-1,0),scale:function(o){return Math.pow(2,o)},zoom:function(o){return Math.log(o)/Math.LN2},distance:function(o,c){var p=c.lng-o.lng,v=c.lat-o.lat;return Math.sqrt(p*p+v*v)},infinite:!0});Yt.Earth=tt,Yt.EPSG3395=vl,Yt.EPSG3857=Wt,Yt.EPSG900913=oe,Yt.EPSG4326=Bs,Yt.Simple=bl;var Ye=$.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(o){return o.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(o){return o&&o.removeLayer(this),this},getPane:function(o){return this._map.getPane(o?this.options[o]||o:this.options.pane)},addInteractiveTarget:function(o){return this._map._targets[m(o)]=this,this},removeInteractiveTarget:function(o){return delete this._map._targets[m(o)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(o){var c=o.target;if(c.hasLayer(this)){if(this._map=c,this._zoomAnimated=c._zoomAnimated,this.getEvents){var p=this.getEvents();c.on(p,this),this.once("remove",function(){c.off(p,this)},this)}this.onAdd(c),this.fire("add"),c.fire("layeradd",{layer:this})}}});At.include({addLayer:function(o){if(!o._layerAdd)throw new Error("The provided object is not a Layer.");var c=m(o);return this._layers[c]?this:(this._layers[c]=o,o._mapToAdd=this,o.beforeAdd&&o.beforeAdd(this),this.whenReady(o._layerAdd,o),this)},removeLayer:function(o){var c=m(o);return this._layers[c]?(this._loaded&&o.onRemove(this),delete this._layers[c],this._loaded&&(this.fire("layerremove",{layer:o}),o.fire("remove")),o._map=o._mapToAdd=null,this):this},hasLayer:function(o){return m(o)in this._layers},eachLayer:function(o,c){for(var p in this._layers)o.call(c,this._layers[p]);return this},_addLayers:function(o){o=o?U(o)?o:[o]:[];for(var c=0,p=o.length;c<p;c++)this.addLayer(o[c])},_addZoomLimit:function(o){(!isNaN(o.options.maxZoom)||!isNaN(o.options.minZoom))&&(this._zoomBoundLayers[m(o)]=o,this._updateZoomLevels())},_removeZoomLimit:function(o){var c=m(o);this._zoomBoundLayers[c]&&(delete this._zoomBoundLayers[c],this._updateZoomLevels())},_updateZoomLevels:function(){var o=1/0,c=-1/0,p=this._getZoomSpan();for(var v in this._zoomBoundLayers){var k=this._zoomBoundLayers[v].options;o=k.minZoom===void 0?o:Math.min(o,k.minZoom),c=k.maxZoom===void 0?c:Math.max(c,k.maxZoom)}this._layersMaxZoom=c===-1/0?void 0:c,this._layersMinZoom=o===1/0?void 0:o,p!==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 cn=Ye.extend({initialize:function(o,c){O(this,c),this._layers={};var p,v;if(o)for(p=0,v=o.length;p<v;p++)this.addLayer(o[p])},addLayer:function(o){var c=this.getLayerId(o);return this._layers[c]=o,this._map&&this._map.addLayer(o),this},removeLayer:function(o){var c=o in this._layers?o:this.getLayerId(o);return this._map&&this._layers[c]&&this._map.removeLayer(this._layers[c]),delete this._layers[c],this},hasLayer:function(o){var c=typeof o=="number"?o:this.getLayerId(o);return c in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(o){var c=Array.prototype.slice.call(arguments,1),p,v;for(p in this._layers)v=this._layers[p],v[o]&&v[o].apply(v,c);return this},onAdd:function(o){this.eachLayer(o.addLayer,o)},onRemove:function(o){this.eachLayer(o.removeLayer,o)},eachLayer:function(o,c){for(var p in this._layers)o.call(c,this._layers[p]);return this},getLayer:function(o){return this._layers[o]},getLayers:function(){var o=[];return this.eachLayer(o.push,o),o},setZIndex:function(o){return this.invoke("setZIndex",o)},getLayerId:function(o){return m(o)}}),zs=function(o,c){return new cn(o,c)},yi=cn.extend({addLayer:function(o){return this.hasLayer(o)?this:(o.addEventParent(this),cn.prototype.addLayer.call(this,o),this.fire("layeradd",{layer:o}))},removeLayer:function(o){return this.hasLayer(o)?(o in this._layers&&(o=this._layers[o]),o.removeEventParent(this),cn.prototype.removeLayer.call(this,o),this.fire("layerremove",{layer:o})):this},setStyle:function(o){return this.invoke("setStyle",o)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var o=new kt;for(var c in this._layers){var p=this._layers[c];o.extend(p.getBounds?p.getBounds():p.getLatLng())}return o}}),Fs=function(o,c){return new yi(o,c)},fn=j.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(o){O(this,o)},createIcon:function(o){return this._createIcon("icon",o)},createShadow:function(o){return this._createIcon("shadow",o)},_createIcon:function(o,c){var p=this._getIconUrl(o);if(!p){if(o==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var v=this._createImg(p,c&&c.tagName==="IMG"?c:null);return this._setIconStyles(v,o),(this.options.crossOrigin||this.options.crossOrigin==="")&&(v.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),v},_setIconStyles:function(o,c){var p=this.options,v=p[c+"Size"];typeof v=="number"&&(v=[v,v]);var k=rt(v),A=rt(c==="shadow"&&p.shadowAnchor||p.iconAnchor||k&&k.divideBy(2,!0));o.className="leaflet-marker-"+c+" "+(p.className||""),A&&(o.style.marginLeft=-A.x+"px",o.style.marginTop=-A.y+"px"),k&&(o.style.width=k.x+"px",o.style.height=k.y+"px")},_createImg:function(o,c){return c=c||document.createElement("img"),c.src=o,c},_getIconUrl:function(o){return xt.retina&&this.options[o+"RetinaUrl"]||this.options[o+"Url"]}});function xl(o){return new fn(o)}var On=fn.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(o){return typeof On.imagePath!="string"&&(On.imagePath=this._detectIconPath()),(this.options.imagePath||On.imagePath)+fn.prototype._getIconUrl.call(this,o)},_stripUrl:function(o){var c=function(p,v,k){var A=v.exec(p);return A&&A[k]};return o=c(o,/^url\((['"])?(.+)\1\)$/,2),o&&c(o,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var o=Bt("div","leaflet-default-icon-path",document.body),c=ii(o,"background-image")||ii(o,"backgroundImage");if(document.body.removeChild(o),c=this._stripUrl(c),c)return c;var p=document.querySelector('link[href$="leaflet.css"]');return p?p.href.substring(0,p.href.length-11-1):""}}),Gs=si.extend({initialize:function(o){this._marker=o},addHooks:function(){var o=this._marker._icon;this._draggable||(this._draggable=new Ci(o,o,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),Ct(o,"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&&Ht(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(o){var c=this._marker,p=c._map,v=this._marker.options.autoPanSpeed,k=this._marker.options.autoPanPadding,A=Ei(c._icon),V=p.getPixelBounds(),nt=p.getPixelOrigin(),st=_t(V.min._subtract(nt).add(k),V.max._subtract(nt).subtract(k));if(!st.contains(A)){var ut=rt((Math.max(st.max.x,A.x)-st.max.x)/(V.max.x-st.max.x)-(Math.min(st.min.x,A.x)-st.min.x)/(V.min.x-st.min.x),(Math.max(st.max.y,A.y)-st.max.y)/(V.max.y-st.max.y)-(Math.min(st.min.y,A.y)-st.min.y)/(V.min.y-st.min.y)).multiplyBy(v);p.panBy(ut,{animate:!1}),this._draggable._newPos._add(ut),this._draggable._startPos._add(ut),ae(c._icon,this._draggable._newPos),this._onDrag(o),this._panRequest=F(this._adjustPan.bind(this,o))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(o){this._marker.options.autoPan&&(q(this._panRequest),this._panRequest=F(this._adjustPan.bind(this,o)))},_onDrag:function(o){var c=this._marker,p=c._shadow,v=Ei(c._icon),k=c._map.layerPointToLatLng(v);p&&ae(p,v),c._latlng=k,o.latlng=k,o.oldLatLng=this._oldLatLng,c.fire("move",o).fire("drag",o)},_onDragEnd:function(o){q(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",o)}}),wr=Ye.extend({options:{icon:new On,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(o,c){O(this,c),this._latlng=vt(o)},onAdd:function(o){this._zoomAnimated=this._zoomAnimated&&o.options.markerZoomAnimation,this._zoomAnimated&&o.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(o){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&o.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(o){var c=this._latlng;return this._latlng=vt(o),this.update(),this.fire("move",{oldLatLng:c,latlng:this._latlng})},setZIndexOffset:function(o){return this.options.zIndexOffset=o,this.update()},getIcon:function(){return this.options.icon},setIcon:function(o){return this.options.icon=o,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 o=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(o)}return this},_initIcon:function(){var o=this.options,c="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),p=o.icon.createIcon(this._icon),v=!1;p!==this._icon&&(this._icon&&this._removeIcon(),v=!0,o.title&&(p.title=o.title),p.tagName==="IMG"&&(p.alt=o.alt||"")),Ct(p,c),o.keyboard&&(p.tabIndex="0",p.setAttribute("role","button")),this._icon=p,o.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Mt(p,"focus",this._panOnFocus,this);var k=o.icon.createShadow(this._shadow),A=!1;k!==this._shadow&&(this._removeShadow(),A=!0),k&&(Ct(k,c),k.alt=""),this._shadow=k,o.opacity<1&&this._updateOpacity(),v&&this.getPane().appendChild(this._icon),this._initInteraction(),k&&A&&this.getPane(o.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Xt(this._icon,"focus",this._panOnFocus,this),$t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&$t(this._shadow),this._shadow=null},_setPos:function(o){this._icon&&ae(this._icon,o),this._shadow&&ae(this._shadow,o),this._zIndex=o.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(o){this._icon&&(this._icon.style.zIndex=this._zIndex+o)},_animateZoom:function(o){var c=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center).round();this._setPos(c)},_initInteraction:function(){if(this.options.interactive&&(Ct(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Gs)){var o=this.options.draggable;this.dragging&&(o=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Gs(this),o&&this.dragging.enable()}},setOpacity:function(o){return this.options.opacity=o,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var o=this.options.opacity;this._icon&&fe(this._icon,o),this._shadow&&fe(this._shadow,o)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var o=this._map;if(o){var c=this.options.icon.options,p=c.iconSize?rt(c.iconSize):rt(0,0),v=c.iconAnchor?rt(c.iconAnchor):rt(0,0);o.panInside(this._latlng,{paddingTopLeft:v,paddingBottomRight:p.subtract(v)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function wl(o,c){return new wr(o,c)}var Si=Ye.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(o){this._renderer=o.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(o){return O(this,o),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&o&&Object.prototype.hasOwnProperty.call(o,"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)}}),Rn=Si.extend({options:{fill:!0,radius:10},initialize:function(o,c){O(this,c),this._latlng=vt(o),this._radius=this.options.radius},setLatLng:function(o){var c=this._latlng;return this._latlng=vt(o),this.redraw(),this.fire("move",{oldLatLng:c,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(o){return this.options.radius=this._radius=o,this.redraw()},getRadius:function(){return this._radius},setStyle:function(o){var c=o&&o.radius||this._radius;return Si.prototype.setStyle.call(this,o),this.setRadius(c),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var o=this._radius,c=this._radiusY||o,p=this._clickTolerance(),v=[o+p,c+p];this._pxBounds=new ht(this._point.subtract(v),this._point.add(v))},_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(o){return o.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Us(o,c){return new Rn(o,c)}var kr=Rn.extend({initialize:function(o,c,p){if(typeof c=="number"&&(c=r({},p,{radius:c})),O(this,c),this._latlng=vt(o),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(o){return this._mRadius=o,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var o=[this._radius,this._radiusY||this._radius];return new kt(this._map.layerPointToLatLng(this._point.subtract(o)),this._map.layerPointToLatLng(this._point.add(o)))},setStyle:Si.prototype.setStyle,_project:function(){var o=this._latlng.lng,c=this._latlng.lat,p=this._map,v=p.options.crs;if(v.distance===tt.distance){var k=Math.PI/180,A=this._mRadius/tt.R/k,V=p.project([c+A,o]),nt=p.project([c-A,o]),st=V.add(nt).divideBy(2),ut=p.unproject(st).lat,yt=Math.acos((Math.cos(A*k)-Math.sin(c*k)*Math.sin(ut*k))/(Math.cos(c*k)*Math.cos(ut*k)))/k;(isNaN(yt)||yt===0)&&(yt=A/Math.cos(Math.PI/180*c)),this._point=st.subtract(p.getPixelOrigin()),this._radius=isNaN(yt)?0:st.x-p.project([ut,o-yt]).x,this._radiusY=st.y-V.y}else{var It=v.unproject(v.project(this._latlng).subtract([this._mRadius,0]));this._point=p.latLngToLayerPoint(this._latlng),this._radius=this._point.x-p.latLngToLayerPoint(It).x}this._updateBounds()}});function kl(o,c,p){return new kr(o,c,p)}var ai=Si.extend({options:{smoothFactor:1,noClip:!1},initialize:function(o,c){O(this,c),this._setLatLngs(o)},getLatLngs:function(){return this._latlngs},setLatLngs:function(o){return this._setLatLngs(o),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(o){for(var c=1/0,p=null,v=Nn,k,A,V=0,nt=this._parts.length;V<nt;V++)for(var st=this._parts[V],ut=1,yt=st.length;ut<yt;ut++){k=st[ut-1],A=st[ut];var It=v(o,k,A,!0);It<c&&(c=It,p=v(o,k,A))}return p&&(p.distance=Math.sqrt(c)),p},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Io(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(o,c){return c=c||this._defaultShape(),o=vt(o),c.push(o),this._bounds.extend(o),this.redraw()},_setLatLngs:function(o){this._bounds=new kt,this._latlngs=this._convertLatLngs(o)},_defaultShape:function(){return Ne(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(o){for(var c=[],p=Ne(o),v=0,k=o.length;v<k;v++)p?(c[v]=vt(o[v]),this._bounds.extend(c[v])):c[v]=this._convertLatLngs(o[v]);return c},_project:function(){var o=new ht;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,o),this._bounds.isValid()&&o.isValid()&&(this._rawPxBounds=o,this._updateBounds())},_updateBounds:function(){var o=this._clickTolerance(),c=new J(o,o);this._rawPxBounds&&(this._pxBounds=new ht([this._rawPxBounds.min.subtract(c),this._rawPxBounds.max.add(c)]))},_projectLatlngs:function(o,c,p){var v=o[0]instanceof pt,k=o.length,A,V;if(v){for(V=[],A=0;A<k;A++)V[A]=this._map.latLngToLayerPoint(o[A]),p.extend(V[A]);c.push(V)}else for(A=0;A<k;A++)this._projectLatlngs(o[A],c,p)},_clipPoints:function(){var o=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}var c=this._parts,p,v,k,A,V,nt,st;for(p=0,k=0,A=this._rings.length;p<A;p++)for(st=this._rings[p],v=0,V=st.length;v<V-1;v++)nt=ze(st[v],st[v+1],o,v,!0),nt&&(c[k]=c[k]||[],c[k].push(nt[0]),(nt[1]!==st[v+1]||v===V-2)&&(c[k].push(nt[1]),k++))}},_simplifyPoints:function(){for(var o=this._parts,c=this.options.smoothFactor,p=0,v=o.length;p<v;p++)o[p]=Ds(o[p],c)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(o,c){var p,v,k,A,V,nt,st=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(p=0,A=this._parts.length;p<A;p++)for(nt=this._parts[p],v=0,V=nt.length,k=V-1;v<V;k=v++)if(!(!c&&v===0)&&wo(o,nt[k],nt[v])<=st)return!0;return!1}});function Ao(o,c){return new ai(o,c)}ai._flat=To;var dn=ai.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 Rs(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(o){var c=ai.prototype._convertLatLngs.call(this,o),p=c.length;return p>=2&&c[0]instanceof pt&&c[0].equals(c[p-1])&&c.pop(),c},_setLatLngs:function(o){ai.prototype._setLatLngs.call(this,o),Ne(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ne(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var o=this._renderer._bounds,c=this.options.weight,p=new J(c,c);if(o=new ht(o.min.subtract(p),o.max.add(p)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}for(var v=0,k=this._rings.length,A;v<k;v++)A=Os(this._rings[v],o,!0),A.length&&this._parts.push(A)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(o){var c=!1,p,v,k,A,V,nt,st,ut;if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(A=0,st=this._parts.length;A<st;A++)for(p=this._parts[A],V=0,ut=p.length,nt=ut-1;V<ut;nt=V++)v=p[V],k=p[nt],v.y>o.y!=k.y>o.y&&o.x<(k.x-v.x)*(o.y-v.y)/(k.y-v.y)+v.x&&(c=!c);return c||ai.prototype._containsPoint.call(this,o,!0)}});function qs(o,c){return new dn(o,c)}var li=yi.extend({initialize:function(o,c){O(this,c),this._layers={},o&&this.addData(o)},addData:function(o){var c=U(o)?o:o.features,p,v,k;if(c){for(p=0,v=c.length;p<v;p++)k=c[p],(k.geometries||k.geometry||k.features||k.coordinates)&&this.addData(k);return this}var A=this.options;if(A.filter&&!A.filter(o))return this;var V=Lr(o,A);return V?(V.feature=u(o),V.defaultOptions=V.options,this.resetStyle(V),A.onEachFeature&&A.onEachFeature(o,V),this.addLayer(V)):this},resetStyle:function(o){return o===void 0?this.eachLayer(this.resetStyle,this):(o.options=r({},o.defaultOptions),this._setLayerStyle(o,this.options.style),this)},setStyle:function(o){return this.eachLayer(function(c){this._setLayerStyle(c,o)},this)},_setLayerStyle:function(o,c){o.setStyle&&(typeof c=="function"&&(c=c(o.feature)),o.setStyle(c))}});function Lr(o,c){var p=o.type==="Feature"?o.geometry:o,v=p?p.coordinates:null,k=[],A=c&&c.pointToLayer,V=c&&c.coordsToLatLng||Mi,nt,st,ut,yt;if(!v&&!p)return null;switch(p.type){case"Point":return nt=V(v),Zs(A,o,nt,c);case"MultiPoint":for(ut=0,yt=v.length;ut<yt;ut++)nt=V(v[ut]),k.push(Zs(A,o,nt,c));return new yi(k);case"LineString":case"MultiLineString":return st=Er(v,p.type==="LineString"?0:1,V),new ai(st,c);case"Polygon":case"MultiPolygon":return st=Er(v,p.type==="Polygon"?1:2,V),new dn(st,c);case"GeometryCollection":for(ut=0,yt=p.geometries.length;ut<yt;ut++){var It=Lr({geometry:p.geometries[ut],type:"Feature",properties:o.properties},c);It&&k.push(It)}return new yi(k);case"FeatureCollection":for(ut=0,yt=p.features.length;ut<yt;ut++){var Rt=Lr(p.features[ut],c);Rt&&k.push(Rt)}return new yi(k);default:throw new Error("Invalid GeoJSON object.")}}function Zs(o,c,p,v){return o?o(c,p):new wr(p,v&&v.markersInheritOptions&&v)}function Mi(o){return new pt(o[1],o[0],o[2])}function Er(o,c,p){for(var v=[],k=0,A=o.length,V;k<A;k++)V=c?Er(o[k],c-1,p):(p||Mi)(o[k]),v.push(V);return v}function Tr(o,c){return o=vt(o),o.alt!==void 0?[E(o.lng,c),E(o.lat,c),E(o.alt,c)]:[E(o.lng,c),E(o.lat,c)]}function ke(o,c,p,v){for(var k=[],A=0,V=o.length;A<V;A++)k.push(c?ke(o[A],Ne(o[A])?0:c-1,p,v):Tr(o[A],v));return!c&&p&&k.length>0&&k.push(k[0].slice()),k}function Le(o,c){return o.feature?r({},o.feature,{geometry:c}):u(c)}function u(o){return o.type==="Feature"||o.type==="FeatureCollection"?o:{type:"Feature",properties:{},geometry:o}}var t={toGeoJSON:function(o){return Le(this,{type:"Point",coordinates:Tr(this.getLatLng(),o)})}};wr.include(t),kr.include(t),Rn.include(t),ai.include({toGeoJSON:function(o){var c=!Ne(this._latlngs),p=ke(this._latlngs,c?1:0,!1,o);return Le(this,{type:(c?"Multi":"")+"LineString",coordinates:p})}}),dn.include({toGeoJSON:function(o){var c=!Ne(this._latlngs),p=c&&!Ne(this._latlngs[0]),v=ke(this._latlngs,p?2:c?1:0,!0,o);return c||(v=[v]),Le(this,{type:(p?"Multi":"")+"Polygon",coordinates:v})}}),cn.include({toMultiPoint:function(o){var c=[];return this.eachLayer(function(p){c.push(p.toGeoJSON(o).geometry.coordinates)}),Le(this,{type:"MultiPoint",coordinates:c})},toGeoJSON:function(o){var c=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(c==="MultiPoint")return this.toMultiPoint(o);var p=c==="GeometryCollection",v=[];return this.eachLayer(function(k){if(k.toGeoJSON){var A=k.toGeoJSON(o);if(p)v.push(A.geometry);else{var V=u(A);V.type==="FeatureCollection"?v.push.apply(v,V.features):v.push(V)}}}),p?Le(this,{geometries:v,type:"GeometryCollection"}):{type:"FeatureCollection",features:v}}});function e(o,c){return new li(o,c)}var l=e,g=Ye.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(o,c,p){this._url=o,this._bounds=dt(c),O(this,p)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Ct(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){$t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(o){return this.options.opacity=o,this._image&&this._updateOpacity(),this},setStyle:function(o){return o.opacity&&this.setOpacity(o.opacity),this},bringToFront:function(){return this._map&&sn(this._image),this},bringToBack:function(){return this._map&&qi(this._image),this},setUrl:function(o){return this._url=o,this._image&&(this._image.src=o),this},setBounds:function(o){return this._bounds=dt(o),this._map&&this._reset(),this},getEvents:function(){var o={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var o=this._url.tagName==="IMG",c=this._image=o?this._url:Bt("img");if(Ct(c,"leaflet-image-layer"),this._zoomAnimated&&Ct(c,"leaflet-zoom-animated"),this.options.className&&Ct(c,this.options.className),c.onselectstart=b,c.onmousemove=b,c.onload=f(this.fire,this,"load"),c.onerror=f(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(c.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),o){this._url=c.src;return}c.src=this._url,c.alt=this.options.alt},_animateZoom:function(o){var c=this._map.getZoomScale(o.zoom),p=this._map._latLngBoundsToNewLayerBounds(this._bounds,o.zoom,o.center).min;Zi(this._image,p,c)},_reset:function(){var o=this._image,c=new ht(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),p=c.getSize();ae(o,c.min),o.style.width=p.x+"px",o.style.height=p.y+"px"},_updateOpacity:function(){fe(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 o=this.options.errorOverlayUrl;o&&this._url!==o&&(this._url=o,this._image.src=o)},getCenter:function(){return this._bounds.getCenter()}}),y=function(o,c,p){return new g(o,c,p)},w=g.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var o=this._url.tagName==="VIDEO",c=this._image=o?this._url:Bt("video");if(Ct(c,"leaflet-image-layer"),this._zoomAnimated&&Ct(c,"leaflet-zoom-animated"),this.options.className&&Ct(c,this.options.className),c.onselectstart=b,c.onmousemove=b,c.onloadeddata=f(this.fire,this,"load"),o){for(var p=c.getElementsByTagName("source"),v=[],k=0;k<p.length;k++)v.push(p[k].src);this._url=p.length>0?v:[c.src];return}U(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(c.style,"objectFit")&&(c.style.objectFit="fill"),c.autoplay=!!this.options.autoplay,c.loop=!!this.options.loop,c.muted=!!this.options.muted,c.playsInline=!!this.options.playsInline;for(var A=0;A<this._url.length;A++){var V=Bt("source");V.src=this._url[A],c.appendChild(V)}}});function T(o,c,p){return new w(o,c,p)}var M=g.extend({_initImage:function(){var o=this._image=this._url;Ct(o,"leaflet-image-layer"),this._zoomAnimated&&Ct(o,"leaflet-zoom-animated"),this.options.className&&Ct(o,this.options.className),o.onselectstart=b,o.onmousemove=b}});function z(o,c,p){return new M(o,c,p)}var K=Ye.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(o,c){o&&(o instanceof pt||U(o))?(this._latlng=vt(o),O(this,c)):(O(this,o),this._source=c),this.options.content&&(this._content=this.options.content)},openOn:function(o){return o=arguments.length?o:this._source._map,o.hasLayer(this)||o.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(o){return this._map?this.close():(arguments.length?this._source=o:o=this._source,this._prepareOpen(),this.openOn(o._map)),this},onAdd:function(o){this._zoomAnimated=o._zoomAnimated,this._container||this._initLayout(),o._fadeAnimated&&fe(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),o._fadeAnimated&&fe(this._container,1),this.bringToFront(),this.options.interactive&&(Ct(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(o){o._fadeAnimated?(fe(this._container,0),this._removeTimeout=setTimeout(f($t,void 0,this._container),200)):$t(this._container),this.options.interactive&&(Ht(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(o){return this._latlng=vt(o),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(o){return this._content=o,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 o={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&sn(this._container),this},bringToBack:function(){return this._map&&qi(this._container),this},_prepareOpen:function(o){var c=this._source;if(!c._map)return!1;if(c instanceof yi){c=null;var p=this._source._layers;for(var v in p)if(p[v]._map){c=p[v];break}if(!c)return!1;this._source=c}if(!o)if(c.getCenter)o=c.getCenter();else if(c.getLatLng)o=c.getLatLng();else if(c.getBounds)o=c.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(o),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var o=this._contentNode,c=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof c=="string")o.innerHTML=c;else{for(;o.hasChildNodes();)o.removeChild(o.firstChild);o.appendChild(c)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var o=this._map.latLngToLayerPoint(this._latlng),c=rt(this.options.offset),p=this._getAnchor();this._zoomAnimated?ae(this._container,o.add(p)):c=c.add(o).add(p);var v=this._containerBottom=-c.y,k=this._containerLeft=-Math.round(this._containerWidth/2)+c.x;this._container.style.bottom=v+"px",this._container.style.left=k+"px"}},_getAnchor:function(){return[0,0]}});At.include({_initOverlay:function(o,c,p,v){var k=c;return k instanceof o||(k=new o(v).setContent(c)),p&&k.setLatLng(p),k}}),Ye.include({_initOverlay:function(o,c,p,v){var k=p;return k instanceof o?(O(k,v),k._source=this):(k=c&&!v?c:new o(v,this),k.setContent(p)),k}});var it=K.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(o){return o=arguments.length?o:this._source._map,!o.hasLayer(this)&&o._popup&&o._popup.options.autoClose&&o.removeLayer(o._popup),o._popup=this,K.prototype.openOn.call(this,o)},onAdd:function(o){K.prototype.onAdd.call(this,o),o.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Si||this._source.on("preclick",me))},onRemove:function(o){K.prototype.onRemove.call(this,o),o.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Si||this._source.off("preclick",me))},getEvents:function(){var o=K.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(o.preclick=this.close),this.options.keepInView&&(o.moveend=this._adjustPan),o},_initLayout:function(){var o="leaflet-popup",c=this._container=Bt("div",o+" "+(this.options.className||"")+" leaflet-zoom-animated"),p=this._wrapper=Bt("div",o+"-content-wrapper",c);if(this._contentNode=Bt("div",o+"-content",p),hn(c),Mn(this._contentNode),Mt(c,"contextmenu",me),this._tipContainer=Bt("div",o+"-tip-container",c),this._tip=Bt("div",o+"-tip",this._tipContainer),this.options.closeButton){var v=this._closeButton=Bt("a",o+"-close-button",c);v.setAttribute("role","button"),v.setAttribute("aria-label","Close popup"),v.href="#close",v.innerHTML='<span aria-hidden="true">×</span>',Mt(v,"click",function(k){re(k),this.close()},this)}},_updateLayout:function(){var o=this._contentNode,c=o.style;c.width="",c.whiteSpace="nowrap";var p=o.offsetWidth;p=Math.min(p,this.options.maxWidth),p=Math.max(p,this.options.minWidth),c.width=p+1+"px",c.whiteSpace="",c.height="";var v=o.offsetHeight,k=this.options.maxHeight,A="leaflet-popup-scrolled";k&&v>k?(c.height=k+"px",Ct(o,A)):Ht(o,A),this._containerWidth=this._container.offsetWidth},_animateZoom:function(o){var c=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center),p=this._getAnchor();ae(this._container,c.add(p))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var o=this._map,c=parseInt(ii(this._container,"marginBottom"),10)||0,p=this._container.offsetHeight+c,v=this._containerWidth,k=new J(this._containerLeft,-p-this._containerBottom);k._add(Ei(this._container));var A=o.layerPointToContainerPoint(k),V=rt(this.options.autoPanPadding),nt=rt(this.options.autoPanPaddingTopLeft||V),st=rt(this.options.autoPanPaddingBottomRight||V),ut=o.getSize(),yt=0,It=0;A.x+v+st.x>ut.x&&(yt=A.x+v-ut.x+st.x),A.x-yt-nt.x<0&&(yt=A.x-nt.x),A.y+p+st.y>ut.y&&(It=A.y+p-ut.y+st.y),A.y-It-nt.y<0&&(It=A.y-nt.y),(yt||It)&&(this.options.keepInView&&(this._autopanning=!0),o.fire("autopanstart").panBy([yt,It]))}},_getAnchor:function(){return rt(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),lt=function(o,c){return new it(o,c)};At.mergeOptions({closePopupOnClick:!0}),At.include({openPopup:function(o,c,p){return this._initOverlay(it,o,c,p).openOn(this),this},closePopup:function(o){return o=arguments.length?o:this._popup,o&&o.close(),this}}),Ye.include({bindPopup:function(o,c){return this._popup=this._initOverlay(it,this._popup,o,c),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(o){return this._popup&&(this instanceof yi||(this._popup._source=this),this._popup._prepareOpen(o||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(o){return this._popup&&this._popup.setContent(o),this},getPopup:function(){return this._popup},_openPopup:function(o){if(!(!this._popup||!this._map)){Ti(o);var c=o.layer||o.target;if(this._popup._source===c&&!(c instanceof Si)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(o.latlng);return}this._popup._source=c,this.openPopup(o.latlng)}},_movePopup:function(o){this._popup.setLatLng(o.latlng)},_onKeyPress:function(o){o.originalEvent.keyCode===13&&this._openPopup(o)}});var gt=K.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(o){K.prototype.onAdd.call(this,o),this.setOpacity(this.options.opacity),o.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(o){K.prototype.onRemove.call(this,o),o.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var o=K.prototype.getEvents.call(this);return this.options.permanent||(o.preclick=this.close),o},_initLayout:function(){var o="leaflet-tooltip",c=o+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Bt("div",c),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+m(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(o){var c,p,v=this._map,k=this._container,A=v.latLngToContainerPoint(v.getCenter()),V=v.layerPointToContainerPoint(o),nt=this.options.direction,st=k.offsetWidth,ut=k.offsetHeight,yt=rt(this.options.offset),It=this._getAnchor();nt==="top"?(c=st/2,p=ut):nt==="bottom"?(c=st/2,p=0):nt==="center"?(c=st/2,p=ut/2):nt==="right"?(c=0,p=ut/2):nt==="left"?(c=st,p=ut/2):V.x<A.x?(nt="right",c=0,p=ut/2):(nt="left",c=st+(yt.x+It.x)*2,p=ut/2),o=o.subtract(rt(c,p,!0)).add(yt).add(It),Ht(k,"leaflet-tooltip-right"),Ht(k,"leaflet-tooltip-left"),Ht(k,"leaflet-tooltip-top"),Ht(k,"leaflet-tooltip-bottom"),Ct(k,"leaflet-tooltip-"+nt),ae(k,o)},_updatePosition:function(){var o=this._map.latLngToLayerPoint(this._latlng);this._setPosition(o)},setOpacity:function(o){this.options.opacity=o,this._container&&fe(this._container,o)},_animateZoom:function(o){var c=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center);this._setPosition(c)},_getAnchor:function(){return rt(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),bt=function(o,c){return new gt(o,c)};At.include({openTooltip:function(o,c,p){return this._initOverlay(gt,o,c,p).openOn(this),this},closeTooltip:function(o){return o.close(),this}}),Ye.include({bindTooltip:function(o,c){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(gt,this._tooltip,o,c),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(o){if(!(!o&&this._tooltipHandlersAdded)){var c=o?"off":"on",p={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?p.add=this._openTooltip:(p.mouseover=this._openTooltip,p.mouseout=this.closeTooltip,p.click=this._openTooltip,this._map?this._addFocusListeners():p.add=this._addFocusListeners),this._tooltip.options.sticky&&(p.mousemove=this._moveTooltip),this[c](p),this._tooltipHandlersAdded=!o}},openTooltip:function(o){return this._tooltip&&(this instanceof yi||(this._tooltip._source=this),this._tooltip._prepareOpen(o)&&(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(o){return this._tooltip&&this._tooltip.setContent(o),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(o){var c=typeof o.getElement=="function"&&o.getElement();c&&(Mt(c,"focus",function(){this._tooltip._source=o,this.openTooltip()},this),Mt(c,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(o){var c=typeof o.getElement=="function"&&o.getElement();c&&c.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(o){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var c=this;this._map.once("moveend",function(){c._openOnceFlag=!1,c._openTooltip(o)});return}this._tooltip._source=o.layer||o.target,this.openTooltip(this._tooltip.options.sticky?o.latlng:void 0)}},_moveTooltip:function(o){var c=o.latlng,p,v;this._tooltip.options.sticky&&o.originalEvent&&(p=this._map.mouseEventToContainerPoint(o.originalEvent),v=this._map.containerPointToLayerPoint(p),c=this._map.layerPointToLatLng(v)),this._tooltip.setLatLng(c)}});var wt=fn.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(o){var c=o&&o.tagName==="DIV"?o:document.createElement("div"),p=this.options;if(p.html instanceof Element?(dr(c),c.appendChild(p.html)):c.innerHTML=p.html!==!1?p.html:"",p.bgPos){var v=rt(p.bgPos);c.style.backgroundPosition=-v.x+"px "+-v.y+"px"}return this._setIconStyles(c,"icon"),c},createShadow:function(){return null}});function zt(o){return new wt(o)}fn.Default=On;var Ot=Ye.extend({options:{tileSize:256,opacity:1,updateWhenIdle:xt.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(o){O(this,o)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(o){o._addZoomLimit(this)},onRemove:function(o){this._removeAllTiles(),$t(this._container),o._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(sn(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(qi(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(o){return this.options.opacity=o,this._updateOpacity(),this},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var o=this._clampZoom(this._map.getZoom());o!==this._tileZoom&&(this._tileZoom=o,this._updateLevels()),this._update()}return this},getEvents:function(){var o={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)),o.move=this._onMove),this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},createTile:function(){return document.createElement("div")},getTileSize:function(){var o=this.options.tileSize;return o instanceof J?o:new J(o,o)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(o){for(var c=this.getPane().children,p=-o(-1/0,1/0),v=0,k=c.length,A;v<k;v++)A=c[v].style.zIndex,c[v]!==this._container&&A&&(p=o(p,+A));isFinite(p)&&(this.options.zIndex=p+o(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!xt.ielt9){fe(this._container,this.options.opacity);var o=+new Date,c=!1,p=!1;for(var v in this._tiles){var k=this._tiles[v];if(!(!k.current||!k.loaded)){var A=Math.min(1,(o-k.loaded)/200);fe(k.el,A),A<1?c=!0:(k.active?p=!0:this._onOpaqueTile(k),k.active=!0)}}p&&!this._noPrune&&this._pruneTiles(),c&&(q(this._fadeFrame),this._fadeFrame=F(this._updateOpacity,this))}},_onOpaqueTile:b,_initContainer:function(){this._container||(this._container=Bt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var o=this._tileZoom,c=this.options.maxZoom;if(o!==void 0){for(var p in this._levels)p=Number(p),this._levels[p].el.children.length||p===o?(this._levels[p].el.style.zIndex=c-Math.abs(o-p),this._onUpdateLevel(p)):($t(this._levels[p].el),this._removeTilesAtZoom(p),this._onRemoveLevel(p),delete this._levels[p]);var v=this._levels[o],k=this._map;return v||(v=this._levels[o]={},v.el=Bt("div","leaflet-tile-container leaflet-zoom-animated",this._container),v.el.style.zIndex=c,v.origin=k.project(k.unproject(k.getPixelOrigin()),o).round(),v.zoom=o,this._setZoomTransform(v,k.getCenter(),k.getZoom()),b(v.el.offsetWidth),this._onCreateLevel(v)),this._level=v,v}},_onUpdateLevel:b,_onRemoveLevel:b,_onCreateLevel:b,_pruneTiles:function(){if(this._map){var o,c,p=this._map.getZoom();if(p>this.options.maxZoom||p<this.options.minZoom){this._removeAllTiles();return}for(o in this._tiles)c=this._tiles[o],c.retain=c.current;for(o in this._tiles)if(c=this._tiles[o],c.current&&!c.active){var v=c.coords;this._retainParent(v.x,v.y,v.z,v.z-5)||this._retainChildren(v.x,v.y,v.z,v.z+2)}for(o in this._tiles)this._tiles[o].retain||this._removeTile(o)}},_removeTilesAtZoom:function(o){for(var c in this._tiles)this._tiles[c].coords.z===o&&this._removeTile(c)},_removeAllTiles:function(){for(var o in this._tiles)this._removeTile(o)},_invalidateAll:function(){for(var o in this._levels)$t(this._levels[o].el),this._onRemoveLevel(Number(o)),delete this._levels[o];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(o,c,p,v){var k=Math.floor(o/2),A=Math.floor(c/2),V=p-1,nt=new J(+k,+A);nt.z=+V;var st=this._tileCoordsToKey(nt),ut=this._tiles[st];return ut&&ut.active?(ut.retain=!0,!0):(ut&&ut.loaded&&(ut.retain=!0),V>v?this._retainParent(k,A,V,v):!1)},_retainChildren:function(o,c,p,v){for(var k=2*o;k<2*o+2;k++)for(var A=2*c;A<2*c+2;A++){var V=new J(k,A);V.z=p+1;var nt=this._tileCoordsToKey(V),st=this._tiles[nt];if(st&&st.active){st.retain=!0;continue}else st&&st.loaded&&(st.retain=!0);p+1<v&&this._retainChildren(k,A,p+1,v)}},_resetView:function(o){var c=o&&(o.pinch||o.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),c,c)},_animateZoom:function(o){this._setView(o.center,o.zoom,!0,o.noUpdate)},_clampZoom:function(o){var c=this.options;return c.minNativeZoom!==void 0&&o<c.minNativeZoom?c.minNativeZoom:c.maxNativeZoom!==void 0&&c.maxNativeZoom<o?c.maxNativeZoom:o},_setView:function(o,c,p,v){var k=Math.round(c);this.options.maxZoom!==void 0&&k>this.options.maxZoom||this.options.minZoom!==void 0&&k<this.options.minZoom?k=void 0:k=this._clampZoom(k);var A=this.options.updateWhenZooming&&k!==this._tileZoom;(!v||A)&&(this._tileZoom=k,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),k!==void 0&&this._update(o),p||this._pruneTiles(),this._noPrune=!!p),this._setZoomTransforms(o,c)},_setZoomTransforms:function(o,c){for(var p in this._levels)this._setZoomTransform(this._levels[p],o,c)},_setZoomTransform:function(o,c,p){var v=this._map.getZoomScale(p,o.zoom),k=o.origin.multiplyBy(v).subtract(this._map._getNewPixelOrigin(c,p)).round();xt.any3d?Zi(o.el,k,v):ae(o.el,k)},_resetGrid:function(){var o=this._map,c=o.options.crs,p=this._tileSize=this.getTileSize(),v=this._tileZoom,k=this._map.getPixelWorldBounds(this._tileZoom);k&&(this._globalTileRange=this._pxBoundsToTileRange(k)),this._wrapX=c.wrapLng&&!this.options.noWrap&&[Math.floor(o.project([0,c.wrapLng[0]],v).x/p.x),Math.ceil(o.project([0,c.wrapLng[1]],v).x/p.y)],this._wrapY=c.wrapLat&&!this.options.noWrap&&[Math.floor(o.project([c.wrapLat[0],0],v).y/p.x),Math.ceil(o.project([c.wrapLat[1],0],v).y/p.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(o){var c=this._map,p=c._animatingZoom?Math.max(c._animateToZoom,c.getZoom()):c.getZoom(),v=c.getZoomScale(p,this._tileZoom),k=c.project(o,this._tileZoom).floor(),A=c.getSize().divideBy(v*2);return new ht(k.subtract(A),k.add(A))},_update:function(o){var c=this._map;if(c){var p=this._clampZoom(c.getZoom());if(o===void 0&&(o=c.getCenter()),this._tileZoom!==void 0){var v=this._getTiledPixelBounds(o),k=this._pxBoundsToTileRange(v),A=k.getCenter(),V=[],nt=this.options.keepBuffer,st=new ht(k.getBottomLeft().subtract([nt,-nt]),k.getTopRight().add([nt,-nt]));if(!(isFinite(k.min.x)&&isFinite(k.min.y)&&isFinite(k.max.x)&&isFinite(k.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var ut in this._tiles){var yt=this._tiles[ut].coords;(yt.z!==this._tileZoom||!st.contains(new J(yt.x,yt.y)))&&(this._tiles[ut].current=!1)}if(Math.abs(p-this._tileZoom)>1){this._setView(o,p);return}for(var It=k.min.y;It<=k.max.y;It++)for(var Rt=k.min.x;Rt<=k.max.x;Rt++){var Oe=new J(Rt,It);if(Oe.z=this._tileZoom,!!this._isValidTile(Oe)){var ve=this._tiles[this._tileCoordsToKey(Oe)];ve?ve.current=!0:V.push(Oe)}}if(V.sort(function(Fe,Cr){return Fe.distanceTo(A)-Cr.distanceTo(A)}),V.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var hi=document.createDocumentFragment();for(Rt=0;Rt<V.length;Rt++)this._addTile(V[Rt],hi);this._level.el.appendChild(hi)}}}},_isValidTile:function(o){var c=this._map.options.crs;if(!c.infinite){var p=this._globalTileRange;if(!c.wrapLng&&(o.x<p.min.x||o.x>p.max.x)||!c.wrapLat&&(o.y<p.min.y||o.y>p.max.y))return!1}if(!this.options.bounds)return!0;var v=this._tileCoordsToBounds(o);return dt(this.options.bounds).overlaps(v)},_keyToBounds:function(o){return this._tileCoordsToBounds(this._keyToTileCoords(o))},_tileCoordsToNwSe:function(o){var c=this._map,p=this.getTileSize(),v=o.scaleBy(p),k=v.add(p),A=c.unproject(v,o.z),V=c.unproject(k,o.z);return[A,V]},_tileCoordsToBounds:function(o){var c=this._tileCoordsToNwSe(o),p=new kt(c[0],c[1]);return this.options.noWrap||(p=this._map.wrapLatLngBounds(p)),p},_tileCoordsToKey:function(o){return o.x+":"+o.y+":"+o.z},_keyToTileCoords:function(o){var c=o.split(":"),p=new J(+c[0],+c[1]);return p.z=+c[2],p},_removeTile:function(o){var c=this._tiles[o];c&&($t(c.el),delete this._tiles[o],this.fire("tileunload",{tile:c.el,coords:this._keyToTileCoords(o)}))},_initTile:function(o){Ct(o,"leaflet-tile");var c=this.getTileSize();o.style.width=c.x+"px",o.style.height=c.y+"px",o.onselectstart=b,o.onmousemove=b,xt.ielt9&&this.options.opacity<1&&fe(o,this.options.opacity)},_addTile:function(o,c){var p=this._getTilePos(o),v=this._tileCoordsToKey(o),k=this.createTile(this._wrapCoords(o),f(this._tileReady,this,o));this._initTile(k),this.createTile.length<2&&F(f(this._tileReady,this,o,null,k)),ae(k,p),this._tiles[v]={el:k,coords:o,current:!0},c.appendChild(k),this.fire("tileloadstart",{tile:k,coords:o})},_tileReady:function(o,c,p){c&&this.fire("tileerror",{error:c,tile:p,coords:o});var v=this._tileCoordsToKey(o);p=this._tiles[v],p&&(p.loaded=+new Date,this._map._fadeAnimated?(fe(p.el,0),q(this._fadeFrame),this._fadeFrame=F(this._updateOpacity,this)):(p.active=!0,this._pruneTiles()),c||(Ct(p.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:p.el,coords:o})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),xt.ielt9||!this._map._fadeAnimated?F(this._pruneTiles,this):setTimeout(f(this._pruneTiles,this),250)))},_getTilePos:function(o){return o.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(o){var c=new J(this._wrapX?x(o.x,this._wrapX):o.x,this._wrapY?x(o.y,this._wrapY):o.y);return c.z=o.z,c},_pxBoundsToTileRange:function(o){var c=this.getTileSize();return new ht(o.min.unscaleBy(c).floor(),o.max.unscaleBy(c).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var o in this._tiles)if(!this._tiles[o].loaded)return!1;return!0}});function Jt(o){return new Ot(o)}var ee=Ot.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(o,c){this._url=o,c=O(this,c),c.detectRetina&&xt.retina&&c.maxZoom>0?(c.tileSize=Math.floor(c.tileSize/2),c.zoomReverse?(c.zoomOffset--,c.minZoom=Math.min(c.maxZoom,c.minZoom+1)):(c.zoomOffset++,c.maxZoom=Math.max(c.minZoom,c.maxZoom-1)),c.minZoom=Math.max(0,c.minZoom)):c.zoomReverse?c.minZoom=Math.min(c.maxZoom,c.minZoom):c.maxZoom=Math.max(c.minZoom,c.maxZoom),typeof c.subdomains=="string"&&(c.subdomains=c.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(o,c){return this._url===o&&c===void 0&&(c=!0),this._url=o,c||this.redraw(),this},createTile:function(o,c){var p=document.createElement("img");return Mt(p,"load",f(this._tileOnLoad,this,c,p)),Mt(p,"error",f(this._tileOnError,this,c,p)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(p.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(p.referrerPolicy=this.options.referrerPolicy),p.alt="",p.src=this.getTileUrl(o),p},getTileUrl:function(o){var c={r:xt.retina?"@2x":"",s:this._getSubdomain(o),x:o.x,y:o.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var p=this._globalTileRange.max.y-o.y;this.options.tms&&(c.y=p),c["-y"]=p}return D(this._url,r(c,this.options))},_tileOnLoad:function(o,c){xt.ielt9?setTimeout(f(o,this,null,c),0):o(null,c)},_tileOnError:function(o,c,p){var v=this.options.errorTileUrl;v&&c.getAttribute("src")!==v&&(c.src=v),o(p,c)},_onTileRemove:function(o){o.tile.onload=null},_getZoomForUrl:function(){var o=this._tileZoom,c=this.options.maxZoom,p=this.options.zoomReverse,v=this.options.zoomOffset;return p&&(o=c-o),o+v},_getSubdomain:function(o){var c=Math.abs(o.x+o.y)%this.options.subdomains.length;return this.options.subdomains[c]},_abortLoading:function(){var o,c;for(o in this._tiles)if(this._tiles[o].coords.z!==this._tileZoom&&(c=this._tiles[o].el,c.onload=b,c.onerror=b,!c.complete)){c.src=X;var p=this._tiles[o].coords;$t(c),delete this._tiles[o],this.fire("tileabort",{tile:c,coords:p})}},_removeTile:function(o){var c=this._tiles[o];if(c)return c.el.setAttribute("src",X),Ot.prototype._removeTile.call(this,o)},_tileReady:function(o,c,p){if(!(!this._map||p&&p.getAttribute("src")===X))return Ot.prototype._tileReady.call(this,o,c,p)}});function de(o,c){return new ee(o,c)}var Ai=ee.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(o,c){this._url=o;var p=r({},this.defaultWmsParams);for(var v in c)v in this.options||(p[v]=c[v]);c=O(this,c);var k=c.detectRetina&&xt.retina?2:1,A=this.getTileSize();p.width=A.x*k,p.height=A.y*k,this.wmsParams=p},onAdd:function(o){this._crs=this.options.crs||o.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var c=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[c]=this._crs.code,ee.prototype.onAdd.call(this,o)},getTileUrl:function(o){var c=this._tileCoordsToNwSe(o),p=this._crs,v=_t(p.project(c[0]),p.project(c[1])),k=v.min,A=v.max,V=(this._wmsVersion>=1.3&&this._crs===Bs?[k.y,k.x,A.y,A.x]:[k.x,k.y,A.x,A.y]).join(","),nt=ee.prototype.getTileUrl.call(this,o);return nt+N(this.wmsParams,nt,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+V},setParams:function(o,c){return r(this.wmsParams,o),c||this.redraw(),this}});function Dn(o,c){return new Ai(o,c)}ee.WMS=Ai,de.wms=Dn;var ui=Ye.extend({options:{padding:.1},initialize:function(o){O(this,o),m(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Ct(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 o={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(o.zoomanim=this._onAnimZoom),o},_onAnimZoom:function(o){this._updateTransform(o.center,o.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(o,c){var p=this._map.getZoomScale(c,this._zoom),v=this._map.getSize().multiplyBy(.5+this.options.padding),k=this._map.project(this._center,c),A=v.multiplyBy(-p).add(k).subtract(this._map._getNewPixelOrigin(o,c));xt.any3d?Zi(this._container,A,p):ae(this._container,A)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var o in this._layers)this._layers[o]._reset()},_onZoomEnd:function(){for(var o in this._layers)this._layers[o]._project()},_updatePaths:function(){for(var o in this._layers)this._layers[o]._update()},_update:function(){var o=this.options.padding,c=this._map.getSize(),p=this._map.containerPointToLayerPoint(c.multiplyBy(-o)).round();this._bounds=new ht(p,p.add(c.multiplyBy(1+o*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Po=ui.extend({options:{tolerance:0},getEvents:function(){var o=ui.prototype.getEvents.call(this);return o.viewprereset=this._onViewPreReset,o},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ui.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var o=this._container=document.createElement("canvas");Mt(o,"mousemove",this._onMouseMove,this),Mt(o,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Mt(o,"mouseout",this._handleMouseOut,this),o._leaflet_disable_events=!0,this._ctx=o.getContext("2d")},_destroyContainer:function(){q(this._redrawRequest),delete this._ctx,$t(this._container),Xt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var o;this._redrawBounds=null;for(var c in this._layers)o=this._layers[c],o._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ui.prototype._update.call(this);var o=this._bounds,c=this._container,p=o.getSize(),v=xt.retina?2:1;ae(c,o.min),c.width=v*p.x,c.height=v*p.y,c.style.width=p.x+"px",c.style.height=p.y+"px",xt.retina&&this._ctx.scale(2,2),this._ctx.translate(-o.min.x,-o.min.y),this.fire("update")}},_reset:function(){ui.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(o){this._updateDashArray(o),this._layers[m(o)]=o;var c=o._order={layer:o,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=c),this._drawLast=c,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(o){this._requestRedraw(o)},_removePath:function(o){var c=o._order,p=c.next,v=c.prev;p?p.prev=v:this._drawLast=v,v?v.next=p:this._drawFirst=p,delete o._order,delete this._layers[m(o)],this._requestRedraw(o)},_updatePath:function(o){this._extendRedrawBounds(o),o._project(),o._update(),this._requestRedraw(o)},_updateStyle:function(o){this._updateDashArray(o),this._requestRedraw(o)},_updateDashArray:function(o){if(typeof o.options.dashArray=="string"){var c=o.options.dashArray.split(/[, ]+/),p=[],v,k;for(k=0;k<c.length;k++){if(v=Number(c[k]),isNaN(v))return;p.push(v)}o.options._dashArray=p}else o.options._dashArray=o.options.dashArray},_requestRedraw:function(o){this._map&&(this._extendRedrawBounds(o),this._redrawRequest=this._redrawRequest||F(this._redraw,this))},_extendRedrawBounds:function(o){if(o._pxBounds){var c=(o.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new ht,this._redrawBounds.extend(o._pxBounds.min.subtract([c,c])),this._redrawBounds.extend(o._pxBounds.max.add([c,c]))}},_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 o=this._redrawBounds;if(o){var c=o.getSize();this._ctx.clearRect(o.min.x,o.min.y,c.x,c.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 o,c=this._redrawBounds;if(this._ctx.save(),c){var p=c.getSize();this._ctx.beginPath(),this._ctx.rect(c.min.x,c.min.y,p.x,p.y),this._ctx.clip()}this._drawing=!0;for(var v=this._drawFirst;v;v=v.next)o=v.layer,(!c||o._pxBounds&&o._pxBounds.intersects(c))&&o._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(o,c){if(this._drawing){var p,v,k,A,V=o._parts,nt=V.length,st=this._ctx;if(nt){for(st.beginPath(),p=0;p<nt;p++){for(v=0,k=V[p].length;v<k;v++)A=V[p][v],st[v?"lineTo":"moveTo"](A.x,A.y);c&&st.closePath()}this._fillStroke(st,o)}}},_updateCircle:function(o){if(!(!this._drawing||o._empty())){var c=o._point,p=this._ctx,v=Math.max(Math.round(o._radius),1),k=(Math.max(Math.round(o._radiusY),1)||v)/v;k!==1&&(p.save(),p.scale(1,k)),p.beginPath(),p.arc(c.x,c.y/k,v,0,Math.PI*2,!1),k!==1&&p.restore(),this._fillStroke(p,o)}},_fillStroke:function(o,c){var p=c.options;p.fill&&(o.globalAlpha=p.fillOpacity,o.fillStyle=p.fillColor||p.color,o.fill(p.fillRule||"evenodd")),p.stroke&&p.weight!==0&&(o.setLineDash&&o.setLineDash(c.options&&c.options._dashArray||[]),o.globalAlpha=p.opacity,o.lineWidth=p.weight,o.strokeStyle=p.color,o.lineCap=p.lineCap,o.lineJoin=p.lineJoin,o.stroke())},_onClick:function(o){for(var c=this._map.mouseEventToLayerPoint(o),p,v,k=this._drawFirst;k;k=k.next)p=k.layer,p.options.interactive&&p._containsPoint(c)&&(!(o.type==="click"||o.type==="preclick")||!this._map._draggableMoved(p))&&(v=p);this._fireEvent(v?[v]:!1,o)},_onMouseMove:function(o){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var c=this._map.mouseEventToLayerPoint(o);this._handleMouseHover(o,c)}},_handleMouseOut:function(o){var c=this._hoveredLayer;c&&(Ht(this._container,"leaflet-interactive"),this._fireEvent([c],o,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(o,c){if(!this._mouseHoverThrottled){for(var p,v,k=this._drawFirst;k;k=k.next)p=k.layer,p.options.interactive&&p._containsPoint(c)&&(v=p);v!==this._hoveredLayer&&(this._handleMouseOut(o),v&&(Ct(this._container,"leaflet-interactive"),this._fireEvent([v],o,"mouseover"),this._hoveredLayer=v)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,o),this._mouseHoverThrottled=!0,setTimeout(f(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(o,c,p){this._map._fireDOMEvent(c,p||c.type,o)},_bringToFront:function(o){var c=o._order;if(c){var p=c.next,v=c.prev;if(p)p.prev=v;else return;v?v.next=p:p&&(this._drawFirst=p),c.prev=this._drawLast,this._drawLast.next=c,c.next=null,this._drawLast=c,this._requestRedraw(o)}},_bringToBack:function(o){var c=o._order;if(c){var p=c.next,v=c.prev;if(v)v.next=p;else return;p?p.prev=v:v&&(this._drawLast=v),c.prev=null,c.next=this._drawFirst,this._drawFirst.prev=c,this._drawFirst=c,this._requestRedraw(o)}}});function No(o){return xt.canvas?new Po(o):null}var gn=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(o){return document.createElement("<lvml:"+o+' class="lvml">')}}catch{}return function(o){return document.createElement("<"+o+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Hs={_initContainer:function(){this._container=Bt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ui.prototype._update.call(this),this.fire("update"))},_initPath:function(o){var c=o._container=gn("shape");Ct(c,"leaflet-vml-shape "+(this.options.className||"")),c.coordsize="1 1",o._path=gn("path"),c.appendChild(o._path),this._updateStyle(o),this._layers[m(o)]=o},_addPath:function(o){var c=o._container;this._container.appendChild(c),o.options.interactive&&o.addInteractiveTarget(c)},_removePath:function(o){var c=o._container;$t(c),o.removeInteractiveTarget(c),delete this._layers[m(o)]},_updateStyle:function(o){var c=o._stroke,p=o._fill,v=o.options,k=o._container;k.stroked=!!v.stroke,k.filled=!!v.fill,v.stroke?(c||(c=o._stroke=gn("stroke")),k.appendChild(c),c.weight=v.weight+"px",c.color=v.color,c.opacity=v.opacity,v.dashArray?c.dashStyle=U(v.dashArray)?v.dashArray.join(" "):v.dashArray.replace(/( *, *)/g," "):c.dashStyle="",c.endcap=v.lineCap.replace("butt","flat"),c.joinstyle=v.lineJoin):c&&(k.removeChild(c),o._stroke=null),v.fill?(p||(p=o._fill=gn("fill")),k.appendChild(p),p.color=v.fillColor||v.color,p.opacity=v.fillOpacity):p&&(k.removeChild(p),o._fill=null)},_updateCircle:function(o){var c=o._point.round(),p=Math.round(o._radius),v=Math.round(o._radiusY||p);this._setPath(o,o._empty()?"M0 0":"AL "+c.x+","+c.y+" "+p+","+v+" 0,"+65535*360)},_setPath:function(o,c){o._path.v=c},_bringToFront:function(o){sn(o._container)},_bringToBack:function(o){qi(o._container)}},Bn=xt.vml?gn:Ut,Vi=ui.extend({_initContainer:function(){this._container=Bn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Bn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){$t(this._container),Xt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ui.prototype._update.call(this);var o=this._bounds,c=o.getSize(),p=this._container;(!this._svgSize||!this._svgSize.equals(c))&&(this._svgSize=c,p.setAttribute("width",c.x),p.setAttribute("height",c.y)),ae(p,o.min),p.setAttribute("viewBox",[o.min.x,o.min.y,c.x,c.y].join(" ")),this.fire("update")}},_initPath:function(o){var c=o._path=Bn("path");o.options.className&&Ct(c,o.options.className),o.options.interactive&&Ct(c,"leaflet-interactive"),this._updateStyle(o),this._layers[m(o)]=o},_addPath:function(o){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(o._path),o.addInteractiveTarget(o._path)},_removePath:function(o){$t(o._path),o.removeInteractiveTarget(o._path),delete this._layers[m(o)]},_updatePath:function(o){o._project(),o._update()},_updateStyle:function(o){var c=o._path,p=o.options;c&&(p.stroke?(c.setAttribute("stroke",p.color),c.setAttribute("stroke-opacity",p.opacity),c.setAttribute("stroke-width",p.weight),c.setAttribute("stroke-linecap",p.lineCap),c.setAttribute("stroke-linejoin",p.lineJoin),p.dashArray?c.setAttribute("stroke-dasharray",p.dashArray):c.removeAttribute("stroke-dasharray"),p.dashOffset?c.setAttribute("stroke-dashoffset",p.dashOffset):c.removeAttribute("stroke-dashoffset")):c.setAttribute("stroke","none"),p.fill?(c.setAttribute("fill",p.fillColor||p.color),c.setAttribute("fill-opacity",p.fillOpacity),c.setAttribute("fill-rule",p.fillRule||"evenodd")):c.setAttribute("fill","none"))},_updatePoly:function(o,c){this._setPath(o,eo(o._parts,c))},_updateCircle:function(o){var c=o._point,p=Math.max(Math.round(o._radius),1),v=Math.max(Math.round(o._radiusY),1)||p,k="a"+p+","+v+" 0 1,0 ",A=o._empty()?"M0 0":"M"+(c.x-p)+","+c.y+k+p*2+",0 "+k+-p*2+",0 ";this._setPath(o,A)},_setPath:function(o,c){o._path.setAttribute("d",c)},_bringToFront:function(o){sn(o._path)},_bringToBack:function(o){qi(o._path)}});xt.vml&&Vi.include(Hs);function Ir(o){return xt.svg||xt.vml?new Vi(o):null}At.include({getRenderer:function(o){var c=o.options.renderer||this._getPaneRenderer(o.options.pane)||this.options.renderer||this._renderer;return c||(c=this._renderer=this._createRenderer()),this.hasLayer(c)||this.addLayer(c),c},_getPaneRenderer:function(o){if(o==="overlayPane"||o===void 0)return!1;var c=this._paneRenderers[o];return c===void 0&&(c=this._createRenderer({pane:o}),this._paneRenderers[o]=c),c},_createRenderer:function(o){return this.options.preferCanvas&&No(o)||Ir(o)}});var Kh=dn.extend({initialize:function(o,c){dn.prototype.initialize.call(this,this._boundsToLatLngs(o),c)},setBounds:function(o){return this.setLatLngs(this._boundsToLatLngs(o))},_boundsToLatLngs:function(o){return o=dt(o),[o.getSouthWest(),o.getNorthWest(),o.getNorthEast(),o.getSouthEast()]}});function um(o,c){return new Kh(o,c)}Vi.create=Bn,Vi.pointsToPath=eo,li.geometryToLayer=Lr,li.coordsToLatLng=Mi,li.coordsToLatLngs=Er,li.latLngToCoords=Tr,li.latLngsToCoords=ke,li.getFeature=Le,li.asFeature=u,At.mergeOptions({boxZoom:!0});var Qh=si.extend({initialize:function(o){this._map=o,this._container=o._container,this._pane=o._panes.overlayPane,this._resetStateTimeout=0,o.on("unload",this._destroy,this)},addHooks:function(){Mt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Xt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){$t(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(o){if(!o.shiftKey||o.which!==1&&o.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),gi(),po(),this._startPoint=this._map.mouseEventToContainerPoint(o),Mt(document,{contextmenu:Ti,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(o){this._moved||(this._moved=!0,this._box=Bt("div","leaflet-zoom-box",this._container),Ct(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(o);var c=new ht(this._point,this._startPoint),p=c.getSize();ae(this._box,c.min),this._box.style.width=p.x+"px",this._box.style.height=p.y+"px"},_finish:function(){this._moved&&($t(this._box),Ht(this._container,"leaflet-crosshair")),an(),Cn(),Xt(document,{contextmenu:Ti,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(o){if(!(o.which!==1&&o.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(f(this._resetState,this),0);var c=new kt(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(c).fire("boxzoomend",{boxZoomBounds:c})}},_onKeyDown:function(o){o.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});At.addInitHook("addHandler","boxZoom",Qh),At.mergeOptions({doubleClickZoom:!0});var $h=si.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(o){var c=this._map,p=c.getZoom(),v=c.options.zoomDelta,k=o.originalEvent.shiftKey?p-v:p+v;c.options.doubleClickZoom==="center"?c.setZoom(k):c.setZoomAround(o.containerPoint,k)}});At.addInitHook("addHandler","doubleClickZoom",$h),At.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var tc=si.extend({addHooks:function(){if(!this._draggable){var o=this._map;this._draggable=new Ci(o._mapPane,o._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),o.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),o.on("zoomend",this._onZoomEnd,this),o.whenReady(this._onZoomEnd,this))}Ct(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ht(this._map._container,"leaflet-grab"),Ht(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 o=this._map;if(o._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var c=dt(this._map.options.maxBounds);this._offsetLimit=_t(this._map.latLngToContainerPoint(c.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(c.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;o.fire("movestart").fire("dragstart"),o.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(o){if(this._map.options.inertia){var c=this._lastTime=+new Date,p=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(p),this._times.push(c),this._prunePositions(c)}this._map.fire("move",o).fire("drag",o)},_prunePositions:function(o){for(;this._positions.length>1&&o-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var o=this._map.getSize().divideBy(2),c=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=c.subtract(o).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(o,c){return o-(o-c)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var o=this._draggable._newPos.subtract(this._draggable._startPos),c=this._offsetLimit;o.x<c.min.x&&(o.x=this._viscousLimit(o.x,c.min.x)),o.y<c.min.y&&(o.y=this._viscousLimit(o.y,c.min.y)),o.x>c.max.x&&(o.x=this._viscousLimit(o.x,c.max.x)),o.y>c.max.y&&(o.y=this._viscousLimit(o.y,c.max.y)),this._draggable._newPos=this._draggable._startPos.add(o)}},_onPreDragWrap:function(){var o=this._worldWidth,c=Math.round(o/2),p=this._initialWorldOffset,v=this._draggable._newPos.x,k=(v-c+p)%o+c-p,A=(v+c+p)%o-c-p,V=Math.abs(k+p)<Math.abs(A+p)?k:A;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=V},_onDragEnd:function(o){var c=this._map,p=c.options,v=!p.inertia||o.noInertia||this._times.length<2;if(c.fire("dragend",o),v)c.fire("moveend");else{this._prunePositions(+new Date);var k=this._lastPos.subtract(this._positions[0]),A=(this._lastTime-this._times[0])/1e3,V=p.easeLinearity,nt=k.multiplyBy(V/A),st=nt.distanceTo([0,0]),ut=Math.min(p.inertiaMaxSpeed,st),yt=nt.multiplyBy(ut/st),It=ut/(p.inertiaDeceleration*V),Rt=yt.multiplyBy(-It/2).round();!Rt.x&&!Rt.y?c.fire("moveend"):(Rt=c._limitOffset(Rt,c.options.maxBounds),F(function(){c.panBy(Rt,{duration:It,easeLinearity:V,noMoveStart:!0,animate:!0})}))}}});At.addInitHook("addHandler","dragging",tc),At.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ec=si.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(o){this._map=o,this._setPanDelta(o.options.keyboardPanDelta),this._setZoomDelta(o.options.zoomDelta)},addHooks:function(){var o=this._map._container;o.tabIndex<=0&&(o.tabIndex="0"),Mt(o,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Xt(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 o=document.body,c=document.documentElement,p=o.scrollTop||c.scrollTop,v=o.scrollLeft||c.scrollLeft;this._map._container.focus(),window.scrollTo(v,p)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(o){var c=this._panKeys={},p=this.keyCodes,v,k;for(v=0,k=p.left.length;v<k;v++)c[p.left[v]]=[-1*o,0];for(v=0,k=p.right.length;v<k;v++)c[p.right[v]]=[o,0];for(v=0,k=p.down.length;v<k;v++)c[p.down[v]]=[0,o];for(v=0,k=p.up.length;v<k;v++)c[p.up[v]]=[0,-1*o]},_setZoomDelta:function(o){var c=this._zoomKeys={},p=this.keyCodes,v,k;for(v=0,k=p.zoomIn.length;v<k;v++)c[p.zoomIn[v]]=o;for(v=0,k=p.zoomOut.length;v<k;v++)c[p.zoomOut[v]]=-o},_addHooks:function(){Mt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Xt(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(o){if(!(o.altKey||o.ctrlKey||o.metaKey)){var c=o.keyCode,p=this._map,v;if(c in this._panKeys){if(!p._panAnim||!p._panAnim._inProgress)if(v=this._panKeys[c],o.shiftKey&&(v=rt(v).multiplyBy(3)),p.options.maxBounds&&(v=p._limitOffset(rt(v),p.options.maxBounds)),p.options.worldCopyJump){var k=p.wrapLatLng(p.unproject(p.project(p.getCenter()).add(v)));p.panTo(k)}else p.panBy(v)}else if(c in this._zoomKeys)p.setZoom(p.getZoom()+(o.shiftKey?3:1)*this._zoomKeys[c]);else if(c===27&&p._popup&&p._popup.options.closeOnEscapeKey)p.closePopup();else return;Ti(o)}}});At.addInitHook("addHandler","keyboard",ec),At.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var ic=si.extend({addHooks:function(){Mt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Xt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(o){var c=bo(o),p=this._map.options.wheelDebounceTime;this._delta+=c,this._lastMousePos=this._map.mouseEventToContainerPoint(o),this._startTime||(this._startTime=+new Date);var v=Math.max(p-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(f(this._performZoom,this),v),Ti(o)},_performZoom:function(){var o=this._map,c=o.getZoom(),p=this._map.options.zoomSnap||0;o._stop();var v=this._delta/(this._map.options.wheelPxPerZoomLevel*4),k=4*Math.log(2/(1+Math.exp(-Math.abs(v))))/Math.LN2,A=p?Math.ceil(k/p)*p:k,V=o._limitZoom(c+(this._delta>0?A:-A))-c;this._delta=0,this._startTime=null,V&&(o.options.scrollWheelZoom==="center"?o.setZoom(c+V):o.setZoomAround(this._lastMousePos,c+V))}});At.addInitHook("addHandler","scrollWheelZoom",ic);var hm=600;At.mergeOptions({tapHold:xt.touchNative&&xt.safari&&xt.mobile,tapTolerance:15});var nc=si.extend({addHooks:function(){Mt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Xt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(o){if(clearTimeout(this._holdTimeout),o.touches.length===1){var c=o.touches[0];this._startPos=this._newPos=new J(c.clientX,c.clientY),this._holdTimeout=setTimeout(f(function(){this._cancel(),this._isTapValid()&&(Mt(document,"touchend",re),Mt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",c))},this),hm),Mt(document,"touchend touchcancel contextmenu",this._cancel,this),Mt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function o(){Xt(document,"touchend",re),Xt(document,"touchend touchcancel",o)},_cancel:function(){clearTimeout(this._holdTimeout),Xt(document,"touchend touchcancel contextmenu",this._cancel,this),Xt(document,"touchmove",this._onMove,this)},_onMove:function(o){var c=o.touches[0];this._newPos=new J(c.clientX,c.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(o,c){var p=new MouseEvent(o,{bubbles:!0,cancelable:!0,view:window,screenX:c.screenX,screenY:c.screenY,clientX:c.clientX,clientY:c.clientY});p._simulated=!0,c.target.dispatchEvent(p)}});At.addInitHook("addHandler","tapHold",nc),At.mergeOptions({touchZoom:xt.touch,bounceAtZoomLimits:!0});var rc=si.extend({addHooks:function(){Ct(this._map._container,"leaflet-touch-zoom"),Mt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ht(this._map._container,"leaflet-touch-zoom"),Xt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(o){var c=this._map;if(!(!o.touches||o.touches.length!==2||c._animatingZoom||this._zooming)){var p=c.mouseEventToContainerPoint(o.touches[0]),v=c.mouseEventToContainerPoint(o.touches[1]);this._centerPoint=c.getSize()._divideBy(2),this._startLatLng=c.containerPointToLatLng(this._centerPoint),c.options.touchZoom!=="center"&&(this._pinchStartLatLng=c.containerPointToLatLng(p.add(v)._divideBy(2))),this._startDist=p.distanceTo(v),this._startZoom=c.getZoom(),this._moved=!1,this._zooming=!0,c._stop(),Mt(document,"touchmove",this._onTouchMove,this),Mt(document,"touchend touchcancel",this._onTouchEnd,this),re(o)}},_onTouchMove:function(o){if(!(!o.touches||o.touches.length!==2||!this._zooming)){var c=this._map,p=c.mouseEventToContainerPoint(o.touches[0]),v=c.mouseEventToContainerPoint(o.touches[1]),k=p.distanceTo(v)/this._startDist;if(this._zoom=c.getScaleZoom(k,this._startZoom),!c.options.bounceAtZoomLimits&&(this._zoom<c.getMinZoom()&&k<1||this._zoom>c.getMaxZoom()&&k>1)&&(this._zoom=c._limitZoom(this._zoom)),c.options.touchZoom==="center"){if(this._center=this._startLatLng,k===1)return}else{var A=p._add(v)._divideBy(2)._subtract(this._centerPoint);if(k===1&&A.x===0&&A.y===0)return;this._center=c.unproject(c.project(this._pinchStartLatLng,this._zoom).subtract(A),this._zoom)}this._moved||(c._moveStart(!0,!1),this._moved=!0),q(this._animRequest);var V=f(c._move,c,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=F(V,this,!0),re(o)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,q(this._animRequest),Xt(document,"touchmove",this._onTouchMove,this),Xt(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))}});At.addInitHook("addHandler","touchZoom",rc),At.BoxZoom=Qh,At.DoubleClickZoom=$h,At.Drag=tc,At.Keyboard=ec,At.ScrollWheelZoom=ic,At.TapHold=nc,At.TouchZoom=rc,i.Bounds=ht,i.Browser=xt,i.CRS=Yt,i.Canvas=Po,i.Circle=kr,i.CircleMarker=Rn,i.Class=j,i.Control=He,i.DivIcon=wt,i.DivOverlay=K,i.DomEvent=fl,i.DomUtil=mr,i.Draggable=Ci,i.Evented=$,i.FeatureGroup=yi,i.GeoJSON=li,i.GridLayer=Ot,i.Handler=si,i.Icon=fn,i.ImageOverlay=g,i.LatLng=pt,i.LatLngBounds=kt,i.Layer=Ye,i.LayerGroup=cn,i.LineUtil=Co,i.Map=At,i.Marker=wr,i.Mixin=ml,i.Path=Si,i.Point=J,i.PolyUtil=Pe,i.Polygon=dn,i.Polyline=ai,i.Popup=it,i.PosAnimation=xo,i.Projection=_l,i.Rectangle=Kh,i.Renderer=ui,i.SVG=Vi,i.SVGOverlay=M,i.TileLayer=ee,i.Tooltip=gt,i.Transformation=mt,i.Util=H,i.VideoOverlay=w,i.bind=f,i.bounds=_t,i.canvas=No,i.circle=kl,i.circleMarker=Us,i.control=_e,i.divIcon=zt,i.extend=r,i.featureGroup=Fs,i.geoJSON=e,i.geoJson=l,i.gridLayer=Jt,i.icon=xl,i.imageOverlay=y,i.latLng=vt,i.latLngBounds=dt,i.layerGroup=zs,i.map=vr,i.marker=wl,i.point=rt,i.polygon=qs,i.polyline=Ao,i.popup=lt,i.rectangle=um,i.setOptions=O,i.stamp=m,i.svg=Ir,i.svgOverlay=z,i.tileLayer=de,i.tooltip=bt,i.transformation=Z,i.version=s,i.videoOverlay=T;var cm=window.L;i.noConflict=function(){return window.L=cm,this},window.L=i}))})(Sr,Sr.exports)),Sr.exports}var le=Sl();const Do=Ge({__proto__:null,default:Il(le)},[le]),fc='.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}',dc=`.leaflet-draw-section{position:relative}.leaflet-draw-toolbar{margin-top:12px}.leaflet-draw-toolbar-top{margin-top:0}.leaflet-draw-toolbar-notop a:first-child{border-top-right-radius:0}.leaflet-draw-toolbar-nobottom a:last-child{border-bottom-right-radius:0}.leaflet-draw-toolbar a{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAAeCAYAAACWuCNnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAG7AAABuwBHnU4NQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAbvSURBVHic7dtdbBxXFQfw/9nZ3SRKwAP7UFFUQOoHqGnUoEAoNghX9tyxVcpD1X0J+WgiUQmpfUB5ACSgG1qJIKASqBIUIauqAbWseIlqb+bOWHVR6y0FKZBEqdIUQROIREGRx3FFvR/38ODZst3a3nE8Ywfv+T2t7hzdM3fle/bOnWtACCGEEEIIIYQQQgghhBBCCCGEEEIIIcRa0EbfgBDdFItFKwzDAa3175LuWylVAvBIR/MxrXUp6Vxx9dp4VyObVEdKKW591lonXgiVUg6AHzPzk9ls9meVSmUh6RzXkz179uQKhcIgM+8CACI6U6vVnp+enm6knXt4ePiuTCbzWQAwxlSDIHg57ZwroDAMnwKwz3XdBzzPG08hxzsTNprQG2lTjtd13WFmfghAP4A+AJcATFiW9YNKpfL3uP0kUliiX4SG1pqUUpx0wXJd9/PMXAGwPWq6yMyPz8/P/7xarf4nyVwt7QV4JWkU52i8YwBu6bh0wRhzJAiCF5POCQCDg4N2Pp//NYDRjkuTxph9QRCESeYrFov5ubm5R5n5AIAPtV1aYOb7BgYGTpZKJeO67lFmPsbM9/i+/8Ja8y6zylhOYquPXhsvAJRKpczMzMwTAIaJ6LFGo+HNzs5eKRQKNxPRAWb+CoAjWuvn4vS35skWFasxAAdbbUlOYqVUPwAPwI4lLr8J4KeWZT1eqVTmksoZ5d2QghUVKx/AlmVCFph5yPf9l5LMCwBKqUksFqszRHQcAJj5GwB2MfOE7/tfTDKf4zjHiejrAE4CuNhqZ+bf2rY9FYbhGBH92/O8o47j3Oj7/uUk86+3XhsvACilHmPmgW3btn3pxIkTVzuvj4yMfNoY85wxZiQIglPd+lvTZIuq5xiAQwCe6evr218ul5tr6bNd9GiiAbyvS+hFrfVHk8oLbEzBih4Dz+G9K6t3IaLXFhYWdib5eBh911UA8wBu1lq/CQBDQ0M3WJb1OoAdRPQZz/NeSSqnUuofAKpa6/vb26MfwacA7AdwFcCdWuu/JpU3yl1C91VHoquNXhvvyMjIx4wxr1iWtbNSqfxruTjHcR4AcMj3/bu79XnNe1hpFyvHcXYT0QS6FysASHR1tVEKhcIguhQrAGDm23K53BcATCWV27KsAWYGgPOtYgUAU1NT/1RKnQewxxjzOQCJFSwANwI4297QtmLfD+AtZr43m83OJ5iz3bGU+l1OT43XGFNk5mdXKlYAYNv2eBiG31dK3aS1vrRSbOZabqRYLFppFisAIKJxAB+MGf56krk30O64gZlMJnZsHMxsoo8fHxoauqHVHn3+BAAQUaxV57Xq2F54i5nvIaJXm81mYoX5etID491JRH/sFlQul5tEdMoYc3u32FUXrLYvObViBQDM/MQqwi8knX8jEJHpHrXIGJNo8WDm1spph2VZgeu6+5RSX7YsK8D/Xnb8Psmcnebm5h7G4uS9ysxutOH8VQC70sy7UTb7eImImTnWlgkzUyaT6fr3v6qC1fGL8EytVjuQRrECANu2fwHg1TixzPyXNO5hvTHz6VWE/znJ3L7vzxBRa9PzDmb+FYBfArgjajvd39+f9vGGKwACZh5te6mwmc8KburxMvO5TCbzqW5xxWLRArDbsqyu8z32HtZSxSrNM0Hlcrnpum6JmZ+NEb4pHglrtdrz+Xz+AoBbu4Ser9fra37d3YEBfBvAkq+XmfmbpVIp9grwWnie9zSAp9PMcT3Z7OPNZrO/aTQaf1BKfbd9X7RTGIaHmPlcnPNYsVZYSikOw7AB4CAzj/f19e1fjwOMnueVEeMxJJfLbYqCNT093TDGHAGw0qHYBQBH0vj+Pc+bYOb3HFRk5nHf9yeTzgfgMhF9uEvMTQD+71/vR3pqvJOTk28AeBJAeXR09P1LxbiuuxfA9wB8LU6fsVdYrUOhtm0fTusxcAlMRN+KziUt5SqAM3v37r00OZnGfFp/QRC86DjOUCaTGWPm2zoun8fiIbuZtPLX6/UH8/n8rQDuippertfrD6aRKyqOR5VS81ji8Z+IbmfmgwB+mEb+9dZr4wWA/v7+R6rV6k+azeYpx3EezeVyJ7dv335lfn7+lkajcZCZDzPzYd/3/xSnv9gFq3UuaR2LFQDA87xAKVUB8BEAZ6N9nrNEdEZr/TcArLVOPG8aJ9jj8n3/pcHBwZ1btmx5519zmPl0vV5/Ie2V7fT09Nujo6Nus9kcA4CtW7ce1lq/nUYu27a/Mzs7CyI6gMVX/u/CzJeZ+Ue2bcc9pb1aXc8lJZms18YLANE2wkOu694N4OFGo3E8DMMPAHiDiCaY+ZOb4YCsEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhEjYfwGO+b5dFNs4OgAAAABJRU5ErkJggg==);background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20viewBox='0%200%20600%2060'%20height='60'%20width='600'%20id='svg4225'%20version='1.1'%20inkscape:version='0.91%20r13725'%20sodipodi:docname='spritesheet.svg'%20inkscape:export-filename='/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png'%20inkscape:export-xdpi='90'%20inkscape:export-ydpi='90'%3e%3cmetadata%20id='metadata4258'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%20/%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%20id='defs4256'%20/%3e%3csodipodi:namedview%20pagecolor='%23ffffff'%20bordercolor='%23666666'%20borderopacity='1'%20objecttolerance='10'%20gridtolerance='10'%20guidetolerance='10'%20inkscape:pageopacity='0'%20inkscape:pageshadow='2'%20inkscape:window-width='1920'%20inkscape:window-height='1056'%20id='namedview4254'%20showgrid='false'%20inkscape:zoom='1.3101852'%20inkscape:cx='237.56928'%20inkscape:cy='7.2419621'%20inkscape:window-x='1920'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4225'%20/%3e%3cg%20id='enabled'%20style='fill:%23464646;fill-opacity:1'%3e%3cg%20id='polyline'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%2018,36%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4229'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2036,18%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4231'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2023.142,39.145%20-2.285,-2.29%2016,-15.998%202.285,2.285%20z'%20id='path4233'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cpath%20id='polygon'%20d='M%20100,24.565%2097.904,39.395%2083.07,42%2076,28.773%2086.463,18%20Z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='rectangle'%20d='m%20140,20%2020,0%200,20%20-20,0%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='circle'%20d='m%20221,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='marker'%20d='m%20270,19%20c%20-4.971,0%20-9,4.029%20-9,9%200,4.971%205.001,12%209,14%204.001,-2%209,-9.029%209,-14%200,-4.971%20-4.029,-9%20-9,-9%20z%20m%200,12.5%20c%20-2.484,0%20-4.5,-2.014%20-4.5,-4.5%200,-2.484%202.016,-4.5%204.5,-4.5%202.485,0%204.5,2.016%204.5,4.5%200,2.486%20-2.015,4.5%20-4.5,4.5%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cg%20id='edit'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20337,30.156%200,0.407%200,5.604%20c%200,1.658%20-1.344,3%20-3,3%20l%20-10,0%20c%20-1.655,0%20-3,-1.342%20-3,-3%20l%200,-10%20c%200,-1.657%201.345,-3%203,-3%20l%206.345,0%203.19,-3.17%20-9.535,0%20c%20-3.313,0%20-6,2.687%20-6,6%20l%200,10%20c%200,3.313%202.687,6%206,6%20l%2010,0%20c%203.314,0%206,-2.687%206,-6%20l%200,-8.809%20-3,2.968'%20id='path4240'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.72,24.637%20-8.892,8.892%20-2.828,0%200,-2.829%208.89,-8.89%20z'%20id='path4242'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.697,17.826%204,0%200,4%20-4,0%20z'%20transform='matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)'%20id='path4244'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cg%20id='remove'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20381,42%2018,0%200,-18%20-18,0%200,18%20z%20m%2014,-16%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z'%20id='path4247'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20395,20%200,-4%20-10,0%200,4%20-6,0%200,2%2022,0%200,-2%20-6,0%20z%20m%20-2,0%20-6,0%200,-2%206,0%200,2%20z'%20id='path4249'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3c/g%3e%3cg%20id='disabled'%20transform='translate(120,0)'%20style='fill:%23bbbbbb'%3e%3cuse%20xlink:href='%23edit'%20id='edit-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3cuse%20xlink:href='%23remove'%20id='remove-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3c/g%3e%3cpath%20style='fill:none;stroke:%23464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1'%20id='circle-3'%20d='m%20581.65725,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20/%3e%3c/svg%3e");background-repeat:no-repeat;background-size:300px 30px;background-clip:padding-box}.leaflet-retina .leaflet-draw-toolbar a{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAA8CAYAAAC6nMS5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAA16SURBVHic7d1/jBxneQfw7zNzvotdn+9sVQkxoRKoammBqqpbk6uT5mLfvHPn42yn1VFRVCEhoFH5IYpoSaUCKi1NcGkcfrbCVRFKEwG2aHLn83pmLvY2CTqT1AmCOBE0EOT4B0nBPw/snb2dp3/sLr6s77i923dud/a+H8ny7tzMo8f3eud99p133gGIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiFYGaXYCRETUPMYYrWe/MAzZX2QQ27d5OpqdABFROxgZGVlz5cqVrzuOc18QBJPNzofsYvvSYrVcgTVftZ2l6npgYODXHMc5oKoHHcfZHQTB2WbnRETpGRkZWVMoFA6IyO2qutX3/R1Z64TnO8fWOwLSzti+mSKDg4M3l0qlnSJyG4CbAFwP4ByAlwE8paoPX3fddcH4+PjP00yk5QqsrDPGvAZAHsBrReRNqvpeY8x/iMg9QRCcaXJ6ZIHv+xtUdReAHQBej/IHGABOAnhORMY6OjoempiYONe0JC3zPM84jjOqqrfi6r/3RQCPAdgXhmHUvOyaa3R01L1w4cJBALdVNq1W1THP87woir7ZzNyocWzf7PA8b4uI7E6S5A9Frqknb6j8eZOIvKNQKPzU9/1/dhznvlwuV0gjn5YbFapW09Vqu/Z9K9u2bdsNruvmUe50axUAfMV13X/I5XInlzcze2x/28lCu1b19fWt7u7u/hCAvwGwboHdL6jq7unp6T1TU1OXlyG9VAwODv5mkiR7Ady6wK6Plkqldz/yyCPfX468bBkaGuqamZm5E8DbReQNANYscMiLIrI1CILnZ280xrwHwL+hck4VkacBDLTS6HVaIxWt/Blm+zauldu3atOmTas2bNjwWRG5s7LplKp+VUQOuq77/bVr17589uzZ9SKy0XGcAVUdFZE/qOx7zHXdXWn0yy31i6sMw/4MyF6BZYy5XlWPiMhvL7BrrKpfcxznE7Uf4ixYqQWW53kbATw060NZr28nSbJzcnLyRBp5pcnzvNtE5CEAvXUecg7ArjAMH00xLWuGhoZuKpVKEwB+p85DXnRd9/ZcLvcDAOjv778un88XAChwtRMWkW+jxTpfYOV1wGxfO1q1fav6+vpWr1u3blxVtwH4uar+/fT09OcW+mJrjBkBcC+AXwdwBoAJw/AZm7m1zC+uUlyNA9g6189buZH7+/t/tbOz8wiANy7isKKqftV13U8eOnToe2nlZttKLLAqJ+qjAF69xBAnZ2Zmbj58+PApm3mlqTJydRTXFldHAUxVXvcBuLnm5+dU9c1RFP1v2jk2YmhoqKtUKj2B+jvfE0mS3D45OflD4OqcHADPh2H4F6h0wp7nva1YLOby+fz5dDKnerB9Vwzxff8BVX0bgFMAdoZheKzeg4eHh9cXi8WvAfAAvOC67ptzudz/WUvOVqBGVO7OmBCR/vn2adWOuL+/v7ezs3MSwKYlhkgAHBSRjwdB8JTF1FKx0gqsymXBxwH8XoOh/ieO41vz+fwVG3mlzRjzKF55WfA8gD8LwzA3ez/P87aLyIMAeqrbVDUfRdHty5Pp0hhjPgDgM9X3qnq/iNwPYM5RCdd1T1RPvLM63+q/ce/sTpiaj+27Mvi+f6eq/iuAi67r9uVyuWcXG6NSjB8B0KeqE1EUvcVWfk3v3OYZuXosjuPt+Xx+ull51WNgYKBHRKIlXDaaS6Kq+6Mo+lMLsVKz0gosz/M+KiKfsBTub8MwvMdSrNQYYzwAYc3m7bXFVZXv+8OqemD2NlUdiKLokbRybJQx5lsANlfefi4Mww/UedyvADgI4I9mbxeRDwdB8C92s0yHrc9wK3922b6Na+X2BYD+/v61nZ2dz6M8cX00DMP9S421ffv2V83MzDwHoNfmucuxEWSpslxcjYyMrHEcZ8xScQUAjoj8vqVYZIHv+xtE5MMWQ941PDy83mK8VIjIW2s2HZ2vuAKAIAgmADyxQIxWM3uu5J56DhgZGVkDYBw1nS+ApwB82VJeZAfbt82tWrXqPSgXV481UlwBwMGDB3+sqncDgIh81EZ+QBMLrKwXV5Uh5NoPYqMyN+m9nanqHVj4bsHF6InjeKfFeKmoLMUw+/2Ct6KLyOM1m2x/NmxbW30RhuGPFtp5jstGVU+JiNdqE57rEYahzB6lWOz7Fsf2be/2hYj8SeXlvTbiFYvFLwK4DOAWY8z1NmI2pcDKcnE1OjraWSgU9uPaD2LDRKSlJwavQCO2A4rIDtsxU7BxsQeoau2Jeak3BDTDL72kUm/n63neaFoJUkPYvm3G9/0NKN9gc7mrq6t2OsOSVGqPSQCuiAzaiLnsBVaWiysAuHDhwn4AQ2nEVtUfpBGXluwNKcRcaBmPVpDMfiMiW+o4pnafZM69MmYxnW9lsj9lCNs3m1T1tSjXL89aXo39WCX+62wEW9YCK+vFVcXLKcbmJcLW8qoUYmZhZOfFmvc3e563fb6djTFvwdUJxfPFyJx6O1/f999a6Xz5ZIwMYftm2o2Vv60+HUVETldeLnoUfy7LVmC1SXEFVf0YgFSeX5QkCQus9tfyIzsicnSObQ/6vj9cu71SXP1nPTGyplAo5FDT+arqk3Ecb5s9J0dV2flmENs3u0REgTmnJjRkVjwrd2Iuy3+adimuACCKotPGmC8A+GvLoZOZmZkXLMekBojIaVX9DcthTy+8S3MlSTIuIu+q2dyjqgeMMU8A+CYAUdUtAOa8izZJkvG081wG19xN5jjO4ByLTLrLlRBZxfbNrjMAICI3LrTjIlVHrqyMjKU+gtVOxVVVHMf/hHkWrGvAiawsQrlSqOqiF61rRkzbOjo6AsxfCG4G8FcAPvhLlih5qVgsWpl42kIyezcZ1YXtmy0/QvlqwG9V1i6zZRMAiIiV+dCpFljtWFwBQOUbzqcth+XlwdZjfRRGRMZsx7St8mT5zzcQ4r52+LKgqp9S1U8B+GTtZSPKPrZvdlXaagrAalU1NmJWCrVtAEqO4xyyETO1S4TtWlxVXbp06b7u7u6/BHCTjXiqygKrxYjIQ6p6L2Y9BqZB51etWtXyBRYAuK77hVKp9H5cnUxarzOu634xjZyWWxRFdzU7B0oP2zfbVPUbIrLFcZwPAfivRuOJyPtUdbWq5m09jzCVEax2L64AYGpq6rKq/qOteI7jsMBqMUEQnFXV3bbiqerdExMT52zFS1Mul7soIovugETkI7lc7mIaORERVRWLxS8BeElVb/F9v6EnR/i+f6Oq3gUAjuPYejSavQLLGKPVP4VC4Wd4ZXF1pKura7Bdiquq3t7efwfwnKVwLLBa0PT09B5U1kZp0BPFYvGzFuIsmyAI7kf5uWz1OhgEwTV3FLaoX5yLKosWLknNsZcayohsYvu2uUo98TEAUNW9vu8vad3CoaGhLlX9BoBeAONBEByxleNyLNPwWBzHOywvBtYS9u3bV1LVj1sKxwKrBU1NTV12XXcXgFMNhDmpqndkcF6SisifAzhRx76n4jh+Byzd3rwMjldfqOqSV+xPkmT2yvzH592RlhvbdwUIw3AvgAcArFPVcHBwcFHPBvZ9f0OpVDqA8qrwL8Rx/E6b+VkvsGqfZ9ROlwXnEkXRfgDfajCMXrx48Yc28iH7crncSVXdrKpPLvZYEXk6SZItURS1/PIMcwmC4KzjOCMAam9dn+0SgJ35fP4ny5SWDQ/Mer3HGLPoTtgYMyIiv3gOmqpmZfRuJWD7rgwax/G7UH7EzcYkSf7bGHNXX1/f6oUO9H1/Z+WcPoDysgw7bJ/DUl8Hq52LqwoVkb9T1WiRx8UoX158RlWfnJqaupxCbmRJFEWn+/r6buvu7v4ggI9g4Ynv50XknkKh8JkMjly9wqFDh77j+/6oqo4BqD1xXRaRPw6CwMZl1GXjuu6XSqXSOwH8LoD1AMaMMecA1PtF53WV4wCUC+menp699jOlpWD7rhz5fP5Kf3//UFdX132q+l4Ad3d3d7/fGPN1EZlQ1e/19PS8dPbs2fWu694kIgOqOqqqm4Dy4rKlUumOw4cPN3KVYk7WVkE1xsx5aSBLT+duhDEmQrkSnssZlIeXnxWRY6p6PI7j41nveFeq4eHh9XEc7xSRnQBej6t3kp5EuWh+OI7jh+dYsDDTfN/frKrjAKpPmv9pkiS7JicnH29mXku1devWV3d0dBxAuRNeMhF5ulgsjqRxgk7DfOfqxWr1czvbtzGt3r5zGRwc7FPV3ap6y0L7ishPAHx63bp1e/bt2xenkQ8LLEuMMZtE5JCqfhfAMwCeSZLkO2vWrDk+NjbGyZHUFjzP2yginwcAVX1fVi99Vo2OjnaeP3/+3SLydgBvBNBd56GXAHxXVR/s7e3dm9YJOg0rqQNm+y5dFtp3HmKM2QxgF8qr9b8GwA0AzgH4MYBjIjJ28eLFkFeOiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIhWgv8Hnffz4dmwY9cAAAAASUVORK5CYII=);background-image:linear-gradient(transparent,transparent),url("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:svg='http://www.w3.org/2000/svg'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20viewBox='0%200%20600%2060'%20height='60'%20width='600'%20id='svg4225'%20version='1.1'%20inkscape:version='0.91%20r13725'%20sodipodi:docname='spritesheet.svg'%20inkscape:export-filename='/home/fpuga/development/upstream/icarto.Leaflet.draw/src/images/spritesheet-2x.png'%20inkscape:export-xdpi='90'%20inkscape:export-ydpi='90'%3e%3cmetadata%20id='metadata4258'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3cdc:title%20/%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%20id='defs4256'%20/%3e%3csodipodi:namedview%20pagecolor='%23ffffff'%20bordercolor='%23666666'%20borderopacity='1'%20objecttolerance='10'%20gridtolerance='10'%20guidetolerance='10'%20inkscape:pageopacity='0'%20inkscape:pageshadow='2'%20inkscape:window-width='1920'%20inkscape:window-height='1056'%20id='namedview4254'%20showgrid='false'%20inkscape:zoom='1.3101852'%20inkscape:cx='237.56928'%20inkscape:cy='7.2419621'%20inkscape:window-x='1920'%20inkscape:window-y='24'%20inkscape:window-maximized='1'%20inkscape:current-layer='svg4225'%20/%3e%3cg%20id='enabled'%20style='fill:%23464646;fill-opacity:1'%3e%3cg%20id='polyline'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%2018,36%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4229'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2036,18%200,6%206,0%200,-6%20-6,0%20z%20m%204,4%20-2,0%200,-2%202,0%200,2%20z'%20id='path4231'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%2023.142,39.145%20-2.285,-2.29%2016,-15.998%202.285,2.285%20z'%20id='path4233'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cpath%20id='polygon'%20d='M%20100,24.565%2097.904,39.395%2083.07,42%2076,28.773%2086.463,18%20Z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='rectangle'%20d='m%20140,20%2020,0%200,20%20-20,0%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='circle'%20d='m%20221,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20id='marker'%20d='m%20270,19%20c%20-4.971,0%20-9,4.029%20-9,9%200,4.971%205.001,12%209,14%204.001,-2%209,-9.029%209,-14%200,-4.971%20-4.029,-9%20-9,-9%20z%20m%200,12.5%20c%20-2.484,0%20-4.5,-2.014%20-4.5,-4.5%200,-2.484%202.016,-4.5%204.5,-4.5%202.485,0%204.5,2.016%204.5,4.5%200,2.486%20-2.015,4.5%20-4.5,4.5%20z'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cg%20id='edit'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20337,30.156%200,0.407%200,5.604%20c%200,1.658%20-1.344,3%20-3,3%20l%20-10,0%20c%20-1.655,0%20-3,-1.342%20-3,-3%20l%200,-10%20c%200,-1.657%201.345,-3%203,-3%20l%206.345,0%203.19,-3.17%20-9.535,0%20c%20-3.313,0%20-6,2.687%20-6,6%20l%200,10%20c%200,3.313%202.687,6%206,6%20l%2010,0%20c%203.314,0%206,-2.687%206,-6%20l%200,-8.809%20-3,2.968'%20id='path4240'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.72,24.637%20-8.892,8.892%20-2.828,0%200,-2.829%208.89,-8.89%20z'%20id='path4242'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20338.697,17.826%204,0%200,4%20-4,0%20z'%20transform='matrix(-0.70698336,-0.70723018,0.70723018,-0.70698336,567.55917,274.78273)'%20id='path4244'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3cg%20id='remove'%20style='fill:%23464646;fill-opacity:1'%3e%3cpath%20d='m%20381,42%2018,0%200,-18%20-18,0%200,18%20z%20m%2014,-16%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z%20m%20-4,0%202,0%200,14%20-2,0%200,-14%20z'%20id='path4247'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3cpath%20d='m%20395,20%200,-4%20-10,0%200,4%20-6,0%200,2%2022,0%200,-2%20-6,0%20z%20m%20-2,0%20-6,0%200,-2%206,0%200,2%20z'%20id='path4249'%20inkscape:connector-curvature='0'%20style='fill:%23464646;fill-opacity:1'%20/%3e%3c/g%3e%3c/g%3e%3cg%20id='disabled'%20transform='translate(120,0)'%20style='fill:%23bbbbbb'%3e%3cuse%20xlink:href='%23edit'%20id='edit-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3cuse%20xlink:href='%23remove'%20id='remove-disabled'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20/%3e%3c/g%3e%3cpath%20style='fill:none;stroke:%23464646;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1'%20id='circle-3'%20d='m%20581.65725,30%20c%200,6.078%20-4.926,11%20-11,11%20-6.074,0%20-11,-4.922%20-11,-11%200,-6.074%204.926,-11%2011,-11%206.074,0%2011,4.926%2011,11%20z'%20inkscape:connector-curvature='0'%20/%3e%3c/svg%3e")}.leaflet-draw a{display:block;text-align:center;text-decoration:none}.leaflet-draw a .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.leaflet-draw-actions{display:none;list-style:none;margin:0;padding:0;position:absolute;left:26px;top:0;white-space:nowrap}.leaflet-touch .leaflet-draw-actions{left:32px}.leaflet-right .leaflet-draw-actions{right:26px;left:auto}.leaflet-touch .leaflet-right .leaflet-draw-actions{right:32px;left:auto}.leaflet-draw-actions li{display:inline-block}.leaflet-draw-actions li:first-child a{border-left:0}.leaflet-draw-actions li:last-child a{-webkit-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.leaflet-right .leaflet-draw-actions li:last-child a{-webkit-border-radius:0;border-radius:0}.leaflet-right .leaflet-draw-actions li:first-child a{-webkit-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.leaflet-draw-actions a{background-color:#919187;border-left:1px solid #AAA;color:#fff;font:11px/19px Helvetica Neue,Arial,Helvetica,sans-serif;line-height:28px;text-decoration:none;padding-left:10px;padding-right:10px;height:28px}.leaflet-touch .leaflet-draw-actions a{font-size:12px;line-height:30px;height:30px}.leaflet-draw-actions-bottom{margin-top:0}.leaflet-draw-actions-top{margin-top:1px}.leaflet-draw-actions-top a,.leaflet-draw-actions-bottom a{height:27px;line-height:27px}.leaflet-draw-actions a:hover{background-color:#a0a098}.leaflet-draw-actions-top.leaflet-draw-actions-bottom a{height:26px;line-height:26px}.leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:-2px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline{background-position:0 -1px}.leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-31px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon{background-position:-29px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-62px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle{background-position:-60px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-92px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle{background-position:-90px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-122px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker{background-position:-120px -1px}.leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-273px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circlemarker{background-position:-271px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-152px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit{background-position:-150px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-182px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove{background-position:-180px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-212px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled{background-position:-210px -1px}.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-242px -2px}.leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled{background-position:-240px -2px}.leaflet-mouse-marker{background-color:#fff;cursor:crosshair}.leaflet-draw-tooltip{background:#363636;background:#00000080;border:1px solid transparent;-webkit-border-radius:4px;border-radius:4px;color:#fff;font:12px/18px Helvetica Neue,Arial,Helvetica,sans-serif;margin-left:20px;margin-top:-21px;padding:4px 8px;position:absolute;visibility:hidden;white-space:nowrap;z-index:6}.leaflet-draw-tooltip:before{border-right:6px solid black;border-right-color:#00000080;border-top:6px solid transparent;border-bottom:6px solid transparent;content:"";position:absolute;top:7px;left:-7px}.leaflet-error-draw-tooltip{background-color:#f2dede;border:1px solid #e6b6bd;color:#b94a48}.leaflet-error-draw-tooltip:before{border-right-color:#e6b6bd}.leaflet-draw-tooltip-single{margin-top:-12px}.leaflet-draw-tooltip-subtext{color:#f8d5e4}.leaflet-draw-guide-dash{font-size:1%;opacity:.6;position:absolute;width:5px;height:5px}.leaflet-edit-marker-selected{background-color:#fe57a11a;border:4px dashed rgba(254,87,161,.6);-webkit-border-radius:4px;border-radius:4px;box-sizing:content-box}.leaflet-edit-move{cursor:move}.leaflet-edit-resize{cursor:pointer}.leaflet-oldie .leaflet-draw-toolbar{border:1px solid #999}`,gc=".leaflet-ruler{height:35px;width:35px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfhBQoMHg6McuYvAAABwklEQVQ4y43TP0jUYRgH8M/daQpqdujhnwShGiwyipCIoIgWxyIwrqEhnCQoGqKhpoYMg1qCQjg8TC2JCtSkjCgaKisIhyQUwpJssD9KZWRZg6d450/yGV54n/fzfd53eUOCaoNa5QpNGNPr9cKjUAatdsB++co0G1XiiHd+uqnTq8VzI874o9s2Ic1iiEpii9tmnJOdfkOldt/dU+HYolHnjdmpRNzbuVaNL86m4sXqNOrz3kMXHFKYMqd8VREGBToMifqLgwY1yNZirya5knaBqH16fJjNJiWEFSlxy4g980+pMuZkir/UJjLbrvNRPnINaLUygK/yQpuImHp47LOjuKJPOJA/1y4iZsAlyozLs8IO42L/4QlhGrSCy5oCeKH+dM59vVbL9sn6AP5MRzpnVKtN1viRxit1WRvEmVKFrQbTpoddNR3E+aYKuw1lPOapa0GcEf22KzOtejmcG1rkYdjEAn59KU5cDzjt+HI4BSZtVJTazfIsMQOmFAusLr/E53lniickJYIDNcaUL+JhMZPWBUdOeCCaweGOw5k0lFrv2uyRuBxPlLpoBtTK0p3mh+f+dKl6jX6LapRj6XrzD+1bmkFA/dTVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA1LTEwVDEyOjMwOjE0KzAyOjAwUNH5TAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wNS0xMFQxMjozMDoxNCswMjowMCGMQfAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:center}.leaflet-ruler:hover{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=)}.leaflet-ruler-clicked{height:35px;width:35px;background-repeat:no-repeat;background-position:center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=);border-color:#7fff00!important}.leaflet-bar{background-color:#fff}.leaflet-control{cursor:pointer}.result-tooltip{background-color:#fff;border-width:medium;border-color:#de0000;font-size:smaller}.moving-tooltip{background-color:#ffffffb3;background-clip:padding-box;opacity:.5;border:dotted;border-color:red;font-size:smaller}.plus-length{padding-left:45px}",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC",_c="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='430'%20height='430'%20style='width:100%25;height:100%25;transform:translate3d(0,0,0);content-visibility:visible'%20viewBox='0%200%20430%20430'%3e%3cdefs%3e%3cclipPath%20id='i'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='s'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='e'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='p'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='f'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='m'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='g'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='j'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cclipPath%20id='h'%3e%3cpath%20d='M0%200h430v430H0z'/%3e%3c/clipPath%3e%3cfilter%20id='t'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cfilter%20id='r'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'%20stdDeviation='52.5%2052.5'/%3e%3c/filter%3e%3cfilter%20id='n'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cfilter%20id='k'%20width='300%25'%20height='300%25'%20x='-100%25'%20y='-100%25'%3e%3cfeGaussianBlur%20result='filter_result_0'/%3e%3c/filter%3e%3cmask%20id='u'%20mask-type='alpha'%3e%3cuse%20xmlns:ns1='http://www.w3.org/1999/xlink'%20ns1:href='%23a'/%3e%3c/mask%3e%3cmask%20id='q'%20mask-type='alpha'%3e%3cuse%20xmlns:ns2='http://www.w3.org/1999/xlink'%20ns2:href='%23b'/%3e%3c/mask%3e%3cmask%20id='o'%20mask-type='alpha'%3e%3cuse%20xmlns:ns3='http://www.w3.org/1999/xlink'%20ns3:href='%23c'/%3e%3c/mask%3e%3cmask%20id='l'%20mask-type='alpha'%3e%3cuse%20xmlns:ns4='http://www.w3.org/1999/xlink'%20ns4:href='%23d'/%3e%3c/mask%3e%3cg%20id='a'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23e)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3cg%20id='b'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='12'%20clip-path='url(%23f)'%20style='display:block'%3e%3cpath%20stroke='%2308A88A'%20d='M44.446-66.518a79.998%2079.998%200%200%200-101.012%209.952A79.998%2079.998%200%201%200%2056.569%2056.569%2080.005%2080.005%200%200%200%2073.91-30.615a80.001%2080.001%200%200%200-29.464-35.903z'%20class='secondary'%20style='display:block'%20transform='translate(215%20214)'/%3e%3cpath%20stroke='%23121331'%20d='m141.409%2025.241%208.727%205.041s0%200%200%200a22.3%2022.3%200%200%201%2010.411%2013.542%2022.32%2022.32%200%200%201-2.221%2016.937l-26.515%2045.924a22.325%2022.325%200%200%201-30.497%208.172l-8.754-5.059a143.414%20143.414%200%200%201-43.718%2025.286v10.108a22.302%2022.302%200%200%201-13.778%2020.612%2022.303%2022.303%200%200%201-8.539%201.696h-53.029a22.303%2022.303%200%200%201-15.779-6.531%2022.302%2022.302%200%200%201-6.537-15.777v-10.073a143.416%20143.416%200%200%201-43.719-25.285l-8.754%205.059a22.325%2022.325%200%200%201-30.497-8.172l-26.523-45.924a22.315%2022.315%200%200%201-2.238-16.943A22.31%2022.31%200%200%201-150.142%2030.3l8.727-5.041a145.097%20145.097%200%200%201%200-50.518l-8.727-5.041a22.294%2022.294%200%200%201-10.409-13.554%2022.306%2022.306%200%200%201%202.238-16.943l26.514-45.924a22.325%2022.325%200%200%201%2030.497-8.172l8.754%205.059a143.416%20143.416%200%200%201%2043.719-25.285v-10.073a22.302%2022.302%200%200%201%206.537-15.777%2022.3%2022.3%200%200%201%2015.779-6.531h53.02a22.307%2022.307%200%200%201%2022.317%2022.308v10.037a143.41%20143.41%200%200%201%2043.718%2025.285l8.754-5.059a22.325%2022.325%200%200%201%2030.497%208.172l26.515%2045.942a22.313%2022.313%200%200%201-1.618%2024.757%2022.294%2022.294%200%200%201-6.554%205.74l-8.727%205.041a145.097%20145.097%200%200%201%200%2050.518z'%20class='primary'%20style='display:block'%20transform='rotate(-120%20169.576%2045.095)'/%3e%3c/g%3e%3cg%20id='c'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23g)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3cg%20id='d'%20fill-opacity='0'%20stroke-linecap='round'%20stroke-linejoin='round'%20clip-path='url(%23h)'%20style='display:none'%3e%3cpath%20class='secondary'%20style='display:none'/%3e%3cpath%20class='primary'%20style='display:none'/%3e%3c/g%3e%3c/defs%3e%3cg%20clip-path='url(%23i)'%3e%3cg%20clip-path='url(%23j)'%20filter='url(%23k)'%20mask='url(%23l)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23m)'%20filter='url(%23n)'%20mask='url(%23o)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23p)'%20mask='url(%23q)'%20style='display:block'%3e%3cg%20filter='url(%23r)'%20transform='rotate(-94%20238.762%20-16.565)%20scale(2.4)'%3e%3cg%20class='design'%3e%3cpath%20fill='%234BE1EC'%20d='M0-250c137.975%200%20250%20112.025%20250%20250S137.975%20250%200%20250-250%20137.975-250%200-137.975-250%200-250z'%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20fill='%23CB5EEE'%20d='M113.242-295.384c97.478%200%20176.5%2079.022%20176.5%20176.5s-79.022%20176.5-176.5%20176.5c-43.948%200-74.396-34.057-105.29-60.631-37.631-32.369-71.21-62.338-71.21-115.869%200-97.478%2079.022-176.5%20176.5-176.5z'%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cg%20clip-path='url(%23s)'%20filter='url(%23t)'%20mask='url(%23u)'%20style='display:none'%3e%3cg%20class='design'%3e%3cpath%20class='primary'/%3e%3c/g%3e%3cg%20class='design'%3e%3cpath%20class='secondary'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Ml="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%20-1.67%2047.336%2047.336'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group_42'%20data-name='Group%2042'%20transform='translate(-172.455%20-364.36)'%3e%3cpath%20id='Rectangle_17'%20data-name='Rectangle%2017'%20d='M4.351,0H40.984a4.351,4.351,0,0,1,4.351,4.351V22.117a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z'%20transform='translate(173.455%20384.243)'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cpath%20id='Path_90'%20data-name='Path%2090'%20d='M218.79,390.249a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.778,3.778,0,0,1-3.777-3.778'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cg%20id='Group_41'%20data-name='Group%2041'%3e%3cpath%20id='Rectangle_18'%20data-name='Rectangle%2018'%20d='M4.351,0H26.473a4.351,4.351,0,0,1,4.351,4.351V17.883a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V4.351A4.351,4.351,0,0,1,4.351,0Z'%20transform='translate(180.71%20365.36)'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3cpath%20id='Path_91'%20data-name='Path%2091'%20d='M211.234,370.794a3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778,3.778,3.778,0,0,1-3.778,3.778h0a3.779,3.779,0,0,1-3.778-3.778'%20fill='none'%20stroke='%23000000'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfhBQoMHg6McuYvAAABwklEQVQ4y43TP0jUYRgH8M/daQpqdujhnwShGiwyipCIoIgWxyIwrqEhnCQoGqKhpoYMg1qCQjg8TC2JCtSkjCgaKisIhyQUwpJssD9KZWRZg6d450/yGV54n/fzfd53eUOCaoNa5QpNGNPr9cKjUAatdsB++co0G1XiiHd+uqnTq8VzI874o9s2Ic1iiEpii9tmnJOdfkOldt/dU+HYolHnjdmpRNzbuVaNL86m4sXqNOrz3kMXHFKYMqd8VREGBToMifqLgwY1yNZirya5knaBqH16fJjNJiWEFSlxy4g980+pMuZkir/UJjLbrvNRPnINaLUygK/yQpuImHp47LOjuKJPOJA/1y4iZsAlyozLs8IO42L/4QlhGrSCy5oCeKH+dM59vVbL9sn6AP5MRzpnVKtN1viRxit1WRvEmVKFrQbTpoddNR3E+aYKuw1lPOapa0GcEf22KzOtejmcG1rkYdjEAn59KU5cDzjt+HI4BSZtVJTazfIsMQOmFAusLr/E53lniickJYIDNcaUL+JhMZPWBUdOeCCaweGOw5k0lFrv2uyRuBxPlLpoBtTK0p3mh+f+dKl6jX6LapRj6XrzD+1bmkFA/dTVAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTA1LTEwVDEyOjMwOjE0KzAyOjAwUNH5TAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wNS0xMFQxMjozMDoxNCswMjowMCGMQfAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAACmAAAApgHdff84AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAn9QTFRF////AAAAAAAAAAAAAAAAAAAzABcXABQUABIkDhwrAA0aAAwYABUgABQfABIbABAZAA8fABUcABMaABMfABIeABEcABAbABQeABMdABIdABEbABIbABIbABEdABEcABIcBxsoABEdABIdABIdABEcABMbABMdFBwgERofAhIbEhsfAhIdBxUeEhsgEBofAhMbAhMdBRMdAhIbAhIdAhMdCRceARIcDBgfDBgfDBcfDBcfFhwgDBceDBceCxceFCs5HTdGAxMcDxofGTFAHDRDHDVDHDVEHTZFDRkfEBofERogCh0oERsgARIcEhsfEhsgCh4pDCEsDRkfDRkfEBofBhQdDSMvDRgfDBgfCBUeBxUeDyUyECYzUDktPTAqCRceCRYeChYeDxkfEBkgLCgmWj4wCBYdW0AwGh4hHCAiHSAiTDctBhUdBxYdEBkfLyonMConBhUdJiUkLCclLSgmLigmOzApPTEpDBgfBRQdDBgfERsgWT8wBBMdCBYeChceQjMrSzctZEUyBBMdERsgXUAxXkExY0QzglQ5AxUfBxolSjcthlU6hlY7h1Y7AxMcSDUsSjYsd042g1Q5hlY6jVo8AhIcAxMcBBQdLEpcOVpvARIcAhIcBhQdDSIuEhsgJ0NUNS0oNi0oO11yTTgtUXmSUnqUXEAxXUExYEIyZUUzaEYzb0o1cEo1dEw2i1g8jFk8jcfskFs9mdX9mmA/mtf/pmZCqGdCsWxEvnJHxHVJxnZJyHdJzHlK0XxM031M139N3IFO3YJO4INP5IVQ5YZQ5oZQ6ohR7IlS7opS74tS8ItT841T9I1T9o5U949U+ZBV+pBV/ZJW/pJW/5NWIYcOagAAAJt0Uk5TAAECAwQFCw0OEhQVGBkcHyEkKCkqLTAzNUZLVFZZW2RnanJzeHl8f4uMjY6Pj5KVl52eoKGprKytrq+vsLGytLu9vb/BwsLDxcXP0NDS09bf4uPk5OXl5ufo6enq7O3u7+/x8fHy8/P09PT09fX19fX29vb29vb29/j4+Pj5+fn5+fn6+vr6+vr7/Pz8/Pz9/f39/f39/v7+/v7Td3FlAAABgklEQVQoU2NggAMRJU1DTWURBlQgqhWUND11Tfr05GBdMYQws8a07j2XVx2/cnLl5T0T5+ixQsX5/RrWr70CA+s2NPoLgMUlciddvnLl3PbslMysmi2ngXKTc/iA4uwRC1dfudRT76UtJy5lMHvHlSsni82ZgBLWbZdOHCuPlARpForvBYszA9ky1WeunC8y5YCI9125cqrEnJlbnoHBZ/6mK+0eTAjxUgtmbl99Bt6Ksxd2pXGDxRPg4kZMDIqxV6406cDFT8PEGRwnHLlYJQwSTwSJ51tCxRmiVuw7VAsRP7zkIEKcofnAlb0hEPWXls9AiDNUHriyMxwoPgVoToEVQpwhdNHuY/2imOIMZq1nr2QUgsVtkMUZZOOuXOmYiinOwF63/8QVsDgLd0wnFwMCOM3dBhK3ZeGOXjzLHklCIu8oRDxs8eaNXYJIMuplJ0HigYs3b906UwFJgtGzxY6FLWDe0mXLli3wVoEAaZAMjxoLA6eDu5urq4uziTEEqAIAvamx163e5EoAAAAASUVORK5CYII=";function xc(a){const n="data-leaflet-styles";if(a.querySelector(`style[${n}]`))return;const i=document.createElement("style");i.setAttribute(n,"true"),i.textContent=`
|
|
5
2
|
/* --- Leaflet core CSS --- */
|
|
6
3
|
${fc}
|
|
7
4
|
|
|
@@ -235,7 +232,7 @@ ${gc}
|
|
|
235
232
|
background-repeat: no-repeat !important;
|
|
236
233
|
background-color: #fff;
|
|
237
234
|
}
|
|
238
|
-
`,a.appendChild(i)}function kc(){var a,n;(n=(a=le.Icon.Default).mergeOptions)==null||n.call(a,{iconRetinaUrl:pc,iconUrl:mc,shadowUrl:yc})}function Lc(a){const{root:n,skipStyles:i}=a;try{i||(xc(n),kc()),wc(n)}catch{}}(function(a,n,i){function s(r,h){for(;(r=r.parentElement)&&!r.classList.contains(h););return r}L.drawVersion="1.0.4",L.Draw={},L.drawLocal={draw:{toolbar:{actions:{title:"Cancel drawing",text:"Cancel"},finish:{title:"Finish drawing",text:"Finish"},undo:{title:"Delete last point drawn",text:"Delete last point"},buttons:{polyline:"Draw a polyline",polygon:"Draw a polygon",rectangle:"Draw a rectangle",circle:"Draw a circle",marker:"Draw a marker",circlemarker:"Draw a circlemarker"}},handlers:{circle:{tooltip:{start:"Click and drag to draw circle."},radius:"Radius"},circlemarker:{tooltip:{start:"Click map to place circle marker."}},marker:{tooltip:{start:"Click map to place marker."}},polygon:{tooltip:{start:"Click to start drawing shape.",cont:"Click to continue drawing shape.",end:"Click first point to close this shape."}},polyline:{error:"<strong>Error:</strong> shape edges cannot cross!",tooltip:{start:"Click to start drawing line.",cont:"Click to continue drawing line.",end:"Click last point to finish line."}},rectangle:{tooltip:{start:"Click and drag to draw rectangle."}},simpleshape:{tooltip:{end:"Release mouse to finish drawing."}}}},edit:{toolbar:{actions:{save:{title:"Save changes",text:"Save"},cancel:{title:"Cancel editing, discards all changes",text:"Cancel"},clearAll:{title:"Clear all layers",text:"Clear All"}},buttons:{edit:"Edit layers",editDisabled:"No layers to edit",remove:"Delete layers",removeDisabled:"No layers to delete"}},handlers:{edit:{tooltip:{text:"Drag handles or markers to edit features.",subtext:"Click cancel to undo changes."}},remove:{tooltip:{text:"Click on a feature to remove."}}}}},L.Draw.Event={},L.Draw.Event.CREATED="draw:created",L.Draw.Event.EDITED="draw:edited",L.Draw.Event.DELETED="draw:deleted",L.Draw.Event.DRAWSTART="draw:drawstart",L.Draw.Event.DRAWSTOP="draw:drawstop",L.Draw.Event.DRAWVERTEX="draw:drawvertex",L.Draw.Event.EDITSTART="draw:editstart",L.Draw.Event.EDITMOVE="draw:editmove",L.Draw.Event.EDITRESIZE="draw:editresize",L.Draw.Event.EDITVERTEX="draw:editvertex",L.Draw.Event.EDITSTOP="draw:editstop",L.Draw.Event.DELETESTART="draw:deletestart",L.Draw.Event.DELETESTOP="draw:deletestop",L.Draw.Event.TOOLBAROPENED="draw:toolbaropened",L.Draw.Event.TOOLBARCLOSED="draw:toolbarclosed",L.Draw.Event.MARKERCONTEXT="draw:markercontext",L.Draw=L.Draw||{},L.Draw.Feature=L.Handler.extend({initialize:function(r,h){this._map=r,this._container=r._container,this._overlayPane=r._panes.overlayPane,this._popupPane=r._panes.popupPane,h&&h.shapeOptions&&(h.shapeOptions=L.Util.extend({},this.options.shapeOptions,h.shapeOptions)),L.setOptions(this,h);var f=L.version.split(".");parseInt(f[0],10)===1&&parseInt(f[1],10)>=2?L.Draw.Feature.include(L.Evented.prototype):L.Draw.Feature.include(L.Mixin.Events)},enable:function(){this._enabled||(L.Handler.prototype.enable.call(this),this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.DRAWSTART,{layerType:this.type}))},disable:function(){this._enabled&&(L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.DRAWSTOP,{layerType:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var r=this._map;r&&(L.DomUtil.disableTextSelection(),r.getContainer().focus(),this._tooltip=new L.Draw.Tooltip(this._map),L.DomEvent.on(this._container,"keyup",this._cancelDrawing,this))},removeHooks:function(){this._map&&(L.DomUtil.enableTextSelection(),this._tooltip.dispose(),this._tooltip=null,L.DomEvent.off(this._container,"keyup",this._cancelDrawing,this))},setOptions:function(r){L.setOptions(this,r)},_fireCreatedEvent:function(r){this._map.fire(L.Draw.Event.CREATED,{layer:r,layerType:this.type})},_cancelDrawing:function(r){r.keyCode===27&&(this._map.fire("draw:canceled",{layerType:this.type}),this.disable())}}),L.Draw.Polyline=L.Draw.Feature.extend({statics:{TYPE:"polyline"},Poly:L.Polyline,options:{allowIntersection:!0,repeatMode:!1,drawError:{color:"#b00b00",timeout:2500},icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),guidelineDistance:20,maxGuideLineLength:4e3,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!1,clickable:!0},metric:!0,feet:!0,nautic:!1,showLength:!0,zIndexOffset:2e3,factor:1,maxPoints:0},initialize:function(r,h){L.Browser.touch&&(this.options.icon=this.options.touchIcon),this.options.drawError.message=L.drawLocal.draw.handlers.polyline.error,h&&h.drawError&&(h.drawError=L.Util.extend({},this.options.drawError,h.drawError)),this.type=L.Draw.Polyline.TYPE,L.Draw.Feature.prototype.initialize.call(this,r,h)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._markers=[],this._markerGroup=new L.LayerGroup,this._map.addLayer(this._markerGroup),this._poly=new L.Polyline([],this.options.shapeOptions),this._tooltip.updateContent(this._getTooltipText()),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("mouseout",this._onMouseOut,this).on("mousemove",this._onMouseMove,this).on("mousedown",this._onMouseDown,this).on("mouseup",this._onMouseUp,this).addTo(this._map),this._map.on("mouseup",this._onMouseUp,this).on("mousemove",this._onMouseMove,this).on("zoomlevelschange",this._onZoomEnd,this).on("touchstart",this._onTouch,this).on("zoomend",this._onZoomEnd,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._clearHideErrorTimeout(),this._cleanUpShape(),this._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers,this._map.removeLayer(this._poly),delete this._poly,this._mouseMarker.off("mousedown",this._onMouseDown,this).off("mouseout",this._onMouseOut,this).off("mouseup",this._onMouseUp,this).off("mousemove",this._onMouseMove,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._clearGuides(),this._map.off("mouseup",this._onMouseUp,this).off("mousemove",this._onMouseMove,this).off("zoomlevelschange",this._onZoomEnd,this).off("zoomend",this._onZoomEnd,this).off("touchstart",this._onTouch,this).off("click",this._onTouch,this)},deleteLastVertex:function(){if(!(this._markers.length<=1)){var r=this._markers.pop(),h=this._poly,f=h.getLatLngs(),d=f.splice(-1,1)[0];this._poly.setLatLngs(f),this._markerGroup.removeLayer(r),h.getLatLngs().length<2&&this._map.removeLayer(h),this._vertexChanged(d,!1)}},addVertex:function(r){if(this._markers.length>=2&&!this.options.allowIntersection&&this._poly.newLatLngIntersects(r))return void this._showErrorTooltip();this._errorShown&&this._hideErrorTooltip(),this._markers.push(this._createMarker(r)),this._poly.addLatLng(r),this._poly.getLatLngs().length===2&&this._map.addLayer(this._poly),this._vertexChanged(r,!0)},completeShape:function(){this._markers.length<=1||!this._shapeIsValid()||(this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable())},_finishShape:function(){var r=this._poly._defaultShape?this._poly._defaultShape():this._poly.getLatLngs(),h=this._poly.newLatLngIntersects(r[r.length-1]);if(!this.options.allowIntersection&&h||!this._shapeIsValid())return void this._showErrorTooltip();this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_shapeIsValid:function(){return!0},_onZoomEnd:function(){this._markers!==null&&this._updateGuide()},_onMouseMove:function(r){var h=this._map.mouseEventToLayerPoint(r.originalEvent),f=this._map.layerPointToLatLng(h);this._currentLatLng=f,this._updateTooltip(f),this._updateGuide(h),this._mouseMarker.setLatLng(f),L.DomEvent.preventDefault(r.originalEvent)},_vertexChanged:function(r,h){this._map.fire(L.Draw.Event.DRAWVERTEX,{layers:this._markerGroup}),this._updateFinishHandler(),this._updateRunningMeasure(r,h),this._clearGuides(),this._updateTooltip()},_onMouseDown:function(r){if(!this._clickHandled&&!this._touchHandled&&!this._disableMarkers){this._onMouseMove(r),this._clickHandled=!0,this._disableNewMarkers();var h=r.originalEvent,f=h.clientX,d=h.clientY;this._startPoint.call(this,f,d)}},_startPoint:function(r,h){this._mouseDownOrigin=L.point(r,h)},_onMouseUp:function(r){var h=r.originalEvent,f=h.clientX,d=h.clientY;this._endPoint.call(this,f,d,r),this._clickHandled=null},_endPoint:function(r,h,f){if(this._mouseDownOrigin){var d=L.point(r,h).distanceTo(this._mouseDownOrigin),m=this._calculateFinishDistance(f.latlng);this.options.maxPoints>1&&this.options.maxPoints==this._markers.length+1?(this.addVertex(f.latlng),this._finishShape()):m<10&&L.Browser.touch?this._finishShape():Math.abs(d)<9*(a.devicePixelRatio||1)&&this.addVertex(f.latlng),this._enableNewMarkers()}this._mouseDownOrigin=null},_onTouch:function(r){var h,f,d=r.originalEvent;!d.touches||!d.touches[0]||this._clickHandled||this._touchHandled||this._disableMarkers||(h=d.touches[0].clientX,f=d.touches[0].clientY,this._disableNewMarkers(),this._touchHandled=!0,this._startPoint.call(this,h,f),this._endPoint.call(this,h,f,r),this._touchHandled=null),this._clickHandled=null},_onMouseOut:function(){this._tooltip&&this._tooltip._onMouseOut.call(this._tooltip)},_calculateFinishDistance:function(r){var h;if(this._markers.length>0){var f;if(this.type===L.Draw.Polyline.TYPE)f=this._markers[this._markers.length-1];else{if(this.type!==L.Draw.Polygon.TYPE)return 1/0;f=this._markers[0]}var d=this._map.latLngToContainerPoint(f.getLatLng()),m=new L.Marker(r,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset}),_=this._map.latLngToContainerPoint(m.getLatLng());h=d.distanceTo(_)}else h=1/0;return h},_updateFinishHandler:function(){var r=this._markers.length;r>1&&this._markers[r-1].on("click",this._finishShape,this),r>2&&this._markers[r-2].off("click",this._finishShape,this)},_createMarker:function(r){var h=new L.Marker(r,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset});return this._markerGroup.addLayer(h),h},_updateGuide:function(r){var h=this._markers?this._markers.length:0;h>0&&(r=r||this._map.latLngToLayerPoint(this._currentLatLng),this._clearGuides(),this._drawGuide(this._map.latLngToLayerPoint(this._markers[h-1].getLatLng()),r))},_updateTooltip:function(r){var h=this._getTooltipText();r&&this._tooltip.updatePosition(r),this._errorShown||this._tooltip.updateContent(h)},_drawGuide:function(r,h){var f,d,m,_=Math.floor(Math.sqrt(Math.pow(h.x-r.x,2)+Math.pow(h.y-r.y,2))),x=this.options.guidelineDistance,b=this.options.maxGuideLineLength,E=_>b?_-b:x;for(this._guidesContainer||(this._guidesContainer=L.DomUtil.create("div","leaflet-draw-guides",this._overlayPane));E<_;E+=this.options.guidelineDistance)f=E/_,d={x:Math.floor(r.x*(1-f)+f*h.x),y:Math.floor(r.y*(1-f)+f*h.y)},m=L.DomUtil.create("div","leaflet-draw-guide-dash",this._guidesContainer),m.style.backgroundColor=this._errorShown?this.options.drawError.color:this.options.shapeOptions.color,L.DomUtil.setPosition(m,d)},_updateGuideColor:function(r){if(this._guidesContainer)for(var h=0,f=this._guidesContainer.childNodes.length;h<f;h++)this._guidesContainer.childNodes[h].style.backgroundColor=r},_clearGuides:function(){if(this._guidesContainer)for(;this._guidesContainer.firstChild;)this._guidesContainer.removeChild(this._guidesContainer.firstChild)},_getTooltipText:function(){var r,h,f=this.options.showLength;return this._markers.length===0?r={text:L.drawLocal.draw.handlers.polyline.tooltip.start}:(h=f?this._getMeasurementString():"",r=this._markers.length===1?{text:L.drawLocal.draw.handlers.polyline.tooltip.cont,subtext:h}:{text:L.drawLocal.draw.handlers.polyline.tooltip.end,subtext:h}),r},_updateRunningMeasure:function(r,h){var f,d,m=this._markers.length;this._markers.length===1?this._measurementRunningTotal=0:(f=m-(h?2:1),d=L.GeometryUtil.isVersion07x()?r.distanceTo(this._markers[f].getLatLng())*(this.options.factor||1):this._map.distance(r,this._markers[f].getLatLng())*(this.options.factor||1),this._measurementRunningTotal+=d*(h?1:-1))},_getMeasurementString:function(){var r,h=this._currentLatLng,f=this._markers[this._markers.length-1].getLatLng();return r=L.GeometryUtil.isVersion07x()?f&&h&&h.distanceTo?this._measurementRunningTotal+h.distanceTo(f)*(this.options.factor||1):this._measurementRunningTotal||0:f&&h?this._measurementRunningTotal+this._map.distance(h,f)*(this.options.factor||1):this._measurementRunningTotal||0,L.GeometryUtil.readableDistance(r,this.options.metric,this.options.feet,this.options.nautic,this.options.precision)},_showErrorTooltip:function(){this._errorShown=!0,this._tooltip.showAsError().updateContent({text:this.options.drawError.message}),this._updateGuideColor(this.options.drawError.color),this._poly.setStyle({color:this.options.drawError.color}),this._clearHideErrorTimeout(),this._hideErrorTimeout=setTimeout(L.Util.bind(this._hideErrorTooltip,this),this.options.drawError.timeout)},_hideErrorTooltip:function(){this._errorShown=!1,this._clearHideErrorTimeout(),this._tooltip.removeError().updateContent(this._getTooltipText()),this._updateGuideColor(this.options.shapeOptions.color),this._poly.setStyle({color:this.options.shapeOptions.color})},_clearHideErrorTimeout:function(){this._hideErrorTimeout&&(clearTimeout(this._hideErrorTimeout),this._hideErrorTimeout=null)},_disableNewMarkers:function(){this._disableMarkers=!0},_enableNewMarkers:function(){setTimeout(function(){this._disableMarkers=!1}.bind(this),50)},_cleanUpShape:function(){this._markers.length>1&&this._markers[this._markers.length-1].off("click",this._finishShape,this)},_fireCreatedEvent:function(){var r=new this.Poly(this._poly.getLatLngs(),this.options.shapeOptions);L.Draw.Feature.prototype._fireCreatedEvent.call(this,r)}}),L.Draw.Polygon=L.Draw.Polyline.extend({statics:{TYPE:"polygon"},Poly:L.Polygon,options:{showArea:!1,showLength:!1,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},metric:!0,feet:!0,nautic:!1,precision:{}},initialize:function(r,h){L.Draw.Polyline.prototype.initialize.call(this,r,h),this.type=L.Draw.Polygon.TYPE},_updateFinishHandler:function(){var r=this._markers.length;r===1&&this._markers[0].on("click",this._finishShape,this),r>2&&(this._markers[r-1].on("dblclick",this._finishShape,this),r>3&&this._markers[r-2].off("dblclick",this._finishShape,this))},_getTooltipText:function(){var r,h;return this._markers.length===0?r=L.drawLocal.draw.handlers.polygon.tooltip.start:this._markers.length<3?(r=L.drawLocal.draw.handlers.polygon.tooltip.cont,h=this._getMeasurementString()):(r=L.drawLocal.draw.handlers.polygon.tooltip.end,h=this._getMeasurementString()),{text:r,subtext:h}},_getMeasurementString:function(){var r=this._area,h="";return r||this.options.showLength?(this.options.showLength&&(h=L.Draw.Polyline.prototype._getMeasurementString.call(this)),r&&(h+="<br>"+L.GeometryUtil.readableArea(r,this.options.metric,this.options.precision)),h):null},_shapeIsValid:function(){return this._markers.length>=3},_vertexChanged:function(r,h){var f;!this.options.allowIntersection&&this.options.showArea&&(f=this._poly.getLatLngs(),this._area=L.GeometryUtil.geodesicArea(f)),L.Draw.Polyline.prototype._vertexChanged.call(this,r,h)},_cleanUpShape:function(){var r=this._markers.length;r>0&&(this._markers[0].off("click",this._finishShape,this),r>2&&this._markers[r-1].off("dblclick",this._finishShape,this))}}),L.SimpleShape={},L.Draw.SimpleShape=L.Draw.Feature.extend({options:{repeatMode:!1},initialize:function(r,h){this._endLabelText=L.drawLocal.draw.handlers.simpleshape.tooltip.end,L.Draw.Feature.prototype.initialize.call(this,r,h)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._mapDraggable=this._map.dragging.enabled(),this._mapDraggable&&this._map.dragging.disable(),this._container.style.cursor="crosshair",this._tooltip.updateContent({text:this._initialLabelText}),this._map.on("mousedown",this._onMouseDown,this).on("mousemove",this._onMouseMove,this).on("touchstart",this._onMouseDown,this).on("touchmove",this._onMouseMove,this),n.addEventListener("touchstart",L.DomEvent.preventDefault,{passive:!1}))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._mapDraggable&&this._map.dragging.enable(),this._container.style.cursor="",this._map.off("mousedown",this._onMouseDown,this).off("mousemove",this._onMouseMove,this).off("touchstart",this._onMouseDown,this).off("touchmove",this._onMouseMove,this),L.DomEvent.off(n,"mouseup",this._onMouseUp,this),L.DomEvent.off(n,"touchend",this._onMouseUp,this),n.removeEventListener("touchstart",L.DomEvent.preventDefault),this._shape&&(this._map.removeLayer(this._shape),delete this._shape)),this._isDrawing=!1},_getTooltipText:function(){return{text:this._endLabelText}},_onMouseDown:function(r){this._isDrawing=!0,this._startLatLng=r.latlng,L.DomEvent.on(n,"mouseup",this._onMouseUp,this).on(n,"touchend",this._onMouseUp,this).preventDefault(r.originalEvent)},_onMouseMove:function(r){var h=r.latlng;this._tooltip.updatePosition(h),this._isDrawing&&(this._tooltip.updateContent(this._getTooltipText()),this._drawShape(h))},_onMouseUp:function(){this._shape&&this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()}}),L.Draw.Rectangle=L.Draw.SimpleShape.extend({statics:{TYPE:"rectangle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showArea:!0,metric:!0},initialize:function(r,h){this.type=L.Draw.Rectangle.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.rectangle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this,r,h)},disable:function(){this._enabled&&(this._isCurrentlyTwoClickDrawing=!1,L.Draw.SimpleShape.prototype.disable.call(this))},_onMouseUp:function(r){if(!this._shape&&!this._isCurrentlyTwoClickDrawing)return void(this._isCurrentlyTwoClickDrawing=!0);this._isCurrentlyTwoClickDrawing&&!s(r.target,"leaflet-pane")||L.Draw.SimpleShape.prototype._onMouseUp.call(this)},_drawShape:function(r){this._shape?this._shape.setBounds(new L.LatLngBounds(this._startLatLng,r)):(this._shape=new L.Rectangle(new L.LatLngBounds(this._startLatLng,r),this.options.shapeOptions),this._map.addLayer(this._shape))},_fireCreatedEvent:function(){var r=new L.Rectangle(this._shape.getBounds(),this.options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this,r)},_getTooltipText:function(){var r,h,f,d=L.Draw.SimpleShape.prototype._getTooltipText.call(this),m=this._shape,_=this.options.showArea;return m&&(r=this._shape._defaultShape?this._shape._defaultShape():this._shape.getLatLngs(),h=L.GeometryUtil.geodesicArea(r),f=_?L.GeometryUtil.readableArea(h,this.options.metric):""),{text:d.text,subtext:f}}}),L.Draw.Marker=L.Draw.Feature.extend({statics:{TYPE:"marker"},options:{icon:new L.Icon.Default,repeatMode:!1,zIndexOffset:2e3},initialize:function(r,h){this.type=L.Draw.Marker.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.marker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this,r,h)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._tooltip.updateContent({text:this._initialLabelText}),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("click",this._onClick,this).addTo(this._map),this._map.on("mousemove",this._onMouseMove,this),this._map.on("click",this._onTouch,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._map.off("click",this._onClick,this).off("click",this._onTouch,this),this._marker&&(this._marker.off("click",this._onClick,this),this._map.removeLayer(this._marker),delete this._marker),this._mouseMarker.off("click",this._onClick,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._map.off("mousemove",this._onMouseMove,this))},_onMouseMove:function(r){var h=r.latlng;this._tooltip.updatePosition(h),this._mouseMarker.setLatLng(h),this._marker?(h=this._mouseMarker.getLatLng(),this._marker.setLatLng(h)):(this._marker=this._createMarker(h),this._marker.on("click",this._onClick,this),this._map.on("click",this._onClick,this).addLayer(this._marker))},_createMarker:function(r){return new L.Marker(r,{icon:this.options.icon,zIndexOffset:this.options.zIndexOffset})},_onClick:function(){this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_onTouch:function(r){this._onMouseMove(r),this._onClick()},_fireCreatedEvent:function(){var r=new L.Marker.Touch(this._marker.getLatLng(),{icon:this.options.icon});L.Draw.Feature.prototype._fireCreatedEvent.call(this,r)}}),L.Draw.CircleMarker=L.Draw.Marker.extend({statics:{TYPE:"circlemarker"},options:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0,zIndexOffset:2e3},initialize:function(r,h){this.type=L.Draw.CircleMarker.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.circlemarker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this,r,h)},_fireCreatedEvent:function(){var r=new L.CircleMarker(this._marker.getLatLng(),this.options);L.Draw.Feature.prototype._fireCreatedEvent.call(this,r)},_createMarker:function(r){return new L.CircleMarker(r,this.options)}}),L.Draw.Circle=L.Draw.SimpleShape.extend({statics:{TYPE:"circle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showRadius:!0,metric:!0,feet:!0,nautic:!1},initialize:function(r,h){this.type=L.Draw.Circle.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.circle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this,r,h)},_drawShape:function(r){if(L.GeometryUtil.isVersion07x())var h=this._startLatLng.distanceTo(r);else var h=this._map.distance(this._startLatLng,r);this._shape?this._shape.setRadius(h):(this._shape=new L.Circle(this._startLatLng,h,this.options.shapeOptions),this._map.addLayer(this._shape))},_fireCreatedEvent:function(){var r=new L.Circle(this._startLatLng,this._shape.getRadius(),this.options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this,r)},_onMouseMove:function(r){var h,f=r.latlng,d=this.options.showRadius,m=this.options.metric;if(this._tooltip.updatePosition(f),this._isDrawing){this._drawShape(f),h=this._shape.getRadius().toFixed(1);var _="";d&&(_=L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(h,m,this.options.feet,this.options.nautic)),this._tooltip.updateContent({text:this._endLabelText,subtext:_})}}}),L.Edit=L.Edit||{},L.Edit.Marker=L.Handler.extend({initialize:function(r,h){this._marker=r,L.setOptions(this,h)},addHooks:function(){var r=this._marker;r.dragging.enable(),r.on("dragend",this._onDragEnd,r),this._toggleMarkerHighlight()},removeHooks:function(){var r=this._marker;r.dragging.disable(),r.off("dragend",this._onDragEnd,r),this._toggleMarkerHighlight()},_onDragEnd:function(r){var h=r.target;h.edited=!0,this._map.fire(L.Draw.Event.EDITMOVE,{layer:h})},_toggleMarkerHighlight:function(){var r=this._marker._icon;r&&(r.style.display="none",L.DomUtil.hasClass(r,"leaflet-edit-marker-selected")?(L.DomUtil.removeClass(r,"leaflet-edit-marker-selected"),this._offsetMarker(r,-4)):(L.DomUtil.addClass(r,"leaflet-edit-marker-selected"),this._offsetMarker(r,4)),r.style.display="")},_offsetMarker:function(r,h){var f=parseInt(r.style.marginTop,10)-h,d=parseInt(r.style.marginLeft,10)-h;r.style.marginTop=f+"px",r.style.marginLeft=d+"px"}}),L.Marker.addInitHook(function(){L.Edit.Marker&&(this.editing=new L.Edit.Marker(this),this.options.editable&&this.editing.enable())}),L.Edit=L.Edit||{},L.Edit.Poly=L.Handler.extend({initialize:function(r){this.latlngs=[r._latlngs],r._holes&&(this.latlngs=this.latlngs.concat(r._holes)),this._poly=r,this._poly.on("revert-edited",this._updateLatLngs,this)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat(this._poly._latlngs)?this._poly._latlngs:this._poly._latlngs[0]:this._poly._latlngs},_eachVertexHandler:function(r){for(var h=0;h<this._verticesHandlers.length;h++)r(this._verticesHandlers[h])},addHooks:function(){this._initHandlers(),this._eachVertexHandler(function(r){r.addHooks()})},removeHooks:function(){this._eachVertexHandler(function(r){r.removeHooks()})},updateMarkers:function(){this._eachVertexHandler(function(r){r.updateMarkers()})},_initHandlers:function(){this._verticesHandlers=[];for(var r=0;r<this.latlngs.length;r++)this._verticesHandlers.push(new L.Edit.PolyVerticesEdit(this._poly,this.latlngs[r],this._poly.options.poly))},_updateLatLngs:function(r){this.latlngs=[r.layer._latlngs],r.layer._holes&&(this.latlngs=this.latlngs.concat(r.layer._holes))}}),L.Edit.PolyVerticesEdit=L.Handler.extend({options:{icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),drawError:{color:"#b00b00",timeout:1e3}},initialize:function(r,h,f){L.Browser.touch&&(this.options.icon=this.options.touchIcon),this._poly=r,f&&f.drawError&&(f.drawError=L.Util.extend({},this.options.drawError,f.drawError)),this._latlngs=h,L.setOptions(this,f)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat(this._latlngs)?this._latlngs:this._latlngs[0]:this._latlngs},addHooks:function(){var r=this._poly,h=r._path;r instanceof L.Polygon||(r.options.fill=!1,r.options.editing&&(r.options.editing.fill=!1)),h&&r.options.editing&&r.options.editing.className&&(r.options.original.className&&r.options.original.className.split(" ").forEach(function(f){L.DomUtil.removeClass(h,f)}),r.options.editing.className.split(" ").forEach(function(f){L.DomUtil.addClass(h,f)})),r.setStyle(r.options.editing),this._poly._map&&(this._map=this._poly._map,this._markerGroup||this._initMarkers(),this._poly._map.addLayer(this._markerGroup))},removeHooks:function(){var r=this._poly,h=r._path;h&&r.options.editing&&r.options.editing.className&&(r.options.editing.className.split(" ").forEach(function(f){L.DomUtil.removeClass(h,f)}),r.options.original.className&&r.options.original.className.split(" ").forEach(function(f){L.DomUtil.addClass(h,f)})),r.setStyle(r.options.original),r._map&&(r._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers)},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup||(this._markerGroup=new L.LayerGroup),this._markers=[];var r,h,f,d,m=this._defaultShape();for(r=0,f=m.length;r<f;r++)d=this._createMarker(m[r],r),d.on("click",this._onMarkerClick,this),d.on("contextmenu",this._onContextMenu,this),this._markers.push(d);var _,x;for(r=0,h=f-1;r<f;h=r++)(r!==0||L.Polygon&&this._poly instanceof L.Polygon)&&(_=this._markers[h],x=this._markers[r],this._createMiddleMarker(_,x),this._updatePrevNext(_,x))},_createMarker:function(r,h){var f=new L.Marker.Touch(r,{draggable:!0,icon:this.options.icon});return f._origLatLng=r,f._index=h,f.on("dragstart",this._onMarkerDragStart,this).on("drag",this._onMarkerDrag,this).on("dragend",this._fireEdit,this).on("touchmove",this._onTouchMove,this).on("touchend",this._fireEdit,this).on("MSPointerMove",this._onTouchMove,this).on("MSPointerUp",this._fireEdit,this),this._markerGroup.addLayer(f),f},_onMarkerDragStart:function(){this._poly.fire("editstart")},_spliceLatLngs:function(){var r=this._defaultShape(),h=[].splice.apply(r,arguments);return this._poly._convertLatLngs(r,!0),this._poly.redraw(),h},_removeMarker:function(r){var h=r._index;this._markerGroup.removeLayer(r),this._markers.splice(h,1),this._spliceLatLngs(h,1),this._updateIndexes(h,-1),r.off("dragstart",this._onMarkerDragStart,this).off("drag",this._onMarkerDrag,this).off("dragend",this._fireEdit,this).off("touchmove",this._onMarkerDrag,this).off("touchend",this._fireEdit,this).off("click",this._onMarkerClick,this).off("MSPointerMove",this._onTouchMove,this).off("MSPointerUp",this._fireEdit,this)},_fireEdit:function(){this._poly.edited=!0,this._poly.fire("edit"),this._poly._map.fire(L.Draw.Event.EDITVERTEX,{layers:this._markerGroup,poly:this._poly})},_onMarkerDrag:function(r){var h=r.target,f=this._poly,d=L.LatLngUtil.cloneLatLng(h._origLatLng);if(L.extend(h._origLatLng,h._latlng),f.options.poly){var m=f._map._editTooltip;if(!f.options.poly.allowIntersection&&f.intersects()){L.extend(h._origLatLng,d),h.setLatLng(d);var _=f.options.color;f.setStyle({color:this.options.drawError.color}),m&&m.updateContent({text:L.drawLocal.draw.handlers.polyline.error}),setTimeout(function(){f.setStyle({color:_}),m&&m.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext})},1e3)}}h._middleLeft&&h._middleLeft.setLatLng(this._getMiddleLatLng(h._prev,h)),h._middleRight&&h._middleRight.setLatLng(this._getMiddleLatLng(h,h._next)),this._poly._bounds._southWest=L.latLng(1/0,1/0),this._poly._bounds._northEast=L.latLng(-1/0,-1/0);var x=this._poly.getLatLngs();this._poly._convertLatLngs(x,!0),this._poly.redraw(),this._poly.fire("editdrag")},_onMarkerClick:function(r){var h=L.Polygon&&this._poly instanceof L.Polygon?4:3,f=r.target;this._defaultShape().length<h||(this._removeMarker(f),this._updatePrevNext(f._prev,f._next),f._middleLeft&&this._markerGroup.removeLayer(f._middleLeft),f._middleRight&&this._markerGroup.removeLayer(f._middleRight),f._prev&&f._next?this._createMiddleMarker(f._prev,f._next):f._prev?f._next||(f._prev._middleRight=null):f._next._middleLeft=null,this._fireEdit())},_onContextMenu:function(r){var h=r.target;this._poly,this._poly._map.fire(L.Draw.Event.MARKERCONTEXT,{marker:h,layers:this._markerGroup,poly:this._poly}),L.DomEvent.stopPropagation},_onTouchMove:function(r){var h=this._map.mouseEventToLayerPoint(r.originalEvent.touches[0]),f=this._map.layerPointToLatLng(h),d=r.target;L.extend(d._origLatLng,f),d._middleLeft&&d._middleLeft.setLatLng(this._getMiddleLatLng(d._prev,d)),d._middleRight&&d._middleRight.setLatLng(this._getMiddleLatLng(d,d._next)),this._poly.redraw(),this.updateMarkers()},_updateIndexes:function(r,h){this._markerGroup.eachLayer(function(f){f._index>r&&(f._index+=h)})},_createMiddleMarker:function(r,h){var f,d,m,_=this._getMiddleLatLng(r,h),x=this._createMarker(_);x.setOpacity(.6),r._middleRight=h._middleLeft=x,d=function(){x.off("touchmove",d,this);var b=h._index;x._index=b,x.off("click",f,this).on("click",this._onMarkerClick,this),_.lat=x.getLatLng().lat,_.lng=x.getLatLng().lng,this._spliceLatLngs(b,0,_),this._markers.splice(b,0,x),x.setOpacity(1),this._updateIndexes(b,1),h._index++,this._updatePrevNext(r,x),this._updatePrevNext(x,h),this._poly.fire("editstart")},m=function(){x.off("dragstart",d,this),x.off("dragend",m,this),x.off("touchmove",d,this),this._createMiddleMarker(r,x),this._createMiddleMarker(x,h)},f=function(){d.call(this),m.call(this),this._fireEdit()},x.on("click",f,this).on("dragstart",d,this).on("dragend",m,this).on("touchmove",d,this),this._markerGroup.addLayer(x)},_updatePrevNext:function(r,h){r&&(r._next=h),h&&(h._prev=r)},_getMiddleLatLng:function(r,h){var f=this._poly._map,d=f.project(r.getLatLng()),m=f.project(h.getLatLng());return f.unproject(d._add(m)._divideBy(2))}}),L.Polyline.addInitHook(function(){this.editing||(L.Edit.Poly&&(this.editing=new L.Edit.Poly(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()}))}),L.Edit=L.Edit||{},L.Edit.SimpleShape=L.Handler.extend({options:{moveIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move"}),resizeIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize"}),touchMoveIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move leaflet-touch-icon"}),touchResizeIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize leaflet-touch-icon"})},initialize:function(r,h){L.Browser.touch&&(this.options.moveIcon=this.options.touchMoveIcon,this.options.resizeIcon=this.options.touchResizeIcon),this._shape=r,L.Util.setOptions(this,h)},addHooks:function(){var r=this._shape;this._shape._map&&(this._map=this._shape._map,r.setStyle(r.options.editing),r._map&&(this._map=r._map,this._markerGroup||this._initMarkers(),this._map.addLayer(this._markerGroup)))},removeHooks:function(){var r=this._shape;if(r.setStyle(r.options.original),r._map){this._unbindMarker(this._moveMarker);for(var h=0,f=this._resizeMarkers.length;h<f;h++)this._unbindMarker(this._resizeMarkers[h]);this._resizeMarkers=null,this._map.removeLayer(this._markerGroup),delete this._markerGroup}this._map=null},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup||(this._markerGroup=new L.LayerGroup),this._createMoveMarker(),this._createResizeMarker()},_createMoveMarker:function(){},_createResizeMarker:function(){},_createMarker:function(r,h){var f=new L.Marker.Touch(r,{draggable:!0,icon:h,zIndexOffset:10});return this._bindMarker(f),this._markerGroup.addLayer(f),f},_bindMarker:function(r){r.on("dragstart",this._onMarkerDragStart,this).on("drag",this._onMarkerDrag,this).on("dragend",this._onMarkerDragEnd,this).on("touchstart",this._onTouchStart,this).on("touchmove",this._onTouchMove,this).on("MSPointerMove",this._onTouchMove,this).on("touchend",this._onTouchEnd,this).on("MSPointerUp",this._onTouchEnd,this)},_unbindMarker:function(r){r.off("dragstart",this._onMarkerDragStart,this).off("drag",this._onMarkerDrag,this).off("dragend",this._onMarkerDragEnd,this).off("touchstart",this._onTouchStart,this).off("touchmove",this._onTouchMove,this).off("MSPointerMove",this._onTouchMove,this).off("touchend",this._onTouchEnd,this).off("MSPointerUp",this._onTouchEnd,this)},_onMarkerDragStart:function(r){r.target.setOpacity(0),this._shape.fire("editstart")},_fireEdit:function(){this._shape.edited=!0,this._shape.fire("edit")},_onMarkerDrag:function(r){var h=r.target,f=h.getLatLng();h===this._moveMarker?this._move(f):this._resize(f),this._shape.redraw(),this._shape.fire("editdrag")},_onMarkerDragEnd:function(r){r.target.setOpacity(1),this._fireEdit()},_onTouchStart:function(r){if(L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this,r),typeof this._getCorners=="function"){var h=this._getCorners(),f=r.target,d=f._cornerIndex;f.setOpacity(0),this._oppositeCorner=h[(d+2)%4],this._toggleCornerMarkers(0,d)}this._shape.fire("editstart")},_onTouchMove:function(r){var h=this._map.mouseEventToLayerPoint(r.originalEvent.touches[0]),f=this._map.layerPointToLatLng(h);return r.target===this._moveMarker?this._move(f):this._resize(f),this._shape.redraw(),!1},_onTouchEnd:function(r){r.target.setOpacity(1),this.updateMarkers(),this._fireEdit()},_move:function(){},_resize:function(){}}),L.Edit=L.Edit||{},L.Edit.Rectangle=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var r=this._shape.getBounds(),h=r.getCenter();this._moveMarker=this._createMarker(h,this.options.moveIcon)},_createResizeMarker:function(){var r=this._getCorners();this._resizeMarkers=[];for(var h=0,f=r.length;h<f;h++)this._resizeMarkers.push(this._createMarker(r[h],this.options.resizeIcon)),this._resizeMarkers[h]._cornerIndex=h},_onMarkerDragStart:function(r){L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this,r);var h=this._getCorners(),f=r.target,d=f._cornerIndex;this._oppositeCorner=h[(d+2)%4],this._toggleCornerMarkers(0,d)},_onMarkerDragEnd:function(r){var h,f,d=r.target;d===this._moveMarker&&(h=this._shape.getBounds(),f=h.getCenter(),d.setLatLng(f)),this._toggleCornerMarkers(1),this._repositionCornerMarkers(),L.Edit.SimpleShape.prototype._onMarkerDragEnd.call(this,r)},_move:function(r){for(var h,f=this._shape._defaultShape?this._shape._defaultShape():this._shape.getLatLngs(),d=this._shape.getBounds(),m=d.getCenter(),_=[],x=0,b=f.length;x<b;x++)h=[f[x].lat-m.lat,f[x].lng-m.lng],_.push([r.lat+h[0],r.lng+h[1]]);this._shape.setLatLngs(_),this._repositionCornerMarkers(),this._map.fire(L.Draw.Event.EDITMOVE,{layer:this._shape})},_resize:function(r){var h;this._shape.setBounds(L.latLngBounds(r,this._oppositeCorner)),h=this._shape.getBounds(),this._moveMarker.setLatLng(h.getCenter()),this._map.fire(L.Draw.Event.EDITRESIZE,{layer:this._shape})},_getCorners:function(){var r=this._shape.getBounds();return[r.getNorthWest(),r.getNorthEast(),r.getSouthEast(),r.getSouthWest()]},_toggleCornerMarkers:function(r){for(var h=0,f=this._resizeMarkers.length;h<f;h++)this._resizeMarkers[h].setOpacity(r)},_repositionCornerMarkers:function(){for(var r=this._getCorners(),h=0,f=this._resizeMarkers.length;h<f;h++)this._resizeMarkers[h].setLatLng(r[h])}}),L.Rectangle.addInitHook(function(){L.Edit.Rectangle&&(this.editing=new L.Edit.Rectangle(this),this.options.editable&&this.editing.enable())}),L.Edit=L.Edit||{},L.Edit.CircleMarker=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var r=this._shape.getLatLng();this._moveMarker=this._createMarker(r,this.options.moveIcon)},_createResizeMarker:function(){this._resizeMarkers=[]},_move:function(r){if(this._resizeMarkers.length){var h=this._getResizeMarkerPoint(r);this._resizeMarkers[0].setLatLng(h)}this._shape.setLatLng(r),this._map.fire(L.Draw.Event.EDITMOVE,{layer:this._shape})}}),L.CircleMarker.addInitHook(function(){L.Edit.CircleMarker&&(this.editing=new L.Edit.CircleMarker(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()})}),L.Edit=L.Edit||{},L.Edit.Circle=L.Edit.CircleMarker.extend({_createResizeMarker:function(){var r=this._shape.getLatLng(),h=this._getResizeMarkerPoint(r);this._resizeMarkers=[],this._resizeMarkers.push(this._createMarker(h,this.options.resizeIcon))},_getResizeMarkerPoint:function(r){var h=this._shape._radius*Math.cos(Math.PI/4),f=this._map.project(r);return this._map.unproject([f.x+h,f.y-h])},_resize:function(r){var h=this._moveMarker.getLatLng();L.GeometryUtil.isVersion07x()?radius=h.distanceTo(r):radius=this._map.distance(h,r),this._shape.setRadius(radius),this._map.editTooltip&&this._map._editTooltip.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.subtext+"<br />"+L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(radius,!0,this.options.feet,this.options.nautic)}),this._shape.setRadius(radius),this._map.fire(L.Draw.Event.EDITRESIZE,{layer:this._shape})}}),L.Circle.addInitHook(function(){L.Edit.Circle&&(this.editing=new L.Edit.Circle(this),this.options.editable&&this.editing.enable())}),L.Map.mergeOptions({touchExtend:!0}),L.Map.TouchExtend=L.Handler.extend({initialize:function(r){this._map=r,this._container=r._container,this._pane=r._panes.overlayPane},addHooks:function(){L.DomEvent.on(this._container,"touchstart",this._onTouchStart,this),L.DomEvent.on(this._container,"touchend",this._onTouchEnd,this),L.DomEvent.on(this._container,"touchmove",this._onTouchMove,this),this._detectIE()?(L.DomEvent.on(this._container,"MSPointerDown",this._onTouchStart,this),L.DomEvent.on(this._container,"MSPointerUp",this._onTouchEnd,this),L.DomEvent.on(this._container,"MSPointerMove",this._onTouchMove,this),L.DomEvent.on(this._container,"MSPointerCancel",this._onTouchCancel,this)):(L.DomEvent.on(this._container,"touchcancel",this._onTouchCancel,this),L.DomEvent.on(this._container,"touchleave",this._onTouchLeave,this))},removeHooks:function(){L.DomEvent.off(this._container,"touchstart",this._onTouchStart,this),L.DomEvent.off(this._container,"touchend",this._onTouchEnd,this),L.DomEvent.off(this._container,"touchmove",this._onTouchMove,this),this._detectIE()?(L.DomEvent.off(this._container,"MSPointerDown",this._onTouchStart,this),L.DomEvent.off(this._container,"MSPointerUp",this._onTouchEnd,this),L.DomEvent.off(this._container,"MSPointerMove",this._onTouchMove,this),L.DomEvent.off(this._container,"MSPointerCancel",this._onTouchCancel,this)):(L.DomEvent.off(this._container,"touchcancel",this._onTouchCancel,this),L.DomEvent.off(this._container,"touchleave",this._onTouchLeave,this))},_touchEvent:function(r,h){var f={};if(r.touches!==void 0){if(!r.touches.length)return;f=r.touches[0]}else if(r.pointerType!=="touch"||(f=r,!this._filterClick(r)))return;var d=this._map.mouseEventToContainerPoint(f),m=this._map.mouseEventToLayerPoint(f),_=this._map.layerPointToLatLng(m);this._map.fire(h,{latlng:_,layerPoint:m,containerPoint:d,pageX:f.pageX,pageY:f.pageY,originalEvent:r})},_filterClick:function(r){var h=r.timeStamp||r.originalEvent.timeStamp,f=L.DomEvent._lastClick&&h-L.DomEvent._lastClick;return f&&f>100&&f<500||r.target._simulatedClick&&!r._simulated?(L.DomEvent.stop(r),!1):(L.DomEvent._lastClick=h,!0)},_onTouchStart:function(r){this._map._loaded&&this._touchEvent(r,"touchstart")},_onTouchEnd:function(r){this._map._loaded&&this._touchEvent(r,"touchend")},_onTouchCancel:function(r){if(this._map._loaded){var h="touchcancel";this._detectIE()&&(h="pointercancel"),this._touchEvent(r,h)}},_onTouchLeave:function(r){this._map._loaded&&this._touchEvent(r,"touchleave")},_onTouchMove:function(r){this._map._loaded&&this._touchEvent(r,"touchmove")},_detectIE:function(){var r=a.navigator.userAgent,h=r.indexOf("MSIE ");if(h>0)return parseInt(r.substring(h+5,r.indexOf(".",h)),10);if(r.indexOf("Trident/")>0){var f=r.indexOf("rv:");return parseInt(r.substring(f+3,r.indexOf(".",f)),10)}var d=r.indexOf("Edge/");return d>0&&parseInt(r.substring(d+5,r.indexOf(".",d)),10)}}),L.Map.addInitHook("addHandler","touchExtend",L.Map.TouchExtend),L.Marker.Touch=L.Marker.extend({_initInteraction:function(){return this.addInteractiveTarget?L.Marker.prototype._initInteraction.apply(this):this._initInteractionLegacy()},_initInteractionLegacy:function(){if(this.options.clickable){var r=this._icon,h=["dblclick","mousedown","mouseover","mouseout","contextmenu","touchstart","touchend","touchmove"];this._detectIE?h.concat(["MSPointerDown","MSPointerUp","MSPointerMove","MSPointerCancel"]):h.concat(["touchcancel"]),L.DomUtil.addClass(r,"leaflet-clickable"),L.DomEvent.on(r,"click",this._onMouseClick,this),L.DomEvent.on(r,"keypress",this._onKeyPress,this);for(var f=0;f<h.length;f++)L.DomEvent.on(r,h[f],this._fireMouseEvent,this);L.Handler.MarkerDrag&&(this.dragging=new L.Handler.MarkerDrag(this),this.options.draggable&&this.dragging.enable())}},_detectIE:function(){var r=a.navigator.userAgent,h=r.indexOf("MSIE ");if(h>0)return parseInt(r.substring(h+5,r.indexOf(".",h)),10);if(r.indexOf("Trident/")>0){var f=r.indexOf("rv:");return parseInt(r.substring(f+3,r.indexOf(".",f)),10)}var d=r.indexOf("Edge/");return d>0&&parseInt(r.substring(d+5,r.indexOf(".",d)),10)}}),L.LatLngUtil={cloneLatLngs:function(r){for(var h=[],f=0,d=r.length;f<d;f++)Array.isArray(r[f])?h.push(L.LatLngUtil.cloneLatLngs(r[f])):h.push(this.cloneLatLng(r[f]));return h},cloneLatLng:function(r){return L.latLng(r.lat,r.lng)}},(function(){var r={km:2,ha:2,m:0,mi:2,ac:2,yd:0,ft:0,nm:2};L.GeometryUtil=L.extend(L.GeometryUtil||{},{geodesicArea:function(h){var f,d,m=h.length,_=0,x=Math.PI/180;if(m>2){for(var b=0;b<m;b++)f=h[b],d=h[(b+1)%m],_+=(d.lng-f.lng)*x*(2+Math.sin(f.lat*x)+Math.sin(d.lat*x));_=6378137*_*6378137/2}return Math.abs(_)},formattedNumber:function(h,f){var d=parseFloat(h).toFixed(f),m=L.drawLocal.format&&L.drawLocal.format.numeric,_=m&&m.delimiters,x=_&&_.thousands,b=_&&_.decimal;if(x||b){var E=d.split(".");d=x?E[0].replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+x):E[0],b=b||".",E.length>1&&(d=d+b+E[1])}return d},readableArea:function(h,f,x){var m,_,x=L.Util.extend({},r,x);return f?(_=["ha","m"],type=typeof f,type==="string"?_=[f]:type!=="boolean"&&(_=f),m=h>=1e6&&_.indexOf("km")!==-1?L.GeometryUtil.formattedNumber(1e-6*h,x.km)+" km²":h>=1e4&&_.indexOf("ha")!==-1?L.GeometryUtil.formattedNumber(1e-4*h,x.ha)+" ha":L.GeometryUtil.formattedNumber(h,x.m)+" m²"):(h/=.836127,m=h>=3097600?L.GeometryUtil.formattedNumber(h/3097600,x.mi)+" mi²":h>=4840?L.GeometryUtil.formattedNumber(h/4840,x.ac)+" acres":L.GeometryUtil.formattedNumber(h,x.yd)+" yd²"),m},readableDistance:function(h,f,d,m,b){var x,b=L.Util.extend({},r,b);switch(f?typeof f=="string"?f:"metric":d?"feet":m?"nauticalMile":"yards"){case"metric":x=h>1e3?L.GeometryUtil.formattedNumber(h/1e3,b.km)+" km":L.GeometryUtil.formattedNumber(h,b.m)+" m";break;case"feet":h*=3.28083,x=L.GeometryUtil.formattedNumber(h,b.ft)+" ft";break;case"nauticalMile":h*=.53996,x=L.GeometryUtil.formattedNumber(h/1e3,b.nm)+" nm";break;case"yards":default:h*=1.09361,x=h>1760?L.GeometryUtil.formattedNumber(h/1760,b.mi)+" miles":L.GeometryUtil.formattedNumber(h,b.yd)+" yd"}return x},isVersion07x:function(){var h=L.version.split(".");return parseInt(h[0],10)===0&&parseInt(h[1],10)===7}})})(),L.Util.extend(L.LineUtil,{segmentsIntersect:function(r,h,f,d){return this._checkCounterclockwise(r,f,d)!==this._checkCounterclockwise(h,f,d)&&this._checkCounterclockwise(r,h,f)!==this._checkCounterclockwise(r,h,d)},_checkCounterclockwise:function(r,h,f){return(f.y-r.y)*(h.x-r.x)>(h.y-r.y)*(f.x-r.x)}}),L.Polyline.include({intersects:function(){var r,h,f,d=this._getProjectedPoints(),m=d?d.length:0;if(this._tooFewPointsForIntersection())return!1;for(r=m-1;r>=3;r--)if(h=d[r-1],f=d[r],this._lineSegmentsIntersectsRange(h,f,r-2))return!0;return!1},newLatLngIntersects:function(r,h){return!!this._map&&this.newPointIntersects(this._map.latLngToLayerPoint(r),h)},newPointIntersects:function(r,h){var f=this._getProjectedPoints(),d=f?f.length:0,m=f?f[d-1]:null,_=d-2;return!this._tooFewPointsForIntersection(1)&&this._lineSegmentsIntersectsRange(m,r,_,h?1:0)},_tooFewPointsForIntersection:function(r){var h=this._getProjectedPoints(),f=h?h.length:0;return f+=r||0,!h||f<=3},_lineSegmentsIntersectsRange:function(r,h,f,d){var m,_,x=this._getProjectedPoints();d=d||0;for(var b=f;b>d;b--)if(m=x[b-1],_=x[b],L.LineUtil.segmentsIntersect(r,h,m,_))return!0;return!1},_getProjectedPoints:function(){if(!this._defaultShape)return this._originalPoints;for(var r=[],h=this._defaultShape(),f=0;f<h.length;f++)r.push(this._map.latLngToLayerPoint(h[f]));return r}}),L.Polygon.include({intersects:function(){var r,h,f,d,m=this._getProjectedPoints();return!this._tooFewPointsForIntersection()&&(!!L.Polyline.prototype.intersects.call(this)||(r=m.length,h=m[0],f=m[r-1],d=r-2,this._lineSegmentsIntersectsRange(f,h,d,1)))}}),L.Control.Draw=L.Control.extend({options:{position:"topleft",draw:{},edit:!1},initialize:function(r){if(L.version<"0.7")throw new Error("Leaflet.draw 0.2.3+ requires Leaflet 0.7.0+. Download latest from https://github.com/Leaflet/Leaflet/");L.Control.prototype.initialize.call(this,r);var h;this._toolbars={},L.DrawToolbar&&this.options.draw&&(h=new L.DrawToolbar(this.options.draw),this._toolbars[L.DrawToolbar.TYPE]=h,this._toolbars[L.DrawToolbar.TYPE].on("enable",this._toolbarEnabled,this)),L.EditToolbar&&this.options.edit&&(h=new L.EditToolbar(this.options.edit),this._toolbars[L.EditToolbar.TYPE]=h,this._toolbars[L.EditToolbar.TYPE].on("enable",this._toolbarEnabled,this)),L.toolbar=this},onAdd:function(r){var h,f=L.DomUtil.create("div","leaflet-draw"),d=!1;for(var m in this._toolbars)this._toolbars.hasOwnProperty(m)&&(h=this._toolbars[m].addToolbar(r))&&(d||(L.DomUtil.hasClass(h,"leaflet-draw-toolbar-top")||L.DomUtil.addClass(h.childNodes[0],"leaflet-draw-toolbar-top"),d=!0),f.appendChild(h));return f},onRemove:function(){for(var r in this._toolbars)this._toolbars.hasOwnProperty(r)&&this._toolbars[r].removeToolbar()},setDrawingOptions:function(r){for(var h in this._toolbars)this._toolbars[h]instanceof L.DrawToolbar&&this._toolbars[h].setOptions(r)},_toolbarEnabled:function(r){var h=r.target;for(var f in this._toolbars)this._toolbars[f]!==h&&this._toolbars[f].disable()}}),L.Map.mergeOptions({drawControlTooltips:!0,drawControl:!1}),L.Map.addInitHook(function(){this.options.drawControl&&(this.drawControl=new L.Control.Draw,this.addControl(this.drawControl))}),L.Toolbar=L.Class.extend({initialize:function(r){L.setOptions(this,r),this._modes={},this._actionButtons=[],this._activeMode=null;var h=L.version.split(".");parseInt(h[0],10)===1&&parseInt(h[1],10)>=2?L.Toolbar.include(L.Evented.prototype):L.Toolbar.include(L.Mixin.Events)},enabled:function(){return this._activeMode!==null},disable:function(){this.enabled()&&this._activeMode.handler.disable()},addToolbar:function(r){var h,f=L.DomUtil.create("div","leaflet-draw-section"),d=0,m=this._toolbarClass||"",_=this.getModeHandlers(r);for(this._toolbarContainer=L.DomUtil.create("div","leaflet-draw-toolbar leaflet-bar"),this._map=r,h=0;h<_.length;h++)_[h].enabled&&this._initModeHandler(_[h].handler,this._toolbarContainer,d++,m,_[h].title);if(d)return this._lastButtonIndex=--d,this._actionsContainer=L.DomUtil.create("ul","leaflet-draw-actions"),f.appendChild(this._toolbarContainer),f.appendChild(this._actionsContainer),f},removeToolbar:function(){for(var r in this._modes)this._modes.hasOwnProperty(r)&&(this._disposeButton(this._modes[r].button,this._modes[r].handler.enable,this._modes[r].handler),this._modes[r].handler.disable(),this._modes[r].handler.off("enabled",this._handlerActivated,this).off("disabled",this._handlerDeactivated,this));this._modes={};for(var h=0,f=this._actionButtons.length;h<f;h++)this._disposeButton(this._actionButtons[h].button,this._actionButtons[h].callback,this);this._actionButtons=[],this._actionsContainer=null},_initModeHandler:function(r,h,f,d,m){var _=r.type;this._modes[_]={},this._modes[_].handler=r,this._modes[_].button=this._createButton({type:_,title:m,className:d+"-"+_,container:h,callback:this._modes[_].handler.enable,context:this._modes[_].handler}),this._modes[_].buttonIndex=f,this._modes[_].handler.on("enabled",this._handlerActivated,this).on("disabled",this._handlerDeactivated,this)},_detectIOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!a.MSStream},_createButton:function(r){var h=L.DomUtil.create("a",r.className||"",r.container),f=L.DomUtil.create("span","sr-only",r.container);h.href="#",h.appendChild(f),r.title&&(h.title=r.title,f.innerHTML=r.title),r.text&&(h.innerHTML=r.text,f.innerHTML=r.text);var d=this._detectIOS()?"touchstart":"click";return L.DomEvent.on(h,"click",L.DomEvent.stopPropagation).on(h,"mousedown",L.DomEvent.stopPropagation).on(h,"dblclick",L.DomEvent.stopPropagation).on(h,"touchstart",L.DomEvent.stopPropagation).on(h,"click",L.DomEvent.preventDefault).on(h,d,r.callback,r.context),h},_disposeButton:function(r,h){var f=this._detectIOS()?"touchstart":"click";L.DomEvent.off(r,"click",L.DomEvent.stopPropagation).off(r,"mousedown",L.DomEvent.stopPropagation).off(r,"dblclick",L.DomEvent.stopPropagation).off(r,"touchstart",L.DomEvent.stopPropagation).off(r,"click",L.DomEvent.preventDefault).off(r,f,h)},_handlerActivated:function(r){this.disable(),this._activeMode=this._modes[r.handler],L.DomUtil.addClass(this._activeMode.button,"leaflet-draw-toolbar-button-enabled"),this._showActionsToolbar(),this.fire("enable")},_handlerDeactivated:function(){this._hideActionsToolbar(),L.DomUtil.removeClass(this._activeMode.button,"leaflet-draw-toolbar-button-enabled"),this._activeMode=null,this.fire("disable")},_createActions:function(r){var h,f,d,m,_=this._actionsContainer,x=this.getActions(r),b=x.length;for(f=0,d=this._actionButtons.length;f<d;f++)this._disposeButton(this._actionButtons[f].button,this._actionButtons[f].callback);for(this._actionButtons=[];_.firstChild;)_.removeChild(_.firstChild);for(var E=0;E<b;E++)"enabled"in x[E]&&!x[E].enabled||(h=L.DomUtil.create("li","",_),m=this._createButton({title:x[E].title,text:x[E].text,container:h,callback:x[E].callback,context:x[E].context}),this._actionButtons.push({button:m,callback:x[E].callback}))},_showActionsToolbar:function(){var r=this._activeMode.buttonIndex,h=this._lastButtonIndex,f=this._activeMode.button.offsetTop-1;this._createActions(this._activeMode.handler),this._actionsContainer.style.top=f+"px",r===0&&(L.DomUtil.addClass(this._toolbarContainer,"leaflet-draw-toolbar-notop"),L.DomUtil.addClass(this._actionsContainer,"leaflet-draw-actions-top")),r===h&&(L.DomUtil.addClass(this._toolbarContainer,"leaflet-draw-toolbar-nobottom"),L.DomUtil.addClass(this._actionsContainer,"leaflet-draw-actions-bottom")),this._actionsContainer.style.display="block",this._map.fire(L.Draw.Event.TOOLBAROPENED)},_hideActionsToolbar:function(){this._actionsContainer.style.display="none",L.DomUtil.removeClass(this._toolbarContainer,"leaflet-draw-toolbar-notop"),L.DomUtil.removeClass(this._toolbarContainer,"leaflet-draw-toolbar-nobottom"),L.DomUtil.removeClass(this._actionsContainer,"leaflet-draw-actions-top"),L.DomUtil.removeClass(this._actionsContainer,"leaflet-draw-actions-bottom"),this._map.fire(L.Draw.Event.TOOLBARCLOSED)}}),L.Draw=L.Draw||{},L.Draw.Tooltip=L.Class.extend({initialize:function(r){this._map=r,this._popupPane=r._panes.popupPane,this._visible=!1,this._container=r.options.drawControlTooltips?L.DomUtil.create("div","leaflet-draw-tooltip",this._popupPane):null,this._singleLineLabel=!1,this._map.on("mouseout",this._onMouseOut,this)},dispose:function(){this._map.off("mouseout",this._onMouseOut,this),this._container&&(this._popupPane.removeChild(this._container),this._container=null)},updateContent:function(r){return this._container?(r.subtext=r.subtext||"",r.subtext.length!==0||this._singleLineLabel?r.subtext.length>0&&this._singleLineLabel&&(L.DomUtil.removeClass(this._container,"leaflet-draw-tooltip-single"),this._singleLineLabel=!1):(L.DomUtil.addClass(this._container,"leaflet-draw-tooltip-single"),this._singleLineLabel=!0),this._container.innerHTML=(r.subtext.length>0?'<span class="leaflet-draw-tooltip-subtext">'+r.subtext+"</span><br />":"")+"<span>"+r.text+"</span>",r.text||r.subtext?(this._visible=!0,this._container.style.visibility="inherit"):(this._visible=!1,this._container.style.visibility="hidden"),this):this},updatePosition:function(r){var h=this._map.latLngToLayerPoint(r),f=this._container;return this._container&&(this._visible&&(f.style.visibility="inherit"),L.DomUtil.setPosition(f,h)),this},showAsError:function(){return this._container&&L.DomUtil.addClass(this._container,"leaflet-error-draw-tooltip"),this},removeError:function(){return this._container&&L.DomUtil.removeClass(this._container,"leaflet-error-draw-tooltip"),this},_onMouseOut:function(){this._container&&(this._container.style.visibility="hidden")}}),L.DrawToolbar=L.Toolbar.extend({statics:{TYPE:"draw"},options:{polyline:{},polygon:{},rectangle:{},circle:{},marker:{},circlemarker:{}},initialize:function(r){for(var h in this.options)this.options.hasOwnProperty(h)&&r[h]&&(r[h]=L.extend({},this.options[h],r[h]));this._toolbarClass="leaflet-draw-draw",L.Toolbar.prototype.initialize.call(this,r)},getModeHandlers:function(r){return[{enabled:this.options.polyline,handler:new L.Draw.Polyline(r,this.options.polyline),title:L.drawLocal.draw.toolbar.buttons.polyline},{enabled:this.options.polygon,handler:new L.Draw.Polygon(r,this.options.polygon),title:L.drawLocal.draw.toolbar.buttons.polygon},{enabled:this.options.rectangle,handler:new L.Draw.Rectangle(r,this.options.rectangle),title:L.drawLocal.draw.toolbar.buttons.rectangle},{enabled:this.options.circle,handler:new L.Draw.Circle(r,this.options.circle),title:L.drawLocal.draw.toolbar.buttons.circle},{enabled:this.options.marker,handler:new L.Draw.Marker(r,this.options.marker),title:L.drawLocal.draw.toolbar.buttons.marker},{enabled:this.options.circlemarker,handler:new L.Draw.CircleMarker(r,this.options.circlemarker),title:L.drawLocal.draw.toolbar.buttons.circlemarker}]},getActions:function(r){return[{enabled:r.completeShape,title:L.drawLocal.draw.toolbar.finish.title,text:L.drawLocal.draw.toolbar.finish.text,callback:r.completeShape,context:r},{enabled:r.deleteLastVertex,title:L.drawLocal.draw.toolbar.undo.title,text:L.drawLocal.draw.toolbar.undo.text,callback:r.deleteLastVertex,context:r},{title:L.drawLocal.draw.toolbar.actions.title,text:L.drawLocal.draw.toolbar.actions.text,callback:this.disable,context:this}]},setOptions:function(r){L.setOptions(this,r);for(var h in this._modes)this._modes.hasOwnProperty(h)&&r.hasOwnProperty(h)&&this._modes[h].handler.setOptions(r[h])}}),L.EditToolbar=L.Toolbar.extend({statics:{TYPE:"edit"},options:{edit:{selectedPathOptions:{dashArray:"10, 10",fill:!0,fillColor:"#fe57a1",fillOpacity:.1,maintainColor:!1}},remove:{},poly:null,featureGroup:null},initialize:function(r){r.edit&&(r.edit.selectedPathOptions===void 0&&(r.edit.selectedPathOptions=this.options.edit.selectedPathOptions),r.edit.selectedPathOptions=L.extend({},this.options.edit.selectedPathOptions,r.edit.selectedPathOptions)),r.remove&&(r.remove=L.extend({},this.options.remove,r.remove)),r.poly&&(r.poly=L.extend({},this.options.poly,r.poly)),this._toolbarClass="leaflet-draw-edit",L.Toolbar.prototype.initialize.call(this,r),this._selectedFeatureCount=0},getModeHandlers:function(r){var h=this.options.featureGroup;return[{enabled:this.options.edit,handler:new L.EditToolbar.Edit(r,{featureGroup:h,selectedPathOptions:this.options.edit.selectedPathOptions,poly:this.options.poly}),title:L.drawLocal.edit.toolbar.buttons.edit},{enabled:this.options.remove,handler:new L.EditToolbar.Delete(r,{featureGroup:h}),title:L.drawLocal.edit.toolbar.buttons.remove}]},getActions:function(r){var h=[{title:L.drawLocal.edit.toolbar.actions.save.title,text:L.drawLocal.edit.toolbar.actions.save.text,callback:this._save,context:this},{title:L.drawLocal.edit.toolbar.actions.cancel.title,text:L.drawLocal.edit.toolbar.actions.cancel.text,callback:this.disable,context:this}];return r.removeAllLayers&&h.push({title:L.drawLocal.edit.toolbar.actions.clearAll.title,text:L.drawLocal.edit.toolbar.actions.clearAll.text,callback:this._clearAllLayers,context:this}),h},addToolbar:function(r){var h=L.Toolbar.prototype.addToolbar.call(this,r);return this._checkDisabled(),this.options.featureGroup.on("layeradd layerremove",this._checkDisabled,this),h},removeToolbar:function(){this.options.featureGroup.off("layeradd layerremove",this._checkDisabled,this),L.Toolbar.prototype.removeToolbar.call(this)},disable:function(){this.enabled()&&(this._activeMode.handler.revertLayers(),L.Toolbar.prototype.disable.call(this))},_save:function(){this._activeMode.handler.save(),this._activeMode&&this._activeMode.handler.disable()},_clearAllLayers:function(){this._activeMode.handler.removeAllLayers(),this._activeMode&&this._activeMode.handler.disable()},_checkDisabled:function(){var r,h=this.options.featureGroup,f=h.getLayers().length!==0;this.options.edit&&(r=this._modes[L.EditToolbar.Edit.TYPE].button,f?L.DomUtil.removeClass(r,"leaflet-disabled"):L.DomUtil.addClass(r,"leaflet-disabled"),r.setAttribute("title",f?L.drawLocal.edit.toolbar.buttons.edit:L.drawLocal.edit.toolbar.buttons.editDisabled)),this.options.remove&&(r=this._modes[L.EditToolbar.Delete.TYPE].button,f?L.DomUtil.removeClass(r,"leaflet-disabled"):L.DomUtil.addClass(r,"leaflet-disabled"),r.setAttribute("title",f?L.drawLocal.edit.toolbar.buttons.remove:L.drawLocal.edit.toolbar.buttons.removeDisabled))}}),L.EditToolbar.Edit=L.Handler.extend({statics:{TYPE:"edit"},initialize:function(r,h){if(L.Handler.prototype.initialize.call(this,r),L.setOptions(this,h),this._featureGroup=h.featureGroup,!(this._featureGroup instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");this._uneditedLayerProps={},this.type=L.EditToolbar.Edit.TYPE;var f=L.version.split(".");parseInt(f[0],10)===1&&parseInt(f[1],10)>=2?L.EditToolbar.Edit.include(L.Evented.prototype):L.EditToolbar.Edit.include(L.Mixin.Events)},enable:function(){!this._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.EDITSTART,{handler:this.type}),L.Handler.prototype.enable.call(this),this._featureGroup.on("layeradd",this._enableLayerEdit,this).on("layerremove",this._disableLayerEdit,this))},disable:function(){this._enabled&&(this._featureGroup.off("layeradd",this._enableLayerEdit,this).off("layerremove",this._disableLayerEdit,this),L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.EDITSTOP,{handler:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var r=this._map;r&&(r.getContainer().focus(),this._featureGroup.eachLayer(this._enableLayerEdit,this),this._tooltip=new L.Draw.Tooltip(this._map),this._tooltip.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}),r._editTooltip=this._tooltip,this._updateTooltip(),this._map.on("mousemove",this._onMouseMove,this).on("touchmove",this._onMouseMove,this).on("MSPointerMove",this._onMouseMove,this).on(L.Draw.Event.EDITVERTEX,this._updateTooltip,this))},removeHooks:function(){this._map&&(this._featureGroup.eachLayer(this._disableLayerEdit,this),this._uneditedLayerProps={},this._tooltip.dispose(),this._tooltip=null,this._map.off("mousemove",this._onMouseMove,this).off("touchmove",this._onMouseMove,this).off("MSPointerMove",this._onMouseMove,this).off(L.Draw.Event.EDITVERTEX,this._updateTooltip,this))},revertLayers:function(){this._featureGroup.eachLayer(function(r){this._revertLayer(r)},this)},save:function(){var r=new L.LayerGroup;this._featureGroup.eachLayer(function(h){h.edited&&(r.addLayer(h),h.edited=!1)}),this._map.fire(L.Draw.Event.EDITED,{layers:r})},_backupLayer:function(r){var h=L.Util.stamp(r);this._uneditedLayerProps[h]||(r instanceof L.Polyline||r instanceof L.Polygon||r instanceof L.Rectangle?this._uneditedLayerProps[h]={latlngs:L.LatLngUtil.cloneLatLngs(r.getLatLngs())}:r instanceof L.Circle?this._uneditedLayerProps[h]={latlng:L.LatLngUtil.cloneLatLng(r.getLatLng()),radius:r.getRadius()}:(r instanceof L.Marker||r instanceof L.CircleMarker)&&(this._uneditedLayerProps[h]={latlng:L.LatLngUtil.cloneLatLng(r.getLatLng())}))},_getTooltipText:function(){return{text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}},_updateTooltip:function(){this._tooltip.updateContent(this._getTooltipText())},_revertLayer:function(r){var h=L.Util.stamp(r);r.edited=!1,this._uneditedLayerProps.hasOwnProperty(h)&&(r instanceof L.Polyline||r instanceof L.Polygon||r instanceof L.Rectangle?r.setLatLngs(this._uneditedLayerProps[h].latlngs):r instanceof L.Circle?(r.setLatLng(this._uneditedLayerProps[h].latlng),r.setRadius(this._uneditedLayerProps[h].radius)):(r instanceof L.Marker||r instanceof L.CircleMarker)&&r.setLatLng(this._uneditedLayerProps[h].latlng),r.fire("revert-edited",{layer:r}))},_enableLayerEdit:function(r){var h,f,d=r.layer||r.target||r;this._backupLayer(d),this.options.poly&&(f=L.Util.extend({},this.options.poly),d.options.poly=f),this.options.selectedPathOptions&&(h=L.Util.extend({},this.options.selectedPathOptions),h.maintainColor&&(h.color=d.options.color,h.fillColor=d.options.fillColor),d.options.original=L.extend({},d.options),d.options.editing=h),d instanceof L.Marker?(d.editing&&d.editing.enable(),d.dragging.enable(),d.on("dragend",this._onMarkerDragEnd).on("touchmove",this._onTouchMove,this).on("MSPointerMove",this._onTouchMove,this).on("touchend",this._onMarkerDragEnd,this).on("MSPointerUp",this._onMarkerDragEnd,this)):d.editing.enable()},_disableLayerEdit:function(r){var h=r.layer||r.target||r;h.edited=!1,h.editing&&h.editing.disable(),delete h.options.editing,delete h.options.original,this._selectedPathOptions&&(h instanceof L.Marker?this._toggleMarkerHighlight(h):(h.setStyle(h.options.previousOptions),delete h.options.previousOptions)),h instanceof L.Marker?(h.dragging.disable(),h.off("dragend",this._onMarkerDragEnd,this).off("touchmove",this._onTouchMove,this).off("MSPointerMove",this._onTouchMove,this).off("touchend",this._onMarkerDragEnd,this).off("MSPointerUp",this._onMarkerDragEnd,this)):h.editing.disable()},_onMouseMove:function(r){this._tooltip.updatePosition(r.latlng)},_onMarkerDragEnd:function(r){var h=r.target;h.edited=!0,this._map.fire(L.Draw.Event.EDITMOVE,{layer:h})},_onTouchMove:function(r){var h=r.originalEvent.changedTouches[0],f=this._map.mouseEventToLayerPoint(h),d=this._map.layerPointToLatLng(f);r.target.setLatLng(d)},_hasAvailableLayers:function(){return this._featureGroup.getLayers().length!==0}}),L.EditToolbar.Delete=L.Handler.extend({statics:{TYPE:"remove"},initialize:function(r,h){if(L.Handler.prototype.initialize.call(this,r),L.Util.setOptions(this,h),this._deletableLayers=this.options.featureGroup,!(this._deletableLayers instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");this.type=L.EditToolbar.Delete.TYPE;var f=L.version.split(".");parseInt(f[0],10)===1&&parseInt(f[1],10)>=2?L.EditToolbar.Delete.include(L.Evented.prototype):L.EditToolbar.Delete.include(L.Mixin.Events)},enable:function(){!this._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.DELETESTART,{handler:this.type}),L.Handler.prototype.enable.call(this),this._deletableLayers.on("layeradd",this._enableLayerDelete,this).on("layerremove",this._disableLayerDelete,this))},disable:function(){this._enabled&&(this._deletableLayers.off("layeradd",this._enableLayerDelete,this).off("layerremove",this._disableLayerDelete,this),L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.DELETESTOP,{handler:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var r=this._map;r&&(r.getContainer().focus(),this._deletableLayers.eachLayer(this._enableLayerDelete,this),this._deletedLayers=new L.LayerGroup,this._tooltip=new L.Draw.Tooltip(this._map),this._tooltip.updateContent({text:L.drawLocal.edit.handlers.remove.tooltip.text}),this._map.on("mousemove",this._onMouseMove,this))},removeHooks:function(){this._map&&(this._deletableLayers.eachLayer(this._disableLayerDelete,this),this._deletedLayers=null,this._tooltip.dispose(),this._tooltip=null,this._map.off("mousemove",this._onMouseMove,this))},revertLayers:function(){this._deletedLayers.eachLayer(function(r){this._deletableLayers.addLayer(r),r.fire("revert-deleted",{layer:r})},this)},save:function(){this._map.fire(L.Draw.Event.DELETED,{layers:this._deletedLayers})},removeAllLayers:function(){this._deletableLayers.eachLayer(function(r){this._removeLayer({layer:r})},this),this.save()},_enableLayerDelete:function(r){(r.layer||r.target||r).on("click",this._removeLayer,this)},_disableLayerDelete:function(r){var h=r.layer||r.target||r;h.off("click",this._removeLayer,this),this._deletedLayers.removeLayer(h)},_removeLayer:function(r){var h=r.layer||r.target||r;this._deletableLayers.removeLayer(h),this._deletedLayers.addLayer(h),h.fire("deleted")},_onMouseMove:function(r){this._tooltip.updatePosition(r.latlng)},_hasAvailableLayers:function(){return this._deletableLayers.getLayers().length!==0}})})(window,document);var Xs={exports:{}},Al;function Ec(){return Al||(Al=1,(function(a,n){(function(i,s){a.exports=i(Sl()),typeof s!="undefined"&&s.L&&(s.L.Ruler=i(L))})(function(i){i.Control.Ruler=i.Control.extend({options:{position:"topright",circleMarker:{color:"red",radius:2},lineStyle:{color:"red",dashArray:"1,6"},lengthUnit:{display:"km",decimal:2,factor:null,label:"Distance:"},angleUnit:{display:"°",decimal:2,factor:null,label:"Bearing:"}},onAdd:function(s){return this._map=s,this._container=i.DomUtil.create("div","leaflet-bar"),this._container.classList.add("leaflet-ruler"),i.DomEvent.disableClickPropagation(this._container),i.DomEvent.on(this._container,"click",this._toggleMeasure,this),this._choice=!1,this._defaultCursor=this._map._container.style.cursor,this._allLayers=i.layerGroup(),this._container},onRemove:function(){i.DomEvent.off(this._container,"click",this._toggleMeasure,this)},_toggleMeasure:function(){this._choice=!this._choice,this._clickedLatLong=null,this._clickedPoints=[],this._totalLength=0,this._choice?(this._map.doubleClickZoom.disable(),i.DomEvent.on(this._map._container,"keydown",this._escape,this),i.DomEvent.on(this._map._container,"dblclick",this._closePath,this),this._container.classList.add("leaflet-ruler-clicked"),this._clickCount=0,this._tempLine=i.featureGroup().addTo(this._allLayers),this._tempPoint=i.featureGroup().addTo(this._allLayers),this._pointLayer=i.featureGroup().addTo(this._allLayers),this._polylineLayer=i.featureGroup().addTo(this._allLayers),this._allLayers.addTo(this._map),this._map._container.style.cursor="crosshair",this._map.on("click",this._clicked,this),this._map.on("mousemove",this._moving,this)):(this._map.doubleClickZoom.enable(),i.DomEvent.off(this._map._container,"keydown",this._escape,this),i.DomEvent.off(this._map._container,"dblclick",this._closePath,this),this._container.classList.remove("leaflet-ruler-clicked"),this._map.removeLayer(this._allLayers),this._allLayers=i.layerGroup(),this._map._container.style.cursor=this._defaultCursor,this._map.off("click",this._clicked,this),this._map.off("mousemove",this._moving,this))},_clicked:function(s){if(this._clickedLatLong=s.latlng,this._clickedPoints.push(this._clickedLatLong),i.circleMarker(this._clickedLatLong,this.options.circleMarker).addTo(this._pointLayer),this._clickCount>0&&!s.latlng.equals(this._clickedPoints[this._clickedPoints.length-2])){this._movingLatLong&&i.polyline([this._clickedPoints[this._clickCount-1],this._movingLatLong],this.options.lineStyle).addTo(this._polylineLayer);var r;this._totalLength+=this._result.Distance,this._clickCount>1?r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._totalLength.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display:r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._result.Distance.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display,i.circleMarker(this._clickedLatLong,this.options.circleMarker).bindTooltip(r,{permanent:!0,className:"result-tooltip"}).addTo(this._pointLayer).openTooltip()}this._clickCount++},_moving:function(s){if(this._clickedLatLong){i.DomEvent.off(this._container,"click",this._toggleMeasure,this),this._movingLatLong=s.latlng,this._tempLine&&(this._map.removeLayer(this._tempLine),this._map.removeLayer(this._tempPoint));var r;this._addedLength=0,this._tempLine=i.featureGroup(),this._tempPoint=i.featureGroup(),this._tempLine.addTo(this._map),this._tempPoint.addTo(this._map),this._calculateBearingAndDistance(),this._addedLength=this._result.Distance+this._totalLength,i.polyline([this._clickedLatLong,this._movingLatLong],this.options.lineStyle).addTo(this._tempLine),this._clickCount>1?r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._addedLength.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display+'<br><div class="plus-length">(+'+this._result.Distance.toFixed(this.options.lengthUnit.decimal)+")</div>":r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._result.Distance.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display,i.circleMarker(this._movingLatLong,this.options.circleMarker).bindTooltip(r,{sticky:!0,offset:i.point(0,-40),className:"moving-tooltip"}).addTo(this._tempPoint).openTooltip()}},_escape:function(s){s.keyCode===27&&(this._clickCount>0?this._closePath():(this._choice=!0,this._toggleMeasure()))},_calculateBearingAndDistance:function(){var s=this._clickedLatLong.lat,r=this._clickedLatLong.lng,h=this._movingLatLong.lat,f=this._movingLatLong.lng,d=Math.PI/180,m=Math.sin((f-r)*d)*Math.cos(h*d),_=Math.cos(s*d)*Math.sin(h*d)-Math.sin(s*d)*Math.cos(h*d)*Math.cos((f-r)*d),x=Math.atan2(m,_)*((this.options.angleUnit.factor?this.options.angleUnit.factor/2:180)/Math.PI);x+=x<0?this.options.angleUnit.factor?this.options.angleUnit.factor:360:0;var b=this.options.lengthUnit.factor?6371*this.options.lengthUnit.factor:6371,E=(h-s)*d,C=(f-r)*d,M=Math.sin(E/2)*Math.sin(E/2)+Math.cos(s*d)*Math.cos(h*d)*Math.sin(C/2)*Math.sin(C/2),S=2*Math.atan2(Math.sqrt(M),Math.sqrt(1-M)),z=b*S;this._result={Bearing:x,Distance:z}},_closePath:function(){this._map.removeLayer(this._tempLine),this._map.removeLayer(this._tempPoint),this._clickCount<=1&&this._map.removeLayer(this._pointLayer),this._choice=!1,i.DomEvent.on(this._container,"click",this._toggleMeasure,this),this._toggleMeasure()}}),i.control.ruler=function(s){return new i.Control.Ruler(s)}},window)})(Xs)),Xs.exports}Ec();const be=[];for(let a=0;a<256;++a)be.push((a+256).toString(16).slice(1));function Tc(a,n=0){return(be[a[n+0]]+be[a[n+1]]+be[a[n+2]]+be[a[n+3]]+"-"+be[a[n+4]]+be[a[n+5]]+"-"+be[a[n+6]]+be[a[n+7]]+"-"+be[a[n+8]]+be[a[n+9]]+"-"+be[a[n+10]]+be[a[n+11]]+be[a[n+12]]+be[a[n+13]]+be[a[n+14]]+be[a[n+15]]).toLowerCase()}let Js;const Ic=new Uint8Array(16);function Cc(){if(!Js){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Js=crypto.getRandomValues.bind(crypto)}return Js(Ic)}const Pl={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Mr(a,n,i){var r,h,f;if(Pl.randomUUID&&!a)return Pl.randomUUID();a=a||{};const s=(f=(h=a.random)!=null?h:(r=a.rng)==null?void 0:r.call(a))!=null?f:Cc();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Tc(s)}function Ve(a){var i,s;const n=(s=a.id)!=null?s:(i=a.properties)==null?void 0:i.id;if(n!=null)return String(n)}const Sc=/^(.*)::(\d+)$/,vi="geokit:source";function Ws(a){const n=Ve(a);if(!n)return null;const i=Sc.exec(n);return i?{baseId:i[1],childIndex:Number(i[2]),feature:a}:null}function Mc(a,n){const i=n&&typeof n=="object"?{...n}:{};return i.id=a,i}function Ac(a,n){var _,x;const i=[...n].sort((b,E)=>b.childIndex-E.childIndex),s=i[0].feature,r=Mc(a,s.properties),h=(_=s.properties)==null?void 0:_[vi],f=Array.isArray(h)?h[h.length-1]:void 0,d=i.map(b=>b.feature.geometry).filter(b=>b!=null);let m;return d.length===0?m={type:"GeometryCollection",geometries:[]}:d.length===1&&!f?m=d[0]:(f==null?void 0:f.type)!=="GeometryCollection"&&d.every(b=>b.type==="Point")?m={type:"MultiPoint",coordinates:d.map(b=>b.coordinates)}:(f==null?void 0:f.type)!=="GeometryCollection"&&d.every(b=>b.type==="LineString")?m={type:"MultiLineString",coordinates:d.map(b=>b.coordinates)}:(f==null?void 0:f.type)!=="GeometryCollection"&&d.every(b=>b.type==="Polygon")?m={type:"MultiPolygon",coordinates:d.map(b=>b.coordinates)}:m={type:"GeometryCollection",geometries:d},f&&r&&(f.hasPropertyId?r.id=f.propertyId:delete r.id,h.length>1?r[vi]=h.slice(0,-1):delete r[vi]),{type:"Feature",id:(x=f==null?void 0:f.id)!=null?x:a,properties:f!=null&&f.nullProperties&&Object.keys(r!=null?r:{}).length===0?null:r,geometry:m}}function Pc(a,n){const i=s=>{switch(s.type){case"Point":n(s.coordinates);break;case"MultiPoint":case"LineString":for(const r of s.coordinates)n(r);break;case"MultiLineString":case"Polygon":for(const r of s.coordinates)for(const h of r)n(h);break;case"MultiPolygon":for(const r of s.coordinates)for(const h of r)for(const f of h)n(f);break;case"GeometryCollection":for(const r of s.geometries)i(r);break}};i(a)}function Nc(a){const n=a.geometry;if(!n)return null;let i=1/0,s=1/0,r=-1/0,h=-1/0,f=!1;return Pc(n,d=>{const[m,_]=d;typeof m!="number"||typeof _!="number"||(f=!0,m<i&&(i=m),_<s&&(s=_),m>r&&(r=m),_>h&&(h=_))}),f?[i,s,r,h]:null}function Oc(a){let n=1/0,i=1/0,s=-1/0,r=-1/0,h=!1;for(const f of a.features){const d=Nc(f);d&&(h=!0,n=Math.min(n,d[0]),i=Math.min(i,d[1]),s=Math.max(s,d[2]),r=Math.max(r,d[3]))}return h?[n,i,s,r]:null}function Rc(a){const[n,i,s,r]=a;return[[i,n],[r,s]]}function js(a,n={}){var r;const i=[];for(const h of a.features){if(!h||h.type!=="Feature")continue;const f=(r=h.properties)!=null?r:{},d=Ve(h),m=(x,b)=>{const E=f&&typeof f=="object"?{...f}:{},C=d!==void 0?`${d}::${b}`:void 0;C!==void 0&&(E.id=C);const M=Array.isArray(f[vi])?f[vi]:[],S={type:h.geometry.type,hasPropertyId:Object.prototype.hasOwnProperty.call(f,"id"),nullProperties:h.properties===null};return h.id!==void 0?S.id=h.id:d!==void 0&&(S.id=d),S.hasPropertyId&&(S.propertyId=f.id),n.preserveMetadata&&(E[vi]=[...M,S]),{type:"Feature",id:C,properties:E,geometry:x}},_=h.geometry;if(_)switch(_.type){case"MultiPolygon":for(const[x,b]of _.coordinates.entries())i.push(m({type:"Polygon",coordinates:b},x));break;case"MultiLineString":for(const[x,b]of _.coordinates.entries())i.push(m({type:"LineString",coordinates:b},x));break;case"MultiPoint":for(const[x,b]of _.coordinates.entries())i.push(m({type:"Point",coordinates:b},x));break;case"GeometryCollection":for(const[x,b]of _.geometries.entries())i.push(m(b,x));break;default:i.push(h);break}}const s={type:"FeatureCollection",features:i};return n.preserveMetadata&&i.some(h=>h.geometry.type.startsWith("Multi")||h.geometry.type==="GeometryCollection")?js(s,n):s}function Ks(a,n={}){var x;if(((x=n.adapter)!=null?x:"editing")!=="source")return a;const s=b=>{var E;return Array.isArray((E=b.properties)==null?void 0:E[vi])?b.properties[vi].length:0},r=a.features.reduce((b,E)=>Math.max(b,s(E)),0),h=b=>r===0?!n.provenanceOnly:s(b)===r,f=new Map;for(const b of a.features){if(!h(b))continue;const E=Ws(b);if(!E)continue;const C=f.get(E.baseId);C?C.push(E):f.set(E.baseId,[E])}if(f.size===0)return a;const d=new Set,m=[];for(const b of a.features){if(!h(b)){m.push(b);continue}const E=Ws(b);if(!E){m.push(b);continue}d.has(E.baseId)||(d.add(E.baseId),m.push(Ac(E.baseId,f.get(E.baseId))))}const _={type:"FeatureCollection",features:m};return m.some(b=>{var E;return Array.isArray((E=b.properties)==null?void 0:E[vi])&&b.properties[vi].length>0&&Ws(b)})?Ks(_,n):_}function Nl(a){return(a==null?void 0:a.type)==="Polygon"}function Ol(a){return(a==null?void 0:a.type)==="MultiPolygon"}function Dc(a){const n=a.geometry;return n?Nl(n)?[n.coordinates]:Ol(n)?n.coordinates:[]:[]}function Bc(a,n){var r,h;const i=[];for(const f of a){const d=Dc(f);d.length>0&&i.push(...d)}if(i.length===0)return null;const s=(h=n!=null?n:(r=a[0])==null?void 0:r.properties)!=null?h:{};return i.length===1?{type:"Feature",properties:{...s},geometry:{type:"Polygon",coordinates:i[0]}}:{type:"Feature",properties:{...s},geometry:{type:"MultiPolygon",coordinates:i}}}class zc{constructor(n=Ro("feature-store","debug")){Q(this,"log");Q(this,"features");this.log=n,this.features=new Map}size(){return this.features.size}has(n){return this.features.has(n)}get(n){return this.features.get(n)}add(n){var h,f,d,m;const i=[],s=(f=(h=performance.now)==null?void 0:h.call(performance))!=null?f:Date.now();for(const _ of n.features){const x=this.ensureId(_),b={..._,id:x};this.features.set(x,b),i.push(x)}const r=((m=(d=performance.now)==null?void 0:d.call(performance))!=null?m:Date.now())-s;return this.log.debug("add",{count:n.features.length,ids:i,elapsedMs:Math.round(r)}),i}update(n,i){if(!this.features.has(n)){this.log.warn("update:missing",{id:n});return}const s={...i,id:n};this.features.set(n,s),this.log.debug("update",{id:n})}remove(n){this.features.delete(n)?this.log.debug("remove",{id:n}):this.log.warn("remove:missing",{id:n})}clear(){const n=this.features.size;this.features.clear(),this.log.debug("clear",{count:n})}toFeatureCollection(){return{type:"FeatureCollection",features:Array.from(this.features.values())}}bounds(){const n=this.toFeatureCollection();if(n.features.length===0)return null;const i=Oc(n);return i?Rc(i):null}ensureId(n){const i=Ve(n);if(i)return String(i);const s=Mr();return n.id=s,n.properties&&typeof n.properties=="object"&&(n.properties.id=s),s}}const Rl=["base","drawn","imported","guide","measurement"];function Bo(a){if(!a||typeof a!="object"||Array.isArray(a))throw new Error("Invalid layer style");const n={};for(const i of["color","fillColor","dashArray"])if(a[i]!==void 0){if(typeof a[i]!="string"||a[i].length>128)throw new Error(`Invalid ${i}`);n[i]=a[i]}for(const i of["weight","opacity","fillOpacity"]){const s=a[i];if(s!==void 0){if(!Number.isFinite(s)||s<0||s>(i==="weight"?100:1))throw new Error(`Invalid ${i}`);n[i]=s}}return n}class Qs{constructor(){Q(this,"layers",[])}getLayers(){return this.layers.map((n,i)=>({...n,order:i,featureIds:[...n.featureIds],style:{...n.style}}))}get(n){const i=this.getLayers().find(s=>s.id===n);if(!i)throw new Error(`Unknown layer: ${n}`);return i}add(n,i={},s=(r=>(r=i.kind)!=null?r:"imported")()){var d,m,_;const h=(d=i.id)!=null?d:Mr();if(!h||this.layers.some(x=>x.id===h))throw new Error(`Duplicate layer: ${h}`);if(!Rl.includes(s))throw new Error("Invalid layer kind");const f=Bo((m=i.style)!=null?m:{});return this.layers.push({id:h,name:((_=i.name)==null?void 0:_.trim())||`${s} layer`,kind:s,visible:!0,order:this.layers.length,featureIds:[...n],style:f}),h}setLayerVisibility(n,i){if(this.get(n),typeof i!="boolean")throw new Error("Invalid layer visibility");this.layers.find(s=>s.id===n).visible=i}setLayerStyle(n,i){const s=this.get(n);this.layers.find(r=>r.id===n).style={...s.style,...Bo(i)}}reorderLayers(n){if(n.length!==this.layers.length||new Set(n).size!==n.length||n.some(i=>!this.layers.some(s=>s.id===i)))throw new Error("Order must contain every layer id exactly once");this.layers=n.map(i=>this.layers.find(s=>s.id===i))}removeLayer(n){this.get(n),this.layers=this.layers.filter(i=>i.id!==n)}removeFeature(n){for(const i of this.layers)i.featureIds=i.featureIds.filter(s=>s!==n);this.layers=this.layers.filter(i=>i.kind==="base"||i.featureIds.length>0)}clearData(){this.layers=this.layers.filter(n=>n.kind==="base")}snapshot(){return{version:1,layers:this.getLayers()}}static parseSnapshot(n,i){const s=n;if(!s||s.version!==1||!Array.isArray(s.layers))throw new Error("Invalid geokit:layers snapshot");const r=new Set,h=new Set,f=s.layers.map((d,m)=>{if(!d||typeof d.id!="string"||!d.id||r.has(d.id)||typeof d.name!="string"||!Rl.includes(d.kind)||typeof d.visible!="boolean"||d.order!==m||!Array.isArray(d.featureIds))throw new Error("Invalid layer record");r.add(d.id);for(const _ of d.featureIds){if(typeof _!="string"||!i.includes(_)||h.has(_)||d.kind==="base")throw new Error("Invalid layer membership");h.add(_)}return{...d,featureIds:[...d.featureIds],style:Bo(d.style)}});if(i.some(d=>!h.has(d)))throw new Error("Layer snapshot must cover every feature");if(f.filter(d=>d.kind==="base").length!==1||!f.some(d=>d.kind==="base"&&d.id==="base"))throw new Error("Layer snapshot must contain the base layer");return{version:1,layers:f}}restore(n){this.layers=n.layers.map(i=>({...i,featureIds:[...i.featureIds],style:{...i.style}}))}}const zn={crop:Object.freeze({color:"#287a39",fillColor:"#76b947",weight:2,fillOpacity:.25}),water:Object.freeze({color:"#176da5",fillColor:"#59b4e5",weight:2,fillOpacity:.3}),reference:Object.freeze({color:"#735aa6",weight:2,fillOpacity:.08,dashArray:"6 4"})};function Fc(a,n,i){const s=a.getRootNode()instanceof ShadowRoot?a.getRootNode().activeElement:document.activeElement,r=document.createElement("section");r.setAttribute("role","dialog"),r.setAttribute("aria-label","Layer style"),r.setAttribute("part","layer-style-panel"),Object.assign(r.style,{position:"absolute",zIndex:"1100",top:"12px",left:"12px",padding:"12px",background:"var(--geokit-panel-background, white)",color:"var(--geokit-panel-color, #222)"});const h=document.createElement("select");h.setAttribute("aria-label","Layer"),n.filter(x=>x.kind!=="base").forEach(x=>{const b=document.createElement("option");b.value=x.id,b.textContent=x.name,h.append(b)}),r.append(h);const f=document.createElement("select");f.setAttribute("aria-label","Style preset");for(const x of Object.keys(zn)){const b=document.createElement("option");b.value=x,b.textContent=x,f.append(b)}r.append(f);const d=document.createElement("button");d.type="button",d.textContent="Apply style",d.disabled=h.options.length===0,d.onclick=()=>i(h.value,zn[f.value]);const m=document.createElement("button");m.type="button",m.textContent="Close layer style";const _=()=>{r.remove(),s instanceof HTMLElement&&s.isConnected&&s.focus()};m.onclick=_,r.addEventListener("keydown",x=>{x.key==="Escape"&&(x.stopPropagation(),_())});for(const x of["click","dblclick","pointerdown","mousedown","wheel"])r.addEventListener(x,b=>b.stopPropagation());return r.append(d,m),a.append(r),h.focus(),_}const Dl=new WeakSet,$s="button, a[href], [role='button']";function Gc(a){a.querySelectorAll(".leaflet-draw-toolbar").forEach((n,i)=>{n.setAttribute("role","toolbar"),n.setAttribute("aria-label",i===0?"Draw tools":"Edit tools"),n.setAttribute("aria-orientation","vertical")}),a.querySelectorAll("[data-geokit-tool]").forEach(n=>{!n.matches($s)&&!n.matches(".leaflet-ruler")||(n.tagName!=="BUTTON"&&(n.setAttribute("role","button"),n.tabIndex=0),n.hasAttribute("aria-label")||n.setAttribute("aria-label",n.title||n.dataset.geokitTool||"Map tool"))}),!Dl.has(a)&&(Dl.add(a),a.addEventListener("keydown",n=>{if(n.altKey||n.ctrlKey||n.metaKey||n.shiftKey)return;const i=n.target;if(!(i instanceof HTMLElement))return;const s=i.closest($s);if(!s||!a.contains(s))return;if((n.key===" "||n.key==="Enter")&&s.tagName!=="BUTTON"&&s.getAttribute("role")==="button"){n.preventDefault(),n.stopPropagation(),!n.repeat&&s.getAttribute("aria-disabled")!=="true"&&s.click();return}const r=s.closest("[role='toolbar']");if(!r)return;const h=r.getAttribute("aria-orientation")==="vertical",f=h?"ArrowDown":"ArrowRight";if(![f,h?"ArrowUp":"ArrowLeft","Home","End"].includes(n.key))return;const m=Array.from(r.querySelectorAll($s)).filter(b=>!b.matches(":disabled, [aria-disabled='true'], [hidden]")&&!b.closest("[hidden]")&&getComputedStyle(b).display!=="none"),_=m.indexOf(s);if(_<0||!m.length)return;n.preventDefault(),n.stopPropagation();const x=n.key==="Home"?0:n.key==="End"?m.length-1:(_+(n.key===f?1:-1)+m.length)%m.length;m[x].focus()}))}function ta(a,n,i=!1){const s=i?"alert":"status";let r=a.querySelector(`[data-geokit-announcement='${s}']`);r||(r=document.createElement("div"),r.dataset.geokitAnnouncement=s,r.setAttribute("role",s),r.setAttribute("aria-live",i?"assertive":"polite"),r.setAttribute("aria-atomic","true"),r.className="leaflet-geokit-sr-only",a.append(r)),r.textContent=n}const Uc=`
|
|
235
|
+
`,a.appendChild(i)}function kc(){var a,n;(n=(a=le.Icon.Default).mergeOptions)==null||n.call(a,{iconRetinaUrl:pc,iconUrl:mc,shadowUrl:yc})}function Lc(a){const{root:n,skipStyles:i}=a;try{i||(xc(n),kc()),wc(n)}catch{}}(function(a,n,i){function s(r,h){for(;(r=r.parentElement)&&!r.classList.contains(h););return r}L.drawVersion="1.0.4",L.Draw={},L.drawLocal={draw:{toolbar:{actions:{title:"Cancel drawing",text:"Cancel"},finish:{title:"Finish drawing",text:"Finish"},undo:{title:"Delete last point drawn",text:"Delete last point"},buttons:{polyline:"Draw a polyline",polygon:"Draw a polygon",rectangle:"Draw a rectangle",circle:"Draw a circle",marker:"Draw a marker",circlemarker:"Draw a circlemarker"}},handlers:{circle:{tooltip:{start:"Click and drag to draw circle."},radius:"Radius"},circlemarker:{tooltip:{start:"Click map to place circle marker."}},marker:{tooltip:{start:"Click map to place marker."}},polygon:{tooltip:{start:"Click to start drawing shape.",cont:"Click to continue drawing shape.",end:"Click first point to close this shape."}},polyline:{error:"<strong>Error:</strong> shape edges cannot cross!",tooltip:{start:"Click to start drawing line.",cont:"Click to continue drawing line.",end:"Click last point to finish line."}},rectangle:{tooltip:{start:"Click and drag to draw rectangle."}},simpleshape:{tooltip:{end:"Release mouse to finish drawing."}}}},edit:{toolbar:{actions:{save:{title:"Save changes",text:"Save"},cancel:{title:"Cancel editing, discards all changes",text:"Cancel"},clearAll:{title:"Clear all layers",text:"Clear All"}},buttons:{edit:"Edit layers",editDisabled:"No layers to edit",remove:"Delete layers",removeDisabled:"No layers to delete"}},handlers:{edit:{tooltip:{text:"Drag handles or markers to edit features.",subtext:"Click cancel to undo changes."}},remove:{tooltip:{text:"Click on a feature to remove."}}}}},L.Draw.Event={},L.Draw.Event.CREATED="draw:created",L.Draw.Event.EDITED="draw:edited",L.Draw.Event.DELETED="draw:deleted",L.Draw.Event.DRAWSTART="draw:drawstart",L.Draw.Event.DRAWSTOP="draw:drawstop",L.Draw.Event.DRAWVERTEX="draw:drawvertex",L.Draw.Event.EDITSTART="draw:editstart",L.Draw.Event.EDITMOVE="draw:editmove",L.Draw.Event.EDITRESIZE="draw:editresize",L.Draw.Event.EDITVERTEX="draw:editvertex",L.Draw.Event.EDITSTOP="draw:editstop",L.Draw.Event.DELETESTART="draw:deletestart",L.Draw.Event.DELETESTOP="draw:deletestop",L.Draw.Event.TOOLBAROPENED="draw:toolbaropened",L.Draw.Event.TOOLBARCLOSED="draw:toolbarclosed",L.Draw.Event.MARKERCONTEXT="draw:markercontext",L.Draw=L.Draw||{},L.Draw.Feature=L.Handler.extend({initialize:function(r,h){this._map=r,this._container=r._container,this._overlayPane=r._panes.overlayPane,this._popupPane=r._panes.popupPane,h&&h.shapeOptions&&(h.shapeOptions=L.Util.extend({},this.options.shapeOptions,h.shapeOptions)),L.setOptions(this,h);var f=L.version.split(".");parseInt(f[0],10)===1&&parseInt(f[1],10)>=2?L.Draw.Feature.include(L.Evented.prototype):L.Draw.Feature.include(L.Mixin.Events)},enable:function(){this._enabled||(L.Handler.prototype.enable.call(this),this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.DRAWSTART,{layerType:this.type}))},disable:function(){this._enabled&&(L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.DRAWSTOP,{layerType:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var r=this._map;r&&(L.DomUtil.disableTextSelection(),r.getContainer().focus(),this._tooltip=new L.Draw.Tooltip(this._map),L.DomEvent.on(this._container,"keyup",this._cancelDrawing,this))},removeHooks:function(){this._map&&(L.DomUtil.enableTextSelection(),this._tooltip.dispose(),this._tooltip=null,L.DomEvent.off(this._container,"keyup",this._cancelDrawing,this))},setOptions:function(r){L.setOptions(this,r)},_fireCreatedEvent:function(r){this._map.fire(L.Draw.Event.CREATED,{layer:r,layerType:this.type})},_cancelDrawing:function(r){r.keyCode===27&&(this._map.fire("draw:canceled",{layerType:this.type}),this.disable())}}),L.Draw.Polyline=L.Draw.Feature.extend({statics:{TYPE:"polyline"},Poly:L.Polyline,options:{allowIntersection:!0,repeatMode:!1,drawError:{color:"#b00b00",timeout:2500},icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),guidelineDistance:20,maxGuideLineLength:4e3,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!1,clickable:!0},metric:!0,feet:!0,nautic:!1,showLength:!0,zIndexOffset:2e3,factor:1,maxPoints:0},initialize:function(r,h){L.Browser.touch&&(this.options.icon=this.options.touchIcon),this.options.drawError.message=L.drawLocal.draw.handlers.polyline.error,h&&h.drawError&&(h.drawError=L.Util.extend({},this.options.drawError,h.drawError)),this.type=L.Draw.Polyline.TYPE,L.Draw.Feature.prototype.initialize.call(this,r,h)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._markers=[],this._markerGroup=new L.LayerGroup,this._map.addLayer(this._markerGroup),this._poly=new L.Polyline([],this.options.shapeOptions),this._tooltip.updateContent(this._getTooltipText()),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("mouseout",this._onMouseOut,this).on("mousemove",this._onMouseMove,this).on("mousedown",this._onMouseDown,this).on("mouseup",this._onMouseUp,this).addTo(this._map),this._map.on("mouseup",this._onMouseUp,this).on("mousemove",this._onMouseMove,this).on("zoomlevelschange",this._onZoomEnd,this).on("touchstart",this._onTouch,this).on("zoomend",this._onZoomEnd,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._clearHideErrorTimeout(),this._cleanUpShape(),this._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers,this._map.removeLayer(this._poly),delete this._poly,this._mouseMarker.off("mousedown",this._onMouseDown,this).off("mouseout",this._onMouseOut,this).off("mouseup",this._onMouseUp,this).off("mousemove",this._onMouseMove,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._clearGuides(),this._map.off("mouseup",this._onMouseUp,this).off("mousemove",this._onMouseMove,this).off("zoomlevelschange",this._onZoomEnd,this).off("zoomend",this._onZoomEnd,this).off("touchstart",this._onTouch,this).off("click",this._onTouch,this)},deleteLastVertex:function(){if(!(this._markers.length<=1)){var r=this._markers.pop(),h=this._poly,f=h.getLatLngs(),d=f.splice(-1,1)[0];this._poly.setLatLngs(f),this._markerGroup.removeLayer(r),h.getLatLngs().length<2&&this._map.removeLayer(h),this._vertexChanged(d,!1)}},addVertex:function(r){if(this._markers.length>=2&&!this.options.allowIntersection&&this._poly.newLatLngIntersects(r))return void this._showErrorTooltip();this._errorShown&&this._hideErrorTooltip(),this._markers.push(this._createMarker(r)),this._poly.addLatLng(r),this._poly.getLatLngs().length===2&&this._map.addLayer(this._poly),this._vertexChanged(r,!0)},completeShape:function(){this._markers.length<=1||!this._shapeIsValid()||(this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable())},_finishShape:function(){var r=this._poly._defaultShape?this._poly._defaultShape():this._poly.getLatLngs(),h=this._poly.newLatLngIntersects(r[r.length-1]);if(!this.options.allowIntersection&&h||!this._shapeIsValid())return void this._showErrorTooltip();this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_shapeIsValid:function(){return!0},_onZoomEnd:function(){this._markers!==null&&this._updateGuide()},_onMouseMove:function(r){var h=this._map.mouseEventToLayerPoint(r.originalEvent),f=this._map.layerPointToLatLng(h);this._currentLatLng=f,this._updateTooltip(f),this._updateGuide(h),this._mouseMarker.setLatLng(f),L.DomEvent.preventDefault(r.originalEvent)},_vertexChanged:function(r,h){this._map.fire(L.Draw.Event.DRAWVERTEX,{layers:this._markerGroup}),this._updateFinishHandler(),this._updateRunningMeasure(r,h),this._clearGuides(),this._updateTooltip()},_onMouseDown:function(r){if(!this._clickHandled&&!this._touchHandled&&!this._disableMarkers){this._onMouseMove(r),this._clickHandled=!0,this._disableNewMarkers();var h=r.originalEvent,f=h.clientX,d=h.clientY;this._startPoint.call(this,f,d)}},_startPoint:function(r,h){this._mouseDownOrigin=L.point(r,h)},_onMouseUp:function(r){var h=r.originalEvent,f=h.clientX,d=h.clientY;this._endPoint.call(this,f,d,r),this._clickHandled=null},_endPoint:function(r,h,f){if(this._mouseDownOrigin){var d=L.point(r,h).distanceTo(this._mouseDownOrigin),m=this._calculateFinishDistance(f.latlng);this.options.maxPoints>1&&this.options.maxPoints==this._markers.length+1?(this.addVertex(f.latlng),this._finishShape()):m<10&&L.Browser.touch?this._finishShape():Math.abs(d)<9*(a.devicePixelRatio||1)&&this.addVertex(f.latlng),this._enableNewMarkers()}this._mouseDownOrigin=null},_onTouch:function(r){var h,f,d=r.originalEvent;!d.touches||!d.touches[0]||this._clickHandled||this._touchHandled||this._disableMarkers||(h=d.touches[0].clientX,f=d.touches[0].clientY,this._disableNewMarkers(),this._touchHandled=!0,this._startPoint.call(this,h,f),this._endPoint.call(this,h,f,r),this._touchHandled=null),this._clickHandled=null},_onMouseOut:function(){this._tooltip&&this._tooltip._onMouseOut.call(this._tooltip)},_calculateFinishDistance:function(r){var h;if(this._markers.length>0){var f;if(this.type===L.Draw.Polyline.TYPE)f=this._markers[this._markers.length-1];else{if(this.type!==L.Draw.Polygon.TYPE)return 1/0;f=this._markers[0]}var d=this._map.latLngToContainerPoint(f.getLatLng()),m=new L.Marker(r,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset}),_=this._map.latLngToContainerPoint(m.getLatLng());h=d.distanceTo(_)}else h=1/0;return h},_updateFinishHandler:function(){var r=this._markers.length;r>1&&this._markers[r-1].on("click",this._finishShape,this),r>2&&this._markers[r-2].off("click",this._finishShape,this)},_createMarker:function(r){var h=new L.Marker(r,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset});return this._markerGroup.addLayer(h),h},_updateGuide:function(r){var h=this._markers?this._markers.length:0;h>0&&(r=r||this._map.latLngToLayerPoint(this._currentLatLng),this._clearGuides(),this._drawGuide(this._map.latLngToLayerPoint(this._markers[h-1].getLatLng()),r))},_updateTooltip:function(r){var h=this._getTooltipText();r&&this._tooltip.updatePosition(r),this._errorShown||this._tooltip.updateContent(h)},_drawGuide:function(r,h){var f,d,m,_=Math.floor(Math.sqrt(Math.pow(h.x-r.x,2)+Math.pow(h.y-r.y,2))),x=this.options.guidelineDistance,b=this.options.maxGuideLineLength,E=_>b?_-b:x;for(this._guidesContainer||(this._guidesContainer=L.DomUtil.create("div","leaflet-draw-guides",this._overlayPane));E<_;E+=this.options.guidelineDistance)f=E/_,d={x:Math.floor(r.x*(1-f)+f*h.x),y:Math.floor(r.y*(1-f)+f*h.y)},m=L.DomUtil.create("div","leaflet-draw-guide-dash",this._guidesContainer),m.style.backgroundColor=this._errorShown?this.options.drawError.color:this.options.shapeOptions.color,L.DomUtil.setPosition(m,d)},_updateGuideColor:function(r){if(this._guidesContainer)for(var h=0,f=this._guidesContainer.childNodes.length;h<f;h++)this._guidesContainer.childNodes[h].style.backgroundColor=r},_clearGuides:function(){if(this._guidesContainer)for(;this._guidesContainer.firstChild;)this._guidesContainer.removeChild(this._guidesContainer.firstChild)},_getTooltipText:function(){var r,h,f=this.options.showLength;return this._markers.length===0?r={text:L.drawLocal.draw.handlers.polyline.tooltip.start}:(h=f?this._getMeasurementString():"",r=this._markers.length===1?{text:L.drawLocal.draw.handlers.polyline.tooltip.cont,subtext:h}:{text:L.drawLocal.draw.handlers.polyline.tooltip.end,subtext:h}),r},_updateRunningMeasure:function(r,h){var f,d,m=this._markers.length;this._markers.length===1?this._measurementRunningTotal=0:(f=m-(h?2:1),d=L.GeometryUtil.isVersion07x()?r.distanceTo(this._markers[f].getLatLng())*(this.options.factor||1):this._map.distance(r,this._markers[f].getLatLng())*(this.options.factor||1),this._measurementRunningTotal+=d*(h?1:-1))},_getMeasurementString:function(){var r,h=this._currentLatLng,f=this._markers[this._markers.length-1].getLatLng();return r=L.GeometryUtil.isVersion07x()?f&&h&&h.distanceTo?this._measurementRunningTotal+h.distanceTo(f)*(this.options.factor||1):this._measurementRunningTotal||0:f&&h?this._measurementRunningTotal+this._map.distance(h,f)*(this.options.factor||1):this._measurementRunningTotal||0,L.GeometryUtil.readableDistance(r,this.options.metric,this.options.feet,this.options.nautic,this.options.precision)},_showErrorTooltip:function(){this._errorShown=!0,this._tooltip.showAsError().updateContent({text:this.options.drawError.message}),this._updateGuideColor(this.options.drawError.color),this._poly.setStyle({color:this.options.drawError.color}),this._clearHideErrorTimeout(),this._hideErrorTimeout=setTimeout(L.Util.bind(this._hideErrorTooltip,this),this.options.drawError.timeout)},_hideErrorTooltip:function(){this._errorShown=!1,this._clearHideErrorTimeout(),this._tooltip.removeError().updateContent(this._getTooltipText()),this._updateGuideColor(this.options.shapeOptions.color),this._poly.setStyle({color:this.options.shapeOptions.color})},_clearHideErrorTimeout:function(){this._hideErrorTimeout&&(clearTimeout(this._hideErrorTimeout),this._hideErrorTimeout=null)},_disableNewMarkers:function(){this._disableMarkers=!0},_enableNewMarkers:function(){setTimeout(function(){this._disableMarkers=!1}.bind(this),50)},_cleanUpShape:function(){this._markers.length>1&&this._markers[this._markers.length-1].off("click",this._finishShape,this)},_fireCreatedEvent:function(){var r=new this.Poly(this._poly.getLatLngs(),this.options.shapeOptions);L.Draw.Feature.prototype._fireCreatedEvent.call(this,r)}}),L.Draw.Polygon=L.Draw.Polyline.extend({statics:{TYPE:"polygon"},Poly:L.Polygon,options:{showArea:!1,showLength:!1,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},metric:!0,feet:!0,nautic:!1,precision:{}},initialize:function(r,h){L.Draw.Polyline.prototype.initialize.call(this,r,h),this.type=L.Draw.Polygon.TYPE},_updateFinishHandler:function(){var r=this._markers.length;r===1&&this._markers[0].on("click",this._finishShape,this),r>2&&(this._markers[r-1].on("dblclick",this._finishShape,this),r>3&&this._markers[r-2].off("dblclick",this._finishShape,this))},_getTooltipText:function(){var r,h;return this._markers.length===0?r=L.drawLocal.draw.handlers.polygon.tooltip.start:this._markers.length<3?(r=L.drawLocal.draw.handlers.polygon.tooltip.cont,h=this._getMeasurementString()):(r=L.drawLocal.draw.handlers.polygon.tooltip.end,h=this._getMeasurementString()),{text:r,subtext:h}},_getMeasurementString:function(){var r=this._area,h="";return r||this.options.showLength?(this.options.showLength&&(h=L.Draw.Polyline.prototype._getMeasurementString.call(this)),r&&(h+="<br>"+L.GeometryUtil.readableArea(r,this.options.metric,this.options.precision)),h):null},_shapeIsValid:function(){return this._markers.length>=3},_vertexChanged:function(r,h){var f;!this.options.allowIntersection&&this.options.showArea&&(f=this._poly.getLatLngs(),this._area=L.GeometryUtil.geodesicArea(f)),L.Draw.Polyline.prototype._vertexChanged.call(this,r,h)},_cleanUpShape:function(){var r=this._markers.length;r>0&&(this._markers[0].off("click",this._finishShape,this),r>2&&this._markers[r-1].off("dblclick",this._finishShape,this))}}),L.SimpleShape={},L.Draw.SimpleShape=L.Draw.Feature.extend({options:{repeatMode:!1},initialize:function(r,h){this._endLabelText=L.drawLocal.draw.handlers.simpleshape.tooltip.end,L.Draw.Feature.prototype.initialize.call(this,r,h)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._mapDraggable=this._map.dragging.enabled(),this._mapDraggable&&this._map.dragging.disable(),this._container.style.cursor="crosshair",this._tooltip.updateContent({text:this._initialLabelText}),this._map.on("mousedown",this._onMouseDown,this).on("mousemove",this._onMouseMove,this).on("touchstart",this._onMouseDown,this).on("touchmove",this._onMouseMove,this),n.addEventListener("touchstart",L.DomEvent.preventDefault,{passive:!1}))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._mapDraggable&&this._map.dragging.enable(),this._container.style.cursor="",this._map.off("mousedown",this._onMouseDown,this).off("mousemove",this._onMouseMove,this).off("touchstart",this._onMouseDown,this).off("touchmove",this._onMouseMove,this),L.DomEvent.off(n,"mouseup",this._onMouseUp,this),L.DomEvent.off(n,"touchend",this._onMouseUp,this),n.removeEventListener("touchstart",L.DomEvent.preventDefault),this._shape&&(this._map.removeLayer(this._shape),delete this._shape)),this._isDrawing=!1},_getTooltipText:function(){return{text:this._endLabelText}},_onMouseDown:function(r){this._isDrawing=!0,this._startLatLng=r.latlng,L.DomEvent.on(n,"mouseup",this._onMouseUp,this).on(n,"touchend",this._onMouseUp,this).preventDefault(r.originalEvent)},_onMouseMove:function(r){var h=r.latlng;this._tooltip.updatePosition(h),this._isDrawing&&(this._tooltip.updateContent(this._getTooltipText()),this._drawShape(h))},_onMouseUp:function(){this._shape&&this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()}}),L.Draw.Rectangle=L.Draw.SimpleShape.extend({statics:{TYPE:"rectangle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showArea:!0,metric:!0},initialize:function(r,h){this.type=L.Draw.Rectangle.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.rectangle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this,r,h)},disable:function(){this._enabled&&(this._isCurrentlyTwoClickDrawing=!1,L.Draw.SimpleShape.prototype.disable.call(this))},_onMouseUp:function(r){if(!this._shape&&!this._isCurrentlyTwoClickDrawing)return void(this._isCurrentlyTwoClickDrawing=!0);this._isCurrentlyTwoClickDrawing&&!s(r.target,"leaflet-pane")||L.Draw.SimpleShape.prototype._onMouseUp.call(this)},_drawShape:function(r){this._shape?this._shape.setBounds(new L.LatLngBounds(this._startLatLng,r)):(this._shape=new L.Rectangle(new L.LatLngBounds(this._startLatLng,r),this.options.shapeOptions),this._map.addLayer(this._shape))},_fireCreatedEvent:function(){var r=new L.Rectangle(this._shape.getBounds(),this.options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this,r)},_getTooltipText:function(){var r,h,f,d=L.Draw.SimpleShape.prototype._getTooltipText.call(this),m=this._shape,_=this.options.showArea;return m&&(r=this._shape._defaultShape?this._shape._defaultShape():this._shape.getLatLngs(),h=L.GeometryUtil.geodesicArea(r),f=_?L.GeometryUtil.readableArea(h,this.options.metric):""),{text:d.text,subtext:f}}}),L.Draw.Marker=L.Draw.Feature.extend({statics:{TYPE:"marker"},options:{icon:new L.Icon.Default,repeatMode:!1,zIndexOffset:2e3},initialize:function(r,h){this.type=L.Draw.Marker.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.marker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this,r,h)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._tooltip.updateContent({text:this._initialLabelText}),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("click",this._onClick,this).addTo(this._map),this._map.on("mousemove",this._onMouseMove,this),this._map.on("click",this._onTouch,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._map.off("click",this._onClick,this).off("click",this._onTouch,this),this._marker&&(this._marker.off("click",this._onClick,this),this._map.removeLayer(this._marker),delete this._marker),this._mouseMarker.off("click",this._onClick,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._map.off("mousemove",this._onMouseMove,this))},_onMouseMove:function(r){var h=r.latlng;this._tooltip.updatePosition(h),this._mouseMarker.setLatLng(h),this._marker?(h=this._mouseMarker.getLatLng(),this._marker.setLatLng(h)):(this._marker=this._createMarker(h),this._marker.on("click",this._onClick,this),this._map.on("click",this._onClick,this).addLayer(this._marker))},_createMarker:function(r){return new L.Marker(r,{icon:this.options.icon,zIndexOffset:this.options.zIndexOffset})},_onClick:function(){this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_onTouch:function(r){this._onMouseMove(r),this._onClick()},_fireCreatedEvent:function(){var r=new L.Marker.Touch(this._marker.getLatLng(),{icon:this.options.icon});L.Draw.Feature.prototype._fireCreatedEvent.call(this,r)}}),L.Draw.CircleMarker=L.Draw.Marker.extend({statics:{TYPE:"circlemarker"},options:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0,zIndexOffset:2e3},initialize:function(r,h){this.type=L.Draw.CircleMarker.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.circlemarker.tooltip.start,L.Draw.Feature.prototype.initialize.call(this,r,h)},_fireCreatedEvent:function(){var r=new L.CircleMarker(this._marker.getLatLng(),this.options);L.Draw.Feature.prototype._fireCreatedEvent.call(this,r)},_createMarker:function(r){return new L.CircleMarker(r,this.options)}}),L.Draw.Circle=L.Draw.SimpleShape.extend({statics:{TYPE:"circle"},options:{shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0},showRadius:!0,metric:!0,feet:!0,nautic:!1},initialize:function(r,h){this.type=L.Draw.Circle.TYPE,this._initialLabelText=L.drawLocal.draw.handlers.circle.tooltip.start,L.Draw.SimpleShape.prototype.initialize.call(this,r,h)},_drawShape:function(r){if(L.GeometryUtil.isVersion07x())var h=this._startLatLng.distanceTo(r);else var h=this._map.distance(this._startLatLng,r);this._shape?this._shape.setRadius(h):(this._shape=new L.Circle(this._startLatLng,h,this.options.shapeOptions),this._map.addLayer(this._shape))},_fireCreatedEvent:function(){var r=new L.Circle(this._startLatLng,this._shape.getRadius(),this.options.shapeOptions);L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this,r)},_onMouseMove:function(r){var h,f=r.latlng,d=this.options.showRadius,m=this.options.metric;if(this._tooltip.updatePosition(f),this._isDrawing){this._drawShape(f),h=this._shape.getRadius().toFixed(1);var _="";d&&(_=L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(h,m,this.options.feet,this.options.nautic)),this._tooltip.updateContent({text:this._endLabelText,subtext:_})}}}),L.Edit=L.Edit||{},L.Edit.Marker=L.Handler.extend({initialize:function(r,h){this._marker=r,L.setOptions(this,h)},addHooks:function(){var r=this._marker;r.dragging.enable(),r.on("dragend",this._onDragEnd,r),this._toggleMarkerHighlight()},removeHooks:function(){var r=this._marker;r.dragging.disable(),r.off("dragend",this._onDragEnd,r),this._toggleMarkerHighlight()},_onDragEnd:function(r){var h=r.target;h.edited=!0,this._map.fire(L.Draw.Event.EDITMOVE,{layer:h})},_toggleMarkerHighlight:function(){var r=this._marker._icon;r&&(r.style.display="none",L.DomUtil.hasClass(r,"leaflet-edit-marker-selected")?(L.DomUtil.removeClass(r,"leaflet-edit-marker-selected"),this._offsetMarker(r,-4)):(L.DomUtil.addClass(r,"leaflet-edit-marker-selected"),this._offsetMarker(r,4)),r.style.display="")},_offsetMarker:function(r,h){var f=parseInt(r.style.marginTop,10)-h,d=parseInt(r.style.marginLeft,10)-h;r.style.marginTop=f+"px",r.style.marginLeft=d+"px"}}),L.Marker.addInitHook(function(){L.Edit.Marker&&(this.editing=new L.Edit.Marker(this),this.options.editable&&this.editing.enable())}),L.Edit=L.Edit||{},L.Edit.Poly=L.Handler.extend({initialize:function(r){this.latlngs=[r._latlngs],r._holes&&(this.latlngs=this.latlngs.concat(r._holes)),this._poly=r,this._poly.on("revert-edited",this._updateLatLngs,this)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat(this._poly._latlngs)?this._poly._latlngs:this._poly._latlngs[0]:this._poly._latlngs},_eachVertexHandler:function(r){for(var h=0;h<this._verticesHandlers.length;h++)r(this._verticesHandlers[h])},addHooks:function(){this._initHandlers(),this._eachVertexHandler(function(r){r.addHooks()})},removeHooks:function(){this._eachVertexHandler(function(r){r.removeHooks()})},updateMarkers:function(){this._eachVertexHandler(function(r){r.updateMarkers()})},_initHandlers:function(){this._verticesHandlers=[];for(var r=0;r<this.latlngs.length;r++)this._verticesHandlers.push(new L.Edit.PolyVerticesEdit(this._poly,this.latlngs[r],this._poly.options.poly))},_updateLatLngs:function(r){this.latlngs=[r.layer._latlngs],r.layer._holes&&(this.latlngs=this.latlngs.concat(r.layer._holes))}}),L.Edit.PolyVerticesEdit=L.Handler.extend({options:{icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),touchIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-touch-icon"}),drawError:{color:"#b00b00",timeout:1e3}},initialize:function(r,h,f){L.Browser.touch&&(this.options.icon=this.options.touchIcon),this._poly=r,f&&f.drawError&&(f.drawError=L.Util.extend({},this.options.drawError,f.drawError)),this._latlngs=h,L.setOptions(this,f)},_defaultShape:function(){return L.Polyline._flat?L.Polyline._flat(this._latlngs)?this._latlngs:this._latlngs[0]:this._latlngs},addHooks:function(){var r=this._poly,h=r._path;r instanceof L.Polygon||(r.options.fill=!1,r.options.editing&&(r.options.editing.fill=!1)),h&&r.options.editing&&r.options.editing.className&&(r.options.original.className&&r.options.original.className.split(" ").forEach(function(f){L.DomUtil.removeClass(h,f)}),r.options.editing.className.split(" ").forEach(function(f){L.DomUtil.addClass(h,f)})),r.setStyle(r.options.editing),this._poly._map&&(this._map=this._poly._map,this._markerGroup||this._initMarkers(),this._poly._map.addLayer(this._markerGroup))},removeHooks:function(){var r=this._poly,h=r._path;h&&r.options.editing&&r.options.editing.className&&(r.options.editing.className.split(" ").forEach(function(f){L.DomUtil.removeClass(h,f)}),r.options.original.className&&r.options.original.className.split(" ").forEach(function(f){L.DomUtil.addClass(h,f)})),r.setStyle(r.options.original),r._map&&(r._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers)},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup||(this._markerGroup=new L.LayerGroup),this._markers=[];var r,h,f,d,m=this._defaultShape();for(r=0,f=m.length;r<f;r++)d=this._createMarker(m[r],r),d.on("click",this._onMarkerClick,this),d.on("contextmenu",this._onContextMenu,this),this._markers.push(d);var _,x;for(r=0,h=f-1;r<f;h=r++)(r!==0||L.Polygon&&this._poly instanceof L.Polygon)&&(_=this._markers[h],x=this._markers[r],this._createMiddleMarker(_,x),this._updatePrevNext(_,x))},_createMarker:function(r,h){var f=new L.Marker.Touch(r,{draggable:!0,icon:this.options.icon});return f._origLatLng=r,f._index=h,f.on("dragstart",this._onMarkerDragStart,this).on("drag",this._onMarkerDrag,this).on("dragend",this._fireEdit,this).on("touchmove",this._onTouchMove,this).on("touchend",this._fireEdit,this).on("MSPointerMove",this._onTouchMove,this).on("MSPointerUp",this._fireEdit,this),this._markerGroup.addLayer(f),f},_onMarkerDragStart:function(){this._poly.fire("editstart")},_spliceLatLngs:function(){var r=this._defaultShape(),h=[].splice.apply(r,arguments);return this._poly._convertLatLngs(r,!0),this._poly.redraw(),h},_removeMarker:function(r){var h=r._index;this._markerGroup.removeLayer(r),this._markers.splice(h,1),this._spliceLatLngs(h,1),this._updateIndexes(h,-1),r.off("dragstart",this._onMarkerDragStart,this).off("drag",this._onMarkerDrag,this).off("dragend",this._fireEdit,this).off("touchmove",this._onMarkerDrag,this).off("touchend",this._fireEdit,this).off("click",this._onMarkerClick,this).off("MSPointerMove",this._onTouchMove,this).off("MSPointerUp",this._fireEdit,this)},_fireEdit:function(){this._poly.edited=!0,this._poly.fire("edit"),this._poly._map.fire(L.Draw.Event.EDITVERTEX,{layers:this._markerGroup,poly:this._poly})},_onMarkerDrag:function(r){var h=r.target,f=this._poly,d=L.LatLngUtil.cloneLatLng(h._origLatLng);if(L.extend(h._origLatLng,h._latlng),f.options.poly){var m=f._map._editTooltip;if(!f.options.poly.allowIntersection&&f.intersects()){L.extend(h._origLatLng,d),h.setLatLng(d);var _=f.options.color;f.setStyle({color:this.options.drawError.color}),m&&m.updateContent({text:L.drawLocal.draw.handlers.polyline.error}),setTimeout(function(){f.setStyle({color:_}),m&&m.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext})},1e3)}}h._middleLeft&&h._middleLeft.setLatLng(this._getMiddleLatLng(h._prev,h)),h._middleRight&&h._middleRight.setLatLng(this._getMiddleLatLng(h,h._next)),this._poly._bounds._southWest=L.latLng(1/0,1/0),this._poly._bounds._northEast=L.latLng(-1/0,-1/0);var x=this._poly.getLatLngs();this._poly._convertLatLngs(x,!0),this._poly.redraw(),this._poly.fire("editdrag")},_onMarkerClick:function(r){var h=L.Polygon&&this._poly instanceof L.Polygon?4:3,f=r.target;this._defaultShape().length<h||(this._removeMarker(f),this._updatePrevNext(f._prev,f._next),f._middleLeft&&this._markerGroup.removeLayer(f._middleLeft),f._middleRight&&this._markerGroup.removeLayer(f._middleRight),f._prev&&f._next?this._createMiddleMarker(f._prev,f._next):f._prev?f._next||(f._prev._middleRight=null):f._next._middleLeft=null,this._fireEdit())},_onContextMenu:function(r){var h=r.target;this._poly,this._poly._map.fire(L.Draw.Event.MARKERCONTEXT,{marker:h,layers:this._markerGroup,poly:this._poly}),L.DomEvent.stopPropagation},_onTouchMove:function(r){var h=this._map.mouseEventToLayerPoint(r.originalEvent.touches[0]),f=this._map.layerPointToLatLng(h),d=r.target;L.extend(d._origLatLng,f),d._middleLeft&&d._middleLeft.setLatLng(this._getMiddleLatLng(d._prev,d)),d._middleRight&&d._middleRight.setLatLng(this._getMiddleLatLng(d,d._next)),this._poly.redraw(),this.updateMarkers()},_updateIndexes:function(r,h){this._markerGroup.eachLayer(function(f){f._index>r&&(f._index+=h)})},_createMiddleMarker:function(r,h){var f,d,m,_=this._getMiddleLatLng(r,h),x=this._createMarker(_);x.setOpacity(.6),r._middleRight=h._middleLeft=x,d=function(){x.off("touchmove",d,this);var b=h._index;x._index=b,x.off("click",f,this).on("click",this._onMarkerClick,this),_.lat=x.getLatLng().lat,_.lng=x.getLatLng().lng,this._spliceLatLngs(b,0,_),this._markers.splice(b,0,x),x.setOpacity(1),this._updateIndexes(b,1),h._index++,this._updatePrevNext(r,x),this._updatePrevNext(x,h),this._poly.fire("editstart")},m=function(){x.off("dragstart",d,this),x.off("dragend",m,this),x.off("touchmove",d,this),this._createMiddleMarker(r,x),this._createMiddleMarker(x,h)},f=function(){d.call(this),m.call(this),this._fireEdit()},x.on("click",f,this).on("dragstart",d,this).on("dragend",m,this).on("touchmove",d,this),this._markerGroup.addLayer(x)},_updatePrevNext:function(r,h){r&&(r._next=h),h&&(h._prev=r)},_getMiddleLatLng:function(r,h){var f=this._poly._map,d=f.project(r.getLatLng()),m=f.project(h.getLatLng());return f.unproject(d._add(m)._divideBy(2))}}),L.Polyline.addInitHook(function(){this.editing||(L.Edit.Poly&&(this.editing=new L.Edit.Poly(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()}))}),L.Edit=L.Edit||{},L.Edit.SimpleShape=L.Handler.extend({options:{moveIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move"}),resizeIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize"}),touchMoveIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move leaflet-touch-icon"}),touchResizeIcon:new L.DivIcon({iconSize:new L.Point(20,20),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize leaflet-touch-icon"})},initialize:function(r,h){L.Browser.touch&&(this.options.moveIcon=this.options.touchMoveIcon,this.options.resizeIcon=this.options.touchResizeIcon),this._shape=r,L.Util.setOptions(this,h)},addHooks:function(){var r=this._shape;this._shape._map&&(this._map=this._shape._map,r.setStyle(r.options.editing),r._map&&(this._map=r._map,this._markerGroup||this._initMarkers(),this._map.addLayer(this._markerGroup)))},removeHooks:function(){var r=this._shape;if(r.setStyle(r.options.original),r._map){this._unbindMarker(this._moveMarker);for(var h=0,f=this._resizeMarkers.length;h<f;h++)this._unbindMarker(this._resizeMarkers[h]);this._resizeMarkers=null,this._map.removeLayer(this._markerGroup),delete this._markerGroup}this._map=null},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup||(this._markerGroup=new L.LayerGroup),this._createMoveMarker(),this._createResizeMarker()},_createMoveMarker:function(){},_createResizeMarker:function(){},_createMarker:function(r,h){var f=new L.Marker.Touch(r,{draggable:!0,icon:h,zIndexOffset:10});return this._bindMarker(f),this._markerGroup.addLayer(f),f},_bindMarker:function(r){r.on("dragstart",this._onMarkerDragStart,this).on("drag",this._onMarkerDrag,this).on("dragend",this._onMarkerDragEnd,this).on("touchstart",this._onTouchStart,this).on("touchmove",this._onTouchMove,this).on("MSPointerMove",this._onTouchMove,this).on("touchend",this._onTouchEnd,this).on("MSPointerUp",this._onTouchEnd,this)},_unbindMarker:function(r){r.off("dragstart",this._onMarkerDragStart,this).off("drag",this._onMarkerDrag,this).off("dragend",this._onMarkerDragEnd,this).off("touchstart",this._onTouchStart,this).off("touchmove",this._onTouchMove,this).off("MSPointerMove",this._onTouchMove,this).off("touchend",this._onTouchEnd,this).off("MSPointerUp",this._onTouchEnd,this)},_onMarkerDragStart:function(r){r.target.setOpacity(0),this._shape.fire("editstart")},_fireEdit:function(){this._shape.edited=!0,this._shape.fire("edit")},_onMarkerDrag:function(r){var h=r.target,f=h.getLatLng();h===this._moveMarker?this._move(f):this._resize(f),this._shape.redraw(),this._shape.fire("editdrag")},_onMarkerDragEnd:function(r){r.target.setOpacity(1),this._fireEdit()},_onTouchStart:function(r){if(L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this,r),typeof this._getCorners=="function"){var h=this._getCorners(),f=r.target,d=f._cornerIndex;f.setOpacity(0),this._oppositeCorner=h[(d+2)%4],this._toggleCornerMarkers(0,d)}this._shape.fire("editstart")},_onTouchMove:function(r){var h=this._map.mouseEventToLayerPoint(r.originalEvent.touches[0]),f=this._map.layerPointToLatLng(h);return r.target===this._moveMarker?this._move(f):this._resize(f),this._shape.redraw(),!1},_onTouchEnd:function(r){r.target.setOpacity(1),this.updateMarkers(),this._fireEdit()},_move:function(){},_resize:function(){}}),L.Edit=L.Edit||{},L.Edit.Rectangle=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var r=this._shape.getBounds(),h=r.getCenter();this._moveMarker=this._createMarker(h,this.options.moveIcon)},_createResizeMarker:function(){var r=this._getCorners();this._resizeMarkers=[];for(var h=0,f=r.length;h<f;h++)this._resizeMarkers.push(this._createMarker(r[h],this.options.resizeIcon)),this._resizeMarkers[h]._cornerIndex=h},_onMarkerDragStart:function(r){L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this,r);var h=this._getCorners(),f=r.target,d=f._cornerIndex;this._oppositeCorner=h[(d+2)%4],this._toggleCornerMarkers(0,d)},_onMarkerDragEnd:function(r){var h,f,d=r.target;d===this._moveMarker&&(h=this._shape.getBounds(),f=h.getCenter(),d.setLatLng(f)),this._toggleCornerMarkers(1),this._repositionCornerMarkers(),L.Edit.SimpleShape.prototype._onMarkerDragEnd.call(this,r)},_move:function(r){for(var h,f=this._shape._defaultShape?this._shape._defaultShape():this._shape.getLatLngs(),d=this._shape.getBounds(),m=d.getCenter(),_=[],x=0,b=f.length;x<b;x++)h=[f[x].lat-m.lat,f[x].lng-m.lng],_.push([r.lat+h[0],r.lng+h[1]]);this._shape.setLatLngs(_),this._repositionCornerMarkers(),this._map.fire(L.Draw.Event.EDITMOVE,{layer:this._shape})},_resize:function(r){var h;this._shape.setBounds(L.latLngBounds(r,this._oppositeCorner)),h=this._shape.getBounds(),this._moveMarker.setLatLng(h.getCenter()),this._map.fire(L.Draw.Event.EDITRESIZE,{layer:this._shape})},_getCorners:function(){var r=this._shape.getBounds();return[r.getNorthWest(),r.getNorthEast(),r.getSouthEast(),r.getSouthWest()]},_toggleCornerMarkers:function(r){for(var h=0,f=this._resizeMarkers.length;h<f;h++)this._resizeMarkers[h].setOpacity(r)},_repositionCornerMarkers:function(){for(var r=this._getCorners(),h=0,f=this._resizeMarkers.length;h<f;h++)this._resizeMarkers[h].setLatLng(r[h])}}),L.Rectangle.addInitHook(function(){L.Edit.Rectangle&&(this.editing=new L.Edit.Rectangle(this),this.options.editable&&this.editing.enable())}),L.Edit=L.Edit||{},L.Edit.CircleMarker=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var r=this._shape.getLatLng();this._moveMarker=this._createMarker(r,this.options.moveIcon)},_createResizeMarker:function(){this._resizeMarkers=[]},_move:function(r){if(this._resizeMarkers.length){var h=this._getResizeMarkerPoint(r);this._resizeMarkers[0].setLatLng(h)}this._shape.setLatLng(r),this._map.fire(L.Draw.Event.EDITMOVE,{layer:this._shape})}}),L.CircleMarker.addInitHook(function(){L.Edit.CircleMarker&&(this.editing=new L.Edit.CircleMarker(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()})}),L.Edit=L.Edit||{},L.Edit.Circle=L.Edit.CircleMarker.extend({_createResizeMarker:function(){var r=this._shape.getLatLng(),h=this._getResizeMarkerPoint(r);this._resizeMarkers=[],this._resizeMarkers.push(this._createMarker(h,this.options.resizeIcon))},_getResizeMarkerPoint:function(r){var h=this._shape._radius*Math.cos(Math.PI/4),f=this._map.project(r);return this._map.unproject([f.x+h,f.y-h])},_resize:function(r){var h=this._moveMarker.getLatLng();L.GeometryUtil.isVersion07x()?radius=h.distanceTo(r):radius=this._map.distance(h,r),this._shape.setRadius(radius),this._map.editTooltip&&this._map._editTooltip.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.subtext+"<br />"+L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.draw.handlers.circle.radius+": "+L.GeometryUtil.readableDistance(radius,!0,this.options.feet,this.options.nautic)}),this._shape.setRadius(radius),this._map.fire(L.Draw.Event.EDITRESIZE,{layer:this._shape})}}),L.Circle.addInitHook(function(){L.Edit.Circle&&(this.editing=new L.Edit.Circle(this),this.options.editable&&this.editing.enable())}),L.Map.mergeOptions({touchExtend:!0}),L.Map.TouchExtend=L.Handler.extend({initialize:function(r){this._map=r,this._container=r._container,this._pane=r._panes.overlayPane},addHooks:function(){L.DomEvent.on(this._container,"touchstart",this._onTouchStart,this),L.DomEvent.on(this._container,"touchend",this._onTouchEnd,this),L.DomEvent.on(this._container,"touchmove",this._onTouchMove,this),this._detectIE()?(L.DomEvent.on(this._container,"MSPointerDown",this._onTouchStart,this),L.DomEvent.on(this._container,"MSPointerUp",this._onTouchEnd,this),L.DomEvent.on(this._container,"MSPointerMove",this._onTouchMove,this),L.DomEvent.on(this._container,"MSPointerCancel",this._onTouchCancel,this)):(L.DomEvent.on(this._container,"touchcancel",this._onTouchCancel,this),L.DomEvent.on(this._container,"touchleave",this._onTouchLeave,this))},removeHooks:function(){L.DomEvent.off(this._container,"touchstart",this._onTouchStart,this),L.DomEvent.off(this._container,"touchend",this._onTouchEnd,this),L.DomEvent.off(this._container,"touchmove",this._onTouchMove,this),this._detectIE()?(L.DomEvent.off(this._container,"MSPointerDown",this._onTouchStart,this),L.DomEvent.off(this._container,"MSPointerUp",this._onTouchEnd,this),L.DomEvent.off(this._container,"MSPointerMove",this._onTouchMove,this),L.DomEvent.off(this._container,"MSPointerCancel",this._onTouchCancel,this)):(L.DomEvent.off(this._container,"touchcancel",this._onTouchCancel,this),L.DomEvent.off(this._container,"touchleave",this._onTouchLeave,this))},_touchEvent:function(r,h){var f={};if(r.touches!==void 0){if(!r.touches.length)return;f=r.touches[0]}else if(r.pointerType!=="touch"||(f=r,!this._filterClick(r)))return;var d=this._map.mouseEventToContainerPoint(f),m=this._map.mouseEventToLayerPoint(f),_=this._map.layerPointToLatLng(m);this._map.fire(h,{latlng:_,layerPoint:m,containerPoint:d,pageX:f.pageX,pageY:f.pageY,originalEvent:r})},_filterClick:function(r){var h=r.timeStamp||r.originalEvent.timeStamp,f=L.DomEvent._lastClick&&h-L.DomEvent._lastClick;return f&&f>100&&f<500||r.target._simulatedClick&&!r._simulated?(L.DomEvent.stop(r),!1):(L.DomEvent._lastClick=h,!0)},_onTouchStart:function(r){this._map._loaded&&this._touchEvent(r,"touchstart")},_onTouchEnd:function(r){this._map._loaded&&this._touchEvent(r,"touchend")},_onTouchCancel:function(r){if(this._map._loaded){var h="touchcancel";this._detectIE()&&(h="pointercancel"),this._touchEvent(r,h)}},_onTouchLeave:function(r){this._map._loaded&&this._touchEvent(r,"touchleave")},_onTouchMove:function(r){this._map._loaded&&this._touchEvent(r,"touchmove")},_detectIE:function(){var r=a.navigator.userAgent,h=r.indexOf("MSIE ");if(h>0)return parseInt(r.substring(h+5,r.indexOf(".",h)),10);if(r.indexOf("Trident/")>0){var f=r.indexOf("rv:");return parseInt(r.substring(f+3,r.indexOf(".",f)),10)}var d=r.indexOf("Edge/");return d>0&&parseInt(r.substring(d+5,r.indexOf(".",d)),10)}}),L.Map.addInitHook("addHandler","touchExtend",L.Map.TouchExtend),L.Marker.Touch=L.Marker.extend({_initInteraction:function(){return this.addInteractiveTarget?L.Marker.prototype._initInteraction.apply(this):this._initInteractionLegacy()},_initInteractionLegacy:function(){if(this.options.clickable){var r=this._icon,h=["dblclick","mousedown","mouseover","mouseout","contextmenu","touchstart","touchend","touchmove"];this._detectIE?h.concat(["MSPointerDown","MSPointerUp","MSPointerMove","MSPointerCancel"]):h.concat(["touchcancel"]),L.DomUtil.addClass(r,"leaflet-clickable"),L.DomEvent.on(r,"click",this._onMouseClick,this),L.DomEvent.on(r,"keypress",this._onKeyPress,this);for(var f=0;f<h.length;f++)L.DomEvent.on(r,h[f],this._fireMouseEvent,this);L.Handler.MarkerDrag&&(this.dragging=new L.Handler.MarkerDrag(this),this.options.draggable&&this.dragging.enable())}},_detectIE:function(){var r=a.navigator.userAgent,h=r.indexOf("MSIE ");if(h>0)return parseInt(r.substring(h+5,r.indexOf(".",h)),10);if(r.indexOf("Trident/")>0){var f=r.indexOf("rv:");return parseInt(r.substring(f+3,r.indexOf(".",f)),10)}var d=r.indexOf("Edge/");return d>0&&parseInt(r.substring(d+5,r.indexOf(".",d)),10)}}),L.LatLngUtil={cloneLatLngs:function(r){for(var h=[],f=0,d=r.length;f<d;f++)Array.isArray(r[f])?h.push(L.LatLngUtil.cloneLatLngs(r[f])):h.push(this.cloneLatLng(r[f]));return h},cloneLatLng:function(r){return L.latLng(r.lat,r.lng)}},(function(){var r={km:2,ha:2,m:0,mi:2,ac:2,yd:0,ft:0,nm:2};L.GeometryUtil=L.extend(L.GeometryUtil||{},{geodesicArea:function(h){var f,d,m=h.length,_=0,x=Math.PI/180;if(m>2){for(var b=0;b<m;b++)f=h[b],d=h[(b+1)%m],_+=(d.lng-f.lng)*x*(2+Math.sin(f.lat*x)+Math.sin(d.lat*x));_=6378137*_*6378137/2}return Math.abs(_)},formattedNumber:function(h,f){var d=parseFloat(h).toFixed(f),m=L.drawLocal.format&&L.drawLocal.format.numeric,_=m&&m.delimiters,x=_&&_.thousands,b=_&&_.decimal;if(x||b){var E=d.split(".");d=x?E[0].replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+x):E[0],b=b||".",E.length>1&&(d=d+b+E[1])}return d},readableArea:function(h,f,x){var m,_,x=L.Util.extend({},r,x);return f?(_=["ha","m"],type=typeof f,type==="string"?_=[f]:type!=="boolean"&&(_=f),m=h>=1e6&&_.indexOf("km")!==-1?L.GeometryUtil.formattedNumber(1e-6*h,x.km)+" km²":h>=1e4&&_.indexOf("ha")!==-1?L.GeometryUtil.formattedNumber(1e-4*h,x.ha)+" ha":L.GeometryUtil.formattedNumber(h,x.m)+" m²"):(h/=.836127,m=h>=3097600?L.GeometryUtil.formattedNumber(h/3097600,x.mi)+" mi²":h>=4840?L.GeometryUtil.formattedNumber(h/4840,x.ac)+" acres":L.GeometryUtil.formattedNumber(h,x.yd)+" yd²"),m},readableDistance:function(h,f,d,m,b){var x,b=L.Util.extend({},r,b);switch(f?typeof f=="string"?f:"metric":d?"feet":m?"nauticalMile":"yards"){case"metric":x=h>1e3?L.GeometryUtil.formattedNumber(h/1e3,b.km)+" km":L.GeometryUtil.formattedNumber(h,b.m)+" m";break;case"feet":h*=3.28083,x=L.GeometryUtil.formattedNumber(h,b.ft)+" ft";break;case"nauticalMile":h*=.53996,x=L.GeometryUtil.formattedNumber(h/1e3,b.nm)+" nm";break;default:h*=1.09361,x=h>1760?L.GeometryUtil.formattedNumber(h/1760,b.mi)+" miles":L.GeometryUtil.formattedNumber(h,b.yd)+" yd"}return x},isVersion07x:function(){var h=L.version.split(".");return parseInt(h[0],10)===0&&parseInt(h[1],10)===7}})})(),L.Util.extend(L.LineUtil,{segmentsIntersect:function(r,h,f,d){return this._checkCounterclockwise(r,f,d)!==this._checkCounterclockwise(h,f,d)&&this._checkCounterclockwise(r,h,f)!==this._checkCounterclockwise(r,h,d)},_checkCounterclockwise:function(r,h,f){return(f.y-r.y)*(h.x-r.x)>(h.y-r.y)*(f.x-r.x)}}),L.Polyline.include({intersects:function(){var r,h,f,d=this._getProjectedPoints(),m=d?d.length:0;if(this._tooFewPointsForIntersection())return!1;for(r=m-1;r>=3;r--)if(h=d[r-1],f=d[r],this._lineSegmentsIntersectsRange(h,f,r-2))return!0;return!1},newLatLngIntersects:function(r,h){return!!this._map&&this.newPointIntersects(this._map.latLngToLayerPoint(r),h)},newPointIntersects:function(r,h){var f=this._getProjectedPoints(),d=f?f.length:0,m=f?f[d-1]:null,_=d-2;return!this._tooFewPointsForIntersection(1)&&this._lineSegmentsIntersectsRange(m,r,_,h?1:0)},_tooFewPointsForIntersection:function(r){var h=this._getProjectedPoints(),f=h?h.length:0;return f+=r||0,!h||f<=3},_lineSegmentsIntersectsRange:function(r,h,f,d){var m,_,x=this._getProjectedPoints();d=d||0;for(var b=f;b>d;b--)if(m=x[b-1],_=x[b],L.LineUtil.segmentsIntersect(r,h,m,_))return!0;return!1},_getProjectedPoints:function(){if(!this._defaultShape)return this._originalPoints;for(var r=[],h=this._defaultShape(),f=0;f<h.length;f++)r.push(this._map.latLngToLayerPoint(h[f]));return r}}),L.Polygon.include({intersects:function(){var r,h,f,d,m=this._getProjectedPoints();return!this._tooFewPointsForIntersection()&&(!!L.Polyline.prototype.intersects.call(this)||(r=m.length,h=m[0],f=m[r-1],d=r-2,this._lineSegmentsIntersectsRange(f,h,d,1)))}}),L.Control.Draw=L.Control.extend({options:{position:"topleft",draw:{},edit:!1},initialize:function(r){if(L.version<"0.7")throw new Error("Leaflet.draw 0.2.3+ requires Leaflet 0.7.0+. Download latest from https://github.com/Leaflet/Leaflet/");L.Control.prototype.initialize.call(this,r);var h;this._toolbars={},L.DrawToolbar&&this.options.draw&&(h=new L.DrawToolbar(this.options.draw),this._toolbars[L.DrawToolbar.TYPE]=h,this._toolbars[L.DrawToolbar.TYPE].on("enable",this._toolbarEnabled,this)),L.EditToolbar&&this.options.edit&&(h=new L.EditToolbar(this.options.edit),this._toolbars[L.EditToolbar.TYPE]=h,this._toolbars[L.EditToolbar.TYPE].on("enable",this._toolbarEnabled,this)),L.toolbar=this},onAdd:function(r){var h,f=L.DomUtil.create("div","leaflet-draw"),d=!1;for(var m in this._toolbars)this._toolbars.hasOwnProperty(m)&&(h=this._toolbars[m].addToolbar(r))&&(d||(L.DomUtil.hasClass(h,"leaflet-draw-toolbar-top")||L.DomUtil.addClass(h.childNodes[0],"leaflet-draw-toolbar-top"),d=!0),f.appendChild(h));return f},onRemove:function(){for(var r in this._toolbars)this._toolbars.hasOwnProperty(r)&&this._toolbars[r].removeToolbar()},setDrawingOptions:function(r){for(var h in this._toolbars)this._toolbars[h]instanceof L.DrawToolbar&&this._toolbars[h].setOptions(r)},_toolbarEnabled:function(r){var h=r.target;for(var f in this._toolbars)this._toolbars[f]!==h&&this._toolbars[f].disable()}}),L.Map.mergeOptions({drawControlTooltips:!0,drawControl:!1}),L.Map.addInitHook(function(){this.options.drawControl&&(this.drawControl=new L.Control.Draw,this.addControl(this.drawControl))}),L.Toolbar=L.Class.extend({initialize:function(r){L.setOptions(this,r),this._modes={},this._actionButtons=[],this._activeMode=null;var h=L.version.split(".");parseInt(h[0],10)===1&&parseInt(h[1],10)>=2?L.Toolbar.include(L.Evented.prototype):L.Toolbar.include(L.Mixin.Events)},enabled:function(){return this._activeMode!==null},disable:function(){this.enabled()&&this._activeMode.handler.disable()},addToolbar:function(r){var h,f=L.DomUtil.create("div","leaflet-draw-section"),d=0,m=this._toolbarClass||"",_=this.getModeHandlers(r);for(this._toolbarContainer=L.DomUtil.create("div","leaflet-draw-toolbar leaflet-bar"),this._map=r,h=0;h<_.length;h++)_[h].enabled&&this._initModeHandler(_[h].handler,this._toolbarContainer,d++,m,_[h].title);if(d)return this._lastButtonIndex=--d,this._actionsContainer=L.DomUtil.create("ul","leaflet-draw-actions"),f.appendChild(this._toolbarContainer),f.appendChild(this._actionsContainer),f},removeToolbar:function(){for(var r in this._modes)this._modes.hasOwnProperty(r)&&(this._disposeButton(this._modes[r].button,this._modes[r].handler.enable,this._modes[r].handler),this._modes[r].handler.disable(),this._modes[r].handler.off("enabled",this._handlerActivated,this).off("disabled",this._handlerDeactivated,this));this._modes={};for(var h=0,f=this._actionButtons.length;h<f;h++)this._disposeButton(this._actionButtons[h].button,this._actionButtons[h].callback,this);this._actionButtons=[],this._actionsContainer=null},_initModeHandler:function(r,h,f,d,m){var _=r.type;this._modes[_]={},this._modes[_].handler=r,this._modes[_].button=this._createButton({type:_,title:m,className:d+"-"+_,container:h,callback:this._modes[_].handler.enable,context:this._modes[_].handler}),this._modes[_].buttonIndex=f,this._modes[_].handler.on("enabled",this._handlerActivated,this).on("disabled",this._handlerDeactivated,this)},_detectIOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!a.MSStream},_createButton:function(r){var h=L.DomUtil.create("a",r.className||"",r.container),f=L.DomUtil.create("span","sr-only",r.container);h.href="#",h.appendChild(f),r.title&&(h.title=r.title,f.innerHTML=r.title),r.text&&(h.innerHTML=r.text,f.innerHTML=r.text);var d=this._detectIOS()?"touchstart":"click";return L.DomEvent.on(h,"click",L.DomEvent.stopPropagation).on(h,"mousedown",L.DomEvent.stopPropagation).on(h,"dblclick",L.DomEvent.stopPropagation).on(h,"touchstart",L.DomEvent.stopPropagation).on(h,"click",L.DomEvent.preventDefault).on(h,d,r.callback,r.context),h},_disposeButton:function(r,h){var f=this._detectIOS()?"touchstart":"click";L.DomEvent.off(r,"click",L.DomEvent.stopPropagation).off(r,"mousedown",L.DomEvent.stopPropagation).off(r,"dblclick",L.DomEvent.stopPropagation).off(r,"touchstart",L.DomEvent.stopPropagation).off(r,"click",L.DomEvent.preventDefault).off(r,f,h)},_handlerActivated:function(r){this.disable(),this._activeMode=this._modes[r.handler],L.DomUtil.addClass(this._activeMode.button,"leaflet-draw-toolbar-button-enabled"),this._showActionsToolbar(),this.fire("enable")},_handlerDeactivated:function(){this._hideActionsToolbar(),L.DomUtil.removeClass(this._activeMode.button,"leaflet-draw-toolbar-button-enabled"),this._activeMode=null,this.fire("disable")},_createActions:function(r){var h,f,d,m,_=this._actionsContainer,x=this.getActions(r),b=x.length;for(f=0,d=this._actionButtons.length;f<d;f++)this._disposeButton(this._actionButtons[f].button,this._actionButtons[f].callback);for(this._actionButtons=[];_.firstChild;)_.removeChild(_.firstChild);for(var E=0;E<b;E++)"enabled"in x[E]&&!x[E].enabled||(h=L.DomUtil.create("li","",_),m=this._createButton({title:x[E].title,text:x[E].text,container:h,callback:x[E].callback,context:x[E].context}),this._actionButtons.push({button:m,callback:x[E].callback}))},_showActionsToolbar:function(){var r=this._activeMode.buttonIndex,h=this._lastButtonIndex,f=this._activeMode.button.offsetTop-1;this._createActions(this._activeMode.handler),this._actionsContainer.style.top=f+"px",r===0&&(L.DomUtil.addClass(this._toolbarContainer,"leaflet-draw-toolbar-notop"),L.DomUtil.addClass(this._actionsContainer,"leaflet-draw-actions-top")),r===h&&(L.DomUtil.addClass(this._toolbarContainer,"leaflet-draw-toolbar-nobottom"),L.DomUtil.addClass(this._actionsContainer,"leaflet-draw-actions-bottom")),this._actionsContainer.style.display="block",this._map.fire(L.Draw.Event.TOOLBAROPENED)},_hideActionsToolbar:function(){this._actionsContainer.style.display="none",L.DomUtil.removeClass(this._toolbarContainer,"leaflet-draw-toolbar-notop"),L.DomUtil.removeClass(this._toolbarContainer,"leaflet-draw-toolbar-nobottom"),L.DomUtil.removeClass(this._actionsContainer,"leaflet-draw-actions-top"),L.DomUtil.removeClass(this._actionsContainer,"leaflet-draw-actions-bottom"),this._map.fire(L.Draw.Event.TOOLBARCLOSED)}}),L.Draw=L.Draw||{},L.Draw.Tooltip=L.Class.extend({initialize:function(r){this._map=r,this._popupPane=r._panes.popupPane,this._visible=!1,this._container=r.options.drawControlTooltips?L.DomUtil.create("div","leaflet-draw-tooltip",this._popupPane):null,this._singleLineLabel=!1,this._map.on("mouseout",this._onMouseOut,this)},dispose:function(){this._map.off("mouseout",this._onMouseOut,this),this._container&&(this._popupPane.removeChild(this._container),this._container=null)},updateContent:function(r){return this._container?(r.subtext=r.subtext||"",r.subtext.length!==0||this._singleLineLabel?r.subtext.length>0&&this._singleLineLabel&&(L.DomUtil.removeClass(this._container,"leaflet-draw-tooltip-single"),this._singleLineLabel=!1):(L.DomUtil.addClass(this._container,"leaflet-draw-tooltip-single"),this._singleLineLabel=!0),this._container.innerHTML=(r.subtext.length>0?'<span class="leaflet-draw-tooltip-subtext">'+r.subtext+"</span><br />":"")+"<span>"+r.text+"</span>",r.text||r.subtext?(this._visible=!0,this._container.style.visibility="inherit"):(this._visible=!1,this._container.style.visibility="hidden"),this):this},updatePosition:function(r){var h=this._map.latLngToLayerPoint(r),f=this._container;return this._container&&(this._visible&&(f.style.visibility="inherit"),L.DomUtil.setPosition(f,h)),this},showAsError:function(){return this._container&&L.DomUtil.addClass(this._container,"leaflet-error-draw-tooltip"),this},removeError:function(){return this._container&&L.DomUtil.removeClass(this._container,"leaflet-error-draw-tooltip"),this},_onMouseOut:function(){this._container&&(this._container.style.visibility="hidden")}}),L.DrawToolbar=L.Toolbar.extend({statics:{TYPE:"draw"},options:{polyline:{},polygon:{},rectangle:{},circle:{},marker:{},circlemarker:{}},initialize:function(r){for(var h in this.options)this.options.hasOwnProperty(h)&&r[h]&&(r[h]=L.extend({},this.options[h],r[h]));this._toolbarClass="leaflet-draw-draw",L.Toolbar.prototype.initialize.call(this,r)},getModeHandlers:function(r){return[{enabled:this.options.polyline,handler:new L.Draw.Polyline(r,this.options.polyline),title:L.drawLocal.draw.toolbar.buttons.polyline},{enabled:this.options.polygon,handler:new L.Draw.Polygon(r,this.options.polygon),title:L.drawLocal.draw.toolbar.buttons.polygon},{enabled:this.options.rectangle,handler:new L.Draw.Rectangle(r,this.options.rectangle),title:L.drawLocal.draw.toolbar.buttons.rectangle},{enabled:this.options.circle,handler:new L.Draw.Circle(r,this.options.circle),title:L.drawLocal.draw.toolbar.buttons.circle},{enabled:this.options.marker,handler:new L.Draw.Marker(r,this.options.marker),title:L.drawLocal.draw.toolbar.buttons.marker},{enabled:this.options.circlemarker,handler:new L.Draw.CircleMarker(r,this.options.circlemarker),title:L.drawLocal.draw.toolbar.buttons.circlemarker}]},getActions:function(r){return[{enabled:r.completeShape,title:L.drawLocal.draw.toolbar.finish.title,text:L.drawLocal.draw.toolbar.finish.text,callback:r.completeShape,context:r},{enabled:r.deleteLastVertex,title:L.drawLocal.draw.toolbar.undo.title,text:L.drawLocal.draw.toolbar.undo.text,callback:r.deleteLastVertex,context:r},{title:L.drawLocal.draw.toolbar.actions.title,text:L.drawLocal.draw.toolbar.actions.text,callback:this.disable,context:this}]},setOptions:function(r){L.setOptions(this,r);for(var h in this._modes)this._modes.hasOwnProperty(h)&&r.hasOwnProperty(h)&&this._modes[h].handler.setOptions(r[h])}}),L.EditToolbar=L.Toolbar.extend({statics:{TYPE:"edit"},options:{edit:{selectedPathOptions:{dashArray:"10, 10",fill:!0,fillColor:"#fe57a1",fillOpacity:.1,maintainColor:!1}},remove:{},poly:null,featureGroup:null},initialize:function(r){r.edit&&(r.edit.selectedPathOptions===void 0&&(r.edit.selectedPathOptions=this.options.edit.selectedPathOptions),r.edit.selectedPathOptions=L.extend({},this.options.edit.selectedPathOptions,r.edit.selectedPathOptions)),r.remove&&(r.remove=L.extend({},this.options.remove,r.remove)),r.poly&&(r.poly=L.extend({},this.options.poly,r.poly)),this._toolbarClass="leaflet-draw-edit",L.Toolbar.prototype.initialize.call(this,r),this._selectedFeatureCount=0},getModeHandlers:function(r){var h=this.options.featureGroup;return[{enabled:this.options.edit,handler:new L.EditToolbar.Edit(r,{featureGroup:h,selectedPathOptions:this.options.edit.selectedPathOptions,poly:this.options.poly}),title:L.drawLocal.edit.toolbar.buttons.edit},{enabled:this.options.remove,handler:new L.EditToolbar.Delete(r,{featureGroup:h}),title:L.drawLocal.edit.toolbar.buttons.remove}]},getActions:function(r){var h=[{title:L.drawLocal.edit.toolbar.actions.save.title,text:L.drawLocal.edit.toolbar.actions.save.text,callback:this._save,context:this},{title:L.drawLocal.edit.toolbar.actions.cancel.title,text:L.drawLocal.edit.toolbar.actions.cancel.text,callback:this.disable,context:this}];return r.removeAllLayers&&h.push({title:L.drawLocal.edit.toolbar.actions.clearAll.title,text:L.drawLocal.edit.toolbar.actions.clearAll.text,callback:this._clearAllLayers,context:this}),h},addToolbar:function(r){var h=L.Toolbar.prototype.addToolbar.call(this,r);return this._checkDisabled(),this.options.featureGroup.on("layeradd layerremove",this._checkDisabled,this),h},removeToolbar:function(){this.options.featureGroup.off("layeradd layerremove",this._checkDisabled,this),L.Toolbar.prototype.removeToolbar.call(this)},disable:function(){this.enabled()&&(this._activeMode.handler.revertLayers(),L.Toolbar.prototype.disable.call(this))},_save:function(){this._activeMode.handler.save(),this._activeMode&&this._activeMode.handler.disable()},_clearAllLayers:function(){this._activeMode.handler.removeAllLayers(),this._activeMode&&this._activeMode.handler.disable()},_checkDisabled:function(){var r,h=this.options.featureGroup,f=h.getLayers().length!==0;this.options.edit&&(r=this._modes[L.EditToolbar.Edit.TYPE].button,f?L.DomUtil.removeClass(r,"leaflet-disabled"):L.DomUtil.addClass(r,"leaflet-disabled"),r.setAttribute("title",f?L.drawLocal.edit.toolbar.buttons.edit:L.drawLocal.edit.toolbar.buttons.editDisabled)),this.options.remove&&(r=this._modes[L.EditToolbar.Delete.TYPE].button,f?L.DomUtil.removeClass(r,"leaflet-disabled"):L.DomUtil.addClass(r,"leaflet-disabled"),r.setAttribute("title",f?L.drawLocal.edit.toolbar.buttons.remove:L.drawLocal.edit.toolbar.buttons.removeDisabled))}}),L.EditToolbar.Edit=L.Handler.extend({statics:{TYPE:"edit"},initialize:function(r,h){if(L.Handler.prototype.initialize.call(this,r),L.setOptions(this,h),this._featureGroup=h.featureGroup,!(this._featureGroup instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");this._uneditedLayerProps={},this.type=L.EditToolbar.Edit.TYPE;var f=L.version.split(".");parseInt(f[0],10)===1&&parseInt(f[1],10)>=2?L.EditToolbar.Edit.include(L.Evented.prototype):L.EditToolbar.Edit.include(L.Mixin.Events)},enable:function(){!this._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.EDITSTART,{handler:this.type}),L.Handler.prototype.enable.call(this),this._featureGroup.on("layeradd",this._enableLayerEdit,this).on("layerremove",this._disableLayerEdit,this))},disable:function(){this._enabled&&(this._featureGroup.off("layeradd",this._enableLayerEdit,this).off("layerremove",this._disableLayerEdit,this),L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.EDITSTOP,{handler:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var r=this._map;r&&(r.getContainer().focus(),this._featureGroup.eachLayer(this._enableLayerEdit,this),this._tooltip=new L.Draw.Tooltip(this._map),this._tooltip.updateContent({text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}),r._editTooltip=this._tooltip,this._updateTooltip(),this._map.on("mousemove",this._onMouseMove,this).on("touchmove",this._onMouseMove,this).on("MSPointerMove",this._onMouseMove,this).on(L.Draw.Event.EDITVERTEX,this._updateTooltip,this))},removeHooks:function(){this._map&&(this._featureGroup.eachLayer(this._disableLayerEdit,this),this._uneditedLayerProps={},this._tooltip.dispose(),this._tooltip=null,this._map.off("mousemove",this._onMouseMove,this).off("touchmove",this._onMouseMove,this).off("MSPointerMove",this._onMouseMove,this).off(L.Draw.Event.EDITVERTEX,this._updateTooltip,this))},revertLayers:function(){this._featureGroup.eachLayer(function(r){this._revertLayer(r)},this)},save:function(){var r=new L.LayerGroup;this._featureGroup.eachLayer(function(h){h.edited&&(r.addLayer(h),h.edited=!1)}),this._map.fire(L.Draw.Event.EDITED,{layers:r})},_backupLayer:function(r){var h=L.Util.stamp(r);this._uneditedLayerProps[h]||(r instanceof L.Polyline||r instanceof L.Polygon||r instanceof L.Rectangle?this._uneditedLayerProps[h]={latlngs:L.LatLngUtil.cloneLatLngs(r.getLatLngs())}:r instanceof L.Circle?this._uneditedLayerProps[h]={latlng:L.LatLngUtil.cloneLatLng(r.getLatLng()),radius:r.getRadius()}:(r instanceof L.Marker||r instanceof L.CircleMarker)&&(this._uneditedLayerProps[h]={latlng:L.LatLngUtil.cloneLatLng(r.getLatLng())}))},_getTooltipText:function(){return{text:L.drawLocal.edit.handlers.edit.tooltip.text,subtext:L.drawLocal.edit.handlers.edit.tooltip.subtext}},_updateTooltip:function(){this._tooltip.updateContent(this._getTooltipText())},_revertLayer:function(r){var h=L.Util.stamp(r);r.edited=!1,this._uneditedLayerProps.hasOwnProperty(h)&&(r instanceof L.Polyline||r instanceof L.Polygon||r instanceof L.Rectangle?r.setLatLngs(this._uneditedLayerProps[h].latlngs):r instanceof L.Circle?(r.setLatLng(this._uneditedLayerProps[h].latlng),r.setRadius(this._uneditedLayerProps[h].radius)):(r instanceof L.Marker||r instanceof L.CircleMarker)&&r.setLatLng(this._uneditedLayerProps[h].latlng),r.fire("revert-edited",{layer:r}))},_enableLayerEdit:function(r){var h,f,d=r.layer||r.target||r;this._backupLayer(d),this.options.poly&&(f=L.Util.extend({},this.options.poly),d.options.poly=f),this.options.selectedPathOptions&&(h=L.Util.extend({},this.options.selectedPathOptions),h.maintainColor&&(h.color=d.options.color,h.fillColor=d.options.fillColor),d.options.original=L.extend({},d.options),d.options.editing=h),d instanceof L.Marker?(d.editing&&d.editing.enable(),d.dragging.enable(),d.on("dragend",this._onMarkerDragEnd).on("touchmove",this._onTouchMove,this).on("MSPointerMove",this._onTouchMove,this).on("touchend",this._onMarkerDragEnd,this).on("MSPointerUp",this._onMarkerDragEnd,this)):d.editing.enable()},_disableLayerEdit:function(r){var h=r.layer||r.target||r;h.edited=!1,h.editing&&h.editing.disable(),delete h.options.editing,delete h.options.original,this._selectedPathOptions&&(h instanceof L.Marker?this._toggleMarkerHighlight(h):(h.setStyle(h.options.previousOptions),delete h.options.previousOptions)),h instanceof L.Marker?(h.dragging.disable(),h.off("dragend",this._onMarkerDragEnd,this).off("touchmove",this._onTouchMove,this).off("MSPointerMove",this._onTouchMove,this).off("touchend",this._onMarkerDragEnd,this).off("MSPointerUp",this._onMarkerDragEnd,this)):h.editing.disable()},_onMouseMove:function(r){this._tooltip.updatePosition(r.latlng)},_onMarkerDragEnd:function(r){var h=r.target;h.edited=!0,this._map.fire(L.Draw.Event.EDITMOVE,{layer:h})},_onTouchMove:function(r){var h=r.originalEvent.changedTouches[0],f=this._map.mouseEventToLayerPoint(h),d=this._map.layerPointToLatLng(f);r.target.setLatLng(d)},_hasAvailableLayers:function(){return this._featureGroup.getLayers().length!==0}}),L.EditToolbar.Delete=L.Handler.extend({statics:{TYPE:"remove"},initialize:function(r,h){if(L.Handler.prototype.initialize.call(this,r),L.Util.setOptions(this,h),this._deletableLayers=this.options.featureGroup,!(this._deletableLayers instanceof L.FeatureGroup))throw new Error("options.featureGroup must be a L.FeatureGroup");this.type=L.EditToolbar.Delete.TYPE;var f=L.version.split(".");parseInt(f[0],10)===1&&parseInt(f[1],10)>=2?L.EditToolbar.Delete.include(L.Evented.prototype):L.EditToolbar.Delete.include(L.Mixin.Events)},enable:function(){!this._enabled&&this._hasAvailableLayers()&&(this.fire("enabled",{handler:this.type}),this._map.fire(L.Draw.Event.DELETESTART,{handler:this.type}),L.Handler.prototype.enable.call(this),this._deletableLayers.on("layeradd",this._enableLayerDelete,this).on("layerremove",this._disableLayerDelete,this))},disable:function(){this._enabled&&(this._deletableLayers.off("layeradd",this._enableLayerDelete,this).off("layerremove",this._disableLayerDelete,this),L.Handler.prototype.disable.call(this),this._map.fire(L.Draw.Event.DELETESTOP,{handler:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var r=this._map;r&&(r.getContainer().focus(),this._deletableLayers.eachLayer(this._enableLayerDelete,this),this._deletedLayers=new L.LayerGroup,this._tooltip=new L.Draw.Tooltip(this._map),this._tooltip.updateContent({text:L.drawLocal.edit.handlers.remove.tooltip.text}),this._map.on("mousemove",this._onMouseMove,this))},removeHooks:function(){this._map&&(this._deletableLayers.eachLayer(this._disableLayerDelete,this),this._deletedLayers=null,this._tooltip.dispose(),this._tooltip=null,this._map.off("mousemove",this._onMouseMove,this))},revertLayers:function(){this._deletedLayers.eachLayer(function(r){this._deletableLayers.addLayer(r),r.fire("revert-deleted",{layer:r})},this)},save:function(){this._map.fire(L.Draw.Event.DELETED,{layers:this._deletedLayers})},removeAllLayers:function(){this._deletableLayers.eachLayer(function(r){this._removeLayer({layer:r})},this),this.save()},_enableLayerDelete:function(r){(r.layer||r.target||r).on("click",this._removeLayer,this)},_disableLayerDelete:function(r){var h=r.layer||r.target||r;h.off("click",this._removeLayer,this),this._deletedLayers.removeLayer(h)},_removeLayer:function(r){var h=r.layer||r.target||r;this._deletableLayers.removeLayer(h),this._deletedLayers.addLayer(h),h.fire("deleted")},_onMouseMove:function(r){this._tooltip.updatePosition(r.latlng)},_hasAvailableLayers:function(){return this._deletableLayers.getLayers().length!==0}})})(window,document);var Xs={exports:{}},Al;function Ec(){return Al||(Al=1,(function(a,n){(function(i,s){a.exports=i(Sl()),typeof s!="undefined"&&s.L&&(s.L.Ruler=i(L))})(function(i){i.Control.Ruler=i.Control.extend({options:{position:"topright",circleMarker:{color:"red",radius:2},lineStyle:{color:"red",dashArray:"1,6"},lengthUnit:{display:"km",decimal:2,factor:null,label:"Distance:"},angleUnit:{display:"°",decimal:2,factor:null,label:"Bearing:"}},onAdd:function(s){return this._map=s,this._container=i.DomUtil.create("div","leaflet-bar"),this._container.classList.add("leaflet-ruler"),i.DomEvent.disableClickPropagation(this._container),i.DomEvent.on(this._container,"click",this._toggleMeasure,this),this._choice=!1,this._defaultCursor=this._map._container.style.cursor,this._allLayers=i.layerGroup(),this._container},onRemove:function(){i.DomEvent.off(this._container,"click",this._toggleMeasure,this)},_toggleMeasure:function(){this._choice=!this._choice,this._clickedLatLong=null,this._clickedPoints=[],this._totalLength=0,this._choice?(this._map.doubleClickZoom.disable(),i.DomEvent.on(this._map._container,"keydown",this._escape,this),i.DomEvent.on(this._map._container,"dblclick",this._closePath,this),this._container.classList.add("leaflet-ruler-clicked"),this._clickCount=0,this._tempLine=i.featureGroup().addTo(this._allLayers),this._tempPoint=i.featureGroup().addTo(this._allLayers),this._pointLayer=i.featureGroup().addTo(this._allLayers),this._polylineLayer=i.featureGroup().addTo(this._allLayers),this._allLayers.addTo(this._map),this._map._container.style.cursor="crosshair",this._map.on("click",this._clicked,this),this._map.on("mousemove",this._moving,this)):(this._map.doubleClickZoom.enable(),i.DomEvent.off(this._map._container,"keydown",this._escape,this),i.DomEvent.off(this._map._container,"dblclick",this._closePath,this),this._container.classList.remove("leaflet-ruler-clicked"),this._map.removeLayer(this._allLayers),this._allLayers=i.layerGroup(),this._map._container.style.cursor=this._defaultCursor,this._map.off("click",this._clicked,this),this._map.off("mousemove",this._moving,this))},_clicked:function(s){if(this._clickedLatLong=s.latlng,this._clickedPoints.push(this._clickedLatLong),i.circleMarker(this._clickedLatLong,this.options.circleMarker).addTo(this._pointLayer),this._clickCount>0&&!s.latlng.equals(this._clickedPoints[this._clickedPoints.length-2])){this._movingLatLong&&i.polyline([this._clickedPoints[this._clickCount-1],this._movingLatLong],this.options.lineStyle).addTo(this._polylineLayer);var r;this._totalLength+=this._result.Distance,this._clickCount>1?r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._totalLength.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display:r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._result.Distance.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display,i.circleMarker(this._clickedLatLong,this.options.circleMarker).bindTooltip(r,{permanent:!0,className:"result-tooltip"}).addTo(this._pointLayer).openTooltip()}this._clickCount++},_moving:function(s){if(this._clickedLatLong){i.DomEvent.off(this._container,"click",this._toggleMeasure,this),this._movingLatLong=s.latlng,this._tempLine&&(this._map.removeLayer(this._tempLine),this._map.removeLayer(this._tempPoint));var r;this._addedLength=0,this._tempLine=i.featureGroup(),this._tempPoint=i.featureGroup(),this._tempLine.addTo(this._map),this._tempPoint.addTo(this._map),this._calculateBearingAndDistance(),this._addedLength=this._result.Distance+this._totalLength,i.polyline([this._clickedLatLong,this._movingLatLong],this.options.lineStyle).addTo(this._tempLine),this._clickCount>1?r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._addedLength.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display+'<br><div class="plus-length">(+'+this._result.Distance.toFixed(this.options.lengthUnit.decimal)+")</div>":r="<b>"+this.options.angleUnit.label+"</b> "+this._result.Bearing.toFixed(this.options.angleUnit.decimal)+" "+this.options.angleUnit.display+"<br><b>"+this.options.lengthUnit.label+"</b> "+this._result.Distance.toFixed(this.options.lengthUnit.decimal)+" "+this.options.lengthUnit.display,i.circleMarker(this._movingLatLong,this.options.circleMarker).bindTooltip(r,{sticky:!0,offset:i.point(0,-40),className:"moving-tooltip"}).addTo(this._tempPoint).openTooltip()}},_escape:function(s){s.keyCode===27&&(this._clickCount>0?this._closePath():(this._choice=!0,this._toggleMeasure()))},_calculateBearingAndDistance:function(){var s=this._clickedLatLong.lat,r=this._clickedLatLong.lng,h=this._movingLatLong.lat,f=this._movingLatLong.lng,d=Math.PI/180,m=Math.sin((f-r)*d)*Math.cos(h*d),_=Math.cos(s*d)*Math.sin(h*d)-Math.sin(s*d)*Math.cos(h*d)*Math.cos((f-r)*d),x=Math.atan2(m,_)*((this.options.angleUnit.factor?this.options.angleUnit.factor/2:180)/Math.PI);x+=x<0?this.options.angleUnit.factor?this.options.angleUnit.factor:360:0;var b=this.options.lengthUnit.factor?6371*this.options.lengthUnit.factor:6371,E=(h-s)*d,C=(f-r)*d,S=Math.sin(E/2)*Math.sin(E/2)+Math.cos(s*d)*Math.cos(h*d)*Math.sin(C/2)*Math.sin(C/2),O=2*Math.atan2(Math.sqrt(S),Math.sqrt(1-S)),N=b*O;this._result={Bearing:x,Distance:N}},_closePath:function(){this._map.removeLayer(this._tempLine),this._map.removeLayer(this._tempPoint),this._clickCount<=1&&this._map.removeLayer(this._pointLayer),this._choice=!1,i.DomEvent.on(this._container,"click",this._toggleMeasure,this),this._toggleMeasure()}}),i.control.ruler=function(s){return new i.Control.Ruler(s)}},window)})(Xs)),Xs.exports}Ec();const be=[];for(let a=0;a<256;++a)be.push((a+256).toString(16).slice(1));function Tc(a,n=0){return(be[a[n+0]]+be[a[n+1]]+be[a[n+2]]+be[a[n+3]]+"-"+be[a[n+4]]+be[a[n+5]]+"-"+be[a[n+6]]+be[a[n+7]]+"-"+be[a[n+8]]+be[a[n+9]]+"-"+be[a[n+10]]+be[a[n+11]]+be[a[n+12]]+be[a[n+13]]+be[a[n+14]]+be[a[n+15]]).toLowerCase()}let Js;const Ic=new Uint8Array(16);function Cc(){if(!Js){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Js=crypto.getRandomValues.bind(crypto)}return Js(Ic)}const Pl={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Mr(a,n,i){var r,h,f;if(Pl.randomUUID&&!a)return Pl.randomUUID();a=a||{};const s=(f=(h=a.random)!=null?h:(r=a.rng)==null?void 0:r.call(a))!=null?f:Cc();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Tc(s)}function Ve(a){var i,s;const n=(s=a.id)!=null?s:(i=a.properties)==null?void 0:i.id;if(n!=null)return String(n)}const Sc=/^(.*)::(\d+)$/,vi="geokit:source";function Ws(a){const n=Ve(a);if(!n)return null;const i=Sc.exec(n);return i?{baseId:i[1],childIndex:Number(i[2]),feature:a}:null}function Mc(a,n){const i=n&&typeof n=="object"?{...n}:{};return i.id=a,i}function Ac(a,n){var _,x;const i=[...n].sort((b,E)=>b.childIndex-E.childIndex),s=i[0].feature,r=Mc(a,s.properties),h=(_=s.properties)==null?void 0:_[vi],f=Array.isArray(h)?h[h.length-1]:void 0,d=i.map(b=>b.feature.geometry).filter(b=>b!=null);let m;return d.length===0?m={type:"GeometryCollection",geometries:[]}:d.length===1&&!f?m=d[0]:(f==null?void 0:f.type)!=="GeometryCollection"&&d.every(b=>b.type==="Point")?m={type:"MultiPoint",coordinates:d.map(b=>b.coordinates)}:(f==null?void 0:f.type)!=="GeometryCollection"&&d.every(b=>b.type==="LineString")?m={type:"MultiLineString",coordinates:d.map(b=>b.coordinates)}:(f==null?void 0:f.type)!=="GeometryCollection"&&d.every(b=>b.type==="Polygon")?m={type:"MultiPolygon",coordinates:d.map(b=>b.coordinates)}:m={type:"GeometryCollection",geometries:d},f&&r&&(f.hasPropertyId?r.id=f.propertyId:delete r.id,h.length>1?r[vi]=h.slice(0,-1):delete r[vi]),{type:"Feature",id:(x=f==null?void 0:f.id)!=null?x:a,properties:f!=null&&f.nullProperties&&Object.keys(r!=null?r:{}).length===0?null:r,geometry:m}}function Pc(a,n){const i=s=>{switch(s.type){case"Point":n(s.coordinates);break;case"MultiPoint":case"LineString":for(const r of s.coordinates)n(r);break;case"MultiLineString":case"Polygon":for(const r of s.coordinates)for(const h of r)n(h);break;case"MultiPolygon":for(const r of s.coordinates)for(const h of r)for(const f of h)n(f);break;case"GeometryCollection":for(const r of s.geometries)i(r);break}};i(a)}function Nc(a){const n=a.geometry;if(!n)return null;let i=1/0,s=1/0,r=-1/0,h=-1/0,f=!1;return Pc(n,d=>{const[m,_]=d;typeof m!="number"||typeof _!="number"||(f=!0,m<i&&(i=m),_<s&&(s=_),m>r&&(r=m),_>h&&(h=_))}),f?[i,s,r,h]:null}function Oc(a){let n=1/0,i=1/0,s=-1/0,r=-1/0,h=!1;for(const f of a.features){const d=Nc(f);d&&(h=!0,n=Math.min(n,d[0]),i=Math.min(i,d[1]),s=Math.max(s,d[2]),r=Math.max(r,d[3]))}return h?[n,i,s,r]:null}function Rc(a){const[n,i,s,r]=a;return[[i,n],[r,s]]}function js(a,n={}){var r;const i=[];for(const h of a.features){if(!h||h.type!=="Feature")continue;const f=(r=h.properties)!=null?r:{},d=Ve(h),m=(x,b)=>{const E=f&&typeof f=="object"?{...f}:{},C=d!==void 0?`${d}::${b}`:void 0;C!==void 0&&(E.id=C);const S=Array.isArray(f[vi])?f[vi]:[],O={type:h.geometry.type,hasPropertyId:Object.prototype.hasOwnProperty.call(f,"id"),nullProperties:h.properties===null};return h.id!==void 0?O.id=h.id:d!==void 0&&(O.id=d),O.hasPropertyId&&(O.propertyId=f.id),n.preserveMetadata&&(E[vi]=[...S,O]),{type:"Feature",id:C,properties:E,geometry:x}},_=h.geometry;if(_)switch(_.type){case"MultiPolygon":for(const[x,b]of _.coordinates.entries())i.push(m({type:"Polygon",coordinates:b},x));break;case"MultiLineString":for(const[x,b]of _.coordinates.entries())i.push(m({type:"LineString",coordinates:b},x));break;case"MultiPoint":for(const[x,b]of _.coordinates.entries())i.push(m({type:"Point",coordinates:b},x));break;case"GeometryCollection":for(const[x,b]of _.geometries.entries())i.push(m(b,x));break;default:i.push(h);break}}const s={type:"FeatureCollection",features:i};return n.preserveMetadata&&i.some(h=>h.geometry.type.startsWith("Multi")||h.geometry.type==="GeometryCollection")?js(s,n):s}function Ks(a,n={}){var x;if(((x=n.adapter)!=null?x:"editing")!=="source")return a;const s=b=>{var E;return Array.isArray((E=b.properties)==null?void 0:E[vi])?b.properties[vi].length:0},r=a.features.reduce((b,E)=>Math.max(b,s(E)),0),h=b=>r===0?!n.provenanceOnly:s(b)===r,f=new Map;for(const b of a.features){if(!h(b))continue;const E=Ws(b);if(!E)continue;const C=f.get(E.baseId);C?C.push(E):f.set(E.baseId,[E])}if(f.size===0)return a;const d=new Set,m=[];for(const b of a.features){if(!h(b)){m.push(b);continue}const E=Ws(b);if(!E){m.push(b);continue}d.has(E.baseId)||(d.add(E.baseId),m.push(Ac(E.baseId,f.get(E.baseId))))}const _={type:"FeatureCollection",features:m};return m.some(b=>{var E;return Array.isArray((E=b.properties)==null?void 0:E[vi])&&b.properties[vi].length>0&&Ws(b)})?Ks(_,n):_}function Nl(a){return(a==null?void 0:a.type)==="Polygon"}function Ol(a){return(a==null?void 0:a.type)==="MultiPolygon"}function Dc(a){const n=a.geometry;return n?Nl(n)?[n.coordinates]:Ol(n)?n.coordinates:[]:[]}function Bc(a,n){var r,h;const i=[];for(const f of a){const d=Dc(f);d.length>0&&i.push(...d)}if(i.length===0)return null;const s=(h=n!=null?n:(r=a[0])==null?void 0:r.properties)!=null?h:{};return i.length===1?{type:"Feature",properties:{...s},geometry:{type:"Polygon",coordinates:i[0]}}:{type:"Feature",properties:{...s},geometry:{type:"MultiPolygon",coordinates:i}}}class zc{constructor(n=Ro("feature-store","debug")){Q(this,"log");Q(this,"features");this.log=n,this.features=new Map}size(){return this.features.size}has(n){return this.features.has(n)}get(n){return this.features.get(n)}add(n){var h,f,d,m;const i=[],s=(f=(h=performance.now)==null?void 0:h.call(performance))!=null?f:Date.now();for(const _ of n.features){const x=this.ensureId(_),b={..._,id:x};this.features.set(x,b),i.push(x)}const r=((m=(d=performance.now)==null?void 0:d.call(performance))!=null?m:Date.now())-s;return this.log.debug("add",{count:n.features.length,ids:i,elapsedMs:Math.round(r)}),i}update(n,i){if(!this.features.has(n)){this.log.warn("update:missing",{id:n});return}const s={...i,id:n};this.features.set(n,s),this.log.debug("update",{id:n})}remove(n){this.features.delete(n)?this.log.debug("remove",{id:n}):this.log.warn("remove:missing",{id:n})}clear(){const n=this.features.size;this.features.clear(),this.log.debug("clear",{count:n})}toFeatureCollection(){return{type:"FeatureCollection",features:Array.from(this.features.values())}}bounds(){const n=this.toFeatureCollection();if(n.features.length===0)return null;const i=Oc(n);return i?Rc(i):null}ensureId(n){const i=Ve(n);if(i)return String(i);const s=Mr();return n.id=s,n.properties&&typeof n.properties=="object"&&(n.properties.id=s),s}}const Rl=["base","drawn","imported","guide","measurement"];function Bo(a){if(!a||typeof a!="object"||Array.isArray(a))throw new Error("Invalid layer style");const n={};for(const i of["color","fillColor","dashArray"])if(a[i]!==void 0){if(typeof a[i]!="string"||a[i].length>128)throw new Error(`Invalid ${i}`);n[i]=a[i]}for(const i of["weight","opacity","fillOpacity"]){const s=a[i];if(s!==void 0){if(!Number.isFinite(s)||s<0||s>(i==="weight"?100:1))throw new Error(`Invalid ${i}`);n[i]=s}}return n}class Qs{constructor(){Q(this,"layers",[])}getLayers(){return this.layers.map((n,i)=>({...n,order:i,featureIds:[...n.featureIds],style:{...n.style}}))}get(n){const i=this.getLayers().find(s=>s.id===n);if(!i)throw new Error(`Unknown layer: ${n}`);return i}add(n,i={},s=(r=>(r=i.kind)!=null?r:"imported")()){var d,m,_;const h=(d=i.id)!=null?d:Mr();if(!h||this.layers.some(x=>x.id===h))throw new Error(`Duplicate layer: ${h}`);if(!Rl.includes(s))throw new Error("Invalid layer kind");const f=Bo((m=i.style)!=null?m:{});return this.layers.push({id:h,name:((_=i.name)==null?void 0:_.trim())||`${s} layer`,kind:s,visible:!0,order:this.layers.length,featureIds:[...n],style:f}),h}setLayerVisibility(n,i){if(this.get(n),typeof i!="boolean")throw new Error("Invalid layer visibility");this.layers.find(s=>s.id===n).visible=i}setLayerStyle(n,i){const s=this.get(n);this.layers.find(r=>r.id===n).style={...s.style,...Bo(i)}}reorderLayers(n){if(n.length!==this.layers.length||new Set(n).size!==n.length||n.some(i=>!this.layers.some(s=>s.id===i)))throw new Error("Order must contain every layer id exactly once");this.layers=n.map(i=>this.layers.find(s=>s.id===i))}removeLayer(n){this.get(n),this.layers=this.layers.filter(i=>i.id!==n)}removeFeature(n){for(const i of this.layers)i.featureIds=i.featureIds.filter(s=>s!==n);this.layers=this.layers.filter(i=>i.kind==="base"||i.featureIds.length>0)}clearData(){this.layers=this.layers.filter(n=>n.kind==="base")}snapshot(){return{version:1,layers:this.getLayers()}}static parseSnapshot(n,i){const s=n;if(!s||s.version!==1||!Array.isArray(s.layers))throw new Error("Invalid geokit:layers snapshot");const r=new Set,h=new Set,f=s.layers.map((d,m)=>{if(!d||typeof d.id!="string"||!d.id||r.has(d.id)||typeof d.name!="string"||!Rl.includes(d.kind)||typeof d.visible!="boolean"||d.order!==m||!Array.isArray(d.featureIds))throw new Error("Invalid layer record");r.add(d.id);for(const _ of d.featureIds){if(typeof _!="string"||!i.includes(_)||h.has(_)||d.kind==="base")throw new Error("Invalid layer membership");h.add(_)}return{...d,featureIds:[...d.featureIds],style:Bo(d.style)}});if(i.some(d=>!h.has(d)))throw new Error("Layer snapshot must cover every feature");if(f.filter(d=>d.kind==="base").length!==1||!f.some(d=>d.kind==="base"&&d.id==="base"))throw new Error("Layer snapshot must contain the base layer");return{version:1,layers:f}}restore(n){this.layers=n.layers.map(i=>({...i,featureIds:[...i.featureIds],style:{...i.style}}))}}const zn={crop:Object.freeze({color:"#287a39",fillColor:"#76b947",weight:2,fillOpacity:.25}),water:Object.freeze({color:"#176da5",fillColor:"#59b4e5",weight:2,fillOpacity:.3}),reference:Object.freeze({color:"#735aa6",weight:2,fillOpacity:.08,dashArray:"6 4"})};function Fc(a,n,i){const s=a.getRootNode()instanceof ShadowRoot?a.getRootNode().activeElement:document.activeElement,r=document.createElement("section");r.setAttribute("role","dialog"),r.setAttribute("aria-label","Layer style"),r.setAttribute("part","layer-style-panel"),Object.assign(r.style,{position:"absolute",zIndex:"1100",top:"12px",left:"12px",padding:"12px",background:"var(--geokit-panel-background, white)",color:"var(--geokit-panel-color, #222)"});const h=document.createElement("select");h.setAttribute("aria-label","Layer"),n.filter(x=>x.kind!=="base").forEach(x=>{const b=document.createElement("option");b.value=x.id,b.textContent=x.name,h.append(b)}),r.append(h);const f=document.createElement("select");f.setAttribute("aria-label","Style preset");for(const x of Object.keys(zn)){const b=document.createElement("option");b.value=x,b.textContent=x,f.append(b)}r.append(f);const d=document.createElement("button");d.type="button",d.textContent="Apply style",d.disabled=h.options.length===0,d.onclick=()=>i(h.value,zn[f.value]);const m=document.createElement("button");m.type="button",m.textContent="Close layer style";const _=()=>{r.remove(),s instanceof HTMLElement&&s.isConnected&&s.focus()};m.onclick=_,r.addEventListener("keydown",x=>{x.key==="Escape"&&(x.stopPropagation(),_())});for(const x of["click","dblclick","pointerdown","mousedown","wheel"])r.addEventListener(x,b=>b.stopPropagation());return r.append(d,m),a.append(r),h.focus(),_}const Dl=new WeakSet,$s="button, a[href], [role='button']";function Gc(a){a.querySelectorAll(".leaflet-draw-toolbar").forEach((n,i)=>{n.setAttribute("role","toolbar"),n.setAttribute("aria-label",i===0?"Draw tools":"Edit tools"),n.setAttribute("aria-orientation","vertical")}),a.querySelectorAll("[data-geokit-tool]").forEach(n=>{!n.matches($s)&&!n.matches(".leaflet-ruler")||(n.tagName!=="BUTTON"&&(n.setAttribute("role","button"),n.tabIndex=0),n.hasAttribute("aria-label")||n.setAttribute("aria-label",n.title||n.dataset.geokitTool||"Map tool"))}),!Dl.has(a)&&(Dl.add(a),a.addEventListener("keydown",n=>{if(n.altKey||n.ctrlKey||n.metaKey||n.shiftKey)return;const i=n.target;if(!(i instanceof HTMLElement))return;const s=i.closest($s);if(!s||!a.contains(s))return;if((n.key===" "||n.key==="Enter")&&s.tagName!=="BUTTON"&&s.getAttribute("role")==="button"){n.preventDefault(),n.stopPropagation(),!n.repeat&&s.getAttribute("aria-disabled")!=="true"&&s.click();return}const r=s.closest("[role='toolbar']");if(!r)return;const h=r.getAttribute("aria-orientation")==="vertical",f=h?"ArrowDown":"ArrowRight";if(![f,h?"ArrowUp":"ArrowLeft","Home","End"].includes(n.key))return;const m=Array.from(r.querySelectorAll($s)).filter(b=>!b.matches(":disabled, [aria-disabled='true'], [hidden]")&&!b.closest("[hidden]")&&getComputedStyle(b).display!=="none"),_=m.indexOf(s);if(_<0||!m.length)return;n.preventDefault(),n.stopPropagation();const x=n.key==="Home"?0:n.key==="End"?m.length-1:(_+(n.key===f?1:-1)+m.length)%m.length;m[x].focus()}))}function ta(a,n,i=!1){const s=i?"alert":"status";let r=a.querySelector(`[data-geokit-announcement='${s}']`);r||(r=document.createElement("div"),r.dataset.geokitAnnouncement=s,r.setAttribute("role",s),r.setAttribute("aria-live",i?"assertive":"polite"),r.setAttribute("aria-atomic","true"),r.className="leaflet-geokit-sr-only",a.append(r)),r.textContent=n}const Uc=`
|
|
239
236
|
.leaflet-geokit-sr-only {
|
|
240
237
|
position: absolute;
|
|
241
238
|
width: 1px;
|
|
@@ -446,7 +443,7 @@ geokit-toolbar-layout[data-narrow="true"] .leaflet-geokit-toolbar-group {
|
|
|
446
443
|
}
|
|
447
444
|
.leaflet-geokit-toolbar-button[aria-pressed="true"] { outline: 2px solid Highlight; }
|
|
448
445
|
}
|
|
449
|
-
`,Ar=["top-start","top-end","center-end","bottom-start","bottom-end"],Bl={topleft:"top-start",topright:"top-end",bottomleft:"bottom-start",bottomright:"bottom-end"};function qc(a="topright"){return Object.prototype.hasOwnProperty.call(Bl,a)?Bl[a]:Ar.includes(a)?a:"top-end"}function Zc(a){return!!(a.preset||a.responsive||Ar.includes(a.position))}function Hc(a,n){var r,h,f,d,m,_,x;const s=n<((h=(r=a.responsive)==null?void 0:r.breakpoint)!=null?h:600)&&(a.preset==="responsive"||a.responsive)?{position:"bottom-end",orientation:"horizontal",...a.responsive}:{};return{position:(f=a.position)!=null?f:"topright",orientation:(d=a.orientation)!=null?d:"vertical",order:(m=a.order)!=null?m:0,overflow:(_=a.overflow)!=null?_:"wrap",offset:(x=a.offset)!=null?x:[10,10],...s}}class Yc extends HTMLElement{constructor(){super(...arguments);Q(this,"entries",[]);Q(this,"resize");Q(this,"mutations");Q(this,"frame",0);Q(this,"revealFocusedTool",i=>{const s=i.target;s instanceof HTMLElement&&s.matches("button")&&s.scrollIntoView({block:"nearest",inline:"nearest"})});Q(this,"schedule",()=>{this.frame||(this.frame=requestAnimationFrame(()=>{this.frame=0,this.arrange()}))})}connectedCallback(){this.resize=new ResizeObserver(this.schedule),this.resize.observe(this.parentElement),this.parentElement.querySelectorAll(".leaflet-control").forEach(s=>this.resize.observe(s)),this.entries.forEach(({element:s})=>this.resize.observe(s)),this.mutations=new MutationObserver(s=>{s.some(r=>!this.contains(r.target)||r.attributeName==="class")&&this.schedule()});const i=this.getRootNode();this.mutations.observe(i,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style"],characterData:!0}),i instanceof ShadowRoot&&this.mutations.observe(i.host,{attributes:!0,attributeFilter:["class","style"]}),i instanceof ShadowRoot&&this.mutations.observe(this.ownerDocument.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),window.addEventListener("resize",this.schedule),this.addEventListener("focusin",this.revealFocusedTool),this.arrange()}disconnectedCallback(){var i,s;(i=this.resize)==null||i.disconnect(),(s=this.mutations)==null||s.disconnect(),window.removeEventListener("resize",this.schedule),this.removeEventListener("focusin",this.revealFocusedTool),cancelAnimationFrame(this.frame),this.frame=0}arrange(){const i=this.parentElement;if(!i)return;const s=i.getBoundingClientRect();if(!s.width||!s.height)return;let r=0,h=0;i.querySelectorAll(".leaflet-control-container .leaflet-control").forEach(m=>{const _=m.getBoundingClientRect();!_.width||!_.height||(m.closest(".leaflet-top")&&(r=Math.max(r,_.bottom-s.top)),m.closest(".leaflet-bottom")&&(h=Math.max(h,s.bottom-_.top)))}),this.style.setProperty("--_geokit-native-top",`${r}px`),this.style.setProperty("--_geokit-native-bottom",`${h}px`),this.dataset.narrow=String(s.width<600),this.dataset.dense=String(s.width<600&&s.height-r-h<this.entries.length*100),this.entries.forEach(({element:m,config:_})=>{const x=Hc(_,s.width),b=getComputedStyle(m),E=qc(b.getPropertyValue("--geokit-toolbar-zone").trim()||x.position),C=this.querySelector(`[data-geokit-zone="${E}"]`);if(m.parentElement!==C){const Z=m.getRootNode()instanceof ShadowRoot?m.getRootNode().activeElement:document.activeElement;C.appendChild(m),Z instanceof HTMLElement&&m.contains(Z)&&Z.focus({preventScroll:!0})}m.dataset.geokitToolbarPosition=E,m.style.setProperty("--_geokit-direction",x.orientation==="horizontal"?"row":"column"),m.style.setProperty("--_geokit-order",String(Number.isFinite(x.order)?x.order:0)),m.style.setProperty("--_geokit-wrap",x.overflow==="scroll"?"nowrap":"wrap");const[M,S]=x.offset;m.style.setProperty("--_geokit-layout-x",`${Number.isFinite(M)?Math.max(0,M):10}px`),m.style.setProperty("--_geokit-layout-y",`${Number.isFinite(S)?Math.max(0,S):10}px`);const z=getComputedStyle(m).flexDirection.startsWith("row");m.setAttribute("aria-orientation",z?"horizontal":"vertical")});const f=Ar.filter(m=>this.querySelector(`[data-geokit-zone="${m}"]`).childElementCount);for(const m of Ar)this.querySelector(`[data-geokit-zone="${m}"]`).hidden=!f.includes(m);const d=s.width<600?f.map(m=>`"${m}"`):[f.some(m=>m.startsWith("top"))?'"top-start top-end"':"",f.includes("center-end")?'". center-end"':"",f.some(m=>m.startsWith("bottom"))?'"bottom-start bottom-end"':""].filter(Boolean);this.style.gridTemplateAreas=d.join(" "),this.style.gridTemplateRows=s.width<600?f.map(m=>`minmax(0, ${this.querySelector(`[data-geokit-zone="${m}"]`).childElementCount}fr)`).join(" "):`repeat(${Math.max(1,d.length)}, minmax(0, 1fr))`}}function Vc(a){customElements.get("geokit-toolbar-layout")||customElements.define("geokit-toolbar-layout",Yc);const n=document.createElement("geokit-toolbar-layout");return n.setAttribute("part","toolbar-layout"),n.entries=a,Ar.forEach(i=>{const s=document.createElement("div");s.dataset.geokitZone=i,s.setAttribute("part",`toolbar-zone zone-${i}`),s.style.gridArea=i,n.appendChild(s)}),a.forEach(({element:i})=>n.querySelector('[data-geokit-zone="top-end"]').appendChild(i)),n}const Pr={polygon:{selectors:["a.leaflet-draw-draw-polygon"],dataTool:"polygon"},polyline:{selectors:["a.leaflet-draw-draw-polyline"],dataTool:"polyline"},rectangle:{selectors:["a.leaflet-draw-draw-rectangle"],dataTool:"rectangle"},circle:{selectors:["a.leaflet-draw-draw-circle"],dataTool:"circle"},marker:{selectors:["a.leaflet-draw-draw-marker"],dataTool:"marker"},layerCake:{selectors:["a.leaflet-draw-draw-cake"],dataTool:"layer-cake"},move:{selectors:["a.leaflet-draw-draw-move"],dataTool:"move"},select:{selectors:[],dataTool:"select"},edit:{selectors:["a.leaflet-draw-edit-edit"],dataTool:"edit"},delete:{selectors:["a.leaflet-draw-edit-remove"],dataTool:"delete"},ruler:{selectors:[".leaflet-ruler","a.leaflet-ruler"],dataTool:"ruler"},measurementSettings:{selectors:[".leaflet-ruler-settings-button"],dataTool:"measurement-settings"},layerStyle:{selectors:[],dataTool:"layer-style"},save:{selectors:[],dataTool:"save"}},Xc=Object.keys(Pr),ea="leaflet-geokit-tool-button-icon",zl=".leaflet-geokit-cake-icon, .leaflet-geokit-move-icon",Jc="[data-geokit-managed-toolbar='true']",Fl="[data-geokit-tool-popover='true']",Wc="[data-geokit-tool][aria-expanded='true']",ia=new WeakMap,na=new WeakMap,ra=new WeakMap;function Gl(a,n,i={}){if(Or(a),!a.querySelector("style[data-geokit-toolbar-styles]")){const s=document.createElement("style");s.dataset.geokitToolbarStyles="true",s.textContent=Uc,a.prepend(s)}for(const s of Xc){const r=Pr[s];for(const h of jc(a,r.selectors)){h.setAttribute("data-geokit-tool",r.dataTool),h.setAttribute("part","toolbar-button"),Kc(h);const f=n==null?void 0:n[s];f&&Qc(h,f,s),ql(h,s,{source:"leaflet-toolbar",activate:!1,onTrigger:i.onTrigger})}}of(a,n,i),Gc(a),a.querySelector("[data-geokit-announcement='status']")||ta(a,""),a.querySelector("[data-geokit-announcement='alert']")||ta(a,"",!0),Nr(a,a.dataset.geokitActiveTool||null)}function Nr(a,n){a.dataset.geokitActiveTool=n!=null?n:"",a.querySelectorAll(".leaflet-geokit-toolbar-button").forEach(i=>{var h;const s=!!(n&&i.dataset.geokitTool===Pr[n].dataTool);["polygon","polyline","rectangle","circle","marker","layer-cake","move","edit","delete","ruler"].includes((h=i.dataset.geokitTool)!=null?h:"")&&i.setAttribute("aria-pressed",String(s)),i.dataset.geokitActive=String(s),i.dataset.geokitDisabled=String(i.disabled),i.setAttribute("part",`toolbar-button${s?" active":""}${i.disabled?" disabled":""}`)})}function jc(a,n){const i=new Set;for(const s of n)a.querySelectorAll(s).forEach(r=>{i.add(r)});return[...i]}function Kc(a){const n=ia.get(a);n&&(a.removeEventListener("click",n),ia.delete(a)),delete a.__geokitToolButtonConfig;const i=zo(a.dataset.geokitToolButtonClass);i.length>0&&a.classList.remove(...i),delete a.dataset.geokitToolButtonClass,a.removeAttribute("data-geokit-custom-tool-button"),a.dataset.geokitOriginalTitle!==void 0&&Ul(a,"title",a.dataset.geokitOriginalTitle),a.dataset.geokitOriginalAriaLabel!==void 0&&Ul(a,"aria-label",a.dataset.geokitOriginalAriaLabel),a.dataset.geokitOriginalStyleBackgroundImage!==void 0&&oa(a,"background-image",a.dataset.geokitOriginalStyleBackgroundImage,a.dataset.geokitOriginalStyleBackgroundImagePriority),a.dataset.geokitOriginalStylePosition!==void 0&&oa(a,"position",a.dataset.geokitOriginalStylePosition,a.dataset.geokitOriginalStylePositionPriority),Array.from(a.children).forEach(s=>{s instanceof HTMLElement&&s.dataset.geokitToolButtonIcon==="true"&&s.remove()}),a.querySelectorAll(zl).forEach(s=>{s.hidden=!1}),a.removeAttribute("aria-expanded")}function Ul(a,n,i){i?a.setAttribute(n,i):a.removeAttribute(n)}function oa(a,n,i,s){i?a.style.setProperty(n,i,s):a.style.removeProperty(n)}function Qc(a,n,i){var h;$c(a),a.__geokitToolButtonConfig=n,a.setAttribute("data-geokit-custom-tool-button","true"),n.title&&a.setAttribute("title",n.title);const s=(h=n.ariaLabel)!=null?h:n.title;s&&a.setAttribute("aria-label",s);const r=zo(n.className);r.length>0&&(a.classList.add(...r),a.dataset.geokitToolButtonClass=r.join(" ")),n.iconUrl?Fo(a,n,{tool:i}):(n.iconHtml||n.renderIcon)&&Fo(a,n,{tool:i})}function $c(a){var n,i;a.dataset.geokitOriginalTitle===void 0&&(a.dataset.geokitOriginalTitle=(n=a.getAttribute("title"))!=null?n:""),a.dataset.geokitOriginalAriaLabel===void 0&&(a.dataset.geokitOriginalAriaLabel=(i=a.getAttribute("aria-label"))!=null?i:""),a.dataset.geokitOriginalStyleBackgroundImage===void 0&&(a.dataset.geokitOriginalStyleBackgroundImage=a.style.getPropertyValue("background-image"),a.dataset.geokitOriginalStyleBackgroundImagePriority=a.style.getPropertyPriority("background-image")),a.dataset.geokitOriginalStylePosition===void 0&&(a.dataset.geokitOriginalStylePosition=a.style.getPropertyValue("position"),a.dataset.geokitOriginalStylePositionPriority=a.style.getPropertyPriority("position"))}function zo(a){return a?a.split(/\s+/).map(n=>n.trim()).filter(Boolean):[]}function tf(a){return!!(a.iconUrl||a.iconHtml||a.renderIcon)}function Fo(a,n,i={}){var m,_;const[s,r]=ef(n.iconSize);a.classList.contains("leaflet-geokit-toolbar-button")||(a.style.setProperty("background-image","none","important"),a.style.setProperty("position","relative")),a.querySelectorAll(zl).forEach(x=>{x.hidden=!0});const h=document.createElement("span");h.className=ea,h.dataset.geokitToolButtonIcon="true",h.setAttribute("aria-hidden","true"),h.setAttribute("part","icon"),h.style.setProperty("--_geokit-icon-width",`${s}px`),h.style.setProperty("--_geokit-icon-height",`${r}px`);const f=(_=n.renderIcon)==null?void 0:_.call(n,{tool:(m=i.tool)!=null?m:"polygon",groupId:i.groupId,button:a});if(f instanceof HTMLElement||typeof SVGElement!="undefined"&&f instanceof SVGElement)h.appendChild(f);else if(typeof f=="string"&&f.trim())h.innerHTML=f;else if(n.iconHtml)h.innerHTML=n.iconHtml;else if(n.iconUrl){const x=document.createElement("img");x.src=n.iconUrl,x.alt="",x.decoding="async",x.draggable=!1,h.appendChild(x)}a.appendChild(h)}function ef(a){const n=a==null?void 0:a[0],i=a==null?void 0:a[1];return typeof n=="number"&&Number.isFinite(n)&&n>0&&typeof i=="number"&&Number.isFinite(i)&&i>0?[n,i]:[18,18]}function ql(a,n,i){const s=r=>{var m,_;if(a instanceof HTMLButtonElement&&a.disabled){r.preventDefault(),r.stopPropagation();return}const h=nf(a),f=rf(a);h!=null&&h.popover?uf(a,n,h,{container:f,groupId:i.groupId}):Or(f),(m=i.onTrigger)==null||m.call(i,n,{source:i.source,groupId:i.groupId,activate:i.activate});const d=f.querySelector(Fl);if(d&&((_=d.querySelector("button:not(:disabled), [href], input, select, textarea, [tabindex='0']"))!=null?_:d).focus(),r.detail===0){const x=a.getRootNode(),b=x instanceof ShadowRoot?x.activeElement:document.activeElement;b instanceof HTMLElement&&b.closest("[role='dialog']")||a.focus()}i.activate&&(r.preventDefault(),r.stopPropagation())};a.addEventListener("click",s),ia.set(a,s)}function nf(a){const n=a.__geokitToolButtonConfig;if(n)return n;const i=a.dataset.geokitToolButtonConfig;if(!i)return null;try{return JSON.parse(i)}catch{return null}}function rf(a){var i;const n=a.closest("[data-geokit-map-container]");return(i=n!=null?n:a.parentElement)!=null?i:a}function of(a,n,i){var f,d;a.setAttribute("data-geokit-map-container","true"),(f=a.querySelector("geokit-toolbar-layout"))==null||f.remove(),a.querySelectorAll(Jc).forEach(m=>m.remove());const s=(d=i.toolbarGroups)!=null?d:[],r=s.some(m=>(m==null?void 0:m.hideDefaultToolbar)!==!1);sf(a,r);const h=[];s.forEach(m=>{var E;if(!(m!=null&&m.id)||!Array.isArray(m.tools)||m.tools.length===0)return;const _=document.createElement("div");_.dataset.geokitManagedToolbar="true",_.dataset.geokitToolbarGroup=m.id,_.className="leaflet-geokit-toolbar-group leaflet-bar",_.setAttribute("role","toolbar"),_.setAttribute("aria-label",(E=m.ariaLabel)!=null?E:m.id),_.setAttribute("part","toolbar-group");const x=m.orientation==="horizontal"?"horizontal":"vertical";_.dataset.geokitToolbarOrientation=x,_.setAttribute("aria-orientation",x),_.style.setProperty("--_geokit-direction",x==="horizontal"?"row":"column"),typeof m.gap=="number"&&Number.isFinite(m.gap)&&m.gap>=0&&_.style.setProperty("--_geokit-gap",`${m.gap}px`),lf(_,m.position,m.offset);const b=zo(m.className);b.length>0&&_.classList.add(...b),m.tools.forEach((C,M)=>{const S=af(C,m,M,n==null?void 0:n[C]);ql(S,C,{source:"toolbar",activate:!0,groupId:m.id,onTrigger:i.onTrigger}),_.appendChild(S)}),Zc(m)?(_.setAttribute("part",`toolbar-group toolbar-group-${m.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`),h.push({element:_,config:m})):a.appendChild(_)}),h.length&&a.appendChild(Vc(h))}function sf(a,n){a.toggleAttribute("data-geokit-default-toolbar-hidden",n),a.querySelectorAll(".leaflet-draw-toolbar, .leaflet-ruler, .leaflet-ruler-settings-control").forEach(i=>{n?(i.dataset.geokitOriginalDisplay===void 0&&(i.dataset.geokitOriginalDisplay=i.style.display,i.dataset.geokitOriginalDisplayPriority=i.style.getPropertyPriority("display")),i.style.setProperty("display","none","important")):i.dataset.geokitOriginalDisplay!==void 0&&(oa(i,"display",i.dataset.geokitOriginalDisplay,i.dataset.geokitOriginalDisplayPriority),delete i.dataset.geokitOriginalDisplay,delete i.dataset.geokitOriginalDisplayPriority)})}function af(a,n,i,s){var x,b,E,C,M,S,z,Z,O;const r=document.createElement("button");r.type="button",r.dataset.geokitTool=(b=(x=Pr[a])==null?void 0:x.dataTool)!=null?b:a,r.dataset.geokitToolbarGroup=n.id,r.dataset.geokitToolbarPosition=(E=n.position)!=null?E:"topright",r.dataset.geokitToolInstance=df(n.id,a,i),r.className="leaflet-geokit-toolbar-button",r.disabled=(s==null?void 0:s.disabled)===!0,r.setAttribute("aria-disabled",String(r.disabled));const h=(C=s==null?void 0:s.title)!=null?C:Zl(a);r.title=h,r.setAttribute("aria-label",(M=s==null?void 0:s.ariaLabel)!=null?M:h),s!=null&&s.popover&&(r.setAttribute("aria-haspopup","dialog"),r.setAttribute("aria-expanded","false"));const f=zo(s==null?void 0:s.className);if(f.length>0&&r.classList.add(...f),s&&(r.__geokitToolButtonConfig=s,tf(s)&&Fo(r,s,{tool:a,groupId:n.id})),!r.querySelector(`.${ea}`)){const q={iconHtml:gf(a),iconSize:(S=s==null?void 0:s.iconSize)!=null?S:[20,20]};Fo(r,q,{tool:a,groupId:n.id})}const d=`${n.id}-${a}-${i}`,m=r.querySelector(`.${ea}`),_=document.createElement("slot");_.name=`${d}-icon`,_.append(...Array.from(m.childNodes)),m.appendChild(_);for(const q of["badge","tooltip"]){const j=document.createElement("span");j.className=`leaflet-geokit-tool-${q}`,j.setAttribute("part",q),j.setAttribute("aria-hidden","true");const X=document.createElement("slot");X.name=`${d}-${q}`,X.textContent=q==="badge"?(z=s==null?void 0:s.badge)!=null?z:"":(O=(Z=s==null?void 0:s.tooltip)!=null?Z:s==null?void 0:s.ariaLabel)!=null?O:h,j.appendChild(X),r.appendChild(j)}return r}function lf(a,n="topright",i){const[s,r]=pf(i);a.dataset.geokitToolbarPosition=n,a.style.setProperty("--_geokit-offset-x",`${s}px`),a.style.setProperty("--_geokit-offset-y",`${r}px`)}function uf(a,n,i,s){var d,m,_,x,b,E,C,M,S;if(!i.popover)return;Or(s.container);const r=document.createElement("div");if(r.setAttribute("part","popover"),r.dataset.geokitToolPopover="true",r.dataset.geokitTool=(m=(d=Pr[n])==null?void 0:d.dataTool)!=null?m:n,a.dataset.geokitToolInstance&&(r.dataset.geokitToolInstance=a.dataset.geokitToolInstance),s.groupId&&(r.dataset.geokitToolbarGroup=s.groupId),r.setAttribute("role","dialog"),r.setAttribute("aria-label",(x=(_=i.popover.ariaLabel)!=null?_:i.popover.title)!=null?x:Zl(n)),i.popover.title){const z=document.createElement("strong");z.textContent=i.popover.title,r.appendChild(z)}if(i.popover.body){const z=document.createElement("div");z.textContent=i.popover.body,r.appendChild(z)}if(i.popover.html){const z=document.createElement("div");z.innerHTML=i.popover.html,r.appendChild(z)}const h=(E=(b=i.popover).render)==null?void 0:E.call(b,{tool:n,groupId:s.groupId,button:a,popover:r}),f=typeof DocumentFragment!="undefined"&&h instanceof DocumentFragment;if(h instanceof HTMLElement||f)r.appendChild(h);else if(typeof h=="string"&&h.trim()){const z=document.createElement("div");z.innerHTML=h,r.appendChild(z)}s.container.appendChild(r),hf(s.container,a,r),a.setAttribute("aria-expanded","true"),ra.set(r,{tool:n,groupId:s.groupId,button:a,config:i}),cf(s.container,a,r),r.tabIndex=-1,((C=r.querySelector("button:not(:disabled), [href], input, select, textarea, [tabindex='0']"))!=null?C:r).focus(),(S=(M=i.popover).onOpen)==null||S.call(M,{tool:n,groupId:s.groupId,button:a,popover:r})}function hf(a,n,i){const s=a.getBoundingClientRect(),r=n.getBoundingClientRect(),h=Math.max(8,Math.min(r.left-s.left,s.width-i.offsetWidth-8)),f=Math.max(8,Math.min(r.bottom-s.top+8,s.height-i.offsetHeight-8));i.style.setProperty("left",`${h}px`),i.style.setProperty("top",`${f}px`)}function cf(a,n,i){const s=f=>{f.key==="Escape"&&f.composedPath().some(d=>d===i||d===n)&&(f.preventDefault(),f.stopPropagation(),Or(a),n.focus())},r=f=>{f.composedPath().some(d=>d===i||d===n)||Or(a)};document.addEventListener("keydown",s,!0);const h=window.setTimeout(()=>{i.isConnected&&document.addEventListener("pointerdown",r,!0)},0);na.set(i,{keydown:s,pointerdown:r,pointerdownTimer:h})}function Or(a){a.querySelectorAll(Fl).forEach(n=>{var r,h,f;const i=ra.get(n);i==null||i.button.setAttribute("aria-expanded","false"),i||(r=ff(a,n))==null||r.removeAttribute("aria-expanded");const s=na.get(n);s&&(window.clearTimeout(s.pointerdownTimer),document.removeEventListener("keydown",s.keydown,!0),document.removeEventListener("pointerdown",s.pointerdown,!0),na.delete(n)),n.remove(),i&&((f=(h=i.config.popover)==null?void 0:h.onClose)==null||f.call(h,{tool:i.tool,groupId:i.groupId,button:i.button,popover:n}),ra.delete(n))})}function ff(a,n){const i=a.querySelectorAll(Wc);for(const s of i)if(n.dataset.geokitToolInstance&&s.dataset.geokitToolInstance===n.dataset.geokitToolInstance||s.dataset.geokitTool===n.dataset.geokitTool&&s.dataset.geokitToolbarGroup===n.dataset.geokitToolbarGroup)return s;return null}function df(a,n,i){return`${a}:${n}:${i}`}function Zl(a){return{polygon:"Draw polygon",polyline:"Draw line",rectangle:"Draw rectangle",circle:"Draw circle",marker:"Place marker",layerCake:"Draw layer cake",move:"Move feature",select:"Select feature",edit:"Edit features",delete:"Delete features",ruler:"Measure distance",measurementSettings:"Measurement settings",layerStyle:"Layer style",save:"Save map geometry"}[a]}function gf(a){const n="currentColor",i="none";return{polygon:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linejoin="round"><path d="M5.5 7.2 9.2 4.8 18.5 8.3 16.1 18.2 6.3 15.7Z"/><circle cx="5.5" cy="7.2" r="1.2" fill="currentColor"/><circle cx="18.5" cy="8.3" r="1.2" fill="currentColor"/><circle cx="16.1" cy="18.2" r="1.2" fill="currentColor"/></svg>`,polyline:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.8 16.7 9.2 9.5 14.4 13.1 19 6.1"/><circle cx="4.8" cy="16.7" r="1.3" fill="currentColor"/><circle cx="14.4" cy="13.1" r="1.3" fill="currentColor"/><circle cx="19" cy="6.1" r="1.3" fill="currentColor"/></svg>`,rectangle:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8"><rect x="5.5" y="6.5" width="13" height="11" rx="2"/><path d="M8.5 10h7"/></svg>`,circle:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8"><circle cx="12" cy="12" r="6.8"/><circle cx="12" cy="12" r="2" fill="currentColor"/></svg>`,marker:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linejoin="round"><path d="M12 3.4a6 6 0 0 0-6 6c0 4.2 4.5 9.4 5.6 10.5a.6.6 0 0 0 .8 0C13.5 18.8 18 13.6 18 9.4a6 6 0 0 0-6-6Z"/><circle cx="12" cy="9.5" r="2.1" fill="currentColor" stroke="none"/></svg>`,layerCake:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linecap="round"><ellipse cx="12" cy="7.6" rx="6.8" ry="2.7"/><path d="M5.2 11c1.3 1.2 3.8 2 6.8 2s5.5-.8 6.8-2M6.3 15c1.3.9 3.3 1.5 5.7 1.5s4.4-.6 5.7-1.5"/></svg>`,move:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v16M4 12h16M12 4l-2 2M12 4l2 2M20 12l-2-2M20 12l-2 2M12 20l-2-2M12 20l2-2M4 12l2-2M4 12l2 2"/></svg>`,select:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linejoin="round"><path d="M6 4.8 18.5 12 13 13.4 10.2 19Z"/></svg>`,edit:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linejoin="round"><path d="m6 17.8 3.5-.7 7.7-7.7-2.8-2.8-7.7 7.7Z"/><path d="m12.9 7.9 2.8 2.8"/></svg>`,delete:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M7.5 8.2h9l-.8 10a1.7 1.7 0 0 1-1.7 1.5h-4a1.7 1.7 0 0 1-1.7-1.5Z"/><path d="M9.5 8.2V6.8c0-.7.6-1.3 1.3-1.3h2.4c.7 0 1.3.6 1.3 1.3v1.4M10.5 11.5v4.8M13.5 11.5v4.8"/></svg>`,ruler:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linejoin="round"><path d="M5.2 17.8 17.8 5.2l1.7 1.7L6.9 19.5H5.2Z"/><path d="m12.2 8 1.5 1.5M9.9 10.3l1.5 1.5M7.6 12.6l1.5 1.5"/></svg>`,measurementSettings:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.6" stroke-linecap="round"><circle cx="12" cy="12" r="3.2"/><path d="M12 4.8v2M12 17.2v2M4.8 12h2M17.2 12h2M7 7l1.4 1.4M15.6 15.6 17 17M17 7l-1.4 1.4M8.4 15.6 7 17"/></svg>`,layerStyle:'<svg viewBox="0 0 24 24" fill="none"><path d="M5 6h14v3H5z" fill="currentColor" opacity=".9"/><path d="M5 11h14v3H5z" fill="currentColor" opacity=".65"/><path d="M5 16h14v3H5z" fill="currentColor" opacity=".4"/></svg>',save:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linejoin="round" stroke-linecap="round"><path d="M5.5 4.8h11.2l1.8 1.8v12.6h-13Z"/><path d="M8 4.8v5h7v-5M8.2 19.2v-5.4h7.6v5.4"/><path d="M10 16.4h4"/></svg>`}[a]}function pf(a){const n=a==null?void 0:a[0],i=a==null?void 0:a[1];return typeof n=="number"&&Number.isFinite(n)&&n>=0&&typeof i=="number"&&Number.isFinite(i)&&i>=0?[n,i]:[10,10]}const Hl=new WeakSet;function mf(a=Do){var s;if(Hl.has(a))return;const n=a.DrawToolbar;if(!((s=n==null?void 0:n.prototype)!=null&&s.getModeHandlers))return;const i=n.prototype.getModeHandlers;n.prototype.getModeHandlers=function(r){var f,d,m,_;const h=i.call(this,r);if((f=this.options)!=null&&f.cake){const x=(d=a.Draw)==null?void 0:d.Cake;if(!x)return h;h.push({enabled:!0,handler:new x(r,this.options.cake),title:"Draw Layer Cake (Subtractive Zones)"})}if((m=this.options)!=null&&m.move){const x=(_=a.Draw)==null?void 0:_.Move;if(!x)return h;h.push({enabled:!0,handler:new x(r,this.options.move),title:"Move/Translate Features"})}return h},Hl.add(a)}const ks=class ks extends le.Draw.Circle{constructor(n,i){super(n,i),this.type=ks.TYPE}addHooks(){super.addHooks();const n=this._tooltip;n!=null&&n.updateContent&&n.updateContent({text:"Click and drag to draw the Layer Cake base",subtext:"Release mouse to finish base layer"})}};Q(ks,"TYPE","cake");let Go=ks;le.Draw.Cake=Go;function yf(a){const n=a.Draw;if(!n||n.Cake)return;const s=class s extends n.Circle{constructor(h,f){super(h,f),this.type=s.TYPE}addHooks(){super.addHooks();const h=this._tooltip;h!=null&&h.updateContent&&h.updateContent({text:"Click and drag to draw the Layer Cake base",subtext:"Release mouse to finish base layer"})}};Q(s,"TYPE","cake");let i=s;n.Cake=i}function Yl(a,n,i){const s=a.getContainer(),r=s.style.touchAction;s.style.touchAction="none";let h=null,f=!1;const d=()=>{f=!1};a.on("unload",d);const m=(S,z)=>({target:z,originalEvent:S,latlng:a.mouseEventToLatLng(S)}),_=S=>{S.preventDefault(),S.stopPropagation()},x=()=>{var z;const S=h;h=null,S!==null&&((z=s.hasPointerCapture)!=null&&z.call(s,S))&&s.releasePointerCapture(S),f&&a.dragging.enable(),f=!1},b=S=>{if(h!==null||!S.isPrimary||S.button!==0)return;let z;const Z=S.composedPath(),O=a.mouseEventToLayerPoint(S),q=new Set;if(n.eachLayer(j=>{var ot;const X=(ot=j.getElement)==null?void 0:ot.call(j);X&&Z.includes(X)&&(z=j);const et=j._renderer;if(!X&&et&&!q.has(et)&&Z.includes(et._container)){q.add(et);for(let I=et._drawFirst;I;I=I.next){const N=I.layer;n.hasLayer(N)&&N.options.interactive&&N._containsPoint(O)&&(z=N)}}}),!!z&&(_(S),!i.pending())){h=S.pointerId,f=a.dragging.enabled(),a.dragging.disable(),i.start(m(S,z));try{s.setPointerCapture(h)}catch{x(),i.cancel()}}},E=S=>{S.pointerId===h&&(_(S),i.move(m(S)))},C=S=>{S.pointerId===h&&(_(S),i.move(m(S)),x(),i.end(m(S)))},M=S=>{S.pointerId===h&&(_(S),x(),i.cancel())};return s.addEventListener("pointerdown",b,!0),s.addEventListener("pointermove",E,!0),s.addEventListener("pointerup",C,!0),s.addEventListener("pointercancel",M,!0),s.addEventListener("lostpointercapture",M,!0),()=>{x(),i.cancel(),a.off("unload",d),s.style.touchAction=r,s.removeEventListener("pointerdown",b,!0),s.removeEventListener("pointermove",E,!0),s.removeEventListener("pointerup",C,!0),s.removeEventListener("pointercancel",M,!0),s.removeEventListener("lostpointercapture",M,!0)}}const Ls=class Ls extends le.Draw.Feature{constructor(i,s){super(i,s);Q(this,"_unbindPointer",null);Q(this,"_featureGroup");Q(this,"_selectedLayer",null);Q(this,"_originalLatLngs",null);Q(this,"_dragStartLatLng",null);Q(this,"_isDragging",!1);Q(this,"_pendingMove",null);this.type=Ls.TYPE,this._featureGroup=(s==null?void 0:s.featureGroup)||new le.FeatureGroup}enable(){this._enabled||super.enable()}disable(){this._enabled&&super.disable()}addHooks(){const i=this._map;if(!i)return;le.DomUtil.addClass(i.getContainer(),"leaflet-draw-move-mode"),this._unbindPointer=Yl(i,this._featureGroup,{start:r=>this._onLayerMouseDown(r),move:r=>this._onMouseMove(r),end:r=>this._onMouseUp(r),cancel:()=>this.cancelMove(),pending:()=>this.hasPendingMove()}),i.on("unload",this.disable,this),this._featureGroup.eachLayer(r=>{this._enableLayerHover(r)});const s=this._tooltip;s!=null&&s.updateContent&&s.updateContent({text:"Click and drag a feature to move it",subtext:""})}removeHooks(){var s;const i=this._map;i&&((s=this._unbindPointer)==null||s.call(this),this._unbindPointer=null,i.off("unload",this.disable,this),le.DomUtil.removeClass(i.getContainer(),"leaflet-draw-move-mode"),this._featureGroup.eachLayer(r=>{this._disableLayerHover(r)}),this._cleanupDragging())}_enableLayerHover(i){i.on&&(i.on("mouseover",this._onLayerMouseOver,this),i.on("mouseout",this._onLayerMouseOut,this))}_disableLayerHover(i){i.off&&(i.off("mouseover",this._onLayerMouseOver,this),i.off("mouseout",this._onLayerMouseOut,this))}_onLayerMouseOver(i){if(this._isDragging)return;const s=i.target;if(s.getElement){const r=s.getElement();r&&(r.style.cursor="grab")}else s._path&&(s._path.style.cursor="grab")}_onLayerMouseOut(i){if(this._isDragging)return;const s=i.target;if(s.getElement){const r=s.getElement();r&&(r.style.cursor="")}else s._path&&(s._path.style.cursor="")}_onLayerMouseDown(i){if(this._isDragging)return;le.DomEvent.stopPropagation(i.originalEvent),le.DomEvent.preventDefault(i.originalEvent);const s=i.target;if(this._selectedLayer=s,this._isDragging=!0,this._dragStartLatLng=i.latlng,this._storeOriginalLatLngs(s),s.getElement){const h=s.getElement();h&&(h.style.cursor="grabbing")}else s._path&&(s._path.style.cursor="grabbing");const r=s.toGeoJSON();this._pendingMove={layer:s,originalGeoJSON:r,newGeoJSON:r}}_storeOriginalLatLngs(i){i.getLatLng?this._originalLatLngs=i.getLatLng():i.getLatLngs&&(this._originalLatLngs=JSON.parse(JSON.stringify(i.getLatLngs())))}_onMouseMove(i){if(!this._isDragging||!this._selectedLayer||!this._dragStartLatLng)return;const s=this._selectedLayer,r={lat:i.latlng.lat-this._dragStartLatLng.lat,lng:i.latlng.lng-this._dragStartLatLng.lng};if(s.setLatLng){const h=le.latLng(this._originalLatLngs.lat+r.lat,this._originalLatLngs.lng+r.lng);s.setLatLng(h)}else if(s.setLatLngs){const h=this._offsetLatLngs(this._originalLatLngs,r);s.setLatLngs(h)}}_offsetLatLngs(i,s){return i instanceof le.LatLng||i.lat!==void 0&&i.lng!==void 0?le.latLng(i.lat+s.lat,i.lng+s.lng):Array.isArray(i)?i.map(r=>this._offsetLatLngs(r,s)):i}_onMouseUp(i){var r,h;if(!this._isDragging||!this._selectedLayer)return;this._pendingMove&&(this._pendingMove.newGeoJSON=this._selectedLayer.toGeoJSON());const s=this._selectedLayer;if(s.getElement){const f=s.getElement();f&&(f.style.cursor="grab")}else s._path&&(s._path.style.cursor="grab");this._map.fire("draw:moveend",{layer:this._selectedLayer,originalGeoJSON:(r=this._pendingMove)==null?void 0:r.originalGeoJSON,newGeoJSON:(h=this._pendingMove)==null?void 0:h.newGeoJSON}),this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._isDragging=!1}_cleanupDragging(){if(this._selectedLayer){const i=this._selectedLayer;if(i.getElement){const s=i.getElement();s&&(s.style.cursor="")}else i._path&&(i._path.style.cursor="")}this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._selectedLayer=null,this._originalLatLngs=null,this._dragStartLatLng=null,this._isDragging=!1,this._pendingMove=null}confirmMove(){if(!this._pendingMove)return;const i=this._pendingMove;this._cleanupDragging(),this._map.fire("draw:moveconfirmed",{layer:i.layer,originalGeoJSON:i.originalGeoJSON,newGeoJSON:i.newGeoJSON})}cancelMove(){if(!this._pendingMove)return;const i=this._pendingMove.layer;i.setLatLng&&this._originalLatLngs?i.setLatLng(this._originalLatLngs):i.setLatLngs&&this._originalLatLngs&&i.setLatLngs(this._originalLatLngs),this._cleanupDragging()}hasPendingMove(){return this._pendingMove!==null}};Q(Ls,"TYPE","move");let sa=Ls;le.Draw.Move=sa;function _f(a){const n=a.Draw;if(!n||n.Move)return;const s=class s extends n.Feature{constructor(f,d){super(f,d);Q(this,"_unbindPointer",null);Q(this,"_featureGroup");Q(this,"_selectedLayer",null);Q(this,"_originalLatLngs",null);Q(this,"_dragStartLatLng",null);Q(this,"_isDragging",!1);Q(this,"_pendingMove",null);this.type=s.TYPE,this._featureGroup=(d==null?void 0:d.featureGroup)||new le.FeatureGroup}enable(){this._enabled||super.enable()}disable(){this._enabled&&super.disable()}addHooks(){const f=this._map;if(!f)return;a.DomUtil.addClass(f.getContainer(),"leaflet-draw-move-mode"),this._unbindPointer=Yl(f,this._featureGroup,{start:m=>this._onLayerMouseDown(m),move:m=>this._onMouseMove(m),end:m=>this._onMouseUp(m),cancel:()=>this.cancelMove(),pending:()=>this.hasPendingMove()}),f.on("unload",this.disable,this),this._featureGroup.eachLayer(m=>{this._enableLayerHover(m)});const d=this._tooltip;d!=null&&d.updateContent&&d.updateContent({text:"Click and drag a feature to move it",subtext:""})}removeHooks(){var d;const f=this._map;f&&(a.DomUtil.removeClass(f.getContainer(),"leaflet-draw-move-mode"),(d=this._unbindPointer)==null||d.call(this),this._unbindPointer=null,f.off("unload",this.disable,this),this._featureGroup.eachLayer(m=>{this._disableLayerHover(m)}),this._cleanupDragging())}_enableLayerHover(f){f.on&&(f.on("mouseover",this._onLayerMouseOver,this),f.on("mouseout",this._onLayerMouseOut,this))}_disableLayerHover(f){f.off&&(f.off("mouseover",this._onLayerMouseOver,this),f.off("mouseout",this._onLayerMouseOut,this))}_onLayerMouseOver(f){if(this._isDragging)return;const d=f.target;if(d.getElement){const m=d.getElement();m&&(m.style.cursor="grab")}else d._path&&(d._path.style.cursor="grab")}_onLayerMouseOut(f){if(this._isDragging)return;const d=f.target;if(d.getElement){const m=d.getElement();m&&(m.style.cursor="")}else d._path&&(d._path.style.cursor="")}_onLayerMouseDown(f){if(this._isDragging)return;a.DomEvent.stopPropagation(f.originalEvent),a.DomEvent.preventDefault(f.originalEvent);const d=f.target;if(this._selectedLayer=d,this._isDragging=!0,this._dragStartLatLng=f.latlng,this._storeOriginalLatLngs(d),d.getElement){const _=d.getElement();_&&(_.style.cursor="grabbing")}else d._path&&(d._path.style.cursor="grabbing");const m=d.toGeoJSON();this._pendingMove={layer:d,originalGeoJSON:m,newGeoJSON:m}}_storeOriginalLatLngs(f){f.getLatLng?this._originalLatLngs=f.getLatLng():f.getLatLngs&&(this._originalLatLngs=JSON.parse(JSON.stringify(f.getLatLngs())))}_onMouseMove(f){if(!this._isDragging||!this._selectedLayer||!this._dragStartLatLng)return;const d=this._selectedLayer,m={lat:f.latlng.lat-this._dragStartLatLng.lat,lng:f.latlng.lng-this._dragStartLatLng.lng};if(d.setLatLng){const _=a.latLng(this._originalLatLngs.lat+m.lat,this._originalLatLngs.lng+m.lng);d.setLatLng(_)}else if(d.setLatLngs){const _=this._offsetLatLngs(this._originalLatLngs,m);d.setLatLngs(_)}}_offsetLatLngs(f,d){return f instanceof a.LatLng||f.lat!==void 0&&f.lng!==void 0?a.latLng(f.lat+d.lat,f.lng+d.lng):Array.isArray(f)?f.map(m=>this._offsetLatLngs(m,d)):f}_onMouseUp(f){var m,_;if(!this._isDragging||!this._selectedLayer)return;this._pendingMove&&(this._pendingMove.newGeoJSON=this._selectedLayer.toGeoJSON());const d=this._selectedLayer;if(d.getElement){const x=d.getElement();x&&(x.style.cursor="grab")}else d._path&&(d._path.style.cursor="grab");this._map.fire("draw:moveend",{layer:this._selectedLayer,originalGeoJSON:(m=this._pendingMove)==null?void 0:m.originalGeoJSON,newGeoJSON:(_=this._pendingMove)==null?void 0:_.newGeoJSON}),this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._isDragging=!1}_cleanupDragging(){if(this._selectedLayer){const f=this._selectedLayer;if(f.getElement){const d=f.getElement();d&&(d.style.cursor="")}else f._path&&(f._path.style.cursor="")}this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._selectedLayer=null,this._originalLatLngs=null,this._dragStartLatLng=null,this._isDragging=!1,this._pendingMove=null}confirmMove(){if(!this._pendingMove)return;const f=this._pendingMove;this._cleanupDragging(),this._map.fire("draw:moveconfirmed",{layer:f.layer,originalGeoJSON:f.originalGeoJSON,newGeoJSON:f.newGeoJSON})}cancelMove(){if(!this._pendingMove)return;const f=this._pendingMove.layer;f.setLatLng&&this._originalLatLngs?f.setLatLng(this._originalLatLngs):f.setLatLngs&&this._originalLatLngs&&f.setLatLngs(this._originalLatLngs),this._cleanupDragging()}hasPendingMove(){return this._pendingMove!==null}};Q(s,"TYPE","move");let i=s;n.Move=i}const vf=63710088e-1;function aa(a){return a*Math.PI/180}function Vl(a){return a*180/Math.PI}function bf(a,n,i){const s=n/vf,r=aa(i),h=aa(a.lat),f=aa(a.lng),d=Math.sin(h),m=Math.cos(h),_=Math.sin(s),x=Math.cos(s),b=d*x+m*_*Math.cos(r),E=Math.asin(b),C=Math.sin(r)*_*m,M=x-d*b,S=f+Math.atan2(C,M);return{lat:Vl(E),lng:Vl(S)}}function xf(a){let n=0;for(let i=0;i<a.length-1;i++){const[s,r]=a[i],[h,f]=a[i+1];n+=s*f-h*r}return n/2}function la(a){const n=a[0],i=a.at(-1);return!n||!i||n[0]===i[0]&&n[1]===i[1]?a:[...a,n]}function ua(a,n){const i=la(a);if(xf(i)<0===n)return i;const h=[...i].reverse();return la(h)}function ha(a,n,i){if(i<4)throw new Error("steps must be >= 4");const s=[];for(let r=0;r<i;r++){const h=r/i*360,f=bf(a,n,h);s.push([f.lng,f.lat])}return la(s)}function wf(a){const{id:n,center:i,radiusMeters:s,layerIndex:r,steps:h}=a,f=ua(ha(i,s,h),!1);return{type:"Feature",properties:{id:n,layer_index:r,radius_outer:s,type:"core",_meta:{lat:i.lat,lng:i.lng,radius:s}},geometry:{type:"Polygon",coordinates:[f]}}}function kf(a){const{id:n,center:i,radiusOuterMeters:s,radiusInnerMeters:r,layerIndex:h,steps:f}=a,d=ua(ha(i,s,f),!1),m=ua(ha(i,r,f),!0);return{type:"Feature",properties:{id:n,layer_index:h,radius_outer:s,type:"ring",_meta:{lat:i.lat,lng:i.lng,radius:s}},geometry:{type:"Polygon",coordinates:[d,m]}}}function Xl(a){const{circles:n,steps:i=64}=a,s=[...n].sort((h,f)=>h.getRadius()-f.getRadius()),r=[];return s.forEach((h,f)=>{const d=h.getLatLng(),m=h.getRadius(),_=Mr();if(f===0){r.push(wf({id:_,center:d,radiusMeters:m,layerIndex:f,steps:i}));return}const b=s[f-1].getRadius();r.push(kf({id:_,center:d,radiusOuterMeters:m,radiusInnerMeters:b,layerIndex:f,steps:i}))}),{type:"FeatureCollection",features:r}}function Rr(a){a.preventDefault(),a.stopPropagation()}function Lf(a){var _,x;const{root:n,addButtonId:i,saveButtonId:s,onAddRing:r,onSave:h}=a,f=(_=n.querySelector)==null?void 0:_.call(n,`#${i}`),d=(x=n.querySelector)==null?void 0:x.call(n,`#${s}`);if(!f||!d)return;const m="data-cake-controls-bound";if(!(f.hasAttribute(m)||d.hasAttribute(m))){f.setAttribute(m,"true"),d.setAttribute(m,"true");for(const b of[f,d])b.addEventListener("pointerdown",Rr),b.addEventListener("mousedown",Rr),b.addEventListener("touchstart",Rr);f.addEventListener("click",b=>{Rr(b),r()}),d.addEventListener("click",b=>{Rr(b),h()})}}function Ef(a){var i;const n=(i=a.options)!=null?i:{};n.original||(n.original={...n}),n.editing||(n.editing={...n})}function Dr(a,n){if(n==="imperial"){const i=a*3.28084;return i>=5280?`${(i/5280).toFixed(2)} mi`:`${Math.round(i)} ft`}return a>=1e3?`${(a/1e3).toFixed(2)} km`:`${Math.round(a)} m`}class Tf{constructor(n,i,s,r="metric",h){Q(this,"map");Q(this,"layers",[]);Q(this,"controlsGroup");Q(this,"onSave");Q(this,"sessionId",Mr().slice(0,8));Q(this,"baseCircleOptions");Q(this,"detachMapListeners",[]);Q(this,"renderScheduled",!1);Q(this,"measurementSystem");Q(this,"name","Layer cake");Q(this,"style",{...zn.crop});Q(this,"destroyed",!1);Q(this,"saving",!1);this.onChange=h,this.map=n,this.onSave=s,this.measurementSystem=r,this.controlsGroup=le.layerGroup().addTo(n),this.baseCircleOptions={...i.options},Object.assign(this.baseCircleOptions,this.style),delete this.baseCircleOptions.editing,delete this.baseCircleOptions.original,this.addLayer(i),this.installEditEventBridges(),this.renderControls()}installEditEventBridges(){var x,b,E,C,M,S,z,Z;const n=Do,i=(b=(x=n==null?void 0:n.Draw)==null?void 0:x.Event)==null?void 0:b.EDITMOVE,s=(C=(E=n==null?void 0:n.Draw)==null?void 0:E.Event)==null?void 0:C.EDITRESIZE,r=(S=(M=n==null?void 0:n.Draw)==null?void 0:M.Event)==null?void 0:S.EDITSTART,h=(Z=(z=n==null?void 0:n.Draw)==null?void 0:z.Event)==null?void 0:Z.EDITSTOP;if(!i||!s)return;const f=O=>{const q=O==null?void 0:O.layer;q&&this.layers.includes(q)&&this.syncCenters(q)},d=O=>{const q=O==null?void 0:O.layer;q&&this.layers.includes(q)&&(this.updateLabels(q),this.requestRenderControls())},m=O=>{var et;const q=O==null?void 0:O.layer;if(!q||!this.layers.includes(q))return;const j=q;((et=j.getTooltip)==null?void 0:et.call(j))&&this.updateLabels(j)},_=()=>{this.layers.forEach(O=>{var j;const q=(j=O.getTooltip)==null?void 0:j.call(O);q&&(O.setTooltipContent(Dr(O.getRadius(),this.measurementSystem)),q.options.offset=[10,0],q.options.direction="right",O.closeTooltip(),O.openTooltip())})};this.map.on(i,f),this.map.on(s,d),r&&(this.map.on(r,m),this.detachMapListeners.push(()=>this.map.off(r,m))),h&&(this.map.on(h,_),this.detachMapListeners.push(()=>this.map.off(h,_))),this.detachMapListeners.push(()=>this.map.off(i,f)),this.detachMapListeners.push(()=>this.map.off(s,d))}requestRenderControls(){if(this.renderScheduled)return;this.renderScheduled=!0,(typeof requestAnimationFrame=="function"?requestAnimationFrame:i=>setTimeout(()=>i(0),0))(()=>{this.destroyed||(this.renderScheduled=!1,this.renderControls())})}addLayer(n){n.setStyle(this.style),this.layers.push(n),n.addTo(this.map),n.bindTooltip(Dr(n.getRadius(),this.measurementSystem),{permanent:!0,direction:"right",className:"cake-label",offset:[10,0]});const i=n.editing;setTimeout(()=>{var s,r,h,f,d;try{if(this.destroyed||!this.layers.includes(n))return;if((s=n.redraw)==null||s.call(n),Ef(n),(r=i==null?void 0:i.enabled)!=null&&r.call(i)){(h=i.updateMarkers)==null||h.call(i),this.requestRenderControls();return}(f=i==null?void 0:i.enable)==null||f.call(i),(d=i==null?void 0:i.updateMarkers)==null||d.call(i),this.requestRenderControls()}catch{}},0)}addRing(){var r;if(this.destroyed||this.layers.length>=10)return;const n=this.getLargestCircle();if(!n)return;const i=n.getRadius()*1.5,s=le.circle(n.getLatLng(),{...this.baseCircleOptions,radius:i});this.addLayer(s),this.renderControls(),(r=this.onChange)==null||r.call(this,this.snapshot())}snapshot(){var i,s,r;const n=(i=this.layers[0])==null?void 0:i.getLatLng();return{id:this.sessionId,name:this.name,center:{lat:(s=n==null?void 0:n.lat)!=null?s:0,lng:(r=n==null?void 0:n.lng)!=null?r:0},rings:[...this.layers].sort((h,f)=>h.getRadius()-f.getRadius()).map(h=>({radius:h.getRadius()})),style:{...this.style}}}update(n){var r,h,f;if(this.destroyed)throw new Error("Layer cake session is closed");const i=n.radii;if(i&&(!Array.isArray(i)||i.length<1||i.length>10||i.some((d,m)=>!Number.isFinite(d)||d<=0||m>0&&d<=i[m-1])))throw new Error("Use one to ten strictly increasing positive radii");if(n.name!==void 0&&(typeof n.name!="string"||!n.name.trim()))throw new Error("Layer name must not be empty");if(n.preset&&!Object.prototype.hasOwnProperty.call(zn,n.preset))throw new Error("Unknown style preset");const s=Bo({...this.style,...n.preset?zn[n.preset]:{},...n.style});if(this.name=(h=(r=n.name)==null?void 0:r.trim())!=null?h:this.name,this.style=s,Object.assign(this.baseCircleOptions,s),i){const d=this.layers[0].getLatLng();this.layers.forEach(m=>{var _,x;(x=(_=m.editing)==null?void 0:_.disable)==null||x.call(_),this.map.removeLayer(m)}),this.layers=[],i.forEach(m=>this.addLayer(le.circle(d,{...this.baseCircleOptions,radius:m})))}this.layers.forEach(d=>d.setStyle(s)),this.renderControls(),(f=this.onChange)==null||f.call(this,this.snapshot())}save(){if(this.destroyed||this.saving)return;this.saving=!0;const n=Xl({circles:this.layers});try{this.onSave(n),this.destroy()}finally{this.saving=!1}}getLargestCircle(){return this.layers.length===0?null:this.layers.reduce((n,i)=>n.getRadius()>i.getRadius()?n:i)}syncCenters(n){var s;const i=n.getLatLng();this.layers.forEach(r=>{var h,f,d;r!==n&&(r.setLatLng(i),(h=r.redraw)==null||h.call(r),(d=(f=r.editing)==null?void 0:f.updateMarkers)==null||d.call(f))}),this.requestRenderControls(),(s=this.onChange)==null||s.call(this,this.snapshot())}updateLabels(n){var f,d;(f=this.onChange)==null||f.call(this,this.snapshot());const i=n.getRadius();let s=Dr(i,this.measurementSystem);const r=this.layers.filter(m=>m!==n&&m.getRadius()<i);if(r.length>0){const m=r.reduce((b,E)=>b.getRadius()>E.getRadius()?b:E),_=i-m.getRadius(),x=Dr(_,this.measurementSystem);s=`${Dr(i,this.measurementSystem)} (+${x})`}const h=(d=n.getTooltip)==null?void 0:d.call(n);if(h){n.setTooltipContent(s);const _=n.getBounds().getSouthWest();_.lat=n.getLatLng().lat,h.options.direction="left",h.options.offset=[-10,0],h.setLatLng(_),n.closeTooltip(),n.openTooltip()}}renderControls(){if(this.destroyed)return;this.controlsGroup.clearLayers();const n=this.getLargestCircle();if(!n)return;const s=n.getBounds().getNorthEast(),r=`cake-add-${this.sessionId}`,h=`cake-save-${this.sessionId}`,f=le.divIcon({className:"layer-cake-controls",html:`
|
|
446
|
+
`,Ar=["top-start","top-end","center-end","bottom-start","bottom-end"],Bl={topleft:"top-start",topright:"top-end",bottomleft:"bottom-start",bottomright:"bottom-end"};function qc(a="topright"){return Object.prototype.hasOwnProperty.call(Bl,a)?Bl[a]:Ar.includes(a)?a:"top-end"}function Zc(a){return!!(a.preset||a.responsive||Ar.includes(a.position))}function Hc(a,n){var r,h,f,d,m,_,x;const s=n<((h=(r=a.responsive)==null?void 0:r.breakpoint)!=null?h:600)&&(a.preset==="responsive"||a.responsive)?{position:"bottom-end",orientation:"horizontal",...a.responsive}:{};return{position:(f=a.position)!=null?f:"topright",orientation:(d=a.orientation)!=null?d:"vertical",order:(m=a.order)!=null?m:0,overflow:(_=a.overflow)!=null?_:"wrap",offset:(x=a.offset)!=null?x:[10,10],...s}}class Yc extends HTMLElement{constructor(){super(...arguments);Q(this,"entries",[]);Q(this,"resize");Q(this,"mutations");Q(this,"frame",0);Q(this,"revealFocusedTool",i=>{const s=i.target;s instanceof HTMLElement&&s.matches("button")&&s.scrollIntoView({block:"nearest",inline:"nearest"})});Q(this,"schedule",()=>{this.frame||(this.frame=requestAnimationFrame(()=>{this.frame=0,this.arrange()}))})}connectedCallback(){this.resize=new ResizeObserver(this.schedule),this.resize.observe(this.parentElement),this.parentElement.querySelectorAll(".leaflet-control").forEach(s=>this.resize.observe(s)),this.entries.forEach(({element:s})=>this.resize.observe(s)),this.mutations=new MutationObserver(s=>{s.some(r=>!this.contains(r.target)||r.attributeName==="class")&&this.schedule()});const i=this.getRootNode();this.mutations.observe(i,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style"],characterData:!0}),i instanceof ShadowRoot&&this.mutations.observe(i.host,{attributes:!0,attributeFilter:["class","style"]}),i instanceof ShadowRoot&&this.mutations.observe(this.ownerDocument.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),window.addEventListener("resize",this.schedule),this.addEventListener("focusin",this.revealFocusedTool),this.arrange()}disconnectedCallback(){var i,s;(i=this.resize)==null||i.disconnect(),(s=this.mutations)==null||s.disconnect(),window.removeEventListener("resize",this.schedule),this.removeEventListener("focusin",this.revealFocusedTool),cancelAnimationFrame(this.frame),this.frame=0}arrange(){const i=this.parentElement;if(!i)return;const s=i.getBoundingClientRect();if(!s.width||!s.height)return;let r=0,h=0;i.querySelectorAll(".leaflet-control-container .leaflet-control").forEach(m=>{const _=m.getBoundingClientRect();!_.width||!_.height||(m.closest(".leaflet-top")&&(r=Math.max(r,_.bottom-s.top)),m.closest(".leaflet-bottom")&&(h=Math.max(h,s.bottom-_.top)))}),this.style.setProperty("--_geokit-native-top",`${r}px`),this.style.setProperty("--_geokit-native-bottom",`${h}px`),this.dataset.narrow=String(s.width<600),this.dataset.dense=String(s.width<600&&s.height-r-h<this.entries.length*100),this.entries.forEach(({element:m,config:_})=>{const x=Hc(_,s.width),b=getComputedStyle(m),E=qc(b.getPropertyValue("--geokit-toolbar-zone").trim()||x.position),C=this.querySelector(`[data-geokit-zone="${E}"]`);if(m.parentElement!==C){const G=m.getRootNode()instanceof ShadowRoot?m.getRootNode().activeElement:document.activeElement;C.appendChild(m),G instanceof HTMLElement&&m.contains(G)&&G.focus({preventScroll:!0})}m.dataset.geokitToolbarPosition=E,m.style.setProperty("--_geokit-direction",x.orientation==="horizontal"?"row":"column"),m.style.setProperty("--_geokit-order",String(Number.isFinite(x.order)?x.order:0)),m.style.setProperty("--_geokit-wrap",x.overflow==="scroll"?"nowrap":"wrap");const[S,O]=x.offset;m.style.setProperty("--_geokit-layout-x",`${Number.isFinite(S)?Math.max(0,S):10}px`),m.style.setProperty("--_geokit-layout-y",`${Number.isFinite(O)?Math.max(0,O):10}px`);const N=getComputedStyle(m).flexDirection.startsWith("row");m.setAttribute("aria-orientation",N?"horizontal":"vertical")});const f=Ar.filter(m=>this.querySelector(`[data-geokit-zone="${m}"]`).childElementCount);for(const m of Ar)this.querySelector(`[data-geokit-zone="${m}"]`).hidden=!f.includes(m);const d=s.width<600?f.map(m=>`"${m}"`):[f.some(m=>m.startsWith("top"))?'"top-start top-end"':"",f.includes("center-end")?'". center-end"':"",f.some(m=>m.startsWith("bottom"))?'"bottom-start bottom-end"':""].filter(Boolean);this.style.gridTemplateAreas=d.join(" "),this.style.gridTemplateRows=s.width<600?f.map(m=>`minmax(0, ${this.querySelector(`[data-geokit-zone="${m}"]`).childElementCount}fr)`).join(" "):`repeat(${Math.max(1,d.length)}, minmax(0, 1fr))`}}function Vc(a){customElements.get("geokit-toolbar-layout")||customElements.define("geokit-toolbar-layout",Yc);const n=document.createElement("geokit-toolbar-layout");return n.setAttribute("part","toolbar-layout"),n.entries=a,Ar.forEach(i=>{const s=document.createElement("div");s.dataset.geokitZone=i,s.setAttribute("part",`toolbar-zone zone-${i}`),s.style.gridArea=i,n.appendChild(s)}),a.forEach(({element:i})=>n.querySelector('[data-geokit-zone="top-end"]').appendChild(i)),n}const Pr={polygon:{selectors:["a.leaflet-draw-draw-polygon"],dataTool:"polygon"},polyline:{selectors:["a.leaflet-draw-draw-polyline"],dataTool:"polyline"},rectangle:{selectors:["a.leaflet-draw-draw-rectangle"],dataTool:"rectangle"},circle:{selectors:["a.leaflet-draw-draw-circle"],dataTool:"circle"},marker:{selectors:["a.leaflet-draw-draw-marker"],dataTool:"marker"},layerCake:{selectors:["a.leaflet-draw-draw-cake"],dataTool:"layer-cake"},move:{selectors:["a.leaflet-draw-draw-move"],dataTool:"move"},select:{selectors:[],dataTool:"select"},edit:{selectors:["a.leaflet-draw-edit-edit"],dataTool:"edit"},delete:{selectors:["a.leaflet-draw-edit-remove"],dataTool:"delete"},ruler:{selectors:[".leaflet-ruler","a.leaflet-ruler"],dataTool:"ruler"},measurementSettings:{selectors:[".leaflet-ruler-settings-button"],dataTool:"measurement-settings"},layerStyle:{selectors:[],dataTool:"layer-style"},save:{selectors:[],dataTool:"save"}},Xc=Object.keys(Pr),ea="leaflet-geokit-tool-button-icon",zl=".leaflet-geokit-cake-icon, .leaflet-geokit-move-icon",Jc="[data-geokit-managed-toolbar='true']",Fl="[data-geokit-tool-popover='true']",Wc="[data-geokit-tool][aria-expanded='true']",ia=new WeakMap,na=new WeakMap,ra=new WeakMap;function Gl(a,n,i={}){if(Or(a),!a.querySelector("style[data-geokit-toolbar-styles]")){const s=document.createElement("style");s.dataset.geokitToolbarStyles="true",s.textContent=Uc,a.prepend(s)}for(const s of Xc){const r=Pr[s];for(const h of jc(a,r.selectors)){h.setAttribute("data-geokit-tool",r.dataTool),h.setAttribute("part","toolbar-button"),Kc(h);const f=n==null?void 0:n[s];f&&Qc(h,f,s),ql(h,s,{source:"leaflet-toolbar",activate:!1,onTrigger:i.onTrigger})}}of(a,n,i),Gc(a),a.querySelector("[data-geokit-announcement='status']")||ta(a,""),a.querySelector("[data-geokit-announcement='alert']")||ta(a,"",!0),Nr(a,a.dataset.geokitActiveTool||null)}function Nr(a,n){a.dataset.geokitActiveTool=n!=null?n:"",a.querySelectorAll(".leaflet-geokit-toolbar-button").forEach(i=>{var h;const s=!!(n&&i.dataset.geokitTool===Pr[n].dataTool);["polygon","polyline","rectangle","circle","marker","layer-cake","move","edit","delete","ruler"].includes((h=i.dataset.geokitTool)!=null?h:"")&&i.setAttribute("aria-pressed",String(s)),i.dataset.geokitActive=String(s),i.dataset.geokitDisabled=String(i.disabled),i.setAttribute("part",`toolbar-button${s?" active":""}${i.disabled?" disabled":""}`)})}function jc(a,n){const i=new Set;for(const s of n)a.querySelectorAll(s).forEach(r=>{i.add(r)});return[...i]}function Kc(a){const n=ia.get(a);n&&(a.removeEventListener("click",n),ia.delete(a)),delete a.__geokitToolButtonConfig;const i=zo(a.dataset.geokitToolButtonClass);i.length>0&&a.classList.remove(...i),delete a.dataset.geokitToolButtonClass,a.removeAttribute("data-geokit-custom-tool-button"),a.dataset.geokitOriginalTitle!==void 0&&Ul(a,"title",a.dataset.geokitOriginalTitle),a.dataset.geokitOriginalAriaLabel!==void 0&&Ul(a,"aria-label",a.dataset.geokitOriginalAriaLabel),a.dataset.geokitOriginalStyleBackgroundImage!==void 0&&oa(a,"background-image",a.dataset.geokitOriginalStyleBackgroundImage,a.dataset.geokitOriginalStyleBackgroundImagePriority),a.dataset.geokitOriginalStylePosition!==void 0&&oa(a,"position",a.dataset.geokitOriginalStylePosition,a.dataset.geokitOriginalStylePositionPriority),Array.from(a.children).forEach(s=>{s instanceof HTMLElement&&s.dataset.geokitToolButtonIcon==="true"&&s.remove()}),a.querySelectorAll(zl).forEach(s=>{s.hidden=!1}),a.removeAttribute("aria-expanded")}function Ul(a,n,i){i?a.setAttribute(n,i):a.removeAttribute(n)}function oa(a,n,i,s){i?a.style.setProperty(n,i,s):a.style.removeProperty(n)}function Qc(a,n,i){var h;$c(a),a.__geokitToolButtonConfig=n,a.setAttribute("data-geokit-custom-tool-button","true"),n.title&&a.setAttribute("title",n.title);const s=(h=n.ariaLabel)!=null?h:n.title;s&&a.setAttribute("aria-label",s);const r=zo(n.className);r.length>0&&(a.classList.add(...r),a.dataset.geokitToolButtonClass=r.join(" ")),n.iconUrl?Fo(a,n,{tool:i}):(n.iconHtml||n.renderIcon)&&Fo(a,n,{tool:i})}function $c(a){var n,i;a.dataset.geokitOriginalTitle===void 0&&(a.dataset.geokitOriginalTitle=(n=a.getAttribute("title"))!=null?n:""),a.dataset.geokitOriginalAriaLabel===void 0&&(a.dataset.geokitOriginalAriaLabel=(i=a.getAttribute("aria-label"))!=null?i:""),a.dataset.geokitOriginalStyleBackgroundImage===void 0&&(a.dataset.geokitOriginalStyleBackgroundImage=a.style.getPropertyValue("background-image"),a.dataset.geokitOriginalStyleBackgroundImagePriority=a.style.getPropertyPriority("background-image")),a.dataset.geokitOriginalStylePosition===void 0&&(a.dataset.geokitOriginalStylePosition=a.style.getPropertyValue("position"),a.dataset.geokitOriginalStylePositionPriority=a.style.getPropertyPriority("position"))}function zo(a){return a?a.split(/\s+/).map(n=>n.trim()).filter(Boolean):[]}function tf(a){return!!(a.iconUrl||a.iconHtml||a.renderIcon)}function Fo(a,n,i={}){var m,_;const[s,r]=ef(n.iconSize);a.classList.contains("leaflet-geokit-toolbar-button")||(a.style.setProperty("background-image","none","important"),a.style.setProperty("position","relative")),a.querySelectorAll(zl).forEach(x=>{x.hidden=!0});const h=document.createElement("span");h.className=ea,h.dataset.geokitToolButtonIcon="true",h.setAttribute("aria-hidden","true"),h.setAttribute("part","icon"),h.style.setProperty("--_geokit-icon-width",`${s}px`),h.style.setProperty("--_geokit-icon-height",`${r}px`);const f=(_=n.renderIcon)==null?void 0:_.call(n,{tool:(m=i.tool)!=null?m:"polygon",groupId:i.groupId,button:a});if(f instanceof HTMLElement||typeof SVGElement!="undefined"&&f instanceof SVGElement)h.appendChild(f);else if(typeof f=="string"&&f.trim())h.innerHTML=f;else if(n.iconHtml)h.innerHTML=n.iconHtml;else if(n.iconUrl){const x=document.createElement("img");x.src=n.iconUrl,x.alt="",x.decoding="async",x.draggable=!1,h.appendChild(x)}a.appendChild(h)}function ef(a){const n=a==null?void 0:a[0],i=a==null?void 0:a[1];return typeof n=="number"&&Number.isFinite(n)&&n>0&&typeof i=="number"&&Number.isFinite(i)&&i>0?[n,i]:[18,18]}function ql(a,n,i){const s=r=>{var m,_;if(a instanceof HTMLButtonElement&&a.disabled){r.preventDefault(),r.stopPropagation();return}const h=nf(a),f=rf(a);h!=null&&h.popover?uf(a,n,h,{container:f,groupId:i.groupId}):Or(f),(m=i.onTrigger)==null||m.call(i,n,{source:i.source,groupId:i.groupId,activate:i.activate});const d=f.querySelector(Fl);if(d&&((_=d.querySelector("button:not(:disabled), [href], input, select, textarea, [tabindex='0']"))!=null?_:d).focus(),r.detail===0){const x=a.getRootNode(),b=x instanceof ShadowRoot?x.activeElement:document.activeElement;b instanceof HTMLElement&&b.closest("[role='dialog']")||a.focus()}i.activate&&(r.preventDefault(),r.stopPropagation())};a.addEventListener("click",s),ia.set(a,s)}function nf(a){const n=a.__geokitToolButtonConfig;if(n)return n;const i=a.dataset.geokitToolButtonConfig;if(!i)return null;try{return JSON.parse(i)}catch{return null}}function rf(a){var i;const n=a.closest("[data-geokit-map-container]");return(i=n!=null?n:a.parentElement)!=null?i:a}function of(a,n,i){var f,d;a.setAttribute("data-geokit-map-container","true"),(f=a.querySelector("geokit-toolbar-layout"))==null||f.remove(),a.querySelectorAll(Jc).forEach(m=>m.remove());const s=(d=i.toolbarGroups)!=null?d:[],r=s.some(m=>(m==null?void 0:m.hideDefaultToolbar)!==!1);sf(a,r);const h=[];s.forEach(m=>{var E;if(!(m!=null&&m.id)||!Array.isArray(m.tools)||m.tools.length===0)return;const _=document.createElement("div");_.dataset.geokitManagedToolbar="true",_.dataset.geokitToolbarGroup=m.id,_.className="leaflet-geokit-toolbar-group leaflet-bar",_.setAttribute("role","toolbar"),_.setAttribute("aria-label",(E=m.ariaLabel)!=null?E:m.id),_.setAttribute("part","toolbar-group");const x=m.orientation==="horizontal"?"horizontal":"vertical";_.dataset.geokitToolbarOrientation=x,_.setAttribute("aria-orientation",x),_.style.setProperty("--_geokit-direction",x==="horizontal"?"row":"column"),typeof m.gap=="number"&&Number.isFinite(m.gap)&&m.gap>=0&&_.style.setProperty("--_geokit-gap",`${m.gap}px`),lf(_,m.position,m.offset);const b=zo(m.className);b.length>0&&_.classList.add(...b),m.tools.forEach((C,S)=>{const O=af(C,m,S,n==null?void 0:n[C]);ql(O,C,{source:"toolbar",activate:!0,groupId:m.id,onTrigger:i.onTrigger}),_.appendChild(O)}),Zc(m)?(_.setAttribute("part",`toolbar-group toolbar-group-${m.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`),h.push({element:_,config:m})):a.appendChild(_)}),h.length&&a.appendChild(Vc(h))}function sf(a,n){a.toggleAttribute("data-geokit-default-toolbar-hidden",n),a.querySelectorAll(".leaflet-draw-toolbar, .leaflet-ruler, .leaflet-ruler-settings-control").forEach(i=>{n?(i.dataset.geokitOriginalDisplay===void 0&&(i.dataset.geokitOriginalDisplay=i.style.display,i.dataset.geokitOriginalDisplayPriority=i.style.getPropertyPriority("display")),i.style.setProperty("display","none","important")):i.dataset.geokitOriginalDisplay!==void 0&&(oa(i,"display",i.dataset.geokitOriginalDisplay,i.dataset.geokitOriginalDisplayPriority),delete i.dataset.geokitOriginalDisplay,delete i.dataset.geokitOriginalDisplayPriority)})}function af(a,n,i,s){var x,b,E,C,S,O,N,G,D;const r=document.createElement("button");r.type="button",r.dataset.geokitTool=(b=(x=Pr[a])==null?void 0:x.dataTool)!=null?b:a,r.dataset.geokitToolbarGroup=n.id,r.dataset.geokitToolbarPosition=(E=n.position)!=null?E:"topright",r.dataset.geokitToolInstance=df(n.id,a,i),r.className="leaflet-geokit-toolbar-button",r.disabled=(s==null?void 0:s.disabled)===!0,r.setAttribute("aria-disabled",String(r.disabled));const h=(C=s==null?void 0:s.title)!=null?C:Zl(a);r.title=h,r.setAttribute("aria-label",(S=s==null?void 0:s.ariaLabel)!=null?S:h),s!=null&&s.popover&&(r.setAttribute("aria-haspopup","dialog"),r.setAttribute("aria-expanded","false"));const f=zo(s==null?void 0:s.className);if(f.length>0&&r.classList.add(...f),s&&(r.__geokitToolButtonConfig=s,tf(s)&&Fo(r,s,{tool:a,groupId:n.id})),!r.querySelector(`.${ea}`)){const U={iconHtml:gf(a),iconSize:(O=s==null?void 0:s.iconSize)!=null?O:[20,20]};Fo(r,U,{tool:a,groupId:n.id})}const d=`${n.id}-${a}-${i}`,m=r.querySelector(`.${ea}`),_=document.createElement("slot");_.name=`${d}-icon`,_.append(...Array.from(m.childNodes)),m.appendChild(_);for(const U of["badge","tooltip"]){const W=document.createElement("span");W.className=`leaflet-geokit-tool-${U}`,W.setAttribute("part",U),W.setAttribute("aria-hidden","true");const X=document.createElement("slot");X.name=`${d}-${U}`,X.textContent=U==="badge"?(N=s==null?void 0:s.badge)!=null?N:"":(D=(G=s==null?void 0:s.tooltip)!=null?G:s==null?void 0:s.ariaLabel)!=null?D:h,W.appendChild(X),r.appendChild(W)}return r}function lf(a,n="topright",i){const[s,r]=pf(i);a.dataset.geokitToolbarPosition=n,a.style.setProperty("--_geokit-offset-x",`${s}px`),a.style.setProperty("--_geokit-offset-y",`${r}px`)}function uf(a,n,i,s){var d,m,_,x,b,E,C,S,O;if(!i.popover)return;Or(s.container);const r=document.createElement("div");if(r.setAttribute("part","popover"),r.dataset.geokitToolPopover="true",r.dataset.geokitTool=(m=(d=Pr[n])==null?void 0:d.dataTool)!=null?m:n,a.dataset.geokitToolInstance&&(r.dataset.geokitToolInstance=a.dataset.geokitToolInstance),s.groupId&&(r.dataset.geokitToolbarGroup=s.groupId),r.setAttribute("role","dialog"),r.setAttribute("aria-label",(x=(_=i.popover.ariaLabel)!=null?_:i.popover.title)!=null?x:Zl(n)),i.popover.title){const N=document.createElement("strong");N.textContent=i.popover.title,r.appendChild(N)}if(i.popover.body){const N=document.createElement("div");N.textContent=i.popover.body,r.appendChild(N)}if(i.popover.html){const N=document.createElement("div");N.innerHTML=i.popover.html,r.appendChild(N)}const h=(E=(b=i.popover).render)==null?void 0:E.call(b,{tool:n,groupId:s.groupId,button:a,popover:r}),f=typeof DocumentFragment!="undefined"&&h instanceof DocumentFragment;if(h instanceof HTMLElement||f)r.appendChild(h);else if(typeof h=="string"&&h.trim()){const N=document.createElement("div");N.innerHTML=h,r.appendChild(N)}s.container.appendChild(r),hf(s.container,a,r),a.setAttribute("aria-expanded","true"),ra.set(r,{tool:n,groupId:s.groupId,button:a,config:i}),cf(s.container,a,r),r.tabIndex=-1,((C=r.querySelector("button:not(:disabled), [href], input, select, textarea, [tabindex='0']"))!=null?C:r).focus(),(O=(S=i.popover).onOpen)==null||O.call(S,{tool:n,groupId:s.groupId,button:a,popover:r})}function hf(a,n,i){const s=a.getBoundingClientRect(),r=n.getBoundingClientRect(),h=Math.max(8,Math.min(r.left-s.left,s.width-i.offsetWidth-8)),f=Math.max(8,Math.min(r.bottom-s.top+8,s.height-i.offsetHeight-8));i.style.setProperty("left",`${h}px`),i.style.setProperty("top",`${f}px`)}function cf(a,n,i){const s=f=>{f.key==="Escape"&&f.composedPath().some(d=>d===i||d===n)&&(f.preventDefault(),f.stopPropagation(),Or(a),n.focus())},r=f=>{f.composedPath().some(d=>d===i||d===n)||Or(a)};document.addEventListener("keydown",s,!0);const h=window.setTimeout(()=>{i.isConnected&&document.addEventListener("pointerdown",r,!0)},0);na.set(i,{keydown:s,pointerdown:r,pointerdownTimer:h})}function Or(a){a.querySelectorAll(Fl).forEach(n=>{var r,h,f;const i=ra.get(n);i==null||i.button.setAttribute("aria-expanded","false"),i||(r=ff(a,n))==null||r.removeAttribute("aria-expanded");const s=na.get(n);s&&(window.clearTimeout(s.pointerdownTimer),document.removeEventListener("keydown",s.keydown,!0),document.removeEventListener("pointerdown",s.pointerdown,!0),na.delete(n)),n.remove(),i&&((f=(h=i.config.popover)==null?void 0:h.onClose)==null||f.call(h,{tool:i.tool,groupId:i.groupId,button:i.button,popover:n}),ra.delete(n))})}function ff(a,n){const i=a.querySelectorAll(Wc);for(const s of i)if(n.dataset.geokitToolInstance&&s.dataset.geokitToolInstance===n.dataset.geokitToolInstance||s.dataset.geokitTool===n.dataset.geokitTool&&s.dataset.geokitToolbarGroup===n.dataset.geokitToolbarGroup)return s;return null}function df(a,n,i){return`${a}:${n}:${i}`}function Zl(a){return{polygon:"Draw polygon",polyline:"Draw line",rectangle:"Draw rectangle",circle:"Draw circle",marker:"Place marker",layerCake:"Draw layer cake",move:"Move feature",select:"Select feature",edit:"Edit features",delete:"Delete features",ruler:"Measure distance",measurementSettings:"Measurement settings",layerStyle:"Layer style",save:"Save map geometry"}[a]}function gf(a){const n="currentColor",i="none";return{polygon:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linejoin="round"><path d="M5.5 7.2 9.2 4.8 18.5 8.3 16.1 18.2 6.3 15.7Z"/><circle cx="5.5" cy="7.2" r="1.2" fill="currentColor"/><circle cx="18.5" cy="8.3" r="1.2" fill="currentColor"/><circle cx="16.1" cy="18.2" r="1.2" fill="currentColor"/></svg>`,polyline:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.8 16.7 9.2 9.5 14.4 13.1 19 6.1"/><circle cx="4.8" cy="16.7" r="1.3" fill="currentColor"/><circle cx="14.4" cy="13.1" r="1.3" fill="currentColor"/><circle cx="19" cy="6.1" r="1.3" fill="currentColor"/></svg>`,rectangle:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8"><rect x="5.5" y="6.5" width="13" height="11" rx="2"/><path d="M8.5 10h7"/></svg>`,circle:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8"><circle cx="12" cy="12" r="6.8"/><circle cx="12" cy="12" r="2" fill="currentColor"/></svg>`,marker:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linejoin="round"><path d="M12 3.4a6 6 0 0 0-6 6c0 4.2 4.5 9.4 5.6 10.5a.6.6 0 0 0 .8 0C13.5 18.8 18 13.6 18 9.4a6 6 0 0 0-6-6Z"/><circle cx="12" cy="9.5" r="2.1" fill="currentColor" stroke="none"/></svg>`,layerCake:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linecap="round"><ellipse cx="12" cy="7.6" rx="6.8" ry="2.7"/><path d="M5.2 11c1.3 1.2 3.8 2 6.8 2s5.5-.8 6.8-2M6.3 15c1.3.9 3.3 1.5 5.7 1.5s4.4-.6 5.7-1.5"/></svg>`,move:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v16M4 12h16M12 4l-2 2M12 4l2 2M20 12l-2-2M20 12l-2 2M12 20l-2-2M12 20l2-2M4 12l2-2M4 12l2 2"/></svg>`,select:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linejoin="round"><path d="M6 4.8 18.5 12 13 13.4 10.2 19Z"/></svg>`,edit:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linejoin="round"><path d="m6 17.8 3.5-.7 7.7-7.7-2.8-2.8-7.7 7.7Z"/><path d="m12.9 7.9 2.8 2.8"/></svg>`,delete:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M7.5 8.2h9l-.8 10a1.7 1.7 0 0 1-1.7 1.5h-4a1.7 1.7 0 0 1-1.7-1.5Z"/><path d="M9.5 8.2V6.8c0-.7.6-1.3 1.3-1.3h2.4c.7 0 1.3.6 1.3 1.3v1.4M10.5 11.5v4.8M13.5 11.5v4.8"/></svg>`,ruler:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.7" stroke-linejoin="round"><path d="M5.2 17.8 17.8 5.2l1.7 1.7L6.9 19.5H5.2Z"/><path d="m12.2 8 1.5 1.5M9.9 10.3l1.5 1.5M7.6 12.6l1.5 1.5"/></svg>`,measurementSettings:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.6" stroke-linecap="round"><circle cx="12" cy="12" r="3.2"/><path d="M12 4.8v2M12 17.2v2M4.8 12h2M17.2 12h2M7 7l1.4 1.4M15.6 15.6 17 17M17 7l-1.4 1.4M8.4 15.6 7 17"/></svg>`,layerStyle:'<svg viewBox="0 0 24 24" fill="none"><path d="M5 6h14v3H5z" fill="currentColor" opacity=".9"/><path d="M5 11h14v3H5z" fill="currentColor" opacity=".65"/><path d="M5 16h14v3H5z" fill="currentColor" opacity=".4"/></svg>',save:`<svg viewBox="0 0 24 24" fill="${i}" stroke="${n}" stroke-width="1.8" stroke-linejoin="round" stroke-linecap="round"><path d="M5.5 4.8h11.2l1.8 1.8v12.6h-13Z"/><path d="M8 4.8v5h7v-5M8.2 19.2v-5.4h7.6v5.4"/><path d="M10 16.4h4"/></svg>`}[a]}function pf(a){const n=a==null?void 0:a[0],i=a==null?void 0:a[1];return typeof n=="number"&&Number.isFinite(n)&&n>=0&&typeof i=="number"&&Number.isFinite(i)&&i>=0?[n,i]:[10,10]}const Hl=new WeakSet;function mf(a=Do){var s;if(Hl.has(a))return;const n=a.DrawToolbar;if(!((s=n==null?void 0:n.prototype)!=null&&s.getModeHandlers))return;const i=n.prototype.getModeHandlers;n.prototype.getModeHandlers=function(r){var f,d,m,_;const h=i.call(this,r);if((f=this.options)!=null&&f.cake){const x=(d=a.Draw)==null?void 0:d.Cake;if(!x)return h;h.push({enabled:!0,handler:new x(r,this.options.cake),title:"Draw Layer Cake (Subtractive Zones)"})}if((m=this.options)!=null&&m.move){const x=(_=a.Draw)==null?void 0:_.Move;if(!x)return h;h.push({enabled:!0,handler:new x(r,this.options.move),title:"Move/Translate Features"})}return h},Hl.add(a)}const ks=class ks extends le.Draw.Circle{constructor(n,i){super(n,i),this.type=ks.TYPE}addHooks(){super.addHooks();const n=this._tooltip;n!=null&&n.updateContent&&n.updateContent({text:"Click and drag to draw the Layer Cake base",subtext:"Release mouse to finish base layer"})}};Q(ks,"TYPE","cake");let Go=ks;le.Draw.Cake=Go;function yf(a){const n=a.Draw;if(!n||n.Cake)return;const s=class s extends n.Circle{constructor(h,f){super(h,f),this.type=s.TYPE}addHooks(){super.addHooks();const h=this._tooltip;h!=null&&h.updateContent&&h.updateContent({text:"Click and drag to draw the Layer Cake base",subtext:"Release mouse to finish base layer"})}};Q(s,"TYPE","cake");let i=s;n.Cake=i}function Yl(a,n,i){const s=a.getContainer(),r=s.style.touchAction;s.style.touchAction="none";let h=null,f=!1;const d=()=>{f=!1};a.on("unload",d);const m=(O,N)=>({target:N,originalEvent:O,latlng:a.mouseEventToLatLng(O)}),_=O=>{O.preventDefault(),O.stopPropagation()},x=()=>{var N;const O=h;h=null,O!==null&&((N=s.hasPointerCapture)!=null&&N.call(s,O))&&s.releasePointerCapture(O),f&&a.dragging.enable(),f=!1},b=O=>{if(h!==null||!O.isPrimary||O.button!==0)return;let N;const G=O.composedPath(),D=a.mouseEventToLayerPoint(O),U=new Set;if(n.eachLayer(W=>{var ot;const X=(ot=W.getElement)==null?void 0:ot.call(W);X&&G.includes(X)&&(N=W);const et=W._renderer;if(!X&&et&&!U.has(et)&&G.includes(et._container)){U.add(et);for(let I=et._drawFirst;I;I=I.next){const P=I.layer;n.hasLayer(P)&&P.options.interactive&&P._containsPoint(D)&&(N=P)}}}),!!N&&(_(O),!i.pending())){h=O.pointerId,f=a.dragging.enabled(),a.dragging.disable(),i.start(m(O,N));try{s.setPointerCapture(h)}catch{x(),i.cancel()}}},E=O=>{O.pointerId===h&&(_(O),i.move(m(O)))},C=O=>{O.pointerId===h&&(_(O),i.move(m(O)),x(),i.end(m(O)))},S=O=>{O.pointerId===h&&(_(O),x(),i.cancel())};return s.addEventListener("pointerdown",b,!0),s.addEventListener("pointermove",E,!0),s.addEventListener("pointerup",C,!0),s.addEventListener("pointercancel",S,!0),s.addEventListener("lostpointercapture",S,!0),()=>{x(),i.cancel(),a.off("unload",d),s.style.touchAction=r,s.removeEventListener("pointerdown",b,!0),s.removeEventListener("pointermove",E,!0),s.removeEventListener("pointerup",C,!0),s.removeEventListener("pointercancel",S,!0),s.removeEventListener("lostpointercapture",S,!0)}}const Ls=class Ls extends le.Draw.Feature{constructor(i,s){super(i,s);Q(this,"_unbindPointer",null);Q(this,"_featureGroup");Q(this,"_selectedLayer",null);Q(this,"_originalLatLngs",null);Q(this,"_dragStartLatLng",null);Q(this,"_isDragging",!1);Q(this,"_pendingMove",null);this.type=Ls.TYPE,this._featureGroup=(s==null?void 0:s.featureGroup)||new le.FeatureGroup}enable(){this._enabled||super.enable()}disable(){this._enabled&&super.disable()}addHooks(){const i=this._map;if(!i)return;le.DomUtil.addClass(i.getContainer(),"leaflet-draw-move-mode"),this._unbindPointer=Yl(i,this._featureGroup,{start:r=>this._onLayerMouseDown(r),move:r=>this._onMouseMove(r),end:r=>this._onMouseUp(r),cancel:()=>this.cancelMove(),pending:()=>this.hasPendingMove()}),i.on("unload",this.disable,this),this._featureGroup.eachLayer(r=>{this._enableLayerHover(r)});const s=this._tooltip;s!=null&&s.updateContent&&s.updateContent({text:"Click and drag a feature to move it",subtext:""})}removeHooks(){var s;const i=this._map;i&&((s=this._unbindPointer)==null||s.call(this),this._unbindPointer=null,i.off("unload",this.disable,this),le.DomUtil.removeClass(i.getContainer(),"leaflet-draw-move-mode"),this._featureGroup.eachLayer(r=>{this._disableLayerHover(r)}),this._cleanupDragging())}_enableLayerHover(i){i.on&&(i.on("mouseover",this._onLayerMouseOver,this),i.on("mouseout",this._onLayerMouseOut,this))}_disableLayerHover(i){i.off&&(i.off("mouseover",this._onLayerMouseOver,this),i.off("mouseout",this._onLayerMouseOut,this))}_onLayerMouseOver(i){if(this._isDragging)return;const s=i.target;if(s.getElement){const r=s.getElement();r&&(r.style.cursor="grab")}else s._path&&(s._path.style.cursor="grab")}_onLayerMouseOut(i){if(this._isDragging)return;const s=i.target;if(s.getElement){const r=s.getElement();r&&(r.style.cursor="")}else s._path&&(s._path.style.cursor="")}_onLayerMouseDown(i){if(this._isDragging)return;le.DomEvent.stopPropagation(i.originalEvent),le.DomEvent.preventDefault(i.originalEvent);const s=i.target;if(this._selectedLayer=s,this._isDragging=!0,this._dragStartLatLng=i.latlng,this._storeOriginalLatLngs(s),s.getElement){const h=s.getElement();h&&(h.style.cursor="grabbing")}else s._path&&(s._path.style.cursor="grabbing");const r=s.toGeoJSON();this._pendingMove={layer:s,originalGeoJSON:r,newGeoJSON:r}}_storeOriginalLatLngs(i){i.getLatLng?this._originalLatLngs=i.getLatLng():i.getLatLngs&&(this._originalLatLngs=JSON.parse(JSON.stringify(i.getLatLngs())))}_onMouseMove(i){if(!this._isDragging||!this._selectedLayer||!this._dragStartLatLng)return;const s=this._selectedLayer,r={lat:i.latlng.lat-this._dragStartLatLng.lat,lng:i.latlng.lng-this._dragStartLatLng.lng};if(s.setLatLng){const h=le.latLng(this._originalLatLngs.lat+r.lat,this._originalLatLngs.lng+r.lng);s.setLatLng(h)}else if(s.setLatLngs){const h=this._offsetLatLngs(this._originalLatLngs,r);s.setLatLngs(h)}}_offsetLatLngs(i,s){return i instanceof le.LatLng||i.lat!==void 0&&i.lng!==void 0?le.latLng(i.lat+s.lat,i.lng+s.lng):Array.isArray(i)?i.map(r=>this._offsetLatLngs(r,s)):i}_onMouseUp(i){var r,h;if(!this._isDragging||!this._selectedLayer)return;this._pendingMove&&(this._pendingMove.newGeoJSON=this._selectedLayer.toGeoJSON());const s=this._selectedLayer;if(s.getElement){const f=s.getElement();f&&(f.style.cursor="grab")}else s._path&&(s._path.style.cursor="grab");this._map.fire("draw:moveend",{layer:this._selectedLayer,originalGeoJSON:(r=this._pendingMove)==null?void 0:r.originalGeoJSON,newGeoJSON:(h=this._pendingMove)==null?void 0:h.newGeoJSON}),this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._isDragging=!1}_cleanupDragging(){if(this._selectedLayer){const i=this._selectedLayer;if(i.getElement){const s=i.getElement();s&&(s.style.cursor="")}else i._path&&(i._path.style.cursor="")}this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._selectedLayer=null,this._originalLatLngs=null,this._dragStartLatLng=null,this._isDragging=!1,this._pendingMove=null}confirmMove(){if(!this._pendingMove)return;const i=this._pendingMove;this._cleanupDragging(),this._map.fire("draw:moveconfirmed",{layer:i.layer,originalGeoJSON:i.originalGeoJSON,newGeoJSON:i.newGeoJSON})}cancelMove(){if(!this._pendingMove)return;const i=this._pendingMove.layer;i.setLatLng&&this._originalLatLngs?i.setLatLng(this._originalLatLngs):i.setLatLngs&&this._originalLatLngs&&i.setLatLngs(this._originalLatLngs),this._cleanupDragging()}hasPendingMove(){return this._pendingMove!==null}};Q(Ls,"TYPE","move");let sa=Ls;le.Draw.Move=sa;function _f(a){const n=a.Draw;if(!n||n.Move)return;const s=class s extends n.Feature{constructor(f,d){super(f,d);Q(this,"_unbindPointer",null);Q(this,"_featureGroup");Q(this,"_selectedLayer",null);Q(this,"_originalLatLngs",null);Q(this,"_dragStartLatLng",null);Q(this,"_isDragging",!1);Q(this,"_pendingMove",null);this.type=s.TYPE,this._featureGroup=(d==null?void 0:d.featureGroup)||new le.FeatureGroup}enable(){this._enabled||super.enable()}disable(){this._enabled&&super.disable()}addHooks(){const f=this._map;if(!f)return;a.DomUtil.addClass(f.getContainer(),"leaflet-draw-move-mode"),this._unbindPointer=Yl(f,this._featureGroup,{start:m=>this._onLayerMouseDown(m),move:m=>this._onMouseMove(m),end:m=>this._onMouseUp(m),cancel:()=>this.cancelMove(),pending:()=>this.hasPendingMove()}),f.on("unload",this.disable,this),this._featureGroup.eachLayer(m=>{this._enableLayerHover(m)});const d=this._tooltip;d!=null&&d.updateContent&&d.updateContent({text:"Click and drag a feature to move it",subtext:""})}removeHooks(){var d;const f=this._map;f&&(a.DomUtil.removeClass(f.getContainer(),"leaflet-draw-move-mode"),(d=this._unbindPointer)==null||d.call(this),this._unbindPointer=null,f.off("unload",this.disable,this),this._featureGroup.eachLayer(m=>{this._disableLayerHover(m)}),this._cleanupDragging())}_enableLayerHover(f){f.on&&(f.on("mouseover",this._onLayerMouseOver,this),f.on("mouseout",this._onLayerMouseOut,this))}_disableLayerHover(f){f.off&&(f.off("mouseover",this._onLayerMouseOver,this),f.off("mouseout",this._onLayerMouseOut,this))}_onLayerMouseOver(f){if(this._isDragging)return;const d=f.target;if(d.getElement){const m=d.getElement();m&&(m.style.cursor="grab")}else d._path&&(d._path.style.cursor="grab")}_onLayerMouseOut(f){if(this._isDragging)return;const d=f.target;if(d.getElement){const m=d.getElement();m&&(m.style.cursor="")}else d._path&&(d._path.style.cursor="")}_onLayerMouseDown(f){if(this._isDragging)return;a.DomEvent.stopPropagation(f.originalEvent),a.DomEvent.preventDefault(f.originalEvent);const d=f.target;if(this._selectedLayer=d,this._isDragging=!0,this._dragStartLatLng=f.latlng,this._storeOriginalLatLngs(d),d.getElement){const _=d.getElement();_&&(_.style.cursor="grabbing")}else d._path&&(d._path.style.cursor="grabbing");const m=d.toGeoJSON();this._pendingMove={layer:d,originalGeoJSON:m,newGeoJSON:m}}_storeOriginalLatLngs(f){f.getLatLng?this._originalLatLngs=f.getLatLng():f.getLatLngs&&(this._originalLatLngs=JSON.parse(JSON.stringify(f.getLatLngs())))}_onMouseMove(f){if(!this._isDragging||!this._selectedLayer||!this._dragStartLatLng)return;const d=this._selectedLayer,m={lat:f.latlng.lat-this._dragStartLatLng.lat,lng:f.latlng.lng-this._dragStartLatLng.lng};if(d.setLatLng){const _=a.latLng(this._originalLatLngs.lat+m.lat,this._originalLatLngs.lng+m.lng);d.setLatLng(_)}else if(d.setLatLngs){const _=this._offsetLatLngs(this._originalLatLngs,m);d.setLatLngs(_)}}_offsetLatLngs(f,d){return f instanceof a.LatLng||f.lat!==void 0&&f.lng!==void 0?a.latLng(f.lat+d.lat,f.lng+d.lng):Array.isArray(f)?f.map(m=>this._offsetLatLngs(m,d)):f}_onMouseUp(f){var m,_;if(!this._isDragging||!this._selectedLayer)return;this._pendingMove&&(this._pendingMove.newGeoJSON=this._selectedLayer.toGeoJSON());const d=this._selectedLayer;if(d.getElement){const x=d.getElement();x&&(x.style.cursor="grab")}else d._path&&(d._path.style.cursor="grab");this._map.fire("draw:moveend",{layer:this._selectedLayer,originalGeoJSON:(m=this._pendingMove)==null?void 0:m.originalGeoJSON,newGeoJSON:(_=this._pendingMove)==null?void 0:_.newGeoJSON}),this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._isDragging=!1}_cleanupDragging(){if(this._selectedLayer){const f=this._selectedLayer;if(f.getElement){const d=f.getElement();d&&(d.style.cursor="")}else f._path&&(f._path.style.cursor="")}this._map.off("mousemove",this._onMouseMove,this),this._map.off("mouseup",this._onMouseUp,this),this._selectedLayer=null,this._originalLatLngs=null,this._dragStartLatLng=null,this._isDragging=!1,this._pendingMove=null}confirmMove(){if(!this._pendingMove)return;const f=this._pendingMove;this._cleanupDragging(),this._map.fire("draw:moveconfirmed",{layer:f.layer,originalGeoJSON:f.originalGeoJSON,newGeoJSON:f.newGeoJSON})}cancelMove(){if(!this._pendingMove)return;const f=this._pendingMove.layer;f.setLatLng&&this._originalLatLngs?f.setLatLng(this._originalLatLngs):f.setLatLngs&&this._originalLatLngs&&f.setLatLngs(this._originalLatLngs),this._cleanupDragging()}hasPendingMove(){return this._pendingMove!==null}};Q(s,"TYPE","move");let i=s;n.Move=i}const vf=63710088e-1;function aa(a){return a*Math.PI/180}function Vl(a){return a*180/Math.PI}function bf(a,n,i){const s=n/vf,r=aa(i),h=aa(a.lat),f=aa(a.lng),d=Math.sin(h),m=Math.cos(h),_=Math.sin(s),x=Math.cos(s),b=d*x+m*_*Math.cos(r),E=Math.asin(b),C=Math.sin(r)*_*m,S=x-d*b,O=f+Math.atan2(C,S);return{lat:Vl(E),lng:Vl(O)}}function xf(a){let n=0;for(let i=0;i<a.length-1;i++){const[s,r]=a[i],[h,f]=a[i+1];n+=s*f-h*r}return n/2}function la(a){const n=a[0],i=a.at(-1);return!n||!i||n[0]===i[0]&&n[1]===i[1]?a:[...a,n]}function ua(a,n){const i=la(a);if(xf(i)<0===n)return i;const h=[...i].reverse();return la(h)}function ha(a,n,i){if(i<4)throw new Error("steps must be >= 4");const s=[];for(let r=0;r<i;r++){const h=r/i*360,f=bf(a,n,h);s.push([f.lng,f.lat])}return la(s)}function wf(a){const{id:n,center:i,radiusMeters:s,layerIndex:r,steps:h}=a,f=ua(ha(i,s,h),!1);return{type:"Feature",properties:{id:n,layer_index:r,radius_outer:s,type:"core",_meta:{lat:i.lat,lng:i.lng,radius:s}},geometry:{type:"Polygon",coordinates:[f]}}}function kf(a){const{id:n,center:i,radiusOuterMeters:s,radiusInnerMeters:r,layerIndex:h,steps:f}=a,d=ua(ha(i,s,f),!1),m=ua(ha(i,r,f),!0);return{type:"Feature",properties:{id:n,layer_index:h,radius_outer:s,type:"ring",_meta:{lat:i.lat,lng:i.lng,radius:s}},geometry:{type:"Polygon",coordinates:[d,m]}}}function Xl(a){const{circles:n,steps:i=64}=a,s=[...n].sort((h,f)=>h.getRadius()-f.getRadius()),r=[];return s.forEach((h,f)=>{const d=h.getLatLng(),m=h.getRadius(),_=Mr();if(f===0){r.push(wf({id:_,center:d,radiusMeters:m,layerIndex:f,steps:i}));return}const b=s[f-1].getRadius();r.push(kf({id:_,center:d,radiusOuterMeters:m,radiusInnerMeters:b,layerIndex:f,steps:i}))}),{type:"FeatureCollection",features:r}}function Rr(a){a.preventDefault(),a.stopPropagation()}function Lf(a){var _,x;const{root:n,addButtonId:i,saveButtonId:s,onAddRing:r,onSave:h}=a,f=(_=n.querySelector)==null?void 0:_.call(n,`#${i}`),d=(x=n.querySelector)==null?void 0:x.call(n,`#${s}`);if(!f||!d)return;const m="data-cake-controls-bound";if(!(f.hasAttribute(m)||d.hasAttribute(m))){f.setAttribute(m,"true"),d.setAttribute(m,"true");for(const b of[f,d])b.addEventListener("pointerdown",Rr),b.addEventListener("mousedown",Rr),b.addEventListener("touchstart",Rr);f.addEventListener("click",b=>{Rr(b),r()}),d.addEventListener("click",b=>{Rr(b),h()})}}function Ef(a){var i;const n=(i=a.options)!=null?i:{};n.original||(n.original={...n}),n.editing||(n.editing={...n})}function Dr(a,n){if(n==="imperial"){const i=a*3.28084;return i>=5280?`${(i/5280).toFixed(2)} mi`:`${Math.round(i)} ft`}return a>=1e3?`${(a/1e3).toFixed(2)} km`:`${Math.round(a)} m`}class Tf{constructor(n,i,s,r="metric",h){Q(this,"onChange");Q(this,"map");Q(this,"layers",[]);Q(this,"controlsGroup");Q(this,"onSave");Q(this,"sessionId",Mr().slice(0,8));Q(this,"baseCircleOptions");Q(this,"detachMapListeners",[]);Q(this,"renderScheduled",!1);Q(this,"measurementSystem");Q(this,"name","Layer cake");Q(this,"style",{...zn.crop});Q(this,"destroyed",!1);Q(this,"saving",!1);this.onChange=h,this.map=n,this.onSave=s,this.measurementSystem=r,this.controlsGroup=le.layerGroup().addTo(n),this.baseCircleOptions={...i.options},Object.assign(this.baseCircleOptions,this.style),delete this.baseCircleOptions.editing,delete this.baseCircleOptions.original,this.addLayer(i),this.installEditEventBridges(),this.renderControls()}installEditEventBridges(){var x,b,E,C,S,O,N,G;const n=Do,i=(b=(x=n==null?void 0:n.Draw)==null?void 0:x.Event)==null?void 0:b.EDITMOVE,s=(C=(E=n==null?void 0:n.Draw)==null?void 0:E.Event)==null?void 0:C.EDITRESIZE,r=(O=(S=n==null?void 0:n.Draw)==null?void 0:S.Event)==null?void 0:O.EDITSTART,h=(G=(N=n==null?void 0:n.Draw)==null?void 0:N.Event)==null?void 0:G.EDITSTOP;if(!i||!s)return;const f=D=>{const U=D==null?void 0:D.layer;U&&this.layers.includes(U)&&this.syncCenters(U)},d=D=>{const U=D==null?void 0:D.layer;U&&this.layers.includes(U)&&(this.updateLabels(U),this.requestRenderControls())},m=D=>{var et;const U=D==null?void 0:D.layer;if(!U||!this.layers.includes(U))return;const W=U;(et=W.getTooltip)!=null&&et.call(W)&&this.updateLabels(W)},_=()=>{this.layers.forEach(D=>{var W;const U=(W=D.getTooltip)==null?void 0:W.call(D);U&&(D.setTooltipContent(Dr(D.getRadius(),this.measurementSystem)),U.options.offset=[10,0],U.options.direction="right",D.closeTooltip(),D.openTooltip())})};this.map.on(i,f),this.map.on(s,d),r&&(this.map.on(r,m),this.detachMapListeners.push(()=>this.map.off(r,m))),h&&(this.map.on(h,_),this.detachMapListeners.push(()=>this.map.off(h,_))),this.detachMapListeners.push(()=>this.map.off(i,f)),this.detachMapListeners.push(()=>this.map.off(s,d))}requestRenderControls(){if(this.renderScheduled)return;this.renderScheduled=!0,(typeof requestAnimationFrame=="function"?requestAnimationFrame:i=>setTimeout(()=>i(0),0))(()=>{this.destroyed||(this.renderScheduled=!1,this.renderControls())})}addLayer(n){n.setStyle(this.style),this.layers.push(n),n.addTo(this.map),n.bindTooltip(Dr(n.getRadius(),this.measurementSystem),{permanent:!0,direction:"right",className:"cake-label",offset:[10,0]});const i=n.editing;setTimeout(()=>{var s,r,h,f,d;try{if(this.destroyed||!this.layers.includes(n))return;if((s=n.redraw)==null||s.call(n),Ef(n),(r=i==null?void 0:i.enabled)!=null&&r.call(i)){(h=i.updateMarkers)==null||h.call(i),this.requestRenderControls();return}(f=i==null?void 0:i.enable)==null||f.call(i),(d=i==null?void 0:i.updateMarkers)==null||d.call(i),this.requestRenderControls()}catch{}},0)}addRing(){var r;if(this.destroyed||this.layers.length>=10)return;const n=this.getLargestCircle();if(!n)return;const i=n.getRadius()*1.5,s=le.circle(n.getLatLng(),{...this.baseCircleOptions,radius:i});this.addLayer(s),this.renderControls(),(r=this.onChange)==null||r.call(this,this.snapshot())}snapshot(){var i,s,r;const n=(i=this.layers[0])==null?void 0:i.getLatLng();return{id:this.sessionId,name:this.name,center:{lat:(s=n==null?void 0:n.lat)!=null?s:0,lng:(r=n==null?void 0:n.lng)!=null?r:0},rings:[...this.layers].sort((h,f)=>h.getRadius()-f.getRadius()).map(h=>({radius:h.getRadius()})),style:{...this.style}}}update(n){var r,h,f;if(this.destroyed)throw new Error("Layer cake session is closed");const i=n.radii;if(i&&(!Array.isArray(i)||i.length<1||i.length>10||i.some((d,m)=>!Number.isFinite(d)||d<=0||m>0&&d<=i[m-1])))throw new Error("Use one to ten strictly increasing positive radii");if(n.name!==void 0&&(typeof n.name!="string"||!n.name.trim()))throw new Error("Layer name must not be empty");if(n.preset&&!Object.prototype.hasOwnProperty.call(zn,n.preset))throw new Error("Unknown style preset");const s=Bo({...this.style,...n.preset?zn[n.preset]:{},...n.style});if(this.name=(h=(r=n.name)==null?void 0:r.trim())!=null?h:this.name,this.style=s,Object.assign(this.baseCircleOptions,s),i){const d=this.layers[0].getLatLng();this.layers.forEach(m=>{var _,x;(x=(_=m.editing)==null?void 0:_.disable)==null||x.call(_),this.map.removeLayer(m)}),this.layers=[],i.forEach(m=>this.addLayer(le.circle(d,{...this.baseCircleOptions,radius:m})))}this.layers.forEach(d=>d.setStyle(s)),this.renderControls(),(f=this.onChange)==null||f.call(this,this.snapshot())}save(){if(this.destroyed||this.saving)return;this.saving=!0;const n=Xl({circles:this.layers});try{this.onSave(n),this.destroy()}finally{this.saving=!1}}getLargestCircle(){return this.layers.length===0?null:this.layers.reduce((n,i)=>n.getRadius()>i.getRadius()?n:i)}syncCenters(n){var s;const i=n.getLatLng();this.layers.forEach(r=>{var h,f,d;r!==n&&(r.setLatLng(i),(h=r.redraw)==null||h.call(r),(d=(f=r.editing)==null?void 0:f.updateMarkers)==null||d.call(f))}),this.requestRenderControls(),(s=this.onChange)==null||s.call(this,this.snapshot())}updateLabels(n){var f,d;(f=this.onChange)==null||f.call(this,this.snapshot());const i=n.getRadius();let s=Dr(i,this.measurementSystem);const r=this.layers.filter(m=>m!==n&&m.getRadius()<i);if(r.length>0){const m=r.reduce((b,E)=>b.getRadius()>E.getRadius()?b:E),_=i-m.getRadius(),x=Dr(_,this.measurementSystem);s=`${Dr(i,this.measurementSystem)} (+${x})`}const h=(d=n.getTooltip)==null?void 0:d.call(n);if(h){n.setTooltipContent(s);const _=n.getBounds().getSouthWest();_.lat=n.getLatLng().lat,h.options.direction="left",h.options.offset=[-10,0],h.setLatLng(_),n.closeTooltip(),n.openTooltip()}}renderControls(){if(this.destroyed)return;this.controlsGroup.clearLayers();const n=this.getLargestCircle();if(!n)return;const s=n.getBounds().getNorthEast(),r=`cake-add-${this.sessionId}`,h=`cake-save-${this.sessionId}`,f=le.divIcon({className:"layer-cake-controls",html:`
|
|
450
447
|
<div class="layer-cake-controls__container">
|
|
451
448
|
<button id="${r}" type="button">➕ Ring</button>
|
|
452
449
|
<button id="${h}" type="button" class="layer-cake-controls__save">💾 Save</button>
|
|
@@ -482,14 +479,14 @@ geokit-toolbar-layout[data-narrow="true"] .leaflet-geokit-toolbar-group {
|
|
|
482
479
|
<path d="M22 12 L19 15"/>
|
|
483
480
|
</g>
|
|
484
481
|
</svg>
|
|
485
|
-
`,Jl=6378137,Fn=6356752314245e-6,pn=1/298.257223563,Sf=Math.PI/180,Mf=180/Math.PI,Uo=1e9;function Af(a){const n=BigInt(Math.round(a*Uo));return Number(n)/Uo}function Gn(a){return Af(a)*Sf}function Wl(a){const n=a*Mf%360;return n<0?n+360:n}function ca(a){const n=BigInt(Math.round(a*Uo));return Number(n)/Uo}function jl(a,n,i,s){const r=Pf(a,n,i,s);if(r.converged)return{meters:ca(r.distanceMeters),bearingDegrees:Wl(r.bearingRad),algorithm:"vincenty",iterations:r.iterations};const h=Nf(a,n,i,s);return{meters:ca(h.distanceMeters),bearingDegrees:Wl(h.bearingRad),algorithm:"karney",iterations:r.iterations}}function Pf(a,n,i,s){const r=Gn(a),h=Gn(i),f=Gn(s-n),d=Math.atan((1-pn)*Math.tan(r)),m=Math.atan((1-pn)*Math.tan(h)),_=Math.sin(d),x=Math.cos(d),b=Math.sin(m),E=Math.cos(m);let C=f,M=Number.POSITIVE_INFINITY,S=0;const z=200;let Z=0,O=0,q=0,j=0,X=0;for(;Math.abs(C-M)>1e-12&&S<z;){const G=Math.sin(C),H=Math.cos(C);if(Z=Math.sqrt((E*G)**2+(x*b-_*E*H)**2),Z===0)return{distanceMeters:0,bearingRad:0,iterations:S,converged:!0};O=_*b+x*E*H,q=Math.atan2(Z,O);const W=x*E*G/Z;j=1-W**2,X=j===0?0:O-2*_*b/j;const D=pn/16*j*(4+pn*(4-3*j));M=C,C=f+(1-D)*pn*W*(q+D*Z*(X+D*O*(-1+2*X**2))),S+=1}if(S>=z)return{distanceMeters:Number.NaN,bearingRad:0,iterations:S,converged:!1};const et=(Jl**2-Fn**2)/Fn**2*j,ot=1+et/16384*(4096+et*(-768+et*(320-175*et))),I=et/1024*(256+et*(-128+et*(74-47*et))),N=I*Z*(X+I/4*(O*(-1+2*X**2)-I/6*X*(-3+4*Z**2)*(-3+4*X**2))),R=Fn*ot*(q-N),F=Math.atan2(E*Math.sin(C),x*b-_*E*Math.cos(C));return{distanceMeters:R,bearingRad:F,iterations:S,converged:!0}}function Nf(a,n,i,s){const r=Gn(a),h=Gn(i),f=Gn(s-n),d=Math.atan((1-pn)*Math.tan(r)),m=Math.atan((1-pn)*Math.tan(h)),_=Math.sin(d),x=Math.cos(d),b=Math.sin(m),E=Math.cos(m),C=Math.sqrt((E*Math.sin(f))**2+(x*b-_*E*Math.cos(f))**2),M=_*b+x*E*Math.cos(f),S=Math.atan2(C,M);if(S===0)return{distanceMeters:0,bearingRad:0};const Z=1-(x*E*Math.sin(f)/Math.sin(S))**2,O=Z===0?0:M-2*_*b/Z,q=(Jl**2-Fn**2)/Fn**2*Z,j=1+q/16384*(4096+q*(-768+q*(320-175*q))),X=q/1024*(256+q*(-128+q*(74-47*q))),et=X*C*(O+X/4*(M*(-1+2*O**2)-X/6*O*(-3+4*C**2)*(-3+4*O**2))),ot=Fn*j*(S-et),I=Math.atan2(E*Math.sin(f),x*b-_*E*Math.cos(f));return{distanceMeters:ot,bearingRad:I}}const Xi=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),Un=a=>JSON.parse(JSON.stringify(a));function Ji(a){const n=[];let i=0;const s=new Set,r=(S,z,Z,O="error")=>{n.push({code:S,path:z,message:Z,severity:O})},h=(S,z)=>{"crs"in S&&r("crs-mismatch",`${z}.crs`,"RFC 7946 uses WGS84 longitude/latitude; legacy CRS is not reprojected.","warning")},f=(S,z)=>{if(Array.isArray(S)&&S.length===0&&r("empty-geometry",z,"Point has no coordinates."),!Array.isArray(S)||S.length<2||!S.every(Z=>typeof Z=="number"&&Number.isFinite(Z))){r("invalid-position",z,"Expected at least two finite ordinates.");return}(Math.abs(S[0])>180||Math.abs(S[1])>90)&&r("crs-mismatch",z,"Position outside WGS84 longitude/latitude range.","warning")},d=(S,z,Z)=>{if(!Array.isArray(S)||S.length===0){r("empty-geometry",z,"Expected a non-empty coordinate/geometry array.");return}S.forEach((O,q)=>Z(O,`${z}[${q}]`))},m=(S,z)=>{d(S,z,f),Array.isArray(S)&&S.length<2&&r("invalid-line",z,"LineString requires at least two positions.")},_=(S,z)=>{d(S,z,f);const Z=Array.isArray(S)?S[0]:void 0,O=Array.isArray(S)?S[S.length-1]:void 0,q=Array.isArray(Z)&&Array.isArray(O)&&Z.length===O.length&&Z.every((j,X)=>j===O[X]);Array.isArray(S)&&(S.length<4||!q)&&r("invalid-ring",z,"Linear rings require four positions and exact closure.")},x=(S,z)=>d(S,z,_),b=(S,z,Z)=>{if(Z>64){r("nesting-limit",z,"Geometry nesting exceeds 64.");return}if(!Xi(S)){r("empty-geometry",z,"Missing or null geometry.");return}h(S,z);const O=`${z}.coordinates`;switch(S.type){case"Point":f(S.coordinates,O);break;case"LineString":m(S.coordinates,O);break;case"Polygon":x(S.coordinates,O);break;case"MultiPoint":d(S.coordinates,O,f);break;case"MultiLineString":d(S.coordinates,O,m);break;case"MultiPolygon":d(S.coordinates,O,x);break;case"GeometryCollection":d(S.geometries,`${z}.geometries`,(q,j)=>b(q,j,Z+1));break;default:r("unsupported-geometry",z,`Unsupported geometry: ${typeof S.type=="string"?S.type:"missing or non-string type"}.`)}typeof S.type=="string"&&(S.type.startsWith("Multi")||S.type==="GeometryCollection")&&r("multi-expansion",z,"Editing adapters expand this geometry into single-geometry features.","info")},E=(S,z)=>{var q;if(i++,!Xi(S)||S.type!=="Feature"){r("invalid-feature",z,"Expected a Feature.");return}if(h(S,z),S.properties===null||Xi(S.properties)||r("invalid-properties",`${z}.properties`,"Expected an object or null."),Xi(S.properties)){const j=S.properties.id;S.id===void 0&&j!==void 0&&!(typeof j=="string"&&j.length>0)&&!(typeof j=="number"&&Number.isFinite(j))&&r("invalid-id",`${z}.properties.id`,"Fallback ID must be a non-empty string or finite number.");const X=S.properties["geokit:source"];X!==void 0&&(!Array.isArray(X)||X.length===0||X.length>64||!X.every(et=>Xi(et)&&typeof et.type=="string"&&["MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"].includes(et.type)&&(typeof et.id=="string"||typeof et.id=="number")&&typeof et.hasPropertyId=="boolean"&&typeof et.nullProperties=="boolean"))&&r("invalid-provenance",`${z}.properties.geokit:source`,"Reserved expansion provenance is malformed.")}S.id!==void 0&&!(typeof S.id=="string"&&S.id.length>0)&&!(typeof S.id=="number"&&Number.isFinite(S.id))&&r("invalid-id",`${z}.id`,"Feature ID must be a non-empty string or finite number.");const Z=(q=S.id)!=null?q:Xi(S.properties)?S.properties.id:void 0,O=typeof Z=="string"||typeof Z=="number"?String(Z):void 0;O!==void 0&&(s.has(O)&&r("duplicate-id",`${z}.id`,`Duplicate feature ID: ${O}.`),s.add(O)),b(S.geometry,`${z}.geometry`,0)},C=new Set,M=(S,z,Z)=>{if(Z>128){r("nesting-limit",z,"JSON nesting exceeds 128.");return}if(!(S===null||typeof S=="string"||typeof S=="boolean")&&!(typeof S=="number"&&Number.isFinite(S))){if(typeof S!="object"||S===null||C.has(S)){r("invalid-json",z,"Expected finite, acyclic JSON values.");return}if(!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null){r("invalid-json",z,"Expected a plain JSON object.");return}if(C.add(S),Array.isArray(S))for(let O=0;O<S.length;O++)M(S[O],`${z}[${O}]`,Z+1);else Object.entries(S).forEach(([O,q])=>M(q,`${z}.${O}`,Z+1));C.delete(S)}};return M(a,"$",0),Xi(a)?a.type==="FeatureCollection"?(h(a,"$"),Array.isArray(a.features)?a.features.forEach((S,z)=>E(S,`$.features[${z}]`)):r("invalid-collection","$.features","Expected a features array.")):a.type==="Feature"?E(a,"$"):(i=1,b(a,"$",0)):r("invalid-input","$","Expected a GeoJSON object."),{valid:!n.some(S=>S.severity==="error"),featureCount:i,diagnostics:n}}class Br extends Error{constructor(n){super("GeoJSON validation failed"),this.summary=n,this.name="GeoJSONValidationError"}}function qo(a,n={}){var d,m;const i=Ji(a);if(!i.valid)throw new Br(i);const s=Un(a),r=s.type==="FeatureCollection"?s:{type:"FeatureCollection",features:[s.type==="Feature"?s:{type:"Feature",properties:{},geometry:s}]};for(const _ of r.features)_.id=(m=(d=_.id)!=null?d:Ve(_))!=null?m:Mr();const h=n.expandMulti?js(r,{preserveMetadata:!0}):r,f=Ji(h);if(!f.valid)throw new Br(f);return Un(h)}function Kl(a,n={}){const i=Ji(a);if(!i.valid)return{...i,data:null};try{return{...i,data:qo(a,n)}}catch(s){if(s instanceof Br)return{...s.summary,data:null};throw s}}function Ql(a,n={}){let i;try{i=JSON.parse(a)}catch{return{valid:!1,featureCount:0,data:null,diagnostics:[{severity:"error",code:"invalid-json",path:"$",message:"Unable to parse JSON text."}]}}return Kl(i,n)}function Of(a,n={}){var h,f;const i=Ji(a);if(!i.valid)return{...i,data:null};if(n.adapter==="source"){const d=new Map;for(const[m,_]of a.features.entries()){const x=(h=_.properties)==null?void 0:h["geokit:source"];if(!Array.isArray(x)||!x.length)continue;const b=String((f=x[0])==null?void 0:f.id),E={..._.properties};delete E.id,delete E["geokit:source"];const C=zr(E);d.has(b)&&d.get(b)!==C&&i.diagnostics.push({severity:"error",code:"metadata-conflict",path:`$.features[${m}].properties`,message:"Expanded children have divergent properties; export editing data or reconcile before source export."}),d.set(b,C)}}if(i.valid=!i.diagnostics.some(d=>d.severity==="error"),!i.valid)return{...i,data:null};const s=Ks(Un(a),{...n,provenanceOnly:!0}),r=Ji(s);return{...r,diagnostics:[...i.diagnostics,...r.diagnostics],data:r.valid?s:null}}async function Rf(a,n={}){var s;const i=await((s=n.fetcher)!=null?s:fetch)(a,{signal:n.signal});if(!i.ok)throw new Error(`GeoJSON fetch failed: HTTP ${i.status}`);return Ql(await i.text(),n)}function Zo(a){const n=Ji(a);if(!n.valid)throw new Br(n);const i=a;if(i.type!=="FeatureCollection")throw new Error("Diff/patch requires a FeatureCollection.");return new Map(i.features.map(s=>{const r=Ve(s);if(r===void 0)throw new Error("Diff/patch requires stable feature IDs; normalize once before editing.");return[r,s]}))}function zr(a){return Array.isArray(a)?`[${a.map(zr).join(",")}]`:Xi(a)?`{${Object.keys(a).sort().map(n=>`${JSON.stringify(n)}:${zr(a[n])}`).join(",")}}`:JSON.stringify(a)}function Df(a,n){const i=Zo(a),s=Zo(n),r=[],h=[],f=[];for(const[d,m]of s)i.has(d)?zr(i.get(d))!==zr(m)&&h.push(Un(m)):r.push(Un(m));for(const d of i.keys())s.has(d)||f.push(d);return{created:r,updated:h,deleted:f,createdIds:r.map(d=>Ve(d)),updatedIds:h.map(d=>Ve(d)),deletedIds:[...f]}}function Bf(a,n){const i=Zo(a);if(!n||!Array.isArray(n.created)||!Array.isArray(n.updated)||!Array.isArray(n.deleted))throw new Error("Malformed GeoJSON patch.");const s=new Set,r=h=>{if(s.has(h))throw new Error(`Conflicting patch operations: ${h}`);s.add(h)};for(const h of n.deleted){if(typeof h!="string")throw new Error("Deleted IDs must be strings.");if(r(h),!i.delete(h))throw new Error(`Missing deleted feature: ${h}`)}for(const[h,f]of[["created",n.created],["updated",n.updated]]){const d=Zo({type:"FeatureCollection",features:f});for(const[m,_]of d){if(r(m),h==="created"?i.has(m):!i.has(m))throw new Error(`Invalid ${h} target: ${m}`);i.set(m,_)}}return Un({...a,features:[...i.values()]})}const zf={position:"topleft",circleMarker:{color:"red",radius:2},lineStyle:{color:"red",dashArray:"1,6"},angleUnit:{display:"°",decimal:2,factor:null,label:"Bearing:"}},Ff={display:"km",decimal:2,factor:null,label:"Distance (km):"},Gf={display:"mi",decimal:2,factor:.621371,label:"Distance (mi):"};function Uf(a){const n=a==="imperial"?{...Gf}:{...Ff};return{...zf,lengthUnit:n}}const qf={metric:"Meters / Kilometers",imperial:"Feet / Miles"};function fa(a,n={}){var h,f;const i=!!((h=a==null?void 0:a.Control)!=null&&h.Draw),s=!!a.draw,r=i&&s;return r||(f=n.onError)==null||f.call(n,"Leaflet.draw is not available on the provided Leaflet instance"),r}const Wi={osm:{urlTemplate:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19,subdomains:["a","b","c"]},here:{styles:{"lite.day":"lite.day","normal.day":"normal.day","satellite.day":"satellite.day"},defaultStyle:"lite.day",attribution:'Map Tiles © <a href="https://www.here.com">HERE</a>',maxZoom:20}};function $l(a){return typeof a=="string"?a.trim().toLowerCase():""}function tu(a){if(typeof a!="string")return;const n=a.trim();return n.length>0?n:void 0}function da(a){const{style:n,attribution:i}=a,s=$l(a.provider),r=tu(a.apiKey);switch(s){case"osm":return{urlTemplate:Wi.osm.urlTemplate,attribution:i||Wi.osm.attribution,maxZoom:Wi.osm.maxZoom,subdomains:[...Wi.osm.subdomains]};case"here":{if(!r)throw new Error("HERE Maps requires an API key");const h=typeof n=="string"?n.trim():"",f=h&&h in Wi.here.styles?h:Wi.here.defaultStyle;return{urlTemplate:`https://maps.hereapi.com/v3/base/mc/{z}/{x}/{y}/png8?style=${encodeURIComponent(f)}&apiKey=${encodeURIComponent(r)}`,attribution:i||Wi.here.attribution,maxZoom:Wi.here.maxZoom,subdomains:void 0}}default:throw new Error(`Unknown tile provider: ${a.provider}`)}}function Zf(a){const n=$l(a.provider),i=tu(a.apiKey);return n?n==="here"&&!i?{valid:!1,error:"HERE Maps requires an API key"}:{valid:!0}:{valid:!1,error:"Provider is required"}}function ga(a,n){return{kind:a.kind,attribution:n.trim()?"present":"missing",attributionRequired:a.capabilities.attributionRequired,offline:a.capabilities.offline,apiKey:a.capabilities.apiKey,drawing:"leaflet-draw",scope:"configuration"}}function eu(a){const n=a.provider.trim().toLowerCase(),i={...a};return{kind:"raster",capabilities:{attributionRequired:!0,offline:n==="osm"||n==="here"?"unsupported":"unknown",apiKey:n==="here"?"required":"none"},resolve:()=>da(i)}}function iu(a){var i;const n={...a,subdomains:(i=a.subdomains)==null?void 0:i.slice()};return{kind:"raster",capabilities:{attributionRequired:!0,offline:"unknown",apiKey:"host-defined"},resolve:()=>{var s;return{...n,subdomains:(s=n.subdomains)==null?void 0:s.slice()}}}}function Hf(a){var n,i;return{attribution:a.attribution,provider:{kind:"vector",capabilities:{attributionRequired:!0,offline:(n=a.offline)!=null?n:"unknown",apiKey:(i=a.apiKey)!=null?i:"host-defined"},createLayer:a.createLayer}}}const Ho={polygon:{control:"polygon",attribute:"draw-polygon",behavior:"draw",mutates:!0},polyline:{control:"polyline",attribute:"draw-polyline",behavior:"draw",mutates:!0},rectangle:{control:"rectangle",attribute:"draw-rectangle",behavior:"draw",mutates:!0},circle:{control:"circle",attribute:"draw-circle",behavior:"draw",mutates:!0},marker:{control:"marker",attribute:"draw-marker",behavior:"draw",mutates:!0},layerCake:{control:"cake",attribute:"draw-layer-cake",behavior:"draw",mutates:!0},move:{control:"move",attribute:"draw-move",behavior:"mode",mutates:!0,needsLayers:!0},edit:{control:"edit",attribute:"edit-features",behavior:"mode",mutates:!0,needsLayers:!0},delete:{control:"delete",attribute:"delete-features",behavior:"mode",mutates:!0,needsLayers:!0},ruler:{control:"ruler",attribute:"draw-ruler",behavior:"mode"},measurementSettings:{behavior:"action"},layerStyle:{behavior:"action"},save:{behavior:"action"},select:{behavior:"deactivate"}};function nu(a){var i,s,r,h,f;const n={};for(const d of Object.keys(Ho)){const m=Ho[d],_=(i=a.config)==null?void 0:i[d];let x=null,b="disabled";a.ready?m.mutates&&a.readOnly?x={code:"read_only",message:"Map is read-only",requirement:"read-only=false"}:m.control&&!a.controls[m.control]?x={code:"missing_attribute",message:`Enable ${m.attribute} to use this tool`,requirement:m.attribute}:d==="delete"&&!a.controls.edit?x={code:"missing_attribute",message:"Enable edit-features to use delete",requirement:"edit-features"}:m.control&&!a.available[d]?(b="unavailable",x={code:"unavailable_plugin",message:`Handler for ${d} is unavailable`}):m.needsLayers&&a.layerCount===0?x={code:"no_editable_layers",message:"No editable layers are loaded"}:(s=_==null?void 0:_.requirements)!=null&&s.selection&&a.selectedFeatureIds.length===0?x={code:"empty_selection",message:"Select a feature first",requirement:"selection"}:(r=_==null?void 0:_.requirements)!=null&&r.provider&&a.provider.state!=="enabled"?(x=a.provider.reason,b=a.provider.state):(h=a.errors)!=null&&h[d]?(b="unavailable",x={code:"runtime_error",message:a.errors[d]}):_!=null&&_.disabled?x={code:"configured_disabled",message:"Disabled by host button configuration"}:b="enabled":(b="unavailable",x={code:"not_ready",message:"Map controller is not ready"}),n[d]={tool:d,state:b,reason:x?{...x}:null,active:a.activeTool===d,groupIds:[...new Set(((f=a.groups)!=null?f:[]).filter(E=>E.tools.includes(d)).map(E=>E.id))],hotkey:null,commands:{activate:!0,deactivate:!0},commandEnabled:b==="enabled"||(x==null?void 0:x.code)==="configured_disabled"||(x==null?void 0:x.code)==="runtime_error",behavior:m.behavior}}return{tools:n,provider:{...a.provider,reason:a.provider.reason?{...a.provider.reason}:null},selectedFeatureIds:[...a.selectedFeatureIds]}}function ru(a,n){for(const i of Object.values(n.tools)){const s=i.tool.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);a.querySelectorAll(`.leaflet-geokit-toolbar-button[data-geokit-tool="${s}"]`).forEach(r=>{var h,f;r.disabled=i.state!=="enabled",r.setAttribute("aria-disabled",String(r.disabled)),r.dataset.geokitDisabled=String(r.disabled),r.dataset.geokitDisabledReason=(f=(h=i.reason)==null?void 0:h.code)!=null?f:"",r.setAttribute("part",`toolbar-button${i.active?" active":""}${r.disabled?" disabled":""}`)})}}const Yf=["vertex","edge","grid","guide"],Yo=6378137,ou=1/298.257223563,mn=ou*(2-ou),Fr=Math.PI/180,pa=89.9;function ma(a){const n=a[0],i=a[1];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function su(a,n){if(a)switch(a.type){case"LineString":n(a.coordinates);return;case"MultiLineString":a.coordinates.forEach(n);return;case"Polygon":a.coordinates.forEach(n);return;case"MultiPolygon":a.coordinates.forEach(i=>i.forEach(n));return;case"GeometryCollection":a.geometries.forEach(i=>su(i,n));return;default:return}}function au(a,n){if(a)switch(a.type){case"Point":n(a.coordinates);return;case"MultiPoint":case"LineString":a.coordinates.forEach(n);return;case"MultiLineString":case"Polygon":a.coordinates.flat().forEach(n);return;case"MultiPolygon":a.coordinates.flat(2).forEach(n);return;case"GeometryCollection":a.geometries.forEach(i=>au(i,n));return}}function Vf(a,n){return Math.hypot(a.x-n.x,a.y-n.y)}function Xf(a,n,i){const s=i.x-n.x,r=i.y-n.y,h=s*s+r*r;if(h===0)return{...n};const f=Math.max(0,Math.min(1,((a.x-n.x)*s+(a.y-n.y)*r)/h));return{x:n.x+f*s,y:n.y+f*r}}function Jf(a){var i;const n=(i=a.modes)!=null&&i.length?a.modes:Yf;return[...new Set(n)]}function Wf(a){const n=Math.sin(a);return Yo*(1-mn)/(1-mn*n**2)**1.5}function ya(a){const n=mn**2,i=mn**3;return Yo*((1-mn/4-3*n/64-5*i/256)*a-(3*mn/8+3*n/32+45*i/1024)*Math.sin(2*a)+(15*n/256+45*i/1024)*Math.sin(4*a)-35*i/3072*Math.sin(6*a))}function jf(a){let n=Math.max(-Math.PI/2,Math.min(Math.PI/2,a/Yo));for(let i=0;i<8;i++)n-=(ya(n)-a)/Wf(n);return n/Fr}function Kf(a){const n=a*Fr;return Yo/Math.sqrt(1-mn*Math.sin(n)**2)*Math.cos(n)*Fr}function Qf(a,n){var b;const i=n.gridSizeMeters,[s,r]=(b=n.gridOrigin)!=null?b:[0,0];if(!Number.isFinite(i)||i<=0||!Number.isFinite(a.lat)||!Number.isFinite(a.lng)||!Number.isFinite(s)||!Number.isFinite(r)||Math.abs(a.lat)>pa||Math.abs(r)>pa)return null;const h=ya(r*Fr),f=ya(a.lat*Fr),d=h+Math.round((f-h)/i)*i,m=jf(d);if(!Number.isFinite(m)||Math.abs(m)>pa)return null;const _=Kf(m);return!Number.isFinite(_)||_<=0?null:{lng:s+Math.round((a.lng-s)*_/i)*i/_,lat:m}}function lu(a,n,i,s,r={},h){var b,E;if(r.enabled===!1)return null;const f=Jf(r),d=(b=r.tolerancePx)!=null?b:12;if(!Number.isFinite(d)||d<=0)return null;const m=i(a);let _=null;const x=(C,M,S={},z)=>{const Z=Vf(m,C);if(Z>d)return;const O=f.indexOf(M),q=_?f.indexOf(_.mode):Number.MAX_SAFE_INTEGER;_&&(Z>_.distancePx+.001||Z>=_.distancePx-.001&&O>q)||(_={latlng:z!=null?z:s(C),point:C,distancePx:Z,mode:M,...S})};for(const C of n){if(!C.visible||C.layerKind==="measurement"||C.featureId===h)continue;const M=C.layerKind==="guide"?f.includes("guide")?["guide"]:[]:f.filter(S=>S==="vertex"||S==="edge");for(const S of M)S==="vertex"?au(C.feature.geometry,z=>{const Z=ma(z);Z&&x(i({lng:Z[0],lat:Z[1]}),S,{targetFeatureId:C.featureId,targetLayerId:C.layerId},{lng:Z[0],lat:Z[1]})}):su(C.feature.geometry,z=>{for(let Z=1;Z<z.length;Z++){const O=ma(z[Z-1]),q=ma(z[Z]);if(!O||!q)continue;const j=i({lng:O[0],lat:O[1]}),X=i({lng:q[0],lat:q[1]}),et=Xf(m,j,X),ot=(X.x-j.x)**2+(X.y-j.y)**2,I=ot===0?0:Math.max(0,Math.min(1,((et.x-j.x)*(X.x-j.x)+(et.y-j.y)*(X.y-j.y))/ot));x(et,S,{targetFeatureId:C.featureId,targetLayerId:C.layerId},{lng:O[0]+(q[0]-O[0])*I,lat:O[1]+(q[1]-O[1])*I})}})}if(f.includes("grid")&&Number.isFinite(r.gridSizeMeters)&&((E=r.gridSizeMeters)!=null?E:0)>0){const C=Qf(a,r);if(C){const M=i(C);x(M,"grid",{},C)}}return _}var Kt=63710088e-1,uu={centimeters:Kt*100,centimetres:Kt*100,cm:Kt*100,degrees:360/(2*Math.PI),deg:360/(2*Math.PI),feet:Kt*3.28084,ft:Kt*3.28084,inches:Kt*39.37,in:Kt*39.37,kilometers:Kt/1e3,kilometres:Kt/1e3,km:Kt/1e3,meters:Kt,metres:Kt,m:Kt,miles:Kt/1609.344,mi:Kt/1609.344,millimeters:Kt*1e3,millimetres:Kt*1e3,mm:Kt*1e3,nauticalmiles:Kt/1852,nmi:Kt/1852,radians:1,rad:1,yards:Kt*1.0936,yd:Kt*1.0936};function Xe(a,n,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=n||{},s.geometry=a,s}function Ue(a,n,i={}){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");if(a.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!du(a[0])||!du(a[1]))throw new Error("coordinates must contain numbers");return Xe({type:"Point",coordinates:a},n,i)}function yn(a,n,i={}){for(const r of a){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let h=0;h<r[r.length-1].length;h++)if(r[r.length-1][h]!==r[0][h])throw new Error("First and last Position are not equivalent.")}return Xe({type:"Polygon",coordinates:a},n,i)}function Pi(a,n,i={}){if(a.length<2)throw new Error("coordinates must be an array of two or more positions");return Xe({type:"LineString",coordinates:a},n,i)}function Re(a,n={}){const i={type:"FeatureCollection"};return n.id&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.features=a,i}function hu(a,n,i={}){return Xe({type:"MultiLineString",coordinates:a},n,i)}function $f(a,n,i={}){return Xe({type:"MultiPolygon",coordinates:a},n,i)}function cu(a,n="kilometers"){const i=uu[n];if(!i)throw new Error(n+" units is invalid");return a*i}function fu(a,n="kilometers"){const i=uu[n];if(!i)throw new Error(n+" units is invalid");return a/i}function td(a,n){return _a(fu(a,n))}function _a(a){return a%(2*Math.PI)*180/Math.PI}function qn(a){return a%360*Math.PI/180}function du(a){return!isNaN(a)&&a!==null&&!Array.isArray(a)}function va(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Vo(a,n,i){if(a!==null)for(var s,r,h,f,d,m,_,x=0,b=0,E,C=a.type,M=C==="FeatureCollection",S=C==="Feature",z=M?a.features.length:1,Z=0;Z<z;Z++){_=M?a.features[Z].geometry:S?a.geometry:a,E=_?_.type==="GeometryCollection":!1,d=E?_.geometries.length:1;for(var O=0;O<d;O++){var q=0,j=0;if(f=E?_.geometries[O]:_,f!==null){m=f.coordinates;var X=f.type;switch(x=i&&(X==="Polygon"||X==="MultiPolygon")?1:0,X){case null:break;case"Point":if(n(m,b,Z,q,j)===!1)return!1;b++,q++;break;case"LineString":case"MultiPoint":for(s=0;s<m.length;s++){if(n(m[s],b,Z,q,j)===!1)return!1;b++,X==="MultiPoint"&&q++}X==="LineString"&&q++;break;case"Polygon":case"MultiLineString":for(s=0;s<m.length;s++){for(r=0;r<m[s].length-x;r++){if(n(m[s][r],b,Z,q,j)===!1)return!1;b++}X==="MultiLineString"&&q++,X==="Polygon"&&j++}X==="Polygon"&&q++;break;case"MultiPolygon":for(s=0;s<m.length;s++){for(j=0,r=0;r<m[s].length;r++){for(h=0;h<m[s][r].length-x;h++){if(n(m[s][r][h],b,Z,q,j)===!1)return!1;b++}j++}q++}break;case"GeometryCollection":for(s=0;s<f.geometries.length;s++)if(Vo(f.geometries[s],n,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Zn(a,n){if(a.type==="Feature")n(a,0);else if(a.type==="FeatureCollection")for(var i=0;i<a.features.length&&n(a.features[i],i)!==!1;i++);}function ed(a,n,i){var s=i;return Zn(a,function(r,h){h===0&&i===void 0?s=r:s=n(s,r,h)}),s}function Hn(a,n){var i,s,r,h,f,d,m,_,x,b,E=0,C=a.type==="FeatureCollection",M=a.type==="Feature",S=C?a.features.length:1;for(i=0;i<S;i++){for(d=C?a.features[i].geometry:M?a.geometry:a,_=C?a.features[i].properties:M?a.properties:{},x=C?a.features[i].bbox:M?a.bbox:void 0,b=C?a.features[i].id:M?a.id:void 0,m=d?d.type==="GeometryCollection":!1,f=m?d.geometries.length:1,r=0;r<f;r++){if(h=m?d.geometries[r]:d,h===null){if(n(null,E,_,x,b)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(n(h,E,_,x,b)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<h.geometries.length;s++)if(n(h.geometries[s],E,_,x,b)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}E++}}function id(a,n,i){var s=i;return Hn(a,function(r,h,f,d,m){h===0&&i===void 0?s=r:s=n(s,r,h,f,d,m)}),s}function Yn(a,n){Hn(a,function(i,s,r,h,f){var d=i===null?null:i.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return n(Xe(i,r,{bbox:h,id:f}),s,0)===!1?!1:void 0}var m;switch(d){case"MultiPoint":m="Point";break;case"MultiLineString":m="LineString";break;case"MultiPolygon":m="Polygon";break}for(var _=0;_<i.coordinates.length;_++){var x=i.coordinates[_],b={type:m,coordinates:x};if(n(Xe(b,r),s,_)===!1)return!1}})}function nd(a){return id(a,(n,i)=>n+rd(i),0)}function rd(a){let n=0,i;switch(a.type){case"Polygon":return gu(a.coordinates);case"MultiPolygon":for(i=0;i<a.coordinates.length;i++)n+=gu(a.coordinates[i]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function gu(a){let n=0;if(a&&a.length>0){n+=Math.abs(pu(a[0]));for(let i=1;i<a.length;i++)n-=Math.abs(pu(a[i]))}return n}var od=Kt*Kt/2,ba=Math.PI/180;function pu(a){const n=a.length-1;if(n<=2)return 0;let i=0,s=0;for(;s<n;){const r=a[s],h=a[s+1===n?0:s+1],f=a[s+2>=n?(s+2)%n:s+2],d=r[0]*ba,m=h[1]*ba,_=f[0]*ba;i+=(_-d)*Math.sin(m),s++}return i*od}function ji(a,n={}){if(a.bbox!=null&&n.recompute!==!0)return a.bbox;const i=[1/0,1/0,-1/0,-1/0];return Vo(a,s=>{i[0]>s[0]&&(i[0]=s[0]),i[1]>s[1]&&(i[1]=s[1]),i[2]<s[0]&&(i[2]=s[0]),i[3]<s[1]&&(i[3]=s[1])}),i}function bi(a){if(!a)throw new Error("coord is required");if(!Array.isArray(a)){if(a.type==="Feature"&&a.geometry!==null&&a.geometry.type==="Point")return[...a.geometry.coordinates];if(a.type==="Point")return[...a.coordinates]}if(Array.isArray(a)&&a.length>=2&&!Array.isArray(a[0])&&!Array.isArray(a[1]))return[...a];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Je(a){if(Array.isArray(a))return a;if(a.type==="Feature"){if(a.geometry!==null)return a.geometry.coordinates}else if(a.coordinates)return a.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Ni(a){return a.type==="Feature"?a.geometry:a}function Xo(a,n){return a.type==="FeatureCollection"?"FeatureCollection":a.type==="GeometryCollection"?"GeometryCollection":a.type==="Feature"&&a.geometry!==null?a.geometry.type:a.type}const Oi=11102230246251565e-32,Ee=134217729,sd=(3+8*Oi)*Oi;function xa(a,n,i,s,r){let h,f,d,m,_=n[0],x=s[0],b=0,E=0;x>_==x>-_?(h=_,_=n[++b]):(h=x,x=s[++E]);let C=0;if(b<a&&E<i)for(x>_==x>-_?(f=_+h,d=h-(f-_),_=n[++b]):(f=x+h,d=h-(f-x),x=s[++E]),h=f,d!==0&&(r[C++]=d);b<a&&E<i;)x>_==x>-_?(f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b]):(f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E]),h=f,d!==0&&(r[C++]=d);for(;b<a;)f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b],h=f,d!==0&&(r[C++]=d);for(;E<i;)f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E],h=f,d!==0&&(r[C++]=d);return(h!==0||C===0)&&(r[C++]=h),C}function ad(a,n){let i=n[0];for(let s=1;s<a;s++)i+=n[s];return i}function Gr(a){return new Float64Array(a)}const ld=(3+16*Oi)*Oi,ud=(2+12*Oi)*Oi,hd=(9+64*Oi)*Oi*Oi,Vn=Gr(4),mu=Gr(8),yu=Gr(12),_u=Gr(16),Ce=Gr(4);function cd(a,n,i,s,r,h,f){let d,m,_,x,b,E,C,M,S,z,Z,O,q,j,X,et,ot,I;const N=a-r,R=i-r,F=n-h,G=s-h;j=N*G,E=Ee*N,C=E-(E-N),M=N-C,E=Ee*G,S=E-(E-G),z=G-S,X=M*z-(j-C*S-M*S-C*z),et=F*R,E=Ee*F,C=E-(E-F),M=F-C,E=Ee*R,S=E-(E-R),z=R-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Vn[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Vn[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Vn[2]=O-(I-b)+(Z-b),Vn[3]=I;let H=ad(4,Vn),W=ud*f;if(H>=W||-H>=W||(b=a-N,d=a-(N+b)+(b-r),b=i-R,_=i-(R+b)+(b-r),b=n-F,m=n-(F+b)+(b-h),b=s-G,x=s-(G+b)+(b-h),d===0&&m===0&&_===0&&x===0)||(W=hd*f+sd*Math.abs(H),H+=N*x+G*d-(F*_+R*m),H>=W||-H>=W))return H;j=d*G,E=Ee*d,C=E-(E-d),M=d-C,E=Ee*G,S=E-(E-G),z=G-S,X=M*z-(j-C*S-M*S-C*z),et=m*R,E=Ee*m,C=E-(E-m),M=m-C,E=Ee*R,S=E-(E-R),z=R-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Ce[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Ce[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Ce[2]=O-(I-b)+(Z-b),Ce[3]=I;const D=xa(4,Vn,4,Ce,mu);j=N*x,E=Ee*N,C=E-(E-N),M=N-C,E=Ee*x,S=E-(E-x),z=x-S,X=M*z-(j-C*S-M*S-C*z),et=F*_,E=Ee*F,C=E-(E-F),M=F-C,E=Ee*_,S=E-(E-_),z=_-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Ce[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Ce[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Ce[2]=O-(I-b)+(Z-b),Ce[3]=I;const Y=xa(D,mu,4,Ce,yu);j=d*x,E=Ee*d,C=E-(E-d),M=d-C,E=Ee*x,S=E-(E-x),z=x-S,X=M*z-(j-C*S-M*S-C*z),et=m*_,E=Ee*m,C=E-(E-m),M=m-C,E=Ee*_,S=E-(E-_),z=_-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Ce[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Ce[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Ce[2]=O-(I-b)+(Z-b),Ce[3]=I;const $=xa(Y,yu,4,Ce,_u);return _u[$-1]}function fd(a,n,i,s,r,h){const f=(n-h)*(i-r),d=(a-r)*(s-h),m=f-d,_=Math.abs(f+d);return Math.abs(m)>=ld*_?m:-cd(a,n,i,s,r,h,_)}function dd(a,n){var i,s,r=0,h,f,d,m,_,x,b,E=a[0],C=a[1],M=n.length;for(i=0;i<M;i++){s=0;var S=n[i],z=S.length-1;if(x=S[0],x[0]!==S[z][0]&&x[1]!==S[z][1])throw new Error("First and last coordinates in a ring must be the same");for(f=x[0]-E,d=x[1]-C,s;s<z;s++){if(b=S[s+1],m=b[0]-E,_=b[1]-C,d===0&&_===0){if(m<=0&&f>=0||f<=0&&m>=0)return 0}else if(_>=0&&d<=0||_<=0&&d>=0){if(h=fd(f,m,d,_,0,0),h===0)return 0;(h>0&&_>0&&d<=0||h<0&&_<=0&&d>0)&&r++}x=b,d=_,f=m}}return r%2!==0}function Xn(a,n,i={}){if(!a)throw new Error("point is required");if(!n)throw new Error("polygon is required");const s=bi(a),r=Ni(n),h=r.type,f=n.bbox;let d=r.coordinates;if(f&&gd(s,f)===!1)return!1;h==="Polygon"&&(d=[d]);for(var m=0;m<d.length;++m){const _=dd(s,d[m]);if(_===0&&!i.ignoreBoundary)return!0;if(_)return!0}return!1}function gd(a,n){return n[0]<=a[0]&&n[1]<=a[1]&&n[2]>=a[0]&&n[3]>=a[1]}class vu{constructor(n=[],i=pd){if(this.data=n,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(n){this.data.push(n),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const n=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:i,compare:s}=this,r=i[n];for(;n>0;){const h=n-1>>1,f=i[h];if(s(r,f)>=0)break;i[n]=f,n=h}i[n]=r}_down(n){const{data:i,compare:s}=this,r=this.length>>1,h=i[n];for(;n<r;){let f=(n<<1)+1,d=i[f];const m=f+1;if(m<this.length&&s(i[m],d)<0&&(f=m,d=i[m]),s(d,h)>=0)break;i[n]=d,n=f}i[n]=h}}function pd(a,n){return a<n?-1:a>n?1:0}const Ri=11102230246251565e-32,Te=134217729,md=(3+8*Ri)*Ri;function wa(a,n,i,s,r){let h,f,d,m,_=n[0],x=s[0],b=0,E=0;x>_==x>-_?(h=_,_=n[++b]):(h=x,x=s[++E]);let C=0;if(b<a&&E<i)for(x>_==x>-_?(f=_+h,d=h-(f-_),_=n[++b]):(f=x+h,d=h-(f-x),x=s[++E]),h=f,d!==0&&(r[C++]=d);b<a&&E<i;)x>_==x>-_?(f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b]):(f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E]),h=f,d!==0&&(r[C++]=d);for(;b<a;)f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b],h=f,d!==0&&(r[C++]=d);for(;E<i;)f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E],h=f,d!==0&&(r[C++]=d);return(h!==0||C===0)&&(r[C++]=h),C}function yd(a,n){let i=n[0];for(let s=1;s<a;s++)i+=n[s];return i}function Ur(a){return new Float64Array(a)}const _d=(3+16*Ri)*Ri,vd=(2+12*Ri)*Ri,bd=(9+64*Ri)*Ri*Ri,Jn=Ur(4),bu=Ur(8),xu=Ur(12),wu=Ur(16),Se=Ur(4);function xd(a,n,i,s,r,h,f){let d,m,_,x,b,E,C,M,S,z,Z,O,q,j,X,et,ot,I;const N=a-r,R=i-r,F=n-h,G=s-h;j=N*G,E=Te*N,C=E-(E-N),M=N-C,E=Te*G,S=E-(E-G),z=G-S,X=M*z-(j-C*S-M*S-C*z),et=F*R,E=Te*F,C=E-(E-F),M=F-C,E=Te*R,S=E-(E-R),z=R-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Jn[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Jn[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Jn[2]=O-(I-b)+(Z-b),Jn[3]=I;let H=yd(4,Jn),W=vd*f;if(H>=W||-H>=W||(b=a-N,d=a-(N+b)+(b-r),b=i-R,_=i-(R+b)+(b-r),b=n-F,m=n-(F+b)+(b-h),b=s-G,x=s-(G+b)+(b-h),d===0&&m===0&&_===0&&x===0)||(W=bd*f+md*Math.abs(H),H+=N*x+G*d-(F*_+R*m),H>=W||-H>=W))return H;j=d*G,E=Te*d,C=E-(E-d),M=d-C,E=Te*G,S=E-(E-G),z=G-S,X=M*z-(j-C*S-M*S-C*z),et=m*R,E=Te*m,C=E-(E-m),M=m-C,E=Te*R,S=E-(E-R),z=R-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Se[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Se[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Se[2]=O-(I-b)+(Z-b),Se[3]=I;const D=wa(4,Jn,4,Se,bu);j=N*x,E=Te*N,C=E-(E-N),M=N-C,E=Te*x,S=E-(E-x),z=x-S,X=M*z-(j-C*S-M*S-C*z),et=F*_,E=Te*F,C=E-(E-F),M=F-C,E=Te*_,S=E-(E-_),z=_-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Se[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Se[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Se[2]=O-(I-b)+(Z-b),Se[3]=I;const Y=wa(D,bu,4,Se,xu);j=d*x,E=Te*d,C=E-(E-d),M=d-C,E=Te*x,S=E-(E-x),z=x-S,X=M*z-(j-C*S-M*S-C*z),et=m*_,E=Te*m,C=E-(E-m),M=m-C,E=Te*_,S=E-(E-_),z=_-S,ot=M*z-(et-C*S-M*S-C*z),Z=X-ot,b=X-Z,Se[0]=X-(Z+b)+(b-ot),O=j+Z,b=O-j,q=j-(O-b)+(Z-b),Z=q-et,b=q-Z,Se[1]=q-(Z+b)+(b-et),I=O+Z,b=I-O,Se[2]=O-(I-b)+(Z-b),Se[3]=I;const $=wa(Y,xu,4,Se,wu);return wu[$-1]}function ku(a,n,i,s,r,h){const f=(n-h)*(i-r),d=(a-r)*(s-h),m=f-d;if(f===0||d===0||f>0!=d>0)return m;const _=Math.abs(f+d);return Math.abs(m)>=_d*_?m:-xd(a,n,i,s,r,h,_)}function wd(a,n){const i=new vu([],Lu);return Ld(a,i),Ed(i,n)}function Lu(a,n){return a.p.x>n.p.x?1:a.p.x<n.p.x||a.p.x===n.p.x&&(a.featureId!==n.featureId||a.ringId!==n.ringId)&&a.isLeftEndpoint&&!n.isLeftEndpoint?-1:a.p.y!==n.p.y?a.p.y>n.p.y?1:-1:1}function kd(a,n){return a.rightSweepEvent.p.x>n.rightSweepEvent.p.x?1:a.rightSweepEvent.p.x<n.rightSweepEvent.p.x?-1:a.rightSweepEvent.p.y!==n.rightSweepEvent.p.y?a.rightSweepEvent.p.y<n.rightSweepEvent.p.y?1:-1:1}function Ld(a,n){if(a.type==="FeatureCollection"){const i=a.features;for(let s=0;s<i.length;s++)Eu(i[s],n)}else Eu(a,n)}var Jo=0,Wo=0,jo=0;function Eu(a,n){const i=a.type==="Feature"?a.geometry:a;let s=i.coordinates;(i.type==="Polygon"||i.type==="MultiLineString")&&(s=[s]),i.type==="LineString"&&(s=[[s]]);for(let r=0;r<s.length;r++)for(let h=0;h<s[r].length;h++){let f=s[r][h][0],d=null;Wo=Wo+1;for(let m=0;m<s[r][h].length-1;m++){d=s[r][h][m+1];const _=new Tu(f,Jo,Wo,jo),x=new Tu(d,Jo,Wo,jo+1);_.otherEvent=x,x.otherEvent=_,Lu(_,x)>0?(x.isLeftEndpoint=!0,_.isLeftEndpoint=!1):(_.isLeftEndpoint=!0,x.isLeftEndpoint=!1),n.push(_),n.push(x),f=d,jo=jo+1}}Jo=Jo+1}var Tu=class{constructor(a,n,i,s){this.p={x:a[0],y:a[1]},this.featureId=n,this.ringId=i,this.eventId=s,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(a){return this.p.x===a.p.x&&this.p.y===a.p.y}asNewXY(){return[this.p.x,this.p.y]}};function Ed(a,n=!1){const i=[],s=new vu([],kd);for(;a.length;){const r=a.pop();if(r.isLeftEndpoint){const h=new Td(r);for(let f=0;f<s.data.length;f++){const d=s.data[f];if(n&&d.leftSweepEvent.featureId===r.featureId)continue;const m=Id(h,d);m!==!1&&i.push(m)}s.push(h)}else r.isLeftEndpoint===!1&&s.pop()}return i}var Td=class{constructor(n){this.leftSweepEvent=n,this.rightSweepEvent=n.otherEvent}};function Id(a,n){if(a===null||n===null)return!1;const i=a.leftSweepEvent.p.x,s=a.leftSweepEvent.p.y,r=a.rightSweepEvent.p.x,h=a.rightSweepEvent.p.y,f=n.leftSweepEvent.p.x,d=n.leftSweepEvent.p.y,m=n.rightSweepEvent.p.x,_=n.rightSweepEvent.p.y,x=ku(i,s,r,h,f,d),b=ku(i,s,r,h,m,_);if(x>0&&b>0)return!1;if(x<0&&b<0)return!1;if(a.leftSweepEvent.ringId===n.leftSweepEvent.ringId){if(a.rightSweepEvent.isSamePoint(n.leftSweepEvent)||a.rightSweepEvent.isSamePoint(n.rightSweepEvent)||a.leftSweepEvent.isSamePoint(n.leftSweepEvent)||a.leftSweepEvent.isSamePoint(n.rightSweepEvent))return!1}else{if(a.rightSweepEvent.isSamePoint(n.leftSweepEvent))return n.leftSweepEvent.asNewXY();if(a.rightSweepEvent.isSamePoint(n.rightSweepEvent))return n.rightSweepEvent.asNewXY();if(a.leftSweepEvent.isSamePoint(n.leftSweepEvent))return n.leftSweepEvent.asNewXY();if(a.leftSweepEvent.isSamePoint(n.rightSweepEvent))return n.rightSweepEvent.asNewXY()}const E=(_-d)*(r-i)-(m-f)*(h-s),C=(m-f)*(s-d)-(_-d)*(i-f),M=(r-i)*(s-d)-(h-s)*(i-f);if(E===0)return!1;const S=C/E,z=M/E;if(S>=0&&S<=1&&z>=0&&z<=1){const Z=i+S*(r-i),O=s+S*(h-s);return[Z,O]}return!1}function Ki(a,n,i={}){const{removeDuplicates:s=!0,ignoreSelfIntersections:r=!0}=i;let h=[];a.type==="FeatureCollection"?h=h.concat(a.features):a.type==="Feature"?h.push(a):(a.type==="LineString"||a.type==="Polygon"||a.type==="MultiLineString"||a.type==="MultiPolygon")&&h.push(Xe(a)),n.type==="FeatureCollection"?h=h.concat(n.features):n.type==="Feature"?h.push(n):(n.type==="LineString"||n.type==="Polygon"||n.type==="MultiLineString"||n.type==="MultiPolygon")&&h.push(Xe(n));const f=wd(Re(h),r);let d=[];if(s){const m={};f.forEach(_=>{const x=_.join(",");m[x]||(m[x]=!0,d.push(_))})}else d=f;return Re(d.map(m=>Ue(m)))}function Ko(a,n={}){const i=Ni(a);switch(!n.properties&&a.type==="Feature"&&(n.properties=a.properties),i.type){case"Polygon":return Cd(i,n);case"MultiPolygon":return Sd(i,n);default:throw new Error("invalid poly")}}function Cd(a,n={}){const s=Ni(a).coordinates,r=n.properties?n.properties:a.type==="Feature"?a.properties:{};return Iu(s,r)}function Sd(a,n={}){const s=Ni(a).coordinates,r=n.properties?n.properties:a.type==="Feature"?a.properties:{},h=[];return s.forEach(f=>{h.push(Iu(f,r))}),Re(h)}function Iu(a,n){return a.length>1?hu(a,n):Pi(a[0],n)}function Md(a,n,{ignoreSelfIntersections:i=!0}={ignoreSelfIntersections:!0}){let s=!0;return Yn(a,r=>{Yn(n,h=>{if(s===!1)return!1;s=Ad(r.geometry,h.geometry,i)})}),s}function Ad(a,n,i){switch(a.type){case"Point":switch(n.type){case"Point":return!Rd(a.coordinates,n.coordinates);case"LineString":return!Qo(n,a);case"Polygon":return!Xn(a,n)}break;case"LineString":switch(n.type){case"Point":return!Qo(a,n);case"LineString":return!Pd(a,n,i);case"Polygon":return!Cu(n,a,i)}break;case"Polygon":switch(n.type){case"Point":return!Xn(n,a);case"LineString":return!Cu(a,n,i);case"Polygon":return!Nd(n,a,i)}}return!1}function Qo(a,n){for(let i=0;i<a.coordinates.length-1;i++)if(Od(a.coordinates[i],a.coordinates[i+1],n.coordinates))return!0;return!1}function Pd(a,n,i){if(Ki(a,n,{ignoreSelfIntersections:i}).features.length>0)return!0;for(const r of a.coordinates)if(Qo(n,{coordinates:r}))return!0;for(const r of n.coordinates)if(Qo(a,{coordinates:r}))return!0;return!1}function Cu(a,n,i){for(const r of n.coordinates)if(Xn(r,a))return!0;return Ki(n,Ko(a),{ignoreSelfIntersections:i}).features.length>0}function Nd(a,n,i){for(const r of a.coordinates[0])if(Xn(r,n))return!0;for(const r of n.coordinates[0])if(Xn(r,a))return!0;return Ki(Ko(a),Ko(n),{ignoreSelfIntersections:i}).features.length>0}function Od(a,n,i){const s=i[0]-a[0],r=i[1]-a[1],h=n[0]-a[0],f=n[1]-a[1];return s*f-r*h!==0?!1:Math.abs(h)>=Math.abs(f)?h>0?a[0]<=i[0]&&i[0]<=n[0]:n[0]<=i[0]&&i[0]<=a[0]:f>0?a[1]<=i[1]&&i[1]<=n[1]:n[1]<=i[1]&&i[1]<=a[1]}function Rd(a,n){return a[0]===n[0]&&a[1]===n[1]}var Dd=Object.defineProperty,Wn=(a,n)=>Dd(a,"name",{value:n,configurable:!0}),Su=class{constructor(n){this.direction=!1,this.compareProperties=!0;var i,s,r;this.precision=10**-((i=n==null?void 0:n.precision)!=null?i:17),this.direction=(s=n==null?void 0:n.direction)!=null?s:!1,this.compareProperties=(r=n==null?void 0:n.compareProperties)!=null?r:!0}compare(n,i){if(n.type!==i.type||!qr(n,i))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,i.coordinates);case"LineString":return this.compareLine(n.coordinates,i.coordinates);case"Polygon":return this.comparePolygon(n,i);case"GeometryCollection":return this.compareGeometryCollection(n,i);case"Feature":return this.compareFeature(n,i);case"FeatureCollection":return this.compareFeatureCollection(n,i);default:if(n.type.startsWith("Multi")){const s=ka(n),r=ka(i);return s.every(h=>r.some(f=>this.compare(h,f)))}}return!1}compareCoord(n,i){return n.length===i.length&&n.every((s,r)=>Math.abs(s-i[r])<this.precision)}compareLine(n,i,s=0,r=!1){if(!qr(n,i))return!1;const h=n;let f=i;if(r&&!this.compareCoord(h[0],f[0])){const m=this.fixStartIndex(f,h);if(m)f=m;else return!1}const d=this.compareCoord(h[s],f[s]);return this.direction||d?this.comparePath(h,f):this.compareCoord(h[s],f[f.length-(1+s)])?this.comparePath(h.slice().reverse(),f):!1}fixStartIndex(n,i){let s,r=-1;for(let h=0;h<n.length;h++)if(this.compareCoord(n[h],i[0])){r=h;break}return r>=0&&(s=[].concat(n.slice(r,n.length),n.slice(1,r+1))),s}comparePath(n,i){return n.every((s,r)=>this.compareCoord(s,i[r]))}comparePolygon(n,i){if(this.compareLine(n.coordinates[0],i.coordinates[0],1,!0)){const s=n.coordinates.slice(1,n.coordinates.length),r=i.coordinates.slice(1,i.coordinates.length);return s.every(h=>r.some(f=>this.compareLine(h,f,1,!0)))}return!1}compareGeometryCollection(n,i){return qr(n.geometries,i.geometries)&&this.compareBBox(n,i)&&n.geometries.every((s,r)=>this.compare(s,i.geometries[r]))}compareFeature(n,i){return n.id===i.id&&(this.compareProperties?La(n.properties,i.properties):!0)&&this.compareBBox(n,i)&&this.compare(n.geometry,i.geometry)}compareFeatureCollection(n,i){return qr(n.features,i.features)&&this.compareBBox(n,i)&&n.features.every((s,r)=>this.compare(s,i.features[r]))}compareBBox(n,i){return!n.bbox&&!i.bbox||(n.bbox&&i.bbox?this.compareCoord(n.bbox,i.bbox):!1)}};Wn(Su,"GeojsonEquality");var Bd=Su;function qr(a,n){return a.coordinates?a.coordinates.length===n.coordinates.length:a.length===n.length}Wn(qr,"sameLength");function ka(a){return a.coordinates.map(n=>({type:a.type.replace("Multi",""),coordinates:n}))}Wn(ka,"explode");function Mu(a,n,i){return new Bd(i).compare(a,n)}Wn(Mu,"geojsonEquality");function La(a,n){if(a===null&&n===null)return!0;if(a===null||n===null)return!1;const i=Object.keys(a),s=Object.keys(n);if(i.length!==s.length)return!1;for(var r of i){const h=a[r],f=n[r],d=Au(h)&&Au(f);if(d&&!La(h,f)||!d&&h!==f)return!1}return!0}Wn(La,"equal");var Au=Wn(a=>a!=null&&typeof a=="object","isObject");function Ea(a,n,i={}){const s=bi(a),r=Je(n);for(let h=0;h<r.length-1;h++){let f=!1;if(i.ignoreEndVertices&&(h===0&&(f="start"),h===r.length-2&&(f="end"),h===0&&h+1===r.length-1&&(f="both")),zd(r[h],r[h+1],s,f,typeof i.epsilon=="undefined"?null:i.epsilon))return!0}return!1}function zd(a,n,i,s,r){const h=i[0],f=i[1],d=a[0],m=a[1],_=n[0],x=n[1],b=i[0]-d,E=i[1]-m,C=_-d,M=x-m,S=b*M-E*C;if(r!==null){if(Math.abs(S)>r)return!1}else if(S!==0)return!1;if(Math.abs(C)===Math.abs(M)&&Math.abs(C)===0)return s?!1:i[0]===a[0]&&i[1]===a[1];if(s){if(s==="start")return Math.abs(C)>=Math.abs(M)?C>0?d<h&&h<=_:_<=h&&h<d:M>0?m<f&&f<=x:x<=f&&f<m;if(s==="end")return Math.abs(C)>=Math.abs(M)?C>0?d<=h&&h<_:_<h&&h<=d:M>0?m<=f&&f<x:x<f&&f<=m;if(s==="both")return Math.abs(C)>=Math.abs(M)?C>0?d<h&&h<_:_<h&&h<d:M>0?m<f&&f<x:x<f&&f<m}else return Math.abs(C)>=Math.abs(M)?C>0?d<=h&&h<=_:_<=h&&h<=d:M>0?m<=f&&f<=x:x<=f&&f<=m;return!1}function Ta(a,n={}){var i=typeof n=="object"?n.mutate:n;if(!a)throw new Error("geojson is required");var s=Xo(a),r=[];switch(s){case"LineString":r=Ia(a,s);break;case"MultiLineString":case"Polygon":Je(a).forEach(function(f){r.push(Ia(f,s))});break;case"MultiPolygon":Je(a).forEach(function(f){var d=[];f.forEach(function(m){d.push(Ia(m,s))}),r.push(d)});break;case"Point":return a;case"MultiPoint":var h={};Je(a).forEach(function(f){var d=f.join("-");Object.prototype.hasOwnProperty.call(h,d)||(r.push(f),h[d]=!0)});break;default:throw new Error(s+" geometry not supported")}return a.coordinates?i===!0?(a.coordinates=r,a):{type:s,coordinates:r}:i===!0?(a.geometry.coordinates=r,a):Xe({type:s,coordinates:r},a.properties,{bbox:a.bbox,id:a.id})}function Ia(a,n){const i=Je(a);if(i.length===2&&!Pu(i[0],i[1]))return i;const s=[];let r=0,h=1,f=2;for(s.push(i[r]);f<i.length;)Ea(i[h],Pi([i[r],i[f]]))?h=f:(s.push(i[h]),r=h,h++,f=h),f++;if(s.push(i[h]),n==="Polygon"||n==="MultiPolygon"){if(Ea(s[0],Pi([s[1],s[s.length-2]]))&&(s.shift(),s.pop(),s.push(s[0])),s.length<4)throw new Error("invalid polygon, fewer than 4 points");if(!Pu(s[0],s[s.length-1]))throw new Error("invalid polygon, first and last points not equal")}return s}function Pu(a,n){return a[0]===n[0]&&a[1]===n[1]}function $o(a,n,i={}){let s=i.precision;if(s=s==null||isNaN(s)?6:s,typeof s!="number"||!(s>=0))throw new Error("precision must be a positive number");const r=Ni(a).type,h=Ni(n).type;return r!==h?!1:Mu(Ta(a),Ta(n),{precision:s})}function Fd(a,n){var i=Ni(a),s=Ni(n),r=i.type,h=s.type;switch(r){case"MultiPoint":switch(h){case"LineString":return Nu(i,s);case"Polygon":return Ru(i,s);default:throw new Error("feature2 "+h+" geometry not supported")}case"LineString":switch(h){case"MultiPoint":return Nu(s,i);case"LineString":return Gd(i,s);case"Polygon":return Ou(i,s);default:throw new Error("feature2 "+h+" geometry not supported")}case"Polygon":switch(h){case"MultiPoint":return Ru(s,i);case"LineString":return Ou(s,i);default:throw new Error("feature2 "+h+" geometry not supported")}default:throw new Error("feature1 "+r+" geometry not supported")}}function Nu(a,n){for(var i=!1,s=!1,r=a.coordinates.length,h=0;h<r&&(!i||!s);h++){for(var f=!1,d=0;d<n.coordinates.length-1;d++){var m=!0;if((d===0||d===n.coordinates.length-2)&&(m=!1),Ud(n.coordinates[d],n.coordinates[d+1],a.coordinates[h],m)){f=!0;break}}f?i=!0:s=!0}return i&&s}function Gd(a,n){const i=Ki(a,n);if(i.features.length===0)return!1;for(const s of i.features)if(!$o(s,Ue(a.coordinates[0]))&&!$o(s,Ue(a.coordinates[a.coordinates.length-1]))&&!$o(s,Ue(n.coordinates[0]))&&!$o(s,Ue(n.coordinates[n.coordinates.length-1])))return!0;return!1}function Ou(a,n){const i=Ko(n);return Ki(a,i).features.length>0}function Ru(a,n){var i=!1,s=!1,r=a.coordinates.length;for(let h=0;h<r&&(!i||!s);h++)Xn(Ue(a.coordinates[h]),n)?i=!0:s=!0;return s&&i}function Ud(a,n,i,s){var r=i[0]-a[0],h=i[1]-a[1],f=n[0]-a[0],d=n[1]-a[1],m=r*d-h*f;return m!==0?!1:s?Math.abs(f)>=Math.abs(d)?f>0?a[0]<=i[0]&&i[0]<=n[0]:n[0]<=i[0]&&i[0]<=a[0]:d>0?a[1]<=i[1]&&i[1]<=n[1]:n[1]<=i[1]&&i[1]<=a[1]:Math.abs(f)>=Math.abs(d)?f>0?a[0]<i[0]&&i[0]<n[0]:n[0]<i[0]&&i[0]<a[0]:d>0?a[1]<i[1]&&i[1]<n[1]:n[1]<i[1]&&i[1]<a[1]}var qd=new Set(["Point","LineString","MultiLineString","MultiPoint","Polygon","MultiPolygon"]);function Du(a){if(!a.type)return!1;const n=Ni(a),i=n.type,s=n.coordinates;switch(i){case"Point":return s.length>1;case"MultiPoint":for(var r=0;r<s.length;r++)if(s[r].length<2)return!1;return!0;case"LineString":if(s.length<2)return!1;for(var r=0;r<s.length;r++)if(s[r].length<2)return!1;return!0;case"MultiLineString":if(s.length<1)return!1;for(var r=0;r<s.length;r++)if(s[r].length<2)return!1;return!0;case"Polygon":for(var r=0;r<n.coordinates.length;r++)if(s[r].length<4||!Bu(s[r])||zu(s[r])||r>0&&Ki(yn([s[0]]),yn([s[r]])).features.length>1)return!1;return!0;case"MultiPolygon":for(var r=0;r<n.coordinates.length;r++)for(var h=n.coordinates[r],f=0;f<h.length;f++)if(h[f].length<4||!Bu(h[f])||zu(h[f])||f===0&&!Zd(h,n.coordinates,r)||f>0&&Ki(yn([h[0]]),yn([h[f]])).features.length>1)return!1;return!0;case"GeometryCollection":return n.geometries?Array.isArray(n.geometries)&&n.geometries.length>0&&n.geometries.every(d=>qd.has(d.type)&&Du(d)):!1;default:return!1}}function Bu(a){return a[0][0]===a[a.length-1][0]&&a[0][1]===a[a.length-1][1]}function zu(a){for(var n=0;n<a.length-1;n++)for(var i=a[n],s=n+1;s<a.length-2;s++){var r=[a[s],a[s+1]];if(Ea(i,Pi(r)))return!0}return!1}function Zd(a,n,i){for(var s=yn(a),r=i+1;r<n.length;r++)if(!Md(s,yn(n[r]))&&Fd(s,Pi(n[r][0])))return!1;return!0}function Hd(a,n={}){const i=ji(a),s=(i[0]+i[2])/2,r=(i[1]+i[3])/2;return Ue([s,r],n.properties,n)}var ts={exports:{}},Yd=ts.exports,Fu;function Vd(){return Fu||(Fu=1,(function(a,n){(function(i,s){a.exports=s()})(Yd,(function(){function i(u,t){(t==null||t>u.length)&&(t=u.length);for(var e=0,l=Array(t);e<t;e++)l[e]=u[e];return l}function s(u,t,e){return t=x(t),(function(l,g){if(g&&(typeof g=="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y})(l)})(u,E()?Reflect.construct(t,e||[],x(u).constructor):t.apply(u,e))}function r(u,t){if(!(u instanceof t))throw new TypeError("Cannot call a class as a function")}function h(u,t,e){if(E())return Reflect.construct.apply(null,arguments);var l=[null];l.push.apply(l,t);var g=new(u.bind.apply(u,l));return e&&C(g,e.prototype),g}function f(u,t){for(var e=0;e<t.length;e++){var l=t[e];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,z(l.key),l)}}function d(u,t,e){return t&&f(u.prototype,t),e&&f(u,e),Object.defineProperty(u,"prototype",{writable:!1}),u}function m(u,t){var e=typeof Symbol!="undefined"&&u[Symbol.iterator]||u["@@iterator"];if(!e){if(Array.isArray(u)||(e=Z(u))||t){e&&(u=e);var l=0,g=function(){};return{s:g,n:function(){return l>=u.length?{done:!0}:{done:!1,value:u[l++]}},e:function(A){throw A},f:g}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
486
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var y,w=!0,T=!1;return{s:function(){e=e.call(u)},n:function(){var
|
|
487
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function z(u){var t=(function(e,l){if(typeof e!="object"||!e)return e;var g=e[Symbol.toPrimitive];if(g!==void 0){var y=g.call(e,l);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)})(u,"string");return typeof t=="symbol"?t:t+""}function Z(u,t){if(u){if(typeof u=="string")return i(u,t);var e={}.toString.call(u).slice(8,-1);return e==="Object"&&u.constructor&&(e=u.constructor.name),e==="Map"||e==="Set"?Array.from(u):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(u,t):void 0}}function O(u){var t=typeof Map=="function"?new Map:void 0;return O=function(e){if(e===null||!(function(g){try{return Function.toString.call(g).indexOf("[native code]")!==-1}catch{return typeof g=="function"}})(e))return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,l)}function l(){return h(e,arguments,x(this).constructor)}return l.prototype=Object.create(e.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),C(l,e)},O(u)}var q=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=u.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=u.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==u.JOIN_ROUND&&(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(t){this._joinStyle=t}},{key:"setSimplifyFactor",value:function(t){this._simplifyFactor=t<0?0:t}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(t){this._endCapStyle=t}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(t){this._mitreLimit=t}},{key:"setSingleSided",value:function(t){this._isSingleSided=t}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=u.CAP_ROUND,this._joinStyle=u.JOIN_ROUND,this._mitreLimit=u.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=u.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(l)}else if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3];this.setQuadrantSegments(g),this.setEndCapStyle(y),this.setJoinStyle(w),this.setMitreLimit(T)}}}},{key:"bufferDistanceError",value:function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)}}])})();q.CAP_ROUND=1,q.CAP_FLAT=2,q.CAP_SQUARE=3,q.JOIN_ROUND=1,q.JOIN_MITRE=2,q.JOIN_BEVEL=3,q.DEFAULT_QUADRANT_SEGMENTS=8,q.DEFAULT_MITRE_LIMIT=5,q.DEFAULT_SIMPLIFY_FACTOR=.01;var j=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({Exception:t})[0],l}return b(t,u),d(t,[{key:"toString",value:function(){return this.message}}])})(O(Error)),X=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({IllegalArgumentException:t})[0],l}return b(t,u),d(t)})(j),et=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u){}}])})();function ot(){}function I(){}function N(){}var R,F,G,H,W,D,Y,$,J=(function(){return d((function u(){r(this,u)}),null,[{key:"equalsWithTolerance",value:function(u,t,e){return Math.abs(u-t)<=e}}])})(),at=(function(){return d((function u(t,e){r(this,u),this.low=e||0,this.high=t||0}),null,[{key:"toBinaryString",value:function(u){var t,e="";for(t=2147483648;t>0;t>>>=1)e+=(u.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)e+=(u.low&t)===t?"1":"0";return e}}])})();function rt(){}function ht(){}rt.NaN=NaN,rt.isNaN=function(u){return Number.isNaN(u)},rt.isInfinite=function(u){return!Number.isFinite(u)},rt.MAX_VALUE=Number.MAX_VALUE,rt.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,rt.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(D=2146435072,Y=new Float64Array(1),$=new Int32Array(Y.buffer),rt.doubleToLongBits=function(u){Y[0]=u;var t=0|$[0],e=0|$[1];return(e&D)===D&&1048575&e&&t!==0&&(t=0,e=2146959360),new at(e,t)},rt.longBitsToDouble=function(u){return $[0]=u.low,$[1]=u.high,Y[0]}):(R=1023,F=Math.log2,G=Math.floor,H=Math.pow,W=(function(){for(var u=53;u>0;u--){var t=H(2,u)-1;if(G(F(t))+1===u)return t}return 0})(),rt.doubleToLongBits=function(u){var t,e,l,g,y,w,T,A,B;if(u<0||1/u===Number.NEGATIVE_INFINITY?(w=1<<31,u=-u):w=0,u===0)return new at(A=w,B=0);if(u===1/0)return new at(A=2146435072|w,B=0);if(u!=u)return new at(A=2146959360,B=0);if(g=0,B=0,(t=G(u))>1)if(t<=W)(g=G(F(t)))<=20?(B=0,A=t<<20-g&1048575):(B=t%(e=H(2,l=g-20))<<32-l,A=t/e&1048575);else for(l=t,B=0;(l=G(e=l/2))!==0;)g++,B>>>=1,B|=(1&A)<<31,A>>>=1,e!==l&&(A|=524288);if(T=g+R,y=t===0,t=u-t,g<52&&t!==0)for(l=0;;){if((e=2*t)>=1?(t=e-1,y?(T--,y=!1):(l<<=1,l|=1,g++)):(t=e,y?--T==0&&(g++,y=!1):(l<<=1,g++)),g===20)A|=l,l=0;else if(g===52){B|=l;break}if(e===1){g<20?A|=l<<20-g:g<52&&(B|=l<<52-g);break}}return A|=T<<20,new at(A|=w,B)},rt.longBitsToDouble=function(u){var t,e,l,g,y=u.high,w=u.low,T=y&1<<31?-1:1;for(l=((2146435072&y)>>20)-R,g=0,e=1<<19,t=1;t<=20;t++)y&e&&(g+=H(2,-t)),e>>>=1;for(e=1<<31,t=21;t<=52;t++)w&e&&(g+=H(2,-t)),e>>>=1;if(l===-1023){if(g===0)return 0*T;l=-1022}else{if(l===1024)return g===0?T/0:NaN;g+=1}return T*g*H(2,l)});var _t=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({RuntimeException:t})[0],l}return b(t,u),d(t)})(j),kt=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)_t.constructor_.call(this);else if(arguments.length===1){var e=arguments[0];_t.constructor_.call(this,e)}}}])})(_t),dt=(function(){function u(){r(this,u)}return d(u,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)u.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new kt("Should never reach here"+(t!==null?": "+t:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var t=arguments[0];u.isTrue(t,null)}else if(arguments.length===2){var e=arguments[1];if(!arguments[0])throw e===null?new kt:new kt(e)}}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];u.equals(t,e,null)}else if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2];if(!g.equals(l))throw new kt("Expected "+l+" but encountered "+g+(y!==null?": "+y:""))}}}])})(),pt=new ArrayBuffer(8),vt=new Float64Array(pt),Yt=new Int32Array(pt),tt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getM",value:function(){return rt.NaN}},{key:"setOrdinate",value:function(t,e){switch(t){case u.X:this.x=e;break;case u.Y:this.y=e;break;case u.Z:this.setZ(e);break;default:throw new X("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var e=arguments[0],l=arguments[1];return!!J.equalsWithTolerance(this.x,e.x,l)&&!!J.equalsWithTolerance(this.y,e.y,l)}}},{key:"setM",value:function(t){throw new X("Invalid ordinate index: "+u.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case u.X:return this.x;case u.Y:return this.y;case u.Z:return this.getZ()}throw new X("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||rt.isNaN(this.getZ())&&rt.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof u&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return J.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(t){this.z=t}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return dt.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(t){var e=this.x-t.x,l=this.y-t.y,g=this.getZ()-t.getZ();return Math.sqrt(e*e+l*l+g*g)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){this.y=t}},{key:"distance",value:function(t){var e=this.x-t.x,l=this.y-t.y;return Math.sqrt(e*e+l*l)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*t+u.hashCode(this.x))+u.hashCode(this.y)}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}},{key:"interfaces_",get:function(){return[ot,I,N]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)u.constructor_.call(this,0,0);else if(arguments.length===1){var t=arguments[0];u.constructor_.call(this,t.x,t.y,t.getZ())}else if(arguments.length===2){var e=arguments[0],l=arguments[1];u.constructor_.call(this,e,l,u.NULL_ORDINATE)}else if(arguments.length===3){var g=arguments[0],y=arguments[1],w=arguments[2];this.x=g,this.y=y,this.z=w}}},{key:"hashCode",value:function(t){return vt[0]=t,Yt[0]^Yt[1]}}])})(),en=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"compare",value:function(t,e){var l=u.compare(t.x,e.x);if(l!==0)return l;var g=u.compare(t.y,e.y);return g!==0?g:this._dimensionsToTest<=2?0:u.compare(t.getZ(),e.getZ())}},{key:"interfaces_",get:function(){return[ht]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)u.constructor_.call(this,2);else if(arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new X("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return t<e?-1:t>e?1:rt.isNaN(t)?rt.isNaN(e)?0:-1:rt.isNaN(e)?1:0}}])})();tt.DimensionalComparator=en,tt.NULL_ORDINATE=rt.NaN,tt.X=0,tt.Y=1,tt.Z=2,tt.M=3;var qt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){if(!(t instanceof u))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new u;var e=this._minx>t._minx?this._minx:t._minx,l=this._miny>t._miny?this._miny:t._miny;return new u(e,this._maxx<t._maxx?this._maxx:t._maxx,l,this._maxy<t._maxy?this._maxy:t._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof u){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];return!this.isNull()&&l>=this._minx&&l<=this._maxx&&g>=this._miny&&g<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof tt){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var l=arguments[0],g=arguments[1];return!this.isNull()&&!((l.x<g.x?l.x:g.x)>this._maxx)&&!((l.x>g.x?l.x:g.x)<this._minx)&&!((l.y<g.y?l.y:g.y)>this._maxy)&&!((l.y>g.y?l.y:g.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var y=arguments[0],w=arguments[1];return!this.isNull()&&!(y>this._maxx||y<this._minx||w>this._maxy||w<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof u){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.isNull()?(this._minx=l,this._maxx=l,this._miny=g,this._maxy=g):(l<this._minx&&(this._minx=l),l>this._maxx&&(this._maxx=l),g<this._miny&&(this._miny=g),g>this._maxy&&(this._maxy=g))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0}},{key:"translate",value:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e}},{key:"expandBy",value:function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=l,this._maxy+=l,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof tt){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];return this.covers(l,g)}}},{key:"centre",value:function(){return this.isNull()?null:new tt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof u){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.init(l.x,g.x,l.y,g.y)}else if(arguments.length===4){var y=arguments[0],w=arguments[1],T=arguments[2],A=arguments[3];y<w?(this._minx=y,this._maxx=w):(this._minx=w,this._maxx=y),T<A?(this._miny=T,this._maxy=A):(this._miny=A,this._maxy=T)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var l=0;return this._maxy<t._miny?l=t._miny-this._maxy:this._miny>t._maxy&&(l=this._miny-t._maxy),e===0?l:l===0?e:Math.sqrt(e*e+l*l)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+tt.hashCode(this._minx))+tt.hashCode(this._maxx))+tt.hashCode(this._miny))+tt.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[ot,N]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof u){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.init(l.x,g.x,l.y,g.y)}else if(arguments.length===4){var y=arguments[0],w=arguments[1],T=arguments[2],A=arguments[3];this.init(y,w,T,A)}}},{key:"intersects",value:function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],l=arguments[2];return l.x>=(t.x<e.x?t.x:e.x)&&l.x<=(t.x>e.x?t.x:e.x)&&l.y>=(t.y<e.y?t.y:e.y)&&l.y<=(t.y>e.y?t.y:e.y)}if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],A=Math.min(w.x,T.x),B=Math.max(w.x,T.x),K=Math.min(g.x,y.x),it=Math.max(g.x,y.x);return!(K>B)&&!(it<A)&&(A=Math.min(w.y,T.y),B=Math.max(w.y,T.y),K=Math.min(g.y,y.y),it=Math.max(g.y,y.y),!(K>B)&&!(it<A))}}}])})(),mt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(t){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(t){return this===t||this.equalsExact(t,0)}},{key:"geometryChanged",value:function(){this.apply(u.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(t){return t!==null&&this.norm().equalsExact(t.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var t;if(arguments.length===1){var e=arguments[0];return t=e,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e)}if(arguments.length===2){var l=arguments[0],g=arguments[1];return t=l,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(l,g)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(t){if(t.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION)throw new X("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(t,e,l){return l===0?t.equals(e):t.distance(e)<=l}},{key:"norm",value:function(){var t=this.copy();return t.normalize(),t}},{key:"reverse",value:function(){var t=this.reverseInternal();return this.envelope!=null&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}},{key:"copy",value:function(){var t=this.copyInternal();return t.envelope=this._envelope==null?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new qt(this._envelope)}},{key:"setSRID",value:function(t){this._SRID=t}},{key:"setUserData",value:function(t){this._userData=t}},{key:"compare",value:function(t,e){for(var l=t.iterator(),g=e.iterator();l.hasNext()&&g.hasNext();){var y=l.next(),w=g.next(),T=y.compareTo(w);if(T!==0)return T}return l.hasNext()?1:g.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(t){return this.getClass()===t.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===u.TYPECODE_MULTIPOINT||this.getTypeCode()===u.TYPECODE_MULTILINESTRING||this.getTypeCode()===u.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[I,ot,N]}},{key:"getClass",value:function(){return u}}],[{key:"hasNonEmptyElements",value:function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1}}])})();mt.constructor_=function(u){u&&(this._envelope=null,this._userData=null,this._factory=u,this._SRID=u.getSRID())},mt.TYPECODE_POINT=0,mt.TYPECODE_MULTIPOINT=1,mt.TYPECODE_LINESTRING=2,mt.TYPECODE_LINEARRING=3,mt.TYPECODE_MULTILINESTRING=4,mt.TYPECODE_POLYGON=5,mt.TYPECODE_MULTIPOLYGON=6,mt.TYPECODE_GEOMETRYCOLLECTION=7,mt.TYPENAME_POINT="Point",mt.TYPENAME_MULTIPOINT="MultiPoint",mt.TYPENAME_LINESTRING="LineString",mt.TYPENAME_LINEARRING="LinearRing",mt.TYPENAME_MULTILINESTRING="MultiLineString",mt.TYPENAME_POLYGON="Polygon",mt.TYPENAME_MULTIPOLYGON="MultiPolygon",mt.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",mt.geometryChangedFilter={get interfaces_(){return[et]},filter:function(u){u.geometryChangedAction()}};var U=(function(){function u(){r(this,u)}return d(u,null,[{key:"toLocationSymbol",value:function(t){switch(t){case u.EXTERIOR:return"e";case u.BOUNDARY:return"b";case u.INTERIOR:return"i";case u.NONE:return"-"}throw new X("Unknown location value: "+t)}}])})();U.INTERIOR=0,U.BOUNDARY=1,U.EXTERIOR=2,U.NONE=-1;var Wt=(function(){return d((function u(){r(this,u)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),oe=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({NoSuchElementException:t})[0],l}return b(t,u),d(t)})(j),Ut=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({UnsupportedOperationException:t})[0],l}return b(t,u),d(t)})(j),eo=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t,[{key:"contains",value:function(){}}])})(Wt),bn=(function(u){function t(e){var l;return r(this,t),(l=s(this,t)).map=new Map,e instanceof Wt&&l.addAll(e),l}return b(t,u),d(t,[{key:"contains",value:function(e){var l=e.hashCode?e.hashCode():e;return!!this.map.has(l)}},{key:"add",value:function(e){var l=e.hashCode?e.hashCode():e;return!this.map.has(l)&&!!this.map.set(l,e)}},{key:"addAll",value:function(e){var l,g=m(e);try{for(g.s();!(l=g.n()).done;){var y=l.value;this.add(y)}}catch(w){g.e(w)}finally{g.f()}return!0}},{key:"remove",value:function(){throw new Ut}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new nr(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(eo),nr=(function(){return d((function u(t){r(this,u),this.iterator=t.values();var e=this.iterator.next(),l=e.done,g=e.value;this.done=l,this.value=g}),[{key:"next",value:function(){if(this.done)throw new oe;var u=this.value,t=this.iterator.next(),e=t.done,l=t.value;return this.done=e,this.value=l,u}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new Ut}}])})(),ct=(function(){function u(){r(this,u)}return d(u,null,[{key:"opposite",value:function(t){return t===u.LEFT?u.RIGHT:t===u.RIGHT?u.LEFT:t}}])})();ct.ON=0,ct.LEFT=1,ct.RIGHT=2;var io=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({EmptyStackException:t})[0],l}return b(t,u),d(t)})(j),rr=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({IndexOutOfBoundsException:t})[0],l}return b(t,u),d(t)})(j),ki=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})(Wt),Es=(function(u){function t(){var e;return r(this,t),(e=s(this,t)).array=[],e}return b(t,u),d(t,[{key:"add",value:function(e){return this.array.push(e),!0}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new rr;return this.array[e]}},{key:"push",value:function(e){return this.array.push(e),e}},{key:"pop",value:function(){if(this.array.length===0)throw new io;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new io;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(e){return this.array.indexOf(e)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(ki);function St(u,t){return u.interfaces_&&u.interfaces_.indexOf(t)>-1}var xn=(function(){return d((function u(t){r(this,u),this.str=t}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,t){this.str=this.str.substr(0,u)+t+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),nn=(function(){function u(t){r(this,u),this.value=t}return d(u,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(t){return this.value<t?-1:this.value>t?1:0}}],[{key:"compare",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"isNan",value:function(t){return Number.isNaN(t)}},{key:"valueOf",value:function(t){return new u(t)}}])})(),or=(function(){return d((function u(){r(this,u)}),null,[{key:"isWhitespace",value:function(u){return u<=32&&u>=0||u===127}},{key:"toUpperCase",value:function(u){return u.toUpperCase()}}])})(),Et=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"le",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}},{key:"extractSignificantDigits",value:function(t,e){var l=this.abs(),g=u.magnitude(l._hi),y=u.TEN.pow(g);(l=l.divide(y)).gt(u.TEN)?(l=l.divide(u.TEN),g+=1):l.lt(u.ONE)&&(l=l.multiply(u.TEN),g-=1);for(var w=g+1,T=new xn,A=u.MAX_PRINT_DIGITS-1,B=0;B<=A;B++){t&&B===w&&T.append(".");var K=Math.trunc(l._hi);if(K<0)break;var it=!1,lt=0;K>9?(it=!0,lt="9"):lt="0"+K,T.append(lt),l=l.subtract(u.valueOf(K)).multiply(u.TEN),it&&l.selfAdd(u.TEN);var gt=!0,bt=u.magnitude(l._hi);if(bt<0&&Math.abs(bt)>=A-B&&(gt=!1),!gt)break}return e[0]=g,T.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof u){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(t){return this.le(t)?this:t}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var l,g,y,w,T=arguments[0],A=arguments[1],B=null,K=null,it=null,lt=null;return y=this._hi/T,lt=(B=(it=u.SPLIT*y)-(B=it-y))*(K=(lt=u.SPLIT*T)-(K=lt-T))-(w=y*T)+B*(g=T-K)+(l=y-B)*K+l*g,lt=y+(it=(this._hi-w-lt+this._lo-y*A)/T),this._hi=lt,this._lo=y-lt+it,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof u){var t,e,l,g,y=arguments[0],w=null,T=null,A=null,B=null;return t=(l=this._hi/y._hi)-(w=(A=u.SPLIT*l)-(w=A-l)),B=w*(T=(B=u.SPLIT*y._hi)-(T=B-y._hi))-(g=l*y._hi)+w*(e=y._hi-T)+t*T+t*e,new u(B=l+(A=(this._hi-g-B+this._lo-l*y._lo)/y._hi),l-B+A)}if(typeof arguments[0]=="number"){var K=arguments[0];return rt.isNaN(K)?u.createNaN():u.copy(this).selfDivide(K,0)}}},{key:"ge",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}},{key:"pow",value:function(t){if(t===0)return u.valueOf(1);var e=new u(this),l=u.valueOf(1),g=Math.abs(t);if(g>1)for(;g>0;)g%2==1&&l.selfMultiply(e),(g/=2)>0&&(e=e.sqr());else l=e;return t<0?l.reciprocal():l}},{key:"ceil",value:function(){if(this.isNaN())return u.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new u(t,e)}},{key:"compareTo",value:function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return u.valueOf(0);if(this.isNegative())return u.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,l=u.valueOf(e),g=this.subtract(l.sqr())._hi*(.5*t);return l.add(g)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e,l,g,y,w,T=arguments[0],A=null;return A=(g=this._hi+T)-(y=g-this._hi),l=(w=(A=T-y+(this._hi-A))+this._lo)+(g-(e=g+w)),this._hi=e+l,this._lo=l+(e-this._hi),this}}else if(arguments.length===2){var B,K,it,lt,gt=arguments[0],bt=arguments[1],wt=null,zt=null,Ot=null;it=this._hi+gt,K=this._lo+bt,zt=it-(Ot=it-this._hi),wt=K-(lt=K-this._lo);var Jt=(B=it+(Ot=(zt=gt-Ot+(this._hi-zt))+K))+(Ot=(wt=bt-lt+(this._lo-wt))+(Ot+(it-B))),ee=Ot+(B-Jt);return this._hi=Jt,this._lo=ee,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var l,g,y=arguments[0],w=arguments[1],T=null,A=null,B=null,K=null;T=(B=u.SPLIT*this._hi)-this._hi,K=u.SPLIT*y,T=B-T,l=this._hi-T,A=K-y;var it=(B=this._hi*y)+(K=T*(A=K-A)-B+T*(g=y-A)+l*A+l*g+(this._hi*w+this._lo*y)),lt=K+(T=B-it);return this._hi=it,this._lo=lt,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return u.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new u(t,e)}},{key:"negate",value:function(){return this.isNaN()?this:new u(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}},{key:"multiply",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return t.isNaN()?u.createNaN():u.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return rt.isNaN(e)?u.createNaN():u.copy(this).selfMultiply(e,0)}}},{key:"isNaN",value:function(){return rt.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=u.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),l=this.extractSignificantDigits(!0,e),g=e[0]+1,y=l;if(l.charAt(0)===".")y="0"+l;else if(g<0)y="0."+u.stringOfChar("0",-g)+l;else if(l.indexOf(".")===-1){var w=g-l.length;y=l+u.stringOfChar("0",w)+".0"}return this.isNegative()?"-"+y:y}},{key:"reciprocal",value:function(){var t,e,l,g,y=null,w=null,T=null,A=null;t=(l=1/this._hi)-(y=(T=u.SPLIT*l)-(y=T-l)),w=(A=u.SPLIT*this._hi)-this._hi;var B=l+(T=(1-(g=l*this._hi)-(A=y*(w=A-w)-g+y*(e=this._hi-w)+t*w+t*e)-l*this._lo)/this._hi);return new u(B,l-B+T)}},{key:"toSciNotation",value:function(){if(this.isZero())return u.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),l=this.extractSignificantDigits(!1,e),g=u.SCI_NOT_EXPONENT_CHAR+e[0];if(l.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+l);var y="";l.length>1&&(y=l.substring(1));var w=l.charAt(0)+"."+y;return this.isNegative()?"-"+w+g:w+g}},{key:"abs",value:function(){return this.isNaN()?u.NaN:this.isNegative()?this.negate():new u(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}},{key:"add",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return u.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return u.copy(this).selfAdd(e)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof u){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this._hi=l,this._lo=g}}},{key:"gt",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?u.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[N,ot,I]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof u){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var l=arguments[0];u.constructor_.call(this,u.parse(l))}}else if(arguments.length===2){var g=arguments[0],y=arguments[1];this.init(g,y)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],l=arguments[2],g=arguments[3];return u.determinant(u.valueOf(t),u.valueOf(e),u.valueOf(l),u.valueOf(g))}if(arguments[3]instanceof u&&arguments[2]instanceof u&&arguments[0]instanceof u&&arguments[1]instanceof u){var y=arguments[1],w=arguments[2],T=arguments[3];return arguments[0].multiply(T).selfSubtract(y.multiply(w))}}},{key:"sqr",value:function(t){return u.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var t=arguments[0];return u.parse(t)}if(typeof arguments[0]=="number")return new u(arguments[0])}},{key:"sqrt",value:function(t){return u.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var e=0,l=t.length;or.isWhitespace(t.charAt(e));)e++;var g=!1;if(e<l){var y=t.charAt(e);y!=="-"&&y!=="+"||(e++,y==="-"&&(g=!0))}for(var w=new u,T=0,A=0,B=0,K=!1;!(e>=l);){var it=t.charAt(e);if(e++,or.isDigit(it)){var lt=it-"0";w.selfMultiply(u.TEN),w.selfAdd(lt),T++}else{if(it!=="."){if(it==="e"||it==="E"){var gt=t.substring(e);try{B=nn.parseInt(gt)}catch(Jt){throw Jt instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+gt+" in string "+t):Jt}break}throw new NumberFormatException("Unexpected character '"+it+"' at position "+e+" in string "+t)}A=T,K=!0}}var bt=w;K||(A=T);var wt=T-A-B;if(wt===0)bt=w;else if(wt>0){var zt=u.TEN.pow(wt);bt=w.divide(zt)}else if(wt<0){var Ot=u.TEN.pow(-wt);bt=w.multiply(Ot)}return g?bt.negate():bt}},{key:"createNaN",value:function(){return new u(rt.NaN,rt.NaN)}},{key:"copy",value:function(t){return new u(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),l=Math.log(e)/Math.log(10),g=Math.trunc(Math.floor(l));return 10*Math.pow(10,g)<=e&&(g+=1),g}},{key:"stringOfChar",value:function(t,e){for(var l=new xn,g=0;g<e;g++)l.append(t);return l.toString()}}])})();Et.PI=new Et(3.141592653589793,12246467991473532e-32),Et.TWO_PI=new Et(6.283185307179586,24492935982947064e-32),Et.PI_2=new Et(1.5707963267948966,6123233995736766e-32),Et.E=new Et(2.718281828459045,14456468917292502e-32),Et.NaN=new Et(rt.NaN,rt.NaN),Et.EPS=123259516440783e-46,Et.SPLIT=134217729,Et.MAX_PRINT_DIGITS=32,Et.TEN=Et.valueOf(10),Et.ONE=Et.valueOf(1),Et.SCI_NOT_EXPONENT_CHAR="E",Et.SCI_NOT_ZERO="0.0E0";var no=(function(){function u(){r(this,u)}return d(u,null,[{key:"orientationIndex",value:function(t,e,l){var g=u.orientationIndexFilter(t,e,l);if(g<=1)return g;var y=Et.valueOf(e.x).selfAdd(-t.x),w=Et.valueOf(e.y).selfAdd(-t.y),T=Et.valueOf(l.x).selfAdd(-e.x),A=Et.valueOf(l.y).selfAdd(-e.y);return y.selfMultiply(A).selfSubtract(w.selfMultiply(T)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof Et&&arguments[2]instanceof Et&&arguments[0]instanceof Et&&arguments[1]instanceof Et){var t=arguments[1],e=arguments[2],l=arguments[3];return arguments[0].multiply(l).selfSubtract(t.multiply(e)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],A=Et.valueOf(g),B=Et.valueOf(y),K=Et.valueOf(w),it=Et.valueOf(T);return A.multiply(it).selfSubtract(B.multiply(K)).signum()}}},{key:"intersection",value:function(t,e,l,g){var y=new Et(t.y).selfSubtract(e.y),w=new Et(e.x).selfSubtract(t.x),T=new Et(t.x).selfMultiply(e.y).selfSubtract(new Et(e.x).selfMultiply(t.y)),A=new Et(l.y).selfSubtract(g.y),B=new Et(g.x).selfSubtract(l.x),K=new Et(l.x).selfMultiply(g.y).selfSubtract(new Et(g.x).selfMultiply(l.y)),it=w.multiply(K).selfSubtract(B.multiply(T)),lt=A.multiply(T).selfSubtract(y.multiply(K)),gt=y.multiply(B).selfSubtract(A.multiply(w)),bt=it.selfDivide(gt).doubleValue(),wt=lt.selfDivide(gt).doubleValue();return rt.isNaN(bt)||rt.isInfinite(bt)||rt.isNaN(wt)||rt.isInfinite(wt)?null:new tt(bt,wt)}},{key:"orientationIndexFilter",value:function(t,e,l){var g=null,y=(t.x-l.x)*(e.y-l.y),w=(t.y-l.y)*(e.x-l.x),T=y-w;if(y>0){if(w<=0)return u.signum(T);g=y+w}else{if(!(y<0)||w>=0)return u.signum(T);g=-y-w}var A=u.DP_SAFE_EPSILON*g;return T>=A||-T>=A?u.signum(T):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}])})();no.DP_SAFE_EPSILON=1e-15;var Dt=(function(){return d((function u(){r(this,u)}),[{key:"getM",value:function(u){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(u,t)}return rt.NaN}},{key:"setOrdinate",value:function(u,t,e){}},{key:"getZ",value:function(u){return this.hasZ()?this.getOrdinate(u,2):rt.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(u,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(u){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(u){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(u){}},{key:"copy",value:function(){}},{key:"getY",value:function(u){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[I]}}])})();Dt.X=0,Dt.Y=1,Dt.Z=2,Dt.M=3;var Tt=(function(){function u(){r(this,u)}return d(u,null,[{key:"index",value:function(t,e,l){return no.orientationIndex(t,e,l)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],e=t.length-1;if(e<3)throw new X("Ring has fewer than 4 points, so orientation cannot be determined");for(var l=t[0],g=0,y=1;y<=e;y++){var w=t[y];w.y>l.y&&(l=w,g=y)}var T=g;do(T-=1)<0&&(T=e);while(t[T].equals2D(l)&&T!==g);var A=g;do A=(A+1)%e;while(t[A].equals2D(l)&&A!==g);var B=t[T],K=t[A];if(B.equals2D(l)||K.equals2D(l)||B.equals2D(K))return!1;var it=u.index(B,l,K);return it===0?B.x>K.x:it>0}if(St(arguments[0],Dt)){var lt=arguments[0],gt=lt.size()-1;if(gt<3)throw new X("Ring has fewer than 4 points, so orientation cannot be determined");for(var bt=lt.getCoordinate(0),wt=0,zt=1;zt<=gt;zt++){var Ot=lt.getCoordinate(zt);Ot.y>bt.y&&(bt=Ot,wt=zt)}var Jt=null,ee=wt;do(ee-=1)<0&&(ee=gt),Jt=lt.getCoordinate(ee);while(Jt.equals2D(bt)&&ee!==wt);var de=null,Ai=wt;do Ai=(Ai+1)%gt,de=lt.getCoordinate(Ai);while(de.equals2D(bt)&&Ai!==wt);if(Jt.equals2D(bt)||de.equals2D(bt)||Jt.equals2D(de))return!1;var Dn=u.index(Jt,bt,de);return Dn===0?Jt.x>de.x:Dn>0}}}])})();Tt.CLOCKWISE=-1,Tt.RIGHT=Tt.CLOCKWISE,Tt.COUNTERCLOCKWISE=1,Tt.LEFT=Tt.COUNTERCLOCKWISE,Tt.COLLINEAR=0,Tt.STRAIGHT=Tt.COLLINEAR;var al=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(u,t){var e=this.getRightmostSideOfSegment(u,t);return e<0&&(e=this.getRightmostSideOfSegment(u,t-1)),e<0&&(this._minCoord=null,this.checkForRightmostCoordinate(u)),e}},{key:"findRightmostEdgeAtVertex",value:function(){var u=this._minDe.getEdge().getCoordinates();dt.isTrue(this._minIndex>0&&this._minIndex<u.length,"rightmost point expected to be interior vertex of edge");var t=u[this._minIndex-1],e=u[this._minIndex+1],l=Tt.index(this._minCoord,e,t),g=!1;(t.y<this._minCoord.y&&e.y<this._minCoord.y&&l===Tt.COUNTERCLOCKWISE||t.y>this._minCoord.y&&e.y>this._minCoord.y&&l===Tt.CLOCKWISE)&&(g=!0),g&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(u,t){var e=u.getEdge().getCoordinates();if(t<0||t+1>=e.length||e[t].y===e[t+1].y)return-1;var l=ct.LEFT;return e[t].y<e[t+1].y&&(l=ct.RIGHT),l}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(u){for(var t=u.getEdge().getCoordinates(),e=0;e<t.length-1;e++)(this._minCoord===null||t[e].x>this._minCoord.x)&&(this._minDe=u,this._minIndex=e,this._minCoord=t[e])}},{key:"findRightmostEdgeAtNode",value:function(){var u=this._minDe.getNode().getEdges();this._minDe=u.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(u){for(var t=u.iterator();t.hasNext();){var e=t.next();e.isForward()&&this.checkForRightmostCoordinate(e)}dt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===ct.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),ti=(function(u){function t(e,l){var g;return r(this,t),(g=s(this,t,[l?e+" [ "+l+" ]":e])).pt=l?new tt(l):void 0,g.name=Object.keys({TopologyException:t})[0],g}return b(t,u),d(t,[{key:"getCoordinate",value:function(){return this.pt}}])})(_t),ro=(function(){return d((function u(){r(this,u),this.array=[]}),[{key:"addLast",value:function(u){this.array.push(u)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),Lt=(function(u){function t(e){var l;return r(this,t),(l=s(this,t)).array=[],e instanceof Wt&&l.addAll(e),l}return b(t,u),d(t,[{key:"interfaces_",get:function(){return[ki,Wt]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(e){return arguments.length===1?this.array.push(e):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(e){var l,g=m(e);try{for(g.s();!(l=g.n()).done;){var y=l.value;this.array.push(y)}}catch(w){g.e(w)}finally{g.f()}}},{key:"set",value:function(e,l){var g=this.array[e];return this.array[e]=l,g}},{key:"iterator",value:function(){return new ll(this)}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new rr;return this.array[e]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(e){e?this.array.sort((function(l,g){return e.compare(l,g)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(e){for(var l=0,g=this.array.length;l<g;l++)if(this.array[l]===e)return!!this.array.splice(l,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(ki),ll=(function(){return d((function u(t){r(this,u),this.arrayList=t,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new oe;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(u){return this.arrayList.set(this.position-1,u)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),wn=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();)u.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(u){for(var t=null,e=u.getEdges().iterator();e.hasNext();){var l=e.next();if(l.isVisited()||l.getSym().isVisited()){t=l;break}}if(t===null)throw new ti("unable to find edge to compute depths at "+u.getCoordinate());u.getEdges().computeDepths(t);for(var g=u.getEdges().iterator();g.hasNext();){var y=g.next();y.setVisited(!0),this.copySymDepths(y)}}},{key:"computeDepth",value:function(u){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(ct.RIGHT,u),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(u){this.addReachable(u),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();){var t=u.next();t.getDepth(ct.RIGHT)>=1&&t.getDepth(ct.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(u){var t=new bn,e=new ro,l=u.getNode();for(e.addLast(l),t.add(l),u.setVisited(!0);!e.isEmpty();){var g=e.removeFirst();t.add(g),this.computeNodeDepth(g);for(var y=g.getEdges().iterator();y.hasNext();){var w=y.next().getSym();if(!w.isVisited()){var T=w.getNode();t.contains(T)||(e.addLast(T),t.add(T))}}}}},{key:"compareTo",value:function(u){var t=u;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var u=new qt,t=this._dirEdgeList.iterator();t.hasNext();)for(var e=t.next().getEdge().getCoordinates(),l=0;l<e.length-1;l++)u.expandToInclude(e[l]);this._env=u}return this._env}},{key:"addReachable",value:function(u){var t=new Es;for(t.add(u);!t.empty();){var e=t.pop();this.add(e,t)}}},{key:"copySymDepths",value:function(u){var t=u.getSym();t.setDepth(ct.LEFT,u.getDepth(ct.RIGHT)),t.setDepth(ct.RIGHT,u.getDepth(ct.LEFT))}},{key:"add",value:function(u,t){u.setVisited(!0),this._nodes.add(u);for(var e=u.getEdges().iterator();e.hasNext();){var l=e.next();this._dirEdgeList.add(l);var g=l.getSym().getNode();g.isVisited()||t.push(g)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new Lt,this._nodes=new Lt,this._rightMostCoord=null,this._env=null,this._finder=new al}}])})(),oo=(function(){return d((function u(){r(this,u)}),null,[{key:"intersection",value:function(u,t,e,l){var g=u.x<t.x?u.x:t.x,y=u.y<t.y?u.y:t.y,w=u.x>t.x?u.x:t.x,T=u.y>t.y?u.y:t.y,A=e.x<l.x?e.x:l.x,B=e.y<l.y?e.y:l.y,K=e.x>l.x?e.x:l.x,it=e.y>l.y?e.y:l.y,lt=((g>A?g:A)+(w<K?w:K))/2,gt=((y>B?y:B)+(T<it?T:it))/2,bt=u.x-lt,wt=u.y-gt,zt=t.x-lt,Ot=t.y-gt,Jt=e.x-lt,ee=e.y-gt,de=l.x-lt,Ai=l.y-gt,Dn=wt-Ot,ui=zt-bt,Po=bt*Ot-zt*wt,No=ee-Ai,gn=de-Jt,Hs=Jt*Ai-de*ee,Bn=Dn*gn-No*ui,Vi=(ui*Hs-gn*Po)/Bn,Ir=(No*Po-Dn*Hs)/Bn;return rt.isNaN(Vi)||rt.isInfinite(Vi)||rt.isNaN(Ir)||rt.isInfinite(Ir)?null:new tt(Vi+lt,Ir+gt)}}])})(),Be=(function(){return d((function u(){r(this,u)}),null,[{key:"arraycopy",value:function(u,t,e,l,g){for(var y=0,w=t;w<t+g;w++)e[l+y]=u[w],y++}},{key:"getProperty",value:function(u){return{"line.separator":`
|
|
488
|
-
`}[u]}}])})(),rn=(function(){function u(){r(this,u)}return d(u,null,[{key:"log10",value:function(t){var e=Math.log(t);return rt.isInfinite(e)||rt.isNaN(e)?e:e/u.LOG_10}},{key:"min",value:function(t,e,l,g){var y=t;return e<y&&(y=e),l<y&&(y=l),g<y&&(y=g),y}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],l=arguments[2];return t<e?e:t>l?l:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var g=arguments[0],y=arguments[1],w=arguments[2];return g<y?y:g>w?w:g}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(arguments.length===3){var t=arguments[1],e=arguments[2],l=arguments[0];return t>l&&(l=t),e>l&&(l=e),l}if(arguments.length===4){var g=arguments[1],y=arguments[2],w=arguments[3],T=arguments[0];return g>T&&(T=g),y>T&&(T=y),w>T&&(T=w),T}}},{key:"average",value:function(t,e){return(t+e)/2}}])})();rn.LOG_10=Math.log(10);var Ze=(function(){function u(){r(this,u)}return d(u,null,[{key:"segmentToSegment",value:function(t,e,l,g){if(t.equals(e))return u.pointToSegment(t,l,g);if(l.equals(g))return u.pointToSegment(g,t,e);var y=!1;if(qt.intersects(t,e,l,g)){var w=(e.x-t.x)*(g.y-l.y)-(e.y-t.y)*(g.x-l.x);if(w===0)y=!0;else{var T=(t.y-l.y)*(g.x-l.x)-(t.x-l.x)*(g.y-l.y),A=((t.y-l.y)*(e.x-t.x)-(t.x-l.x)*(e.y-t.y))/w,B=T/w;(B<0||B>1||A<0||A>1)&&(y=!0)}}else y=!0;return y?rn.min(u.pointToSegment(t,l,g),u.pointToSegment(e,l,g),u.pointToSegment(l,t,e),u.pointToSegment(g,t,e)):0}},{key:"pointToSegment",value:function(t,e,l){if(e.x===l.x&&e.y===l.y)return t.distance(e);var g=(l.x-e.x)*(l.x-e.x)+(l.y-e.y)*(l.y-e.y),y=((t.x-e.x)*(l.x-e.x)+(t.y-e.y)*(l.y-e.y))/g;if(y<=0)return t.distance(e);if(y>=1)return t.distance(l);var w=((e.y-t.y)*(l.x-e.x)-(e.x-t.x)*(l.y-e.y))/g;return Math.abs(w)*Math.sqrt(g)}},{key:"pointToLinePerpendicular",value:function(t,e,l){var g=(l.x-e.x)*(l.x-e.x)+(l.y-e.y)*(l.y-e.y),y=((e.y-t.y)*(l.x-e.x)-(e.x-t.x)*(l.y-e.y))/g;return Math.abs(y)*Math.sqrt(g)}},{key:"pointToSegmentString",value:function(t,e){if(e.length===0)throw new X("Line array must contain at least one vertex");for(var l=t.distance(e[0]),g=0;g<e.length-1;g++){var y=u.pointToSegment(t,e[g],e[g+1]);y<l&&(l=y)}return l}}])})(),so=(function(){return d((function u(){r(this,u)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||St(arguments[0],Dt);else if(arguments.length!==2){if(arguments.length===3){var u=arguments[0],t=arguments[1];return this.create(u,t)}}}}])})(),sr=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u){}}])})(),ul=(function(){return d((function u(){r(this,u)}),null,[{key:"ofLine",value:function(u){var t=u.size();if(t<=1)return 0;var e=0,l=new tt;u.getCoordinate(0,l);for(var g=l.x,y=l.y,w=1;w<t;w++){u.getCoordinate(w,l);var T=l.x,A=l.y,B=T-g,K=A-y;e+=Math.sqrt(B*B+K*K),g=T,y=A}return e}}])})(),Ts=d((function u(){r(this,u)})),Fi=(function(){function u(){r(this,u)}return d(u,null,[{key:"copyCoord",value:function(t,e,l,g){for(var y=Math.min(t.getDimension(),l.getDimension()),w=0;w<y;w++)l.setOrdinate(g,w,t.getOrdinate(e,w))}},{key:"isRing",value:function(t){var e=t.size();return e===0||!(e<=3)&&t.getOrdinate(0,Dt.X)===t.getOrdinate(e-1,Dt.X)&&t.getOrdinate(0,Dt.Y)===t.getOrdinate(e-1,Dt.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(St(arguments[0],Dt)&&Number.isInteger(arguments[1])){var t=arguments[0],e=arguments[1];u.scroll(t,e,u.isRing(t))}else if(St(arguments[0],Dt)&&arguments[1]instanceof tt){var l=arguments[0],g=arguments[1],y=u.indexOf(g,l);if(y<=0)return null;u.scroll(l,y)}}else if(arguments.length===3){var w=arguments[0],T=arguments[1],A=arguments[2];if(T<=0)return null;for(var B=w.copy(),K=A?w.size()-1:w.size(),it=0;it<K;it++)for(var lt=0;lt<w.getDimension();lt++)w.setOrdinate(it,lt,B.getOrdinate((T+it)%K,lt));if(A)for(var gt=0;gt<w.getDimension();gt++)w.setOrdinate(K,gt,w.getOrdinate(0,gt))}}},{key:"isEqual",value:function(t,e){var l=t.size();if(l!==e.size())return!1;for(var g=Math.min(t.getDimension(),e.getDimension()),y=0;y<l;y++)for(var w=0;w<g;w++){var T=t.getOrdinate(y,w),A=e.getOrdinate(y,w);if(t.getOrdinate(y,w)!==e.getOrdinate(y,w)&&(!rt.isNaN(T)||!rt.isNaN(A)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var t=arguments[0];return u.minCoordinateIndex(t,0,t.size()-1)}if(arguments.length===3){for(var e=arguments[0],l=arguments[2],g=-1,y=null,w=arguments[1];w<=l;w++){var T=e.getCoordinate(w);(y===null||y.compareTo(T)>0)&&(y=T,g=w)}return g}}},{key:"extend",value:function(t,e,l){var g=t.create(l,e.getDimension()),y=e.size();if(u.copy(e,0,g,0,y),y>0)for(var w=y;w<l;w++)u.copy(e,y-1,g,w,1);return g}},{key:"reverse",value:function(t){for(var e=t.size()-1,l=Math.trunc(e/2),g=0;g<=l;g++)u.swap(t,g,e-g)}},{key:"swap",value:function(t,e,l){if(e===l)return null;for(var g=0;g<t.getDimension();g++){var y=t.getOrdinate(e,g);t.setOrdinate(e,g,t.getOrdinate(l,g)),t.setOrdinate(l,g,y)}}},{key:"copy",value:function(t,e,l,g,y){for(var w=0;w<y;w++)u.copyCoord(t,e+w,l,g+w)}},{key:"ensureValidRing",value:function(t,e){var l=e.size();return l===0?e:l<=3?u.createClosedRing(t,e,4):e.getOrdinate(0,Dt.X)===e.getOrdinate(l-1,Dt.X)&&e.getOrdinate(0,Dt.Y)===e.getOrdinate(l-1,Dt.Y)?e:u.createClosedRing(t,e,l+1)}},{key:"indexOf",value:function(t,e){for(var l=0;l<e.size();l++)if(t.x===e.getOrdinate(l,Dt.X)&&t.y===e.getOrdinate(l,Dt.Y))return l;return-1}},{key:"createClosedRing",value:function(t,e,l){var g=t.create(l,e.getDimension()),y=e.size();u.copy(e,0,g,0,y);for(var w=y;w<l;w++)u.copy(e,0,g,w,1);return g}},{key:"minCoordinate",value:function(t){for(var e=null,l=0;l<t.size();l++){var g=t.getCoordinate(l);(e===null||e.compareTo(g)>0)&&(e=g)}return e}}])})(),ft=(function(){function u(){r(this,u)}return d(u,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case u.FALSE:return u.SYM_FALSE;case u.TRUE:return u.SYM_TRUE;case u.DONTCARE:return u.SYM_DONTCARE;case u.P:return u.SYM_P;case u.L:return u.SYM_L;case u.A:return u.SYM_A}throw new X("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(or.toUpperCase(t)){case u.SYM_FALSE:return u.FALSE;case u.SYM_TRUE:return u.TRUE;case u.SYM_DONTCARE:return u.DONTCARE;case u.SYM_P:return u.P;case u.SYM_L:return u.L;case u.SYM_A:return u.A}throw new X("Unknown dimension symbol: "+t)}}])})();ft.P=0,ft.L=1,ft.A=2,ft.FALSE=-1,ft.TRUE=-2,ft.DONTCARE=-3,ft.SYM_FALSE="F",ft.SYM_TRUE="T",ft.SYM_DONTCARE="*",ft.SYM_P="0",ft.SYM_L="1",ft.SYM_A="2";var ar=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u){}}])})(),on=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),kn=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new qt:this._points.expandEnvelope(new qt)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];if(!this.isEquivalentClass(e))return!1;var g=e;if(this._points.size()!==g._points.size())return!1;for(var y=0;y<this._points.size();y++)if(!this.equal(this._points.getCoordinate(y),g._points.getCoordinate(y),l))return!1;return!0}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<Math.trunc(this._points.size()/2);e++){var l=this._points.size()-1-e;if(!this._points.getCoordinate(e).equals(this._points.getCoordinate(l))){if(this._points.getCoordinate(e).compareTo(this._points.getCoordinate(l))>0){var g=this._points.copy();Fi.reverse(g),this._points=g}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ft.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var e=this._points.copy();return Fi.reverse(e),this.getFactory().createLineString(e)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return ul.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var e=arguments[0],l=0,g=0;l<this._points.size()&&g<e._points.size();){var y=this._points.getCoordinate(l).compareTo(e._points.getCoordinate(g));if(y!==0)return y;l++,g++}return l<this._points.size()?1:g<e._points.size()?-1:0}if(arguments.length===2){var w=arguments[0];return arguments[1].compare(this._points,w._points)}}},{key:"apply",value:function(){if(St(arguments[0],sr))for(var e=arguments[0],l=0;l<this._points.size();l++)e.filter(this._points.getCoordinate(l));else if(St(arguments[0],on)){var g=arguments[0];if(this._points.size()===0)return null;for(var y=0;y<this._points.size()&&(g.filter(this._points,y),!g.isDone());y++);g.isGeometryChanged()&&this.geometryChanged()}else St(arguments[0],ar)?arguments[0].filter(this):St(arguments[0],et)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new Ut}},{key:"isEquivalentClass",value:function(e){return e instanceof t}},{key:"getCoordinateN",value:function(e){return this._points.getCoordinate(e)}},{key:"getGeometryType",value:function(){return mt.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(e){if(e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),e.size()===1)throw new X("Invalid number of points in LineString (found "+e.size()+" - must be 0 or >= 2)");this._points=e}},{key:"isCoordinate",value:function(e){for(var l=0;l<this._points.size();l++)if(this._points.getCoordinate(l).equals(e))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(e){return this.getFactory().createPoint(this._points.getCoordinate(e))}},{key:"interfaces_",get:function(){return[Ts]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],l=arguments[1];mt.constructor_.call(this,l),this.init(e)}}}}])})(mt),Is=d((function u(){r(this,u)})),ao=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new qt;var e=new qt;return e.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),e}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new t(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),l))}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return ft.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return mt.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0];return this.getCoordinate().compareTo(e.getCoordinate())}if(arguments.length===2){var l=arguments[0];return arguments[1].compare(this._coordinates,l._coordinates)}}},{key:"apply",value:function(){if(St(arguments[0],sr)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this.getCoordinate())}else if(St(arguments[0],on)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this._coordinates,0),l.isGeometryChanged()&&this.geometryChanged()}else St(arguments[0],ar)?arguments[0].filter(this):St(arguments[0],et)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return mt.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(e){e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),dt.isTrue(e.size()<=1),this._coordinates=e}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Is]}}],[{key:"constructor_",value:function(){this._coordinates=null;var e=arguments[0],l=arguments[1];mt.constructor_.call(this,l),this.init(e)}}])})(mt),Cs=(function(){function u(){r(this,u)}return d(u,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(u.ofRingSigned(t))}if(St(arguments[0],Dt)){var e=arguments[0];return Math.abs(u.ofRingSigned(e))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,l=t[0].x,g=1;g<t.length-1;g++){var y=t[g].x-l,w=t[g+1].y;e+=y*(t[g-1].y-w)}return e/2}if(St(arguments[0],Dt)){var T=arguments[0],A=T.size();if(A<3)return 0;var B=new tt,K=new tt,it=new tt;T.getCoordinate(0,K),T.getCoordinate(1,it);var lt=K.x;it.x-=lt;for(var gt=0,bt=1;bt<A-1;bt++)B.y=K.y,K.x=it.x,K.y=it.y,T.getCoordinate(bt+1,it),it.x-=lt,gt+=K.x*(B.y-it.y);return gt/2}}}])})(),pe=(function(){return d((function u(){r(this,u)}),null,[{key:"sort",value:function(){var u=arguments,t=arguments[0];if(arguments.length===1)t.sort((function(lt,gt){return lt.compareTo(gt)}));else if(arguments.length===2)t.sort((function(lt,gt){return u[1].compare(lt,gt)}));else if(arguments.length===3){var e=t.slice(arguments[1],arguments[2]);e.sort();var l=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);var g,y=m(l);try{for(y.s();!(g=y.n()).done;){var w=g.value;t.push(w)}}catch(lt){y.e(lt)}finally{y.f()}}else if(arguments.length===4){var T=t.slice(arguments[1],arguments[2]);T.sort((function(lt,gt){return u[3].compare(lt,gt)}));var A=t.slice(0,arguments[1]).concat(T,t.slice(arguments[2],t.length));t.splice(0,t.length);var B,K=m(A);try{for(K.s();!(B=K.n()).done;){var it=B.value;t.push(it)}}catch(lt){K.e(lt)}finally{K.f()}}}},{key:"asList",value:function(u){var t,e=new Lt,l=m(u);try{for(l.s();!(t=l.n()).done;){var g=t.value;e.add(g)}}catch(y){l.e(y)}finally{l.f()}return e}},{key:"copyOf",value:function(u,t){return u.slice(0,t)}}])})(),xt=d((function u(){r(this,u)})),Ln=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var e=new Array(this.getNumPoints()).fill(null),l=-1,g=this._shell.getCoordinates(),y=0;y<g.length;y++)e[++l]=g[y];for(var w=0;w<this._holes.length;w++)for(var T=this._holes[w].getCoordinates(),A=0;A<T.length;A++)e[++l]=T[A];return e}},{key:"getArea",value:function(){var e=0;e+=Cs.ofRing(this._shell.getCoordinateSequence());for(var l=0;l<this._holes.length;l++)e-=Cs.ofRing(this._holes[l].getCoordinateSequence());return e}},{key:"copyInternal",value:function(){for(var e=this._shell.copy(),l=new Array(this._holes.length).fill(null),g=0;g<this._holes.length;g++)l[g]=this._holes[g].copy();return new t(e,l,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var e=this._shell.getCoordinateSequence(),l=this.getEnvelopeInternal(),g=0;g<5;g++){var y=e.getX(g);if(y!==l.getMinX()&&y!==l.getMaxX())return!1;var w=e.getY(g);if(w!==l.getMinY()&&w!==l.getMaxY())return!1}for(var T=e.getX(0),A=e.getY(0),B=1;B<=4;B++){var K=e.getX(B),it=e.getY(B);if(K!==T==(it!==A))return!1;T=K,A=it}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];if(!this.isEquivalentClass(e))return!1;var g=e,y=this._shell,w=g._shell;if(!y.equalsExact(w,l)||this._holes.length!==g._holes.length)return!1;for(var T=0;T<this._holes.length;T++)if(!this._holes[T].equalsExact(g._holes[T],l))return!1;return!0}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var e=0;e<this._holes.length;e++)this._holes[e]=this.normalized(this._holes[e],!1);pe.sort(this._holes)}else if(arguments.length===2){var l=arguments[0],g=arguments[1];if(l.isEmpty())return null;var y=l.getCoordinateSequence(),w=Fi.minCoordinateIndex(y,0,y.size()-2);Fi.scroll(y,w,!0),Tt.isCCW(y)===g&&Fi.reverse(y)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var e=this.getExteriorRing().reverse(),l=new Array(this.getNumInteriorRing()).fill(null),g=0;g<l.length;g++)l[g]=this.getInteriorRingN(g).reverse();return this.getFactory().createPolygon(e,l)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var e=0;e+=this._shell.getLength();for(var l=0;l<this._holes.length;l++)e+=this._holes[l].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=this._shell.getNumPoints(),l=0;l<this._holes.length;l++)e+=this._holes[l].getNumPoints();return e}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(e,l){var g=e.copy();return this.normalize(g,l),g}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],l=this._shell,g=e._shell;return l.compareToSameClass(g)}if(arguments.length===2){var y=arguments[1],w=arguments[0],T=this._shell,A=w._shell,B=T.compareToSameClass(A,y);if(B!==0)return B;for(var K=this.getNumInteriorRing(),it=w.getNumInteriorRing(),lt=0;lt<K&<<it;){var gt=this.getInteriorRingN(lt),bt=w.getInteriorRingN(lt),wt=gt.compareToSameClass(bt,y);if(wt!==0)return wt;lt++}return lt<K?1:lt<it?-1:0}}},{key:"apply",value:function(){if(St(arguments[0],sr)){var e=arguments[0];this._shell.apply(e);for(var l=0;l<this._holes.length;l++)this._holes[l].apply(e)}else if(St(arguments[0],on)){var g=arguments[0];if(this._shell.apply(g),!g.isDone())for(var y=0;y<this._holes.length&&(this._holes[y].apply(g),!g.isDone());y++);g.isGeometryChanged()&&this.geometryChanged()}else if(St(arguments[0],ar))arguments[0].filter(this);else if(St(arguments[0],et)){var w=arguments[0];w.filter(this),this._shell.apply(w);for(var T=0;T<this._holes.length;T++)this._holes[T].apply(w)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var e=new Array(this._holes.length+1).fill(null);e[0]=this._shell;for(var l=0;l<this._holes.length;l++)e[l+1]=this._holes[l];return e.length<=1?this.getFactory().createLinearRing(e[0].getCoordinateSequence()):this.getFactory().createMultiLineString(e)}},{key:"getGeometryType",value:function(){return mt.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(e){return this._holes[e]}},{key:"interfaces_",get:function(){return[xt]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var e=arguments[0],l=arguments[1],g=arguments[2];if(mt.constructor_.call(this,g),e===null&&(e=this.getFactory().createLinearRing()),l===null&&(l=[]),mt.hasNullElements(l))throw new X("holes must not contain null elements");if(e.isEmpty()&&mt.hasNonEmptyElements(l))throw new X("shell is empty but holes are not");this._shell=e,this._holes=l}}])})(mt),Ss=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t)})(eo),lo=(function(u){function t(e){var l;return r(this,t),(l=s(this,t)).array=[],e instanceof Wt&&l.addAll(e),l}return b(t,u),d(t,[{key:"contains",value:function(e){var l,g=m(this.array);try{for(g.s();!(l=g.n()).done;)if(l.value.compareTo(e)===0)return!0}catch(y){g.e(y)}finally{g.f()}return!1}},{key:"add",value:function(e){if(this.contains(e))return!1;for(var l=0,g=this.array.length;l<g;l++)if(this.array[l].compareTo(e)===1)return!!this.array.splice(l,0,e);return this.array.push(e),!0}},{key:"addAll",value:function(e){var l,g=m(e);try{for(g.s();!(l=g.n()).done;){var y=l.value;this.add(y)}}catch(w){g.e(w)}finally{g.f()}return!0}},{key:"remove",value:function(){throw new Ut}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new Ms(this.array)}}])})(Ss),Ms=(function(){return d((function u(t){r(this,u),this.array=t,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new oe;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new Ut}}])})(),xe=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){for(var e=new qt,l=0;l<this._geometries.length;l++)e.expandToInclude(this._geometries[l].getEnvelopeInternal());return e}},{key:"getGeometryN",value:function(e){return this._geometries[e]}},{key:"getCoordinates",value:function(){for(var e=new Array(this.getNumPoints()).fill(null),l=-1,g=0;g<this._geometries.length;g++)for(var y=this._geometries[g].getCoordinates(),w=0;w<y.length;w++)e[++l]=y[w];return e}},{key:"getArea",value:function(){for(var e=0,l=0;l<this._geometries.length;l++)e+=this._geometries[l].getArea();return e}},{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];if(!this.isEquivalentClass(e))return!1;var g=e;if(this._geometries.length!==g._geometries.length)return!1;for(var y=0;y<this._geometries.length;y++)if(!this._geometries[y].equalsExact(g._geometries[y],l))return!1;return!0}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<this._geometries.length;e++)this._geometries[e].normalize();pe.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var e=ft.FALSE,l=0;l<this._geometries.length;l++)e=Math.max(e,this._geometries[l].getBoundaryDimension());return e}},{key:"reverseInternal",value:function(){for(var e=this._geometries.length,l=new Lt(e),g=0;g<e;g++)l.add(this._geometries[g].reverse());return this.getFactory().buildGeometry(l)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var e=ft.FALSE,l=0;l<this._geometries.length;l++)e=Math.max(e,this._geometries[l].getDimension());return e}},{key:"getLength",value:function(){for(var e=0,l=0;l<this._geometries.length;l++)e+=this._geometries[l].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=0,l=0;l<this._geometries.length;l++)e+=this._geometries[l].getNumPoints();return e}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],l=new lo(pe.asList(this._geometries)),g=new lo(pe.asList(e._geometries));return this.compare(l,g)}if(arguments.length===2){for(var y=arguments[1],w=arguments[0],T=this.getNumGeometries(),A=w.getNumGeometries(),B=0;B<T&&B<A;){var K=this.getGeometryN(B),it=w.getGeometryN(B),lt=K.compareToSameClass(it,y);if(lt!==0)return lt;B++}return B<T?1:B<A?-1:0}}},{key:"apply",value:function(){if(St(arguments[0],sr))for(var e=arguments[0],l=0;l<this._geometries.length;l++)this._geometries[l].apply(e);else if(St(arguments[0],on)){var g=arguments[0];if(this._geometries.length===0)return null;for(var y=0;y<this._geometries.length&&(this._geometries[y].apply(g),!g.isDone());y++);g.isGeometryChanged()&&this.geometryChanged()}else if(St(arguments[0],ar)){var w=arguments[0];w.filter(this);for(var T=0;T<this._geometries.length;T++)this._geometries[T].apply(w)}else if(St(arguments[0],et)){var A=arguments[0];A.filter(this);for(var B=0;B<this._geometries.length;B++)this._geometries[B].apply(A)}}},{key:"getBoundary",value:function(){return mt.checkNotGeometryCollection(this),dt.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return mt.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],l=arguments[1];if(mt.constructor_.call(this,l),e===null&&(e=[]),mt.hasNullElements(e))throw new X("geometries must not contain null elements");this._geometries=e}}}}])})(mt),lr=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&M(t,"equalsExact",this,1).call(this,e,l)}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var e=arguments[0];return this._geometries[e].getCoordinate()}return M(t,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return ft.FALSE}},{key:"getTypeCode",value:function(){return mt.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return mt.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Is]}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];xe.constructor_.call(this,e,l)}}])})(xe),ei=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return ft.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||M(t,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var e=this._points.copy();return Fi.reverse(e),this.getFactory().createLinearRing(e)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!M(t,"isClosed",this,1).call(this))throw new X("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new X("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return mt.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];kn.constructor_.call(this,e,l),this.validateConstruction()}}])})(kn);ei.MINIMUM_VALID_SIZE=4;var Li=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"setOrdinate",value:function(e,l){switch(e){case t.X:this.x=l;break;case t.Y:this.y=l;break;default:throw new X("Invalid ordinate index: "+e)}}},{key:"getZ",value:function(){return tt.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y}throw new X("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new X("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)tt.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];tt.constructor_.call(this,e.x,e.y)}else if(arguments[0]instanceof tt){var l=arguments[0];tt.constructor_.call(this,l.x,l.y)}}else if(arguments.length===2){var g=arguments[0],y=arguments[1];tt.constructor_.call(this,g,y,tt.NULL_ORDINATE)}}}])})(tt);Li.X=0,Li.Y=1,Li.Z=-1,Li.M=-1;var Gi=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,l){switch(e){case t.X:this.x=l;break;case t.Y:this.y=l;break;case t.M:this._m=l;break;default:throw new X("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getZ",value:function(){return tt.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new X("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new X("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)tt.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];tt.constructor_.call(this,e.x,e.y),this._m=e._m}else if(arguments[0]instanceof tt){var l=arguments[0];tt.constructor_.call(this,l.x,l.y),this._m=this.getM()}}else if(arguments.length===3){var g=arguments[0],y=arguments[1],w=arguments[2];tt.constructor_.call(this,g,y,tt.NULL_ORDINATE),this._m=w}}}])})(tt);Gi.X=0,Gi.Y=1,Gi.Z=-1,Gi.M=2;var uo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,l){switch(e){case tt.X:this.x=l;break;case tt.Y:this.y=l;break;case tt.Z:this.z=l;break;case tt.M:this._m=l;break;default:throw new X("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getOrdinate",value:function(e){switch(e){case tt.X:return this.x;case tt.Y:return this.y;case tt.Z:return this.getZ();case tt.M:return this.getM()}throw new X("Invalid ordinate index: "+e)}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)tt.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];tt.constructor_.call(this,e),this._m=e._m}else if(arguments[0]instanceof tt){var l=arguments[0];tt.constructor_.call(this,l),this._m=this.getM()}}else if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3];tt.constructor_.call(this,g,y,w),this._m=T}}}])})(tt),ur=(function(){function u(){r(this,u)}return d(u,null,[{key:"measures",value:function(t){return t instanceof Li?0:t instanceof Gi||t instanceof uo?1:0}},{key:"dimension",value:function(t){return t instanceof Li?2:t instanceof Gi?3:t instanceof uo?4:3}},{key:"create",value:function(){if(arguments.length===1){var t=arguments[0];return u.create(t,0)}if(arguments.length===2){var e=arguments[0],l=arguments[1];return e===2?new Li:e===3&&l===0?new tt:e===3&&l===1?new Gi:e===4&&l===1?new uo:new tt}}}])})(),En=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getCoordinate",value:function(e){return this.get(e)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&St(arguments[0],Wt)){for(var e=arguments[1],l=!1,g=arguments[0].iterator();g.hasNext();)this.add(g.next(),e),l=!0;return l}return M(t,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var e=M(t,"clone",this,1).call(this),l=0;l<this.size();l++)e.add(l,this.get(l).clone());return e}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(t.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(t.coordArrayType);for(var e=this.size(),l=new Array(e).fill(null),g=0;g<e;g++)l[g]=this.get(e-g-1);return l}}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];return M(t,"add",this,1).call(this,e)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var l=arguments[0],g=arguments[1];return this.add(l,g,!0),!0}if(arguments[0]instanceof tt&&typeof arguments[1]=="boolean"){var y=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(y))return null;M(t,"add",this,1).call(this,y)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var w=arguments[0],T=arguments[1];return this.add(w,T),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var A=arguments[0],B=arguments[1];if(arguments[2])for(var K=0;K<A.length;K++)this.add(A[K],B);else for(var it=A.length-1;it>=0;it--)this.add(A[it],B);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof tt){var lt=arguments[0],gt=arguments[1];if(!arguments[2]){var bt=this.size();if(bt>0&&(lt>0&&this.get(lt-1).equals2D(gt)||lt<bt&&this.get(lt).equals2D(gt)))return null}M(t,"add",this,1).call(this,lt,gt)}}else if(arguments.length===4){var wt=arguments[0],zt=arguments[1],Ot=arguments[2],Jt=arguments[3],ee=1;Ot>Jt&&(ee=-1);for(var de=Ot;de!==Jt;de+=ee)this.add(wt[de],zt);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var e=this.get(0).copy();this.add(e,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.ensureCapacity(l.length),this.add(l,g)}}}}])})(Lt);En.coordArrayType=new Array(0).fill(null);var se=(function(){function u(){r(this,u)}return d(u,null,[{key:"isRing",value:function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}},{key:"ptNotInList",value:function(t,e){for(var l=0;l<t.length;l++){var g=t[l];if(u.indexOf(g,e)<0)return g}return null}},{key:"scroll",value:function(t,e){var l=u.indexOf(e,t);if(l<0)return null;var g=new Array(t.length).fill(null);Be.arraycopy(t,l,g,0,t.length-l),Be.arraycopy(t,0,g,t.length-l,l),Be.arraycopy(g,0,t,0,t.length)}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(var l=0;l<t.length;l++)if(!t[l].equals(e[l]))return!1;return!0}if(arguments.length===3){var g=arguments[0],y=arguments[1],w=arguments[2];if(g===y)return!0;if(g===null||y===null||g.length!==y.length)return!1;for(var T=0;T<g.length;T++)if(w.compare(g[T],y[T])!==0)return!1;return!0}}},{key:"intersection",value:function(t,e){for(var l=new En,g=0;g<t.length;g++)e.intersects(t[g])&&l.add(t[g],!0);return l.toCoordinateArray()}},{key:"measures",value:function(t){if(t===null||t.length===0)return 0;var e,l=0,g=m(t);try{for(g.s();!(e=g.n()).done;){var y=e.value;l=Math.max(l,ur.measures(y))}}catch(w){g.e(w)}finally{g.f()}return l}},{key:"hasRepeatedPoints",value:function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(t){return u.hasRepeatedPoints(t)?new En(t,!1).toCoordinateArray():t}},{key:"reverse",value:function(t){for(var e=t.length-1,l=Math.trunc(e/2),g=0;g<=l;g++){var y=t[g];t[g]=t[e-g],t[e-g]=y}}},{key:"removeNull",value:function(t){for(var e=0,l=0;l<t.length;l++)t[l]!==null&&e++;var g=new Array(e).fill(null);if(e===0)return g;for(var y=0,w=0;w<t.length;w++)t[w]!==null&&(g[y++]=t[w]);return g}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),l=0;l<t.length;l++)e[l]=t[l].copy();return e}if(arguments.length===5)for(var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],A=arguments[4],B=0;B<A;B++)w[T+B]=g[y+B].copy()}},{key:"isEqualReversed",value:function(t,e){for(var l=0;l<t.length;l++){var g=t[l],y=e[t.length-l-1];if(g.compareTo(y)!==0)return!1}return!0}},{key:"envelope",value:function(t){for(var e=new qt,l=0;l<t.length;l++)e.expandToInclude(t[l]);return e}},{key:"toCoordinateArray",value:function(t){return t.toArray(u.coordArrayType)}},{key:"dimension",value:function(t){if(t===null||t.length===0)return 3;var e,l=0,g=m(t);try{for(g.s();!(e=g.n()).done;){var y=e.value;l=Math.max(l,ur.dimension(y))}}catch(w){g.e(w)}finally{g.f()}return l}},{key:"atLeastNCoordinatesOrNothing",value:function(t,e){return e.length>=t?e:[]}},{key:"indexOf",value:function(t,e){for(var l=0;l<e.length;l++)if(t.equals(e[l]))return l;return-1}},{key:"increasingDirection",value:function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var l=t.length-1-e,g=t[e].compareTo(t[l]);if(g!==0)return g}return 1}},{key:"compare",value:function(t,e){for(var l=0;l<t.length&&l<e.length;){var g=t[l].compareTo(e[l]);if(g!==0)return g;l++}return l<e.length?-1:l<t.length?1:0}},{key:"minCoordinate",value:function(t){for(var e=null,l=0;l<t.length;l++)(e===null||e.compareTo(t[l])>0)&&(e=t[l]);return e}},{key:"extract",value:function(t,e,l){e=rn.clamp(e,0,t.length);var g=(l=rn.clamp(l,-1,t.length))-e+1;l<0&&(g=0),e>=t.length&&(g=0),l<e&&(g=0);var y=new Array(g).fill(null);if(g===0)return y;for(var w=0,T=e;T<=l;T++)y[w++]=t[T];return y}}])})(),hl=(function(){return d((function u(){r(this,u)}),[{key:"compare",value:function(u,t){var e=u,l=t;return se.compare(e,l)}},{key:"interfaces_",get:function(){return[ht]}}])})(),hr=(function(){return d((function u(){r(this,u)}),[{key:"compare",value:function(u,t){var e=u,l=t;if(e.length<l.length)return-1;if(e.length>l.length)return 1;if(e.length===0)return 0;var g=se.compare(e,l);return se.isEqualReversed(e,l)?0:g}},{key:"OLDcompare",value:function(u,t){var e=u,l=t;if(e.length<l.length)return-1;if(e.length>l.length)return 1;if(e.length===0)return 0;for(var g=se.increasingDirection(e),y=se.increasingDirection(l),w=g>0?0:e.length-1,T=y>0?0:e.length-1,A=0;A<e.length;A++){var B=e[w].compareTo(l[T]);if(B!==0)return B;w+=g,T+=y}return 0}},{key:"interfaces_",get:function(){return[ht]}}])})();se.ForwardComparator=hl,se.BidirectionalComparator=hr,se.coordArrayType=new Array(0).fill(null);var cr=(function(){return d((function u(t){r(this,u),this.str=t}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,t){this.str=this.str.substr(0,u)+t+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),Tn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getM",value:function(t){return this.hasM()?this._coordinates[t].getM():rt.NaN}},{key:"setOrdinate",value:function(t,e,l){switch(e){case Dt.X:this._coordinates[t].x=l;break;case Dt.Y:this._coordinates[t].y=l;break;default:this._coordinates[t].setOrdinate(e,l)}}},{key:"getZ",value:function(t){return this.hasZ()?this._coordinates[t].getZ():rt.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(t,e){switch(e){case Dt.X:return this._coordinates[t].x;case Dt.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var e=arguments[0];arguments[1].setCoordinate(this._coordinates[e])}}},{key:"getCoordinateCopy",value:function(t){var e=this.createCoordinate();return e.setCoordinate(this._coordinates[t]),e}},{key:"createCoordinate",value:function(){return ur.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(t){return this._coordinates[t].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t}},{key:"copy",value:function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++){var l=this.createCoordinate();l.setCoordinate(this._coordinates[e]),t[e]=l}return new u(t,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var t=new cr(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"}},{key:"getY",value:function(t){return this._coordinates[t].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[Dt,N]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];u.constructor_.call(this,t,se.dimension(t),se.measures(t))}else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var l=0;l<e;l++)this._coordinates[l]=new tt}else if(St(arguments[0],Dt)){var g=arguments[0];if(g===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=g.getDimension(),this._measures=g.getMeasures(),this._coordinates=new Array(g.size()).fill(null);for(var y=0;y<this._coordinates.length;y++)this._coordinates[y]=g.getCoordinateCopy(y)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var w=arguments[0],T=arguments[1];u.constructor_.call(this,w,T,se.measures(w))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var A=arguments[0],B=arguments[1];this._coordinates=new Array(A).fill(null),this._dimension=B;for(var K=0;K<A;K++)this._coordinates[K]=ur.create(B)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var it=arguments[0],lt=arguments[1],gt=arguments[2];this._dimension=lt,this._measures=gt,this._coordinates=it===null?new Array(0).fill(null):it}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var bt=arguments[0],wt=arguments[1],zt=arguments[2];this._coordinates=new Array(bt).fill(null),this._dimension=wt,this._measures=zt;for(var Ot=0;Ot<bt;Ot++)this._coordinates[Ot]=this.createCoordinate()}}}}])})(),ho=(function(){function u(){r(this,u)}return d(u,[{key:"readResolve",value:function(){return u.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new Tn(arguments[0]);if(St(arguments[0],Dt))return new Tn(arguments[0])}else{if(arguments.length===2){var t=arguments[1];return t>3&&(t=3),t<2&&(t=2),new Tn(arguments[0],t)}if(arguments.length===3){var e=arguments[2],l=arguments[1]-e;return e>1&&(e=1),l>3&&(l=3),l<2&&(l=2),new Tn(arguments[0],l+e,e)}}}},{key:"interfaces_",get:function(){return[so,N]}}],[{key:"instance",value:function(){return u.instanceObject}}])})();ho.instanceObject=new ho;var co=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&M(t,"equalsExact",this,1).call(this,e,l)}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return mt.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var e=new Lt,l=0;l<this._geometries.length;l++)for(var g=this._geometries[l].getBoundary(),y=0;y<g.getNumGeometries();y++)e.add(g.getGeometryN(y));var w=new Array(e.size()).fill(null);return this.getFactory().createMultiLineString(e.toArray(w))}},{key:"getGeometryType",value:function(){return mt.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[xt]}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];xe.constructor_.call(this,e,l)}}])})(xe),As=(function(){return d((function u(){r(this,u)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),fo=(function(u){function t(){var e;return r(this,t),(e=s(this,t)).map=new Map,e}return b(t,u),d(t,[{key:"get",value:function(e){return this.map.get(e)||null}},{key:"put",value:function(e,l){return this.map.set(e,l),l}},{key:"values",value:function(){for(var e=new Lt,l=this.map.values(),g=l.next();!g.done;)e.add(g.value),g=l.next();return e}},{key:"entrySet",value:function(){var e=new bn;return this.map.entries().forEach((function(l){return e.add(l)})),e}},{key:"size",value:function(){return this.map.size()}}])})(As),we=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"equals",value:function(t){if(!(t instanceof u))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale}},{key:"compareTo",value:function(t){var e=t,l=this.getMaximumSignificantDigits(),g=e.getMaximumSignificantDigits();return nn.compare(l,g)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===u.FLOATING||this._modelType===u.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var t="UNKNOWN";return this._modelType===u.FLOATING?t="Floating":this._modelType===u.FLOATING_SINGLE?t="Floating-Single":this._modelType===u.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var t=arguments[0];return rt.isNaN(t)||this._modelType===u.FLOATING_SINGLE?t:this._modelType===u.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof tt){var e=arguments[0];if(this._modelType===u.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}}},{key:"getMaximumSignificantDigits",value:function(){var t=16;return this._modelType===u.FLOATING?t=16:this._modelType===u.FLOATING_SINGLE?t=6:this._modelType===u.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}},{key:"setScale",value:function(t){this._scale=Math.abs(t)}},{key:"interfaces_",get:function(){return[N,ot]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=u.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Ui){var t=arguments[0];this._modelType=t,t===u.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=u.FIXED,this.setScale(e)}else if(arguments[0]instanceof u){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}}},{key:"mostPrecise",value:function(t,e){return t.compareTo(e)>=0?t:e}}])})(),Ui=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"readResolve",value:function(){return u.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,u.nameToTypeMap.put(t,this)}}])})();Ui.nameToTypeMap=new fo,we.Type=Ui,we.FIXED=new Ui("FIXED"),we.FLOATING=new Ui("FLOATING"),we.FLOATING_SINGLE=new Ui("FLOATING SINGLE"),we.maximumPreciseValue=9007199254740992;var fr=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&M(t,"equalsExact",this,1).call(this,e,l)}return M(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ft.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return mt.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new Ut}},{key:"getGeometryType",value:function(){return mt.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[Ts]}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];xe.constructor_.call(this,e,l)}}])})(xe),ii=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"createEmpty",value:function(t){switch(t){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new X("Invalid dimension: "+t)}}},{key:"toGeometry",value:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new tt(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new tt(t.getMinX(),t.getMinY()),new tt(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new tt(t.getMinX(),t.getMinY()),new tt(t.getMinX(),t.getMaxY()),new tt(t.getMaxX(),t.getMaxY()),new tt(t.getMaxX(),t.getMinY()),new tt(t.getMinX(),t.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(St(arguments[0],Dt))return new kn(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new fr(null,this):arguments.length===1?new fr(arguments[0],this):void 0}},{key:"buildGeometry",value:function(t){for(var e=null,l=!1,g=!1,y=t.iterator();y.hasNext();){var w=y.next(),T=w.getTypeCode();e===null&&(e=T),T!==e&&(l=!0),w instanceof xe&&(g=!0)}if(e===null)return this.createGeometryCollection();if(l||g)return this.createGeometryCollection(u.toGeometryArray(t));var A=t.iterator().next();if(t.size()>1){if(A instanceof Ln)return this.createMultiPolygon(u.toPolygonArray(t));if(A instanceof kn)return this.createMultiLineString(u.toLineStringArray(t));if(A instanceof ao)return this.createMultiPoint(u.toPointArray(t));dt.shouldNeverReachHere("Unhandled geometry type: "+A.getGeometryType())}return A}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(St(arguments[0],Dt))return new ao(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(St(arguments[0],Dt)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof ei){var l=arguments[0];return this.createPolygon(l,null)}}else if(arguments.length===2)return new Ln(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new xe(null,this):arguments.length===1?new xe(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(St(arguments[0],Dt))return new ei(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new co(null,this):arguments.length===1?new co(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new lr(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new lr(arguments[0],this);if(St(arguments[0],Dt)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),l=0;l<t.size();l++){var g=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());Fi.copy(t,l,g,0,1),e[l]=this.createPoint(g)}return this.createMultiPoint(e)}}}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)u.constructor_.call(this,new we,0);else if(arguments.length===1){if(St(arguments[0],so)){var t=arguments[0];u.constructor_.call(this,new we,0,t)}else if(arguments[0]instanceof we){var e=arguments[0];u.constructor_.call(this,e,0,u.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];u.constructor_.call(this,l,g,u.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this._precisionModel=y,this._coordinateSequenceFactory=T,this._SRID=w}}},{key:"toMultiPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toGeometryArray",value:function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return ho.instance()}},{key:"toMultiLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toMultiPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLinearRingArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"createPointFromInternalCoord",value:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}}])})(),Bt="XY",$t="XYZ",dr="XYM",sn="XYZM",qi={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},gr="EMPTY",Ct=1,Ht=2,ni=3,In=4,fe=5,cl=6;for(var pr in qi)qi[pr].toUpperCase();var Zi=(function(){return d((function u(t){r(this,u),this.wkt=t,this.index_=-1}),[{key:"isAlpha_",value:function(u){return u>="a"&&u<="z"||u>="A"&&u<="Z"}},{key:"isNumeric_",value:function(u,t){return u>="0"&&u<="9"||u=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(u){return u==" "||u==" "||u=="\r"||u==`
|
|
489
|
-
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var u,t=this.nextChar_(),e=this.index_,l=t;if(t=="(")u=Ht;else if(t==",")u=fe;else if(t==")")u=ni;else if(this.isNumeric_(t)||t=="-")u=In,l=this.readNumber_();else if(this.isAlpha_(t))u=Ct,l=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);u=cl}return{position:e,value:l,type:u}}},{key:"readNumber_",value:function(){var u,t=this.index_,e=!1,l=!1;do u=="."?e=!0:u!="e"&&u!="E"||(l=!0),u=this.nextChar_();while(this.isNumeric_(u,e)||!l&&(u=="e"||u=="E")||l&&(u=="-"||u=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var u,t=this.index_;do u=this.nextChar_();while(this.isAlpha_(u));return this.wkt.substring(t,this.index_--).toUpperCase()}}])})(),ae=(function(){return d((function u(t,e){r(this,u),this.lexer_=t,this.token_,this.layout_=Bt,this.factory=e}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(u){return this.token_.type==u}},{key:"match",value:function(u){var t=this.isTokenType(u);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var u=Bt,t=this.token_;if(this.isTokenType(Ct)){var e=t.value;e==="Z"?u=$t:e==="M"?u=dr:e==="ZM"&&(u=sn),u!==Bt&&this.consume_()}return u}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Ht)){var u=[];do u.push(this.parseGeometry_());while(this.match(fe));if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Ht)){var u=this.parsePoint_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Ht)){var u=this.parsePointList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Ht)){var u=this.parseLineStringTextList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var u;if(this.match(Ht)){if(u=this.token_.type==Ht?this.parsePointTextList_():this.parsePointList_(),this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Ht)){var u=this.parseLineStringTextList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Ht)){var u=this.parsePolygonTextList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var u=[],t=this.layout_.length,e=0;e<t;++e){var l=this.token_;if(!this.match(In))break;u.push(l.value)}if(u.length==t)return u;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var u=[this.parsePoint_()];this.match(fe);)u.push(this.parsePoint_());return u}},{key:"parsePointTextList_",value:function(){for(var u=[this.parsePointText_()];this.match(fe);)u.push(this.parsePointText_());return u}},{key:"parseLineStringTextList_",value:function(){for(var u=[this.parseLineStringText_()];this.match(fe);)u.push(this.parseLineStringText_());return u}},{key:"parsePolygonTextList_",value:function(){for(var u=[this.parsePolygonText_()];this.match(fe);)u.push(this.parsePolygonText_());return u}},{key:"isEmptyGeometry_",value:function(){var u=this.isTokenType(Ct)&&this.token_.value==gr;return u&&this.consume_(),u}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var u=this.factory,t=function(wt){return h(tt,S(wt))},e=function(wt){var zt=wt.map((function(Ot){return u.createLinearRing(Ot.map(t))}));return zt.length>1?u.createPolygon(zt[0],zt.slice(1)):u.createPolygon(zt[0])},l=this.token_;if(this.match(Ct)){var g=l.value;if(this.layout_=this.parseGeometryLayout_(),g=="GEOMETRYCOLLECTION"){var y=this.parseGeometryCollectionText_();return u.createGeometryCollection(y)}switch(g){case"POINT":var w=this.parsePointText_();return w?u.createPoint(h(tt,S(w))):u.createPoint();case"LINESTRING":var T=this.parseLineStringText_().map(t);return u.createLineString(T);case"LINEARRING":var A=this.parseLineStringText_().map(t);return u.createLinearRing(A);case"POLYGON":var B=this.parsePolygonText_();return B&&B.length!==0?e(B):u.createPolygon();case"MULTIPOINT":var K=this.parseMultiPointText_();if(!K||K.length===0)return u.createMultiPoint();var it=K.map(t).map((function(wt){return u.createPoint(wt)}));return u.createMultiPoint(it);case"MULTILINESTRING":var lt=this.parseMultiLineStringText_().map((function(wt){return u.createLineString(wt.map(t))}));return u.createMultiLineString(lt);case"MULTIPOLYGON":var gt=this.parseMultiPolygonText_();if(!gt||gt.length===0)return u.createMultiPolygon();var bt=gt.map(e);return u.createMultiPolygon(bt);default:throw new Error("Invalid geometry type: "+g)}}throw new Error(this.formatErrorMessage_())}}])})();function Ei(u){if(u.isEmpty())return"";var t=u.getCoordinate(),e=[t.x,t.y];return t.z===void 0||Number.isNaN(t.z)||e.push(t.z),t.m===void 0||Number.isNaN(t.m)||e.push(t.m),e.join(" ")}function gi(u){for(var t=u.getCoordinates().map((function(y){var w=[y.x,y.y];return y.z===void 0||Number.isNaN(y.z)||w.push(y.z),y.m===void 0||Number.isNaN(y.m)||w.push(y.m),w})),e=[],l=0,g=t.length;l<g;++l)e.push(t[l].join(" "));return e.join(", ")}function an(u){var t=[];t.push("("+gi(u.getExteriorRing())+")");for(var e=0,l=u.getNumInteriorRing();e<l;++e)t.push("("+gi(u.getInteriorRingN(e))+")");return t.join(", ")}var go={Point:Ei,LineString:gi,LinearRing:gi,Polygon:an,MultiPoint:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push("("+Ei(u.getGeometryN(e))+")");return t.join(", ")},MultiLineString:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push("("+gi(u.getGeometryN(e))+")");return t.join(", ")},MultiPolygon:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push("("+an(u.getGeometryN(e))+")");return t.join(", ")},GeometryCollection:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push(ln(u.getGeometryN(e)));return t.join(", ")}};function ln(u){var t=u.getGeometryType(),e=go[t];t=t.toUpperCase();var l=(function(g){var y="";if(g.isEmpty())return y;var w=g.getCoordinate();return w.z===void 0||Number.isNaN(w.z)||(y+="Z"),w.m===void 0||Number.isNaN(w.m)||(y+="M"),y})(u);return l.length>0&&(t+=" "+l),u.isEmpty()?t+" "+gr:t+" ("+e(u)+")"}var po=(function(){return d((function u(t){r(this,u),this.geometryFactory=t||new ii,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(u){var t=new Zi(u);return new ae(t,this.geometryFactory).parse()}},{key:"write",value:function(u){return ln(u)}}])})(),Cn=(function(){return d((function u(t){r(this,u),this.parser=new po(t)}),[{key:"write",value:function(u){return this.parser.write(u)}}],[{key:"toLineString",value:function(u,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+u.x+" "+u.y+", "+t.x+" "+t.y+" )"}}])})(),Vt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new cr;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}},{key:"computeIntersection",value:function(t,e,l,g){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=l,this._inputLines[1][1]=g,this._result=this.computeIntersect(t,e,l,g)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}}},{key:"getIntersection",value:function(t){return this._intPt[t]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==u.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(t,e){return u.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])}},{key:"isCollinear",value:function(){return this._result===u.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return Cn.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Cn.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(t,e){return this._inputLines[t][e]}},{key:"isIntersection",value:function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new tt,this._intPt[1]=new tt,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(t,e,l){var g=Math.abs(l.x-e.x),y=Math.abs(l.y-e.y),w=-1;if(t.equals(e))w=0;else if(t.equals(l))w=g>y?g:y;else{var T=Math.abs(t.x-e.x),A=Math.abs(t.y-e.y);(w=g>y?T:A)!==0||t.equals(e)||(w=Math.max(T,A))}return dt.isTrue(!(w===0&&!t.equals(e)),"Bad distance calculation"),w}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,l){var g=t.x-e.x,y=t.y-e.y,w=Math.sqrt(g*g+y*y);return dt.isTrue(!(w===0&&!t.equals(e)),"Invalid distance calculation"),w}}])})();Vt.DONT_INTERSECT=0,Vt.DO_INTERSECT=1,Vt.COLLINEAR=2,Vt.NO_INTERSECTION=0,Vt.POINT_INTERSECTION=1,Vt.COLLINEAR_INTERSECTION=2;var pi=(function(u){function t(){return r(this,t),s(this,t)}return b(t,u),d(t,[{key:"isInSegmentEnvelopes",value:function(e){var l=new qt(this._inputLines[0][0],this._inputLines[0][1]),g=new qt(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(e)&&g.contains(e)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return M(t,"computeIntersection",this,1).apply(this,arguments);var e=arguments[0],l=arguments[1],g=arguments[2];if(this._isProper=!1,qt.intersects(l,g,e)&&Tt.index(l,g,e)===0&&Tt.index(g,l,e)===0)return this._isProper=!0,(e.equals(l)||e.equals(g))&&(this._isProper=!1),this._result=Vt.POINT_INTERSECTION,null;this._result=Vt.NO_INTERSECTION}},{key:"intersection",value:function(e,l,g,y){var w=this.intersectionSafe(e,l,g,y);return this.isInSegmentEnvelopes(w)||(w=new tt(t.nearestEndpoint(e,l,g,y))),this._precisionModel!==null&&this._precisionModel.makePrecise(w),w}},{key:"checkDD",value:function(e,l,g,y,w){var T=no.intersection(e,l,g,y),A=this.isInSegmentEnvelopes(T);Be.out.println("DD in env = "+A+" --------------------- "+T),w.distance(T)>1e-4&&Be.out.println("Distance = "+w.distance(T))}},{key:"intersectionSafe",value:function(e,l,g,y){var w=oo.intersection(e,l,g,y);return w===null&&(w=t.nearestEndpoint(e,l,g,y)),w}},{key:"computeCollinearIntersection",value:function(e,l,g,y){var w=qt.intersects(e,l,g),T=qt.intersects(e,l,y),A=qt.intersects(g,y,e),B=qt.intersects(g,y,l);return w&&T?(this._intPt[0]=g,this._intPt[1]=y,Vt.COLLINEAR_INTERSECTION):A&&B?(this._intPt[0]=e,this._intPt[1]=l,Vt.COLLINEAR_INTERSECTION):w&&A?(this._intPt[0]=g,this._intPt[1]=e,!g.equals(e)||T||B?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):w&&B?(this._intPt[0]=g,this._intPt[1]=l,!g.equals(l)||T||A?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):T&&A?(this._intPt[0]=y,this._intPt[1]=e,!y.equals(e)||w||B?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):T&&B?(this._intPt[0]=y,this._intPt[1]=l,!y.equals(l)||w||A?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):Vt.NO_INTERSECTION}},{key:"computeIntersect",value:function(e,l,g,y){if(this._isProper=!1,!qt.intersects(e,l,g,y))return Vt.NO_INTERSECTION;var w=Tt.index(e,l,g),T=Tt.index(e,l,y);if(w>0&&T>0||w<0&&T<0)return Vt.NO_INTERSECTION;var A=Tt.index(g,y,e),B=Tt.index(g,y,l);return A>0&&B>0||A<0&&B<0?Vt.NO_INTERSECTION:w===0&&T===0&&A===0&&B===0?this.computeCollinearIntersection(e,l,g,y):(w===0||T===0||A===0||B===0?(this._isProper=!1,e.equals2D(g)||e.equals2D(y)?this._intPt[0]=e:l.equals2D(g)||l.equals2D(y)?this._intPt[0]=l:w===0?this._intPt[0]=new tt(g):T===0?this._intPt[0]=new tt(y):A===0?this._intPt[0]=new tt(e):B===0&&(this._intPt[0]=new tt(l))):(this._isProper=!0,this._intPt[0]=this.intersection(e,l,g,y)),Vt.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(e,l,g,y){var w=e,T=Ze.pointToSegment(e,g,y),A=Ze.pointToSegment(l,g,y);return A<T&&(T=A,w=l),(A=Ze.pointToSegment(g,e,l))<T&&(T=A,w=g),(A=Ze.pointToSegment(y,e,l))<T&&(T=A,w=y),w}}])})(Vt),mo=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"countSegment",value:function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var l=t.x,g=e.x;return l>g&&(l=e.x,g=t.x),this._p.x>=l&&this._p.x<=g&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var y=Tt.index(t,e,this._p);if(y===Tt.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(y=-y),y===Tt.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==U.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?U.BOUNDARY:this._crossingCount%2==1?U.INTERIOR:U.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof tt&&St(arguments[1],Dt)){for(var t=arguments[1],e=new u(arguments[0]),l=new tt,g=new tt,y=1;y<t.size();y++)if(t.getCoordinate(y,l),t.getCoordinate(y-1,g),e.countSegment(l,g),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof tt&&arguments[1]instanceof Array){for(var w=arguments[1],T=new u(arguments[0]),A=1;A<w.length;A++){var B=w[A],K=w[A-1];if(T.countSegment(B,K),T.isOnSegment())return T.getLocation()}return T.getLocation()}}}])})(),un=(function(){function u(){r(this,u)}return d(u,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof tt&&St(arguments[1],Dt)){for(var t=arguments[0],e=arguments[1],l=new pi,g=new tt,y=new tt,w=e.size(),T=1;T<w;T++)if(e.getCoordinate(T-1,g),e.getCoordinate(T,y),l.computeIntersection(t,g,y),l.hasIntersection())return!0;return!1}if(arguments[0]instanceof tt&&arguments[1]instanceof Array){for(var A=arguments[0],B=arguments[1],K=new pi,it=1;it<B.length;it++){var lt=B[it-1],gt=B[it];if(K.computeIntersection(A,lt,gt),K.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(t,e){return mo.locatePointInRing(t,e)}},{key:"isInRing",value:function(t,e){return u.locateInRing(t,e)!==U.EXTERIOR}}])})(),Ae=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"setAllLocations",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t}},{key:"isNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==U.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===U.NONE&&(this.location[e]=t)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[ct.ON]=this.location[ct.ON],e[ct.LEFT]=U.NONE,e[ct.RIGHT]=U.NONE,this.location=e}for(var l=0;l<this.location.length;l++)this.location[l]===U.NONE&&l<t.location.length&&(this.location[l]=t.location[l])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var t=this.location[ct.LEFT];this.location[ct.LEFT]=this.location[ct.RIGHT],this.location[ct.RIGHT]=t}},{key:"toString",value:function(){var t=new xn;return this.location.length>1&&t.append(U.toLocationSymbol(this.location[ct.LEFT])),t.append(U.toLocationSymbol(this.location[ct.ON])),this.location.length>1&&t.append(U.toLocationSymbol(this.location[ct.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,l){this.location[ct.ON]=t,this.location[ct.LEFT]=e,this.location[ct.RIGHT]=l}},{key:"get",value:function(t){return t<this.location.length?this.location[t]:U.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===U.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var t=arguments[0];this.setLocation(ct.ON,t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.location[e]=l}}},{key:"init",value:function(t){this.location=new Array(t).fill(null),this.setAllLocations(U.NONE)}},{key:"isEqualOnSide",value:function(t,e){return this.location[e]===t.location[e]}},{key:"allPositionsEqual",value:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[ct.ON]=e}else if(arguments[0]instanceof u){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var g=0;g<this.location.length;g++)this.location[g]=l.location[g]}}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this.init(3),this.location[ct.ON]=y,this.location[ct.LEFT]=w,this.location[ct.RIGHT]=T}}}])})(),Ie=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getGeometryCount",value:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t}},{key:"setAllLocations",value:function(t,e){this.elt[t].setAllLocations(e)}},{key:"isNull",value:function(t){return this.elt[t].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.elt[e].setAllLocationsIfNull(l)}}},{key:"isLine",value:function(t){return this.elt[t].isLine()}},{key:"merge",value:function(t){for(var e=0;e<2;e++)this.elt[e]===null&&t.elt[e]!==null?this.elt[e]=new Ae(t.elt[e]):this.elt[e].merge(t.elt[e])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(ct.ON)}if(arguments.length===2){var e=arguments[0],l=arguments[1];return this.elt[e].get(l)}}},{key:"toString",value:function(){var t=new xn;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}}},{key:"isAnyNull",value:function(t){return this.elt[t].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(ct.ON,e)}else if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2];this.elt[l].setLocation(g,y)}}},{key:"isEqualOnSide",value:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)}},{key:"allPositionsEqual",value:function(t,e){return this.elt[t].allPositionsEqual(e)}},{key:"toLine",value:function(t){this.elt[t].isArea()&&(this.elt[t]=new Ae(this.elt[t].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new Ae(t),this.elt[1]=new Ae(t)}else if(arguments[0]instanceof u){var e=arguments[0];this.elt[0]=new Ae(e.elt[0]),this.elt[1]=new Ae(e.elt[1])}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.elt[0]=new Ae(U.NONE),this.elt[1]=new Ae(U.NONE),this.elt[l].setLocation(g)}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this.elt[0]=new Ae(y,w,T),this.elt[1]=new Ae(y,w,T)}else if(arguments.length===4){var A=arguments[0],B=arguments[1],K=arguments[2],it=arguments[3];this.elt[0]=new Ae(U.NONE,U.NONE,U.NONE),this.elt[1]=new Ae(U.NONE,U.NONE,U.NONE),this.elt[A].setLocations(B,K,it)}}},{key:"toLineLabel",value:function(t){for(var e=new u(U.NONE),l=0;l<2;l++)e.setLocation(l,t.getLocation(l));return e}}])})(),mr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var u=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)u[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(u),this._isHole=Tt.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(u){this._startDe=u;var t=u,e=!0;do{if(t===null)throw new ti("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new ti("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var l=t.getLabel();dt.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(t.getEdge(),t.isForward(),e),e=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(u){return this._pts.get(u)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var u=this._startDe;do{var t=u.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),u=this.getNext(u)}while(u!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(u,t,e){var l=u.getCoordinates();if(t){var g=1;e&&(g=0);for(var y=g;y<l.length;y++)this._pts.add(l[y])}else{var w=l.length-2;e&&(w=l.length-1);for(var T=w;T>=0;T--)this._pts.add(l[T])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var u=this._startDe;do u.getEdge().setInResult(!0),u=u.getNext();while(u!==this._startDe)}},{key:"containsPoint",value:function(u){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(u)||!un.isInRing(u,t.getCoordinates()))return!1;for(var e=this._holes.iterator();e.hasNext();)if(e.next().containsPoint(u))return!1;return!0}},{key:"addHole",value:function(u){this._holes.add(u)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var u=arguments[0];this.mergeLabel(u,0),this.mergeLabel(u,1)}else if(arguments.length===2){var t=arguments[1],e=arguments[0].getLocation(t,ct.RIGHT);if(e===U.NONE)return null;if(this._label.getLocation(t)===U.NONE)return this._label.setLocation(t,e),null}}},{key:"setShell",value:function(u){this._shell=u,u!==null&&u.addHole(this)}},{key:"toPolygon",value:function(u){for(var t=new Array(this._holes.size()).fill(null),e=0;e<this._holes.size();e++)t[e]=this._holes.get(e).getLinearRing();return u.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new Lt,this._pts=new Lt,this._label=new Ie(U.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Lt,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var u=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(u),this.computeRing()}}}}])})(),Mt=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"setEdgeRing",value:function(e,l){e.setMinEdgeRing(l)}},{key:"getNext",value:function(e){return e.getNextMin()}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];mr.constructor_.call(this,e,l)}}])})(mr),ri=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"buildMinimalRings",value:function(){var e=new Lt,l=this._startDe;do{if(l.getMinEdgeRing()===null){var g=new Mt(l,this._geometryFactory);e.add(g)}l=l.getNext()}while(l!==this._startDe);return e}},{key:"setEdgeRing",value:function(e,l){e.setEdgeRing(l)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var e=this._startDe;do e.getNode().getEdges().linkMinimalDirectedEdges(this),e=e.getNext();while(e!==this._startDe)}},{key:"getNext",value:function(e){return e.getNext()}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];mr.constructor_.call(this,e,l)}}])})(mr),Xt=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(u){this._isVisited=u}},{key:"setInResult",value:function(u){this._isInResult=u}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(u){this._label=u}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(u){this._isCovered=u,this._isCoveredSet=!0}},{key:"updateIM",value:function(u){dt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(u)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._label=u}}}}])})(),Sn=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"isIncidentEdgeInResult",value:function(){for(var e=this.getEdges().getEdges().iterator();e.hasNext();)if(e.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(e){e.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(e){}},{key:"computeMergedLocation",value:function(e,l){var g=U.NONE;if(g=this._label.getLocation(l),!e.isNull(l)){var y=e.getLocation(l);g!==U.BOUNDARY&&(g=y)}return g}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return M(t,"setLabel",this,1).apply(this,arguments);var e=arguments[0],l=arguments[1];this._label===null?this._label=new Ie(e,l):this._label.setLocation(e,l)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var e=arguments[0];this.mergeLabel(e._label)}else if(arguments[0]instanceof Ie)for(var l=arguments[0],g=0;g<2;g++){var y=this.computeMergedLocation(l,g);this._label.getLocation(g)===U.NONE&&this._label.setLocation(g,y)}}},{key:"add",value:function(e){this._edges.insert(e),e.setNode(this)}},{key:"setLabelBoundary",value:function(e){if(this._label===null)return null;var l=U.NONE;this._label!==null&&(l=this._label.getLocation(e));var g=null;switch(l){case U.BOUNDARY:g=U.INTERIOR;break;case U.INTERIOR:default:g=U.BOUNDARY}this._label.setLocation(e,g)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var e=arguments[0],l=arguments[1];this._coord=e,this._edges=l,this._label=new Ie(0,U.NONE)}}])})(Xt),yo=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t)})(As);function yr(u){return u==null?0:u.color}function Ft(u){return u==null?null:u.parent}function me(u,t){u!==null&&(u.color=t)}function Mn(u){return u==null?null:u.left}function hn(u){return u==null?null:u.right}var re=(function(u){function t(){var e;return r(this,t),(e=s(this,t)).root_=null,e.size_=0,e}return b(t,u),d(t,[{key:"get",value:function(e){for(var l=this.root_;l!==null;){var g=e.compareTo(l.key);if(g<0)l=l.left;else{if(!(g>0))return l.value;l=l.right}}return null}},{key:"put",value:function(e,l){if(this.root_===null)return this.root_={key:e,value:l,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var g,y,w=this.root_;do if(g=w,(y=e.compareTo(w.key))<0)w=w.left;else{if(!(y>0)){var T=w.value;return w.value=l,T}w=w.right}while(w!==null);var A={key:e,left:null,right:null,value:l,parent:g,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return y<0?g.left=A:g.right=A,this.fixAfterInsertion(A),this.size_++,null}},{key:"fixAfterInsertion",value:function(e){var l;for(e.color=1;e!=null&&e!==this.root_&&e.parent.color===1;)Ft(e)===Mn(Ft(Ft(e)))?yr(l=hn(Ft(Ft(e))))===1?(me(Ft(e),0),me(l,0),me(Ft(Ft(e)),1),e=Ft(Ft(e))):(e===hn(Ft(e))&&(e=Ft(e),this.rotateLeft(e)),me(Ft(e),0),me(Ft(Ft(e)),1),this.rotateRight(Ft(Ft(e)))):yr(l=Mn(Ft(Ft(e))))===1?(me(Ft(e),0),me(l,0),me(Ft(Ft(e)),1),e=Ft(Ft(e))):(e===Mn(Ft(e))&&(e=Ft(e),this.rotateRight(e)),me(Ft(e),0),me(Ft(Ft(e)),1),this.rotateLeft(Ft(Ft(e))));this.root_.color=0}},{key:"values",value:function(){var e=new Lt,l=this.getFirstEntry();if(l!==null)for(e.add(l.value);(l=t.successor(l))!==null;)e.add(l.value);return e}},{key:"entrySet",value:function(){var e=new bn,l=this.getFirstEntry();if(l!==null)for(e.add(l);(l=t.successor(l))!==null;)e.add(l);return e}},{key:"rotateLeft",value:function(e){if(e!=null){var l=e.right;e.right=l.left,l.left!=null&&(l.left.parent=e),l.parent=e.parent,e.parent==null?this.root_=l:e.parent.left===e?e.parent.left=l:e.parent.right=l,l.left=e,e.parent=l}}},{key:"rotateRight",value:function(e){if(e!=null){var l=e.left;e.left=l.right,l.right!=null&&(l.right.parent=e),l.parent=e.parent,e.parent==null?this.root_=l:e.parent.right===e?e.parent.right=l:e.parent.left=l,l.right=e,e.parent=l}}},{key:"getFirstEntry",value:function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(e){for(var l=this.root_;l!==null;){var g=e.compareTo(l.key);if(g<0)l=l.left;else{if(!(g>0))return!0;l=l.right}}return!1}}],[{key:"successor",value:function(e){var l;if(e===null)return null;if(e.right!==null){for(l=e.right;l.left!==null;)l=l.left;return l}l=e.parent;for(var g=e;l!==null&&g===l.right;)g=l,l=l.parent;return l}}])})(yo),Ti=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"find",value:function(u){return this.nodeMap.get(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof tt){var u=arguments[0],t=this.nodeMap.get(u);return t===null&&(t=this.nodeFact.createNode(u),this.nodeMap.put(u,t)),t}if(arguments[0]instanceof Sn){var e=arguments[0],l=this.nodeMap.get(e.getCoordinate());return l===null?(this.nodeMap.put(e.getCoordinate(),e),e):(l.mergeLabel(e),l)}}},{key:"print",value:function(u){for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(u){for(var t=new Lt,e=this.iterator();e.hasNext();){var l=e.next();l.getLabel().getLocation(u)===U.BOUNDARY&&t.add(l)}return t}},{key:"add",value:function(u){var t=u.getCoordinate();this.addNode(t).add(u)}}],[{key:"constructor_",value:function(){this.nodeMap=new re,this.nodeFact=null;var u=arguments[0];this.nodeFact=u}}])})(),ye=(function(){function u(){r(this,u)}return d(u,null,[{key:"isNorthern",value:function(t){return t===u.NE||t===u.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&(t-e+4)%4===2}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if((t-e+4)%4===2)return-1;var l=t<e?t:e;return l===0&&(t>e?t:e)===3?3:l}},{key:"isInHalfPlane",value:function(t,e){return e===u.SE?t===u.SE||t===u.SW:t===e||t===e+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new X("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?u.NE:u.SE:e>=0?u.NW:u.SW}if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var l=arguments[0],g=arguments[1];if(g.x===l.x&&g.y===l.y)throw new X("Cannot compute the quadrant for two identical points "+l);return g.x>=l.x?g.y>=l.y?u.NE:u.SE:g.y>=l.y?u.NW:u.SW}}}])})();ye.NE=0,ye.NW=1,ye.SW=2,ye.SE=3;var _o=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"compareDirection",value:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:Tt.index(t._p0,t._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(t){this._node=t}},{key:"print",value:function(t){var e=Math.atan2(this._dy,this._dx),l=this.getClass().getName(),g=l.lastIndexOf("."),y=l.substring(g+1);t.print(" "+y+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)}},{key:"compareTo",value:function(t){var e=t;return this.compareDirection(e)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),l=e.lastIndexOf(".");return" "+e.substring(l+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label}},{key:"computeLabel",value:function(t){}},{key:"init",value:function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=ye.quadrant(this._dx,this._dy),dt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],l=arguments[1],g=arguments[2];u.constructor_.call(this,e,l,g,null)}else if(arguments.length===4){var y=arguments[0],w=arguments[1],T=arguments[2],A=arguments[3];u.constructor_.call(this,y),this.init(w,T),this._label=A}}}])})(),vo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(e){return this._depth[e]}},{key:"setVisited",value:function(e){this._isVisited=e}},{key:"computeDirectedLabel",value:function(){this._label=new Ie(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(e,l){if(this._depth[e]!==-999&&this._depth[e]!==l)throw new ti("assigned depths do not match",this.getCoordinate());this._depth[e]=l}},{key:"isInteriorAreaEdge",value:function(){for(var e=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,ct.LEFT)===U.INTERIOR&&this._label.getLocation(l,ct.RIGHT)===U.INTERIOR||(e=!1);return e}},{key:"setNextMin",value:function(e){this._nextMin=e}},{key:"print",value:function(e){M(t,"print",this,1).call(this,e),e.print(" "+this._depth[ct.LEFT]+"/"+this._depth[ct.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")}},{key:"setMinEdgeRing",value:function(e){this._minEdgeRing=e}},{key:"isLineEdge",value:function(){var e=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,U.EXTERIOR),g=!this._label.isArea(1)||this._label.allPositionsEqual(1,U.EXTERIOR);return e&&l&&g}},{key:"setEdgeRing",value:function(e){this._edgeRing=e}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var e=this._edge.getDepthDelta();return this._isForward||(e=-e),e}},{key:"setInResult",value:function(e){this._isInResult=e}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(e){this.print(e),e.print(" "),this._isForward?this._edge.print(e):this._edge.printReverse(e)}},{key:"setSym",value:function(e){this._sym=e}},{key:"setVisitedEdge",value:function(e){this.setVisited(e),this._sym.setVisited(e)}},{key:"setEdgeDepths",value:function(e,l){var g=this.getEdge().getDepthDelta();this._isForward||(g=-g);var y=1;e===ct.LEFT&&(y=-1);var w=ct.opposite(e),T=l+g*y;this.setDepth(e,l),this.setDepth(w,T)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(e){this._next=e}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var e=arguments[0],l=arguments[1];if(_o.constructor_.call(this,e),this._isForward=l,l)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var g=e.getNumPoints()-1;this.init(e.getCoordinate(g),e.getCoordinate(g-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(e,l){return e===U.EXTERIOR&&l===U.INTERIOR?1:e===U.INTERIOR&&l===U.EXTERIOR?-1:0}}])})(_o),bo=(function(){return d((function u(){r(this,u)}),[{key:"createNode",value:function(u){return new Sn(u,null)}}])})(),_r=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(u){u.println("Edges:");for(var t=0;t<this._edges.size();t++){u.println("edge "+t+":");var e=this._edges.get(t);e.print(u),e.eiList.print(u)}}},{key:"find",value:function(u){return this._nodes.find(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof Sn){var u=arguments[0];return this._nodes.addNode(u)}if(arguments[0]instanceof tt){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(u){Be.out.println(u)}},{key:"isBoundaryNode",value:function(u,t){var e=this._nodes.find(t);if(e===null)return!1;var l=e.getLabel();return l!==null&&l.getLocation(u)===U.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(u,t,e,l){return!!u.equals(e)&&Tt.index(u,t,l)===Tt.COLLINEAR&&ye.quadrant(u,t)===ye.quadrant(e,l)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(u){Be.out.print(u)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(u,t){for(var e=0;e<this._edges.size();e++){var l=this._edges.get(e),g=l.getCoordinates();if(this.matchInSameDirection(u,t,g[0],g[1])||this.matchInSameDirection(u,t,g[g.length-1],g[g.length-2]))return l}return null}},{key:"insertEdge",value:function(u){this._edges.add(u)}},{key:"findEdgeEnd",value:function(u){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var e=t.next();if(e.getEdge()===u)return e}return null}},{key:"addEdges",value:function(u){for(var t=u.iterator();t.hasNext();){var e=t.next();this._edges.add(e);var l=new vo(e,!0),g=new vo(e,!1);l.setSym(g),g.setSym(l),this.add(l),this.add(g)}}},{key:"add",value:function(u){this._nodes.add(u),this._edgeEndList.add(u)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(u,t){for(var e=0;e<this._edges.size();e++){var l=this._edges.get(e),g=l.getCoordinates();if(u.equals(g[0])&&t.equals(g[1]))return l}return null}}],[{key:"constructor_",value:function(){if(this._edges=new Lt,this._nodes=null,this._edgeEndList=new Lt,arguments.length===0)this._nodes=new Ti(new bo);else if(arguments.length===1){var u=arguments[0];this._nodes=new Ti(u)}}},{key:"linkResultDirectedEdges",value:function(u){for(var t=u.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}])})(),fl=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"sortShellsAndHoles",value:function(t,e,l){for(var g=t.iterator();g.hasNext();){var y=g.next();y.isHole()?l.add(y):e.add(y)}}},{key:"computePolygons",value:function(t){for(var e=new Lt,l=t.iterator();l.hasNext();){var g=l.next().toPolygon(this._geometryFactory);e.add(g)}return e}},{key:"placeFreeHoles",value:function(t,e){for(var l=e.iterator();l.hasNext();){var g=l.next();if(g.getShell()===null){var y=u.findEdgeRingContaining(g,t);if(y===null)throw new ti("unable to assign hole to a shell",g.getCoordinate(0));g.setShell(y)}}}},{key:"buildMinimalEdgeRings",value:function(t,e,l){for(var g=new Lt,y=t.iterator();y.hasNext();){var w=y.next();if(w.getMaxNodeDegree()>2){w.linkDirectedEdgesForMinimalEdgeRings();var T=w.buildMinimalRings(),A=this.findShell(T);A!==null?(this.placePolygonHoles(A,T),e.add(A)):l.addAll(T)}else g.add(w)}return g}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new Lt,l=t.iterator();l.hasNext();){var g=l.next();if(g.isInResult()&&g.getLabel().isArea()&&g.getEdgeRing()===null){var y=new ri(g,this._geometryFactory);e.add(y),y.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var l=e.iterator();l.hasNext();){var g=l.next();g.isHole()&&g.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,l=null,g=t.iterator();g.hasNext();){var y=g.next();y.isHole()||(l=y,e++)}return dt.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),l}},{key:"add",value:function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],l=arguments[1];_r.linkResultDirectedEdges(l);var g=this.buildMaximalEdgeRings(e),y=new Lt,w=this.buildMinimalEdgeRings(g,this._shellList,y);this.sortShellsAndHoles(w,this._shellList,y),this.placeFreeHoles(this._shellList,y)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new Lt;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var l=t.getLinearRing(),g=l.getEnvelopeInternal(),y=l.getCoordinateN(0),w=null,T=null,A=e.iterator();A.hasNext();){var B=A.next(),K=B.getLinearRing(),it=K.getEnvelopeInternal();if(!it.equals(g)&&it.contains(g)){y=se.ptNotInList(l.getCoordinates(),K.getCoordinates());var lt=!1;un.isInRing(y,K.getCoordinates())&&(lt=!0),lt&&(w===null||T.contains(it))&&(T=(w=B).getLinearRing().getEnvelopeInternal())}}return w}}])})(),xo=(function(){return d((function u(){r(this,u)}),[{key:"getBounds",value:function(){}}])})(),At=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[xo,N]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var u=arguments[0],t=arguments[1];this._bounds=u,this._item=t}}])})(),vr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var u=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),u}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(u){for(var t=null,e=this._items.get(u);2*u<=this._size&&((t=2*u)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(e)<0);u=t)this._items.set(u,this._items.get(t));this._items.set(u,e)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(u){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,u);u.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,u)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new Lt,this._items.add(null)}}])})(),He=(function(){return d((function u(){r(this,u)}),[{key:"insert",value:function(u,t){}},{key:"remove",value:function(u,t){}},{key:"query",value:function(){}}])})(),_e=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(u){dt.isTrue(this._bounds===null),this._childBoundables.add(u)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[xo,N]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new Lt,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._level=u}}}}])})(),Hi={reverseOrder:function(){return{compare:function(u,t){return t.compareTo(u)}}},min:function(u){return Hi.sort(u),u.get(0)},sort:function(u,t){var e=u.toArray();t?pe.sort(e,t):pe.sort(e);for(var l=u.iterator(),g=0,y=e.length;g<y;g++)l.next(),l.set(e[g])},singletonList:function(u){var t=new Lt;return t.add(u),t}},dl=(function(){function u(){r(this,u)}return d(u,null,[{key:"maxDistance",value:function(t,e,l,g,y,w,T,A){var B=u.distance(t,e,y,w);return B=Math.max(B,u.distance(t,e,T,A)),B=Math.max(B,u.distance(l,g,y,w)),B=Math.max(B,u.distance(l,g,T,A))}},{key:"distance",value:function(t,e,l,g){var y=l-t,w=g-e;return Math.sqrt(y*y+w*w)}},{key:"maximumDistance",value:function(t,e){var l=Math.min(t.getMinX(),e.getMinX()),g=Math.min(t.getMinY(),e.getMinY()),y=Math.max(t.getMaxX(),e.getMaxX()),w=Math.max(t.getMaxY(),e.getMaxY());return u.distance(l,g,y,w)}},{key:"minMaxDistance",value:function(t,e){var l=t.getMinX(),g=t.getMinY(),y=t.getMaxX(),w=t.getMaxY(),T=e.getMinX(),A=e.getMinY(),B=e.getMaxX(),K=e.getMaxY(),it=u.maxDistance(l,g,l,w,T,A,T,K);return it=Math.min(it,u.maxDistance(l,g,l,w,T,A,B,A)),it=Math.min(it,u.maxDistance(l,g,l,w,B,K,T,K)),it=Math.min(it,u.maxDistance(l,g,l,w,B,K,B,A)),it=Math.min(it,u.maxDistance(l,g,y,g,T,A,T,K)),it=Math.min(it,u.maxDistance(l,g,y,g,T,A,B,A)),it=Math.min(it,u.maxDistance(l,g,y,g,B,K,T,K)),it=Math.min(it,u.maxDistance(l,g,y,g,B,K,B,A)),it=Math.min(it,u.maxDistance(y,w,l,w,T,A,T,K)),it=Math.min(it,u.maxDistance(y,w,l,w,T,A,B,A)),it=Math.min(it,u.maxDistance(y,w,l,w,B,K,T,K)),it=Math.min(it,u.maxDistance(y,w,l,w,B,K,B,A)),it=Math.min(it,u.maxDistance(y,w,y,g,T,A,T,K)),it=Math.min(it,u.maxDistance(y,w,y,g,T,A,B,A)),it=Math.min(it,u.maxDistance(y,w,y,g,B,K,T,K)),it=Math.min(it,u.maxDistance(y,w,y,g,B,K,B,A))}}])})(),Ii=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"maximumDistance",value:function(){return dl.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(t,e){var l=u.isComposite(this._boundable1),g=u.isComposite(this._boundable2);if(l&&g)return u.area(this._boundable1)>u.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(l)return this.expand(this._boundable1,this._boundable2,!1,t,e),null;if(g)return this.expand(this._boundable2,this._boundable1,!0,t,e),null;throw new X("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(u.isComposite(this._boundable1)||u.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0}},{key:"expand",value:function(t,e,l,g,y){for(var w=t.getChildBoundables().iterator();w.hasNext();){var T=w.next(),A=null;(A=l?new u(e,T,this._itemDistance):new u(T,e,this._itemDistance)).getDistance()<y&&g.add(A)}}},{key:"getBoundable",value:function(t){return t===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],l=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=l,this._distance=this.distance()}},{key:"area",value:function(t){return t.getBounds().getArea()}},{key:"isComposite",value:function(t){return t instanceof _e}}])})(),Ps=(function(){return d((function u(){r(this,u)}),[{key:"visitItem",value:function(u){}}])})(),Yi=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"queryInternal",value:function(){if(St(arguments[2],Ps)&&arguments[0]instanceof Object&&arguments[1]instanceof _e)for(var t=arguments[0],e=arguments[2],l=arguments[1].getChildBoundables(),g=0;g<l.size();g++){var y=l.get(g);this.getIntersectsOp().intersects(y.getBounds(),t)&&(y instanceof _e?this.queryInternal(t,y,e):y instanceof At?e.visitItem(y.getItem()):dt.shouldNeverReachHere())}else if(St(arguments[2],ki)&&arguments[0]instanceof Object&&arguments[1]instanceof _e)for(var w=arguments[0],T=arguments[2],A=arguments[1].getChildBoundables(),B=0;B<A.size();B++){var K=A.get(B);this.getIntersectsOp().intersects(K.getBounds(),w)&&(K instanceof _e?this.queryInternal(w,K,T):K instanceof At?T.add(K.getItem()):dt.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(t){return t.get(t.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var l=e.next();l instanceof _e?t+=this.size(l):l instanceof At&&(t+=1)}return t}}},{key:"removeItem",value:function(t,e){for(var l=null,g=t.getChildBoundables().iterator();g.hasNext();){var y=g.next();y instanceof At&&y.getItem()===e&&(l=y)}return l!==null&&(t.getChildBoundables().remove(l),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new Lt:t}if(arguments.length===1){for(var e=arguments[0],l=new Lt,g=e.getChildBoundables().iterator();g.hasNext();){var y=g.next();if(y instanceof _e){var w=this.itemsTree(y);w!==null&&l.add(w)}else y instanceof At?l.add(y.getItem()):dt.shouldNeverReachHere()}return l.size()<=0?null:l}}},{key:"insert",value:function(t,e){dt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new At(t,e))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var t=arguments[0],e=new Lt;return this.boundablesAtLevel(t,this._root,e),e}if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2];if(dt.isTrue(l>-2),g.getLevel()===l)return y.add(g),null;for(var w=g.getChildBoundables().iterator();w.hasNext();){var T=w.next();T instanceof _e?this.boundablesAtLevel(l,T,y):(dt.isTrue(T instanceof At),l===-1&&y.add(T))}return null}}},{key:"query",value:function(){if(arguments.length===1){var t=arguments[0];this.build();var e=new Lt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(arguments.length===2){var l=arguments[0],g=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),l)&&this.queryInternal(l,this._root,g)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2],w=this.removeItem(g,y);if(w)return!0;for(var T=null,A=g.getChildBoundables().iterator();A.hasNext();){var B=A.next();if(this.getIntersectsOp().intersects(B.getBounds(),l)&&B instanceof _e&&(w=this.remove(l,B,y))){T=B;break}}return T!==null&&T.getChildBoundables().isEmpty()&&g.getChildBoundables().remove(T),w}}},{key:"createHigherLevels",value:function(t,e){dt.isTrue(!t.isEmpty());var l=this.createParentBoundables(t,e+1);return l.size()===1?l.get(0):this.createHigherLevels(l,e+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var l=e.next();if(l instanceof _e){var g=this.depth(l);g>t&&(t=g)}}return t+1}}},{key:"createParentBoundables",value:function(t,e){dt.isTrue(!t.isEmpty());var l=new Lt;l.add(this.createNode(e));var g=new Lt(t);Hi.sort(g,this.getComparator());for(var y=g.iterator();y.hasNext();){var w=y.next();this.lastNode(l).getChildBoundables().size()===this.getNodeCapacity()&&l.add(this.createNode(e)),this.lastNode(l).addChildBoundable(w)}return l}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[N]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new Lt,this._nodeCapacity=null,arguments.length===0)u.constructor_.call(this,u.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var t=arguments[0];dt.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}},{key:"compareDoubles",value:function(t,e){return t>e?1:t<e?-1:0}}])})();Yi.IntersectsOp=function(){},Yi.DEFAULT_NODE_CAPACITY=10;var gl=(function(){return d((function u(){r(this,u)}),[{key:"distance",value:function(u,t){}}])})(),oi=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(e,l){dt.isTrue(e.length>0);for(var g=new Lt,y=0;y<e.length;y++)g.addAll(this.createParentBoundablesFromVerticalSlice(e[y],l));return g}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var e=arguments[0],l=arguments[1];return this.nearestNeighbourK(e,rt.POSITIVE_INFINITY,l)}if(arguments.length===3){var g=arguments[0],y=arguments[2],w=arguments[1],T=new vr;T.add(g);for(var A=new vr;!T.isEmpty()&&w>=0;){var B=T.poll(),K=B.getDistance();if(K>=w)break;B.isLeaves()?A.size()<y?A.add(B):(A.peek().getDistance()>K&&(A.poll(),A.add(B)),w=A.peek().getDistance()):B.expandToQueue(T,w)}return t.getItems(A)}}},{key:"createNode",value:function(e){return new br(e)}},{key:"size",value:function(){return arguments.length===0?M(t,"size",this,1).call(this):M(t,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof qt))return M(t,"insert",this,1).apply(this,arguments);var e=arguments[0],l=arguments[1];if(e.isNull())return null;M(t,"insert",this,1).call(this,e,l)}},{key:"getIntersectsOp",value:function(){return t.intersectsOp}},{key:"verticalSlices",value:function(e,l){for(var g=Math.trunc(Math.ceil(e.size()/l)),y=new Array(l).fill(null),w=e.iterator(),T=0;T<l;T++){y[T]=new Lt;for(var A=0;w.hasNext()&&A<g;){var B=w.next();y[T].add(B),A++}}return y}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];return M(t,"query",this,1).call(this,e)}if(arguments.length===2){var l=arguments[0],g=arguments[1];M(t,"query",this,1).call(this,l,g)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(e,l){return M(t,"createParentBoundables",this,1).call(this,e,l)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof qt){var e=arguments[0],l=arguments[1];return M(t,"remove",this,1).call(this,e,l)}return M(t,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?M(t,"depth",this,1).call(this):M(t,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(e,l){dt.isTrue(!e.isEmpty());var g=Math.trunc(Math.ceil(e.size()/this.getNodeCapacity())),y=new Lt(e);Hi.sort(y,t.xComparator);var w=this.verticalSlices(y,Math.trunc(Math.ceil(Math.sqrt(g))));return this.createParentBoundablesFromVerticalSlices(w,l)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(St(arguments[0],gl)){var e=arguments[0];if(this.isEmpty())return null;var l=new Ii(this.getRoot(),this.getRoot(),e);return this.nearestNeighbour(l)}if(arguments[0]instanceof Ii){var g=arguments[0],y=rt.POSITIVE_INFINITY,w=null,T=new vr;for(T.add(g);!T.isEmpty()&&y>0;){var A=T.poll(),B=A.getDistance();if(B>=y)break;A.isLeaves()?(y=B,w=A):A.expandToQueue(T,y)}return w===null?null:[w.getBoundable(0).getItem(),w.getBoundable(1).getItem()]}}else{if(arguments.length===2){var K=arguments[0],it=arguments[1];if(this.isEmpty()||K.isEmpty())return null;var lt=new Ii(this.getRoot(),K.getRoot(),it);return this.nearestNeighbour(lt)}if(arguments.length===3){var gt=arguments[2],bt=new At(arguments[0],arguments[1]),wt=new Ii(this.getRoot(),bt,gt);return this.nearestNeighbour(wt)[0]}if(arguments.length===4){var zt=arguments[2],Ot=arguments[3],Jt=new At(arguments[0],arguments[1]),ee=new Ii(this.getRoot(),Jt,zt);return this.nearestNeighbourK(ee,Ot)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var e=arguments[0],l=arguments[1],g=rt.POSITIVE_INFINITY,y=new vr;for(y.add(e);!y.isEmpty();){var w=y.poll(),T=w.getDistance();if(T>l)return!1;if(w.maximumDistance()<=l)return!0;if(w.isLeaves()){if((g=T)<=l)return!0}else w.expandToQueue(y,g)}return!1}if(arguments.length===3){var A=arguments[0],B=arguments[1],K=arguments[2],it=new Ii(this.getRoot(),A.getRoot(),B);return this.isWithinDistance(it,K)}}},{key:"interfaces_",get:function(){return[He,N]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var e=arguments[0];Yi.constructor_.call(this,e)}}},{key:"centreX",value:function(e){return t.avg(e.getMinX(),e.getMaxX())}},{key:"avg",value:function(e,l){return(e+l)/2}},{key:"getItems",value:function(e){for(var l=new Array(e.size()).fill(null),g=0;!e.isEmpty();){var y=e.poll();l[g]=y.getBoundable(0).getItem(),g++}return l}},{key:"centreY",value:function(e){return t.avg(e.getMinY(),e.getMaxY())}}])})(Yi),br=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeBounds",value:function(){for(var e=null,l=this.getChildBoundables().iterator();l.hasNext();){var g=l.next();e===null?e=new qt(g.getBounds()):e.expandToInclude(g.getBounds())}return e}}],[{key:"constructor_",value:function(){var e=arguments[0];_e.constructor_.call(this,e)}}])})(_e);oi.STRtreeNode=br,oi.xComparator=new((function(){return d((function u(){r(this,u)}),[{key:"interfaces_",get:function(){return[ht]}},{key:"compare",value:function(u,t){return Yi.compareDoubles(oi.centreX(u.getBounds()),oi.centreX(t.getBounds()))}}])})()),oi.yComparator=new((function(){return d((function u(){r(this,u)}),[{key:"interfaces_",get:function(){return[ht]}},{key:"compare",value:function(u,t){return Yi.compareDoubles(oi.centreY(u.getBounds()),oi.centreY(t.getBounds()))}}])})()),oi.intersectsOp=new((function(){return d((function u(){r(this,u)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(u,t){return u.intersects(t)}}])})()),oi.DEFAULT_NODE_CAPACITY=10;var pl=(function(){function u(){r(this,u)}return d(u,null,[{key:"relativeSign",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"compare",value:function(t,e,l){if(e.equals2D(l))return 0;var g=u.relativeSign(e.x,l.x),y=u.relativeSign(e.y,l.y);switch(t){case 0:return u.compareValue(g,y);case 1:return u.compareValue(y,g);case 2:return u.compareValue(y,-g);case 3:return u.compareValue(-g,y);case 4:return u.compareValue(-g,-y);case 5:return u.compareValue(-y,-g);case 6:return u.compareValue(-y,g);case 7:return u.compareValue(g,-y)}return dt.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}])})(),si=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(u){var t=u;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?pl.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===u}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var u=arguments[0],t=arguments[1],e=arguments[2],l=arguments[3];this._segString=u,this.coord=new tt(t),this.segmentIndex=e,this._segmentOctant=l,this._isInterior=!t.equals2D(u.getCoordinate(e))}}])})(),ml=(function(){return d((function u(){r(this,u)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),Ns=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var u=new En;this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var l=t.next();this.addEdgeCoordinates(e,l,u),e=l}return u.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var u=new Lt;this.findCollapsesFromInsertedNodes(u),this.findCollapsesFromExistingVertices(u);for(var t=u.iterator();t.hasNext();){var e=t.next().intValue();this.add(this._edge.getCoordinate(e),e)}}},{key:"createSplitEdgePts",value:function(u,t){var e=t.segmentIndex-u.segmentIndex+2;if(e===2)return[new tt(u.coord),new tt(t.coord)];var l=this._edge.getCoordinate(t.segmentIndex),g=t.isInterior()||!t.coord.equals2D(l);g||e--;var y=new Array(e).fill(null),w=0;y[w++]=new tt(u.coord);for(var T=u.segmentIndex+1;T<=t.segmentIndex;T++)y[w++]=this._edge.getCoordinate(T);return g&&(y[w]=new tt(t.coord)),y}},{key:"print",value:function(u){u.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"findCollapsesFromExistingVertices",value:function(u){for(var t=0;t<this._edge.size()-2;t++){var e=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var l=this._edge.getCoordinate(t+2);e.equals2D(l)&&u.add(nn.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(u,t,e){var l=this.createSplitEdgePts(u,t);e.add(l,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),e=t.next();t.hasNext();){var l=t.next(),g=this.createSplitEdge(e,l);u.add(g),e=l}}},{key:"findCollapseIndex",value:function(u,t,e){if(!u.coord.equals2D(t.coord))return!1;var l=t.segmentIndex-u.segmentIndex;return t.isInterior()||l--,l===1&&(e[0]=u.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(u){for(var t=new Array(1).fill(null),e=this.iterator(),l=e.next();e.hasNext();){var g=e.next();this.findCollapseIndex(l,g,t)&&u.add(nn.valueOf(t[0])),l=g}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var u=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(u),u)}},{key:"createSplitEdge",value:function(u,t){var e=this.createSplitEdgePts(u,t);return new mi(e,this._edge.getData())}},{key:"add",value:function(u,t){var e=new si(this._edge,u,t,this._edge.getSegmentOctant(t)),l=this._nodeMap.get(e);return l!==null?(dt.isTrue(l.coord.equals2D(u),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(e,e),e)}},{key:"checkSplitEdgesCorrectness",value:function(u){var t=this._edge.getCoordinates(),e=u.get(0).getCoordinate(0);if(!e.equals2D(t[0]))throw new _t("bad split edge start point at "+e);var l=u.get(u.size()-1).getCoordinates(),g=l[l.length-1];if(!g.equals2D(t[t.length-1]))throw new _t("bad split edge end point at "+g)}}],[{key:"constructor_",value:function(){this._nodeMap=new re,this._edge=null;var u=arguments[0];this._edge=u}}])})(),Ci=(function(){function u(){r(this,u)}return d(u,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new X("Cannot compute the octant for point ( "+t+", "+e+" )");var l=Math.abs(t),g=Math.abs(e);return t>=0?e>=0?l>=g?0:1:l>=g?7:6:e>=0?l>=g?3:2:l>=g?4:5}if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var y=arguments[0],w=arguments[1],T=w.x-y.x,A=w.y-y.y;if(T===0&&A===0)throw new X("Cannot compute the octant for two identical points "+y);return u.octant(T,A)}}}])})(),Os=(function(){return d((function u(){r(this,u)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(u){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(u){}},{key:"getData",value:function(){}}])})(),Rs=(function(){return d((function u(){r(this,u)}),[{key:"addIntersection",value:function(u,t){}},{key:"interfaces_",get:function(){return[Os]}}])})(),mi=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(t){return this._pts[t]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}},{key:"setData",value:function(t){this._data=t}},{key:"safeOctant",value:function(t,e){return t.equals2D(e)?0:Ci.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var l=arguments[1],g=arguments[3],y=new tt(arguments[0].getIntersection(g));this.addIntersection(y,l)}}},{key:"toString",value:function(){return Cn.toLineString(new Tn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var l=e,g=l+1;if(g<this._pts.length){var y=this._pts[g];t.equals2D(y)&&(l=g)}return this._nodeList.add(t,l)}},{key:"addIntersections",value:function(t,e,l){for(var g=0;g<t.getIntersectionNum();g++)this.addIntersection(t,e,l,g)}},{key:"interfaces_",get:function(){return[Rs]}}],[{key:"constructor_",value:function(){this._nodeList=new Ns(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var t=arguments[0],e=new Lt;return u.getNodedSubstrings(t,e),e}if(arguments.length===2)for(var l=arguments[1],g=arguments[0].iterator();g.hasNext();)g.next().getNodeList().addSplitEdges(l)}}])})(),Pe=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof u){var t=arguments[0],e=Tt.index(this.p0,this.p1,t.p0),l=Tt.index(this.p0,this.p1,t.p1);return e>=0&&l>=0||e<=0&&l<=0?Math.max(e,l):0}if(arguments[0]instanceof tt){var g=arguments[0];return Tt.index(this.p0,this.p1,g)}}},{key:"toGeometry",value:function(t){return t.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(t){if(!(t instanceof u))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}},{key:"intersection",value:function(t){var e=new pi;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof tt){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new tt(t);var e=this.projectionFactor(t),l=new tt;return l.x=this.p0.x+e*(this.p1.x-this.p0.x),l.y=this.p0.y+e*(this.p1.y-this.p0.y),l}if(arguments[0]instanceof u){var g=arguments[0],y=this.projectionFactor(g.p0),w=this.projectionFactor(g.p1);if(y>=1&&w>=1||y<=0&&w<=0)return null;var T=this.project(g.p0);y<0&&(T=this.p0),y>1&&(T=this.p1);var A=this.project(g.p1);return w<0&&(A=this.p0),w>1&&(A=this.p1),new u(T,A)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(t){return t===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return Ze.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return u.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,l=this.p1.y-this.p0.y,g=e*e+l*l;return g<=0?rt.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*l)/g}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(e!==null)return[e,e];var l=new Array(2).fill(null),g=rt.MAX_VALUE,y=null,w=this.closestPoint(t.p0);g=w.distance(t.p0),l[0]=w,l[1]=t.p0;var T=this.closestPoint(t.p1);(y=T.distance(t.p1))<g&&(g=y,l[0]=T,l[1]=t.p1);var A=t.closestPoint(this.p0);(y=A.distance(this.p0))<g&&(g=y,l[0]=this.p0,l[1]=A);var B=t.closestPoint(this.p1);return(y=B.distance(this.p1))<g&&(g=y,l[0]=this.p1,l[1]=B),l}},{key:"closestPoint",value:function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(t){var e=t,l=this.p0.compareTo(e.p0);return l!==0?l:this.p1.compareTo(e.p1)}},{key:"reverse",value:function(){var t=this.p0;this.p0=this.p1,this.p1=t}},{key:"equalsTopo",value:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)}},{key:"lineIntersection",value:function(t){return oo.intersection(this.p0,this.p1,t.p0,t.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(t,e){var l=this.p0.x+t*(this.p1.x-this.p0.x),g=this.p0.y+t*(this.p1.y-this.p0.y),y=this.p1.x-this.p0.x,w=this.p1.y-this.p0.y,T=Math.sqrt(y*y+w*w),A=0,B=0;if(e!==0){if(T<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");A=e*y/T,B=e*w/T}return new tt(l-B,g+A)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=l.x,this.p1.y=l.y}}},{key:"segmentFraction",value:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||rt.isNaN(e))&&(e=1),e}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(t){var e=this.p1.getY()-this.p0.getY(),l=this.p0.getX()-this.p1.getX(),g=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),y=e*e+l*l,w=e*e-l*l,T=t.getX(),A=t.getY();return new tt((-w*T-2*e*l*A-2*e*g)/y,(w*A-2*e*l*T-2*l*g)/y)}},{key:"distance",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return Ze.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof tt){var e=arguments[0];return Ze.pointToSegment(e,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new tt;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}},{key:"hashCode",value:function(){var t=rt.doubleToLongBits(this.p0.x);t^=31*rt.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),l=rt.doubleToLongBits(this.p1.x);return l^=31*rt.doubleToLongBits(this.p1.y),e^(Math.trunc(l)^Math.trunc(l>>32))}},{key:"interfaces_",get:function(){return[ot,N]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)u.constructor_.call(this,new tt,new tt);else if(arguments.length===1){var t=arguments[0];u.constructor_.call(this,t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.p0=e,this.p1=l}else if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3];u.constructor_.call(this,new tt(g,y),new tt(w,T))}}},{key:"midPoint",value:function(t,e){return new tt((t.x+e.x)/2,(t.y+e.y)/2)}}])})(),Ds=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var u=arguments[1],t=arguments[2],e=arguments[3];arguments[0].getLineSegment(u,this._overlapSeg1),t.getLineSegment(e,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Pe,this._overlapSeg2=new Pe}}])})(),wo=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(u,t){t.p0=this._pts[u],t.p1=this._pts[u+1]}},{key:"computeSelect",value:function(u,t,e,l){var g=this._pts[t],y=this._pts[e];if(e-t==1)return l.select(this,t),null;if(!u.intersects(g,y))return null;var w=Math.trunc((t+e)/2);t<w&&this.computeSelect(u,t,w,l),w<e&&this.computeSelect(u,w,e,l)}},{key:"getCoordinates",value:function(){for(var u=new Array(this._end-this._start+1).fill(null),t=0,e=this._start;e<=this._end;e++)u[t++]=this._pts[e];return u}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var u=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,u,u._start,u._end,t)}else if(arguments.length===6){var e=arguments[0],l=arguments[1],g=arguments[2],y=arguments[3],w=arguments[4],T=arguments[5];if(l-e==1&&w-y==1)return T.overlap(this,e,g,y),null;if(!this.overlaps(e,l,g,y,w))return null;var A=Math.trunc((e+l)/2),B=Math.trunc((y+w)/2);e<A&&(y<B&&this.computeOverlaps(e,A,g,y,B,T),B<w&&this.computeOverlaps(e,A,g,B,w,T)),A<l&&(y<B&&this.computeOverlaps(A,l,g,y,B,T),B<w&&this.computeOverlaps(A,l,g,B,w,T))}}},{key:"setId",value:function(u){this._id=u}},{key:"select",value:function(u,t){this.computeSelect(u,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var u=this._pts[this._start],t=this._pts[this._end];this._env=new qt(u,t)}return this._env}},{key:"overlaps",value:function(u,t,e,l,g){return qt.intersects(this._pts[u],this._pts[t],e._pts[l],e._pts[g])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var u=arguments[0],t=arguments[1],e=arguments[2],l=arguments[3];this._pts=u,this._start=t,this._end=e,this._context=l}}])})(),yl=(function(){function u(){r(this,u)}return d(u,null,[{key:"findChainEnd",value:function(t,e){for(var l=e;l<t.length-1&&t[l].equals2D(t[l+1]);)l++;if(l>=t.length-1)return t.length-1;for(var g=ye.quadrant(t[l],t[l+1]),y=e+1;y<t.length&&!(!t[y-1].equals2D(t[y])&&ye.quadrant(t[y-1],t[y])!==g);)y++;return y-1}},{key:"getChains",value:function(){if(arguments.length===1){var t=arguments[0];return u.getChains(t,null)}if(arguments.length===2){var e=arguments[0],l=arguments[1],g=new Lt,y=0;do{var w=u.findChainEnd(e,y),T=new wo(e,y,w,l);g.add(T),y=w}while(y<e.length-1);return g}}}])})(),ko=(function(){return d((function u(){r(this,u)}),[{key:"computeNodes",value:function(u){}},{key:"getNodedSubstrings",value:function(){}}])})(),xr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(u){this._segInt=u}},{key:"interfaces_",get:function(){return[ko]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.setSegmentIntersector(u)}}}}])})(),Lo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return mi.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(e){for(var l=yl.getChains(e.getCoordinates(),e).iterator();l.hasNext();){var g=l.next();g.setId(this._idCounter++),this._index.insert(g.getEnvelope(),g),this._monoChains.add(g)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e;for(var l=e.iterator();l.hasNext();)this.add(l.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var e=new Eo(this._segInt),l=this._monoChains.iterator();l.hasNext();)for(var g=l.next(),y=this._index.query(g.getEnvelope()).iterator();y.hasNext();){var w=y.next();if(w.getId()>g.getId()&&(g.computeOverlaps(w,e),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new Lt,this._index=new oi,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var e=arguments[0];xr.constructor_.call(this,e)}}}}])})(xr),Eo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"overlap",value:function(){if(arguments.length!==4)return M(t,"overlap",this,1).apply(this,arguments);var e=arguments[1],l=arguments[2],g=arguments[3],y=arguments[0].getContext(),w=l.getContext();this._si.processIntersections(y,e,w,g)}}],[{key:"constructor_",value:function(){this._si=null;var e=arguments[0];this._si=e}}])})(Ds);Lo.SegmentOverlapAction=Eo;var ze=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isDeletable",value:function(t,e,l,g){var y=this._inputLine[t],w=this._inputLine[e],T=this._inputLine[l];return!!this.isConcave(y,w,T)&&!!this.isShallow(y,w,T,g)&&this.isShallowSampled(y,w,t,l,g)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,e=this.findNextNonDeletedIndex(t),l=this.findNextNonDeletedIndex(e),g=!1;l<this._inputLine.length;){var y=!1;this.isDeletable(t,e,l,this._distanceTol)&&(this._isDeleted[e]=u.DELETE,y=!0,g=!0),t=y?l:e,e=this.findNextNonDeletedIndex(t),l=this.findNextNonDeletedIndex(e)}return g}},{key:"isShallowConcavity",value:function(t,e,l,g){return Tt.index(t,e,l)===this._angleOrientation&&Ze.pointToSegment(e,t,l)<g}},{key:"isShallowSampled",value:function(t,e,l,g,y){var w=Math.trunc((g-l)/u.NUM_PTS_TO_CHECK);w<=0&&(w=1);for(var T=l;T<g;T+=w)if(!this.isShallow(t,e,this._inputLine[T],y))return!1;return!0}},{key:"isConcave",value:function(t,e,l){var g=Tt.index(t,e,l)===this._angleOrientation;return g}},{key:"simplify",value:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=Tt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===u.DELETE;)e++;return e}},{key:"isShallow",value:function(t,e,l,g){return Ze.pointToSegment(e,t,l)<g}},{key:"collapseLine",value:function(){for(var t=new En,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==u.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Tt.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}},{key:"simplify",value:function(t,e){return new u(t).simplify(e)}}])})();ze.INIT=0,ze.DELETE=1,ze.KEEP=1,ze.NUM_PTS_TO_CHECK=10;var An=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getCoordinates",value:function(){return this._ptList.toArray(u.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"addPt",value:function(t){var e=new tt(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(t,e){if(e)for(var l=0;l<t.length;l++)this.addPt(t[l]);else for(var g=t.length-1;g>=0;g--)this.addPt(t[g])}},{key:"isRedundant",value:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}},{key:"toString",value:function(){return new ii().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var t=new tt(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)}},{key:"setMinimumVertexDistance",value:function(t){this._minimimVertexDistance=t}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Lt}}])})();An.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var he=(function(){function u(){r(this,u)}return d(u,null,[{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"normalize",value:function(t){for(;t>Math.PI;)t-=u.PI_TIMES_2;for(;t<=-Math.PI;)t+=u.PI_TIMES_2;return t}},{key:"angle",value:function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var e=arguments[0],l=arguments[1],g=l.x-e.x,y=l.y-e.y;return Math.atan2(y,g)}}},{key:"isAcute",value:function(t,e,l){var g=t.x-e.x,y=t.y-e.y;return g*(l.x-e.x)+y*(l.y-e.y)>0}},{key:"isObtuse",value:function(t,e,l){var g=t.x-e.x,y=t.y-e.y;return g*(l.x-e.x)+y*(l.y-e.y)<0}},{key:"interiorAngle",value:function(t,e,l){var g=u.angle(e,t),y=u.angle(e,l);return Math.abs(y-g)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=u.PI_TIMES_2;t>=u.PI_TIMES_2&&(t=0)}else{for(;t>=u.PI_TIMES_2;)t-=u.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,e,l){var g=u.angle(e,t),y=u.angle(e,l);return u.diff(g,y)}},{key:"diff",value:function(t,e){var l=null;return(l=t<e?e-t:t-e)>Math.PI&&(l=2*Math.PI-l),l}},{key:"toRadians",value:function(t){return t*Math.PI/180}},{key:"getTurn",value:function(t,e){var l=Math.sin(e-t);return l>0?u.COUNTERCLOCKWISE:l<0?u.CLOCKWISE:u.NONE}},{key:"angleBetweenOriented",value:function(t,e,l){var g=u.angle(e,t),y=u.angle(e,l)-g;return y<=-Math.PI?y+u.PI_TIMES_2:y>Math.PI?y-u.PI_TIMES_2:y}}])})();he.PI_TIMES_2=2*Math.PI,he.PI_OVER_2=Math.PI/2,he.PI_OVER_4=Math.PI/4,he.COUNTERCLOCKWISE=Tt.COUNTERCLOCKWISE,he.CLOCKWISE=Tt.CLOCKWISE,he.NONE=Tt.COLLINEAR;var Pn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"addNextSegment",value:function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var l=Tt.index(this._s0,this._s1,this._s2),g=l===Tt.CLOCKWISE&&this._side===ct.LEFT||l===Tt.COUNTERCLOCKWISE&&this._side===ct.RIGHT;l===0?this.addCollinear(e):g?this.addOutsideTurn(l,e):this.addInsideTurn(l,e)}},{key:"addLineEndCap",value:function(t,e){var l=new Pe(t,e),g=new Pe;this.computeOffsetSegment(l,ct.LEFT,this._distance,g);var y=new Pe;this.computeOffsetSegment(l,ct.RIGHT,this._distance,y);var w=e.x-t.x,T=e.y-t.y,A=Math.atan2(T,w);switch(this._bufParams.getEndCapStyle()){case q.CAP_ROUND:this._segList.addPt(g.p1),this.addDirectedFillet(e,A+Math.PI/2,A-Math.PI/2,Tt.CLOCKWISE,this._distance),this._segList.addPt(y.p1);break;case q.CAP_FLAT:this._segList.addPt(g.p1),this._segList.addPt(y.p1);break;case q.CAP_SQUARE:var B=new tt;B.x=Math.abs(this._distance)*Math.cos(A),B.y=Math.abs(this._distance)*Math.sin(A);var K=new tt(g.p1.x+B.x,g.p1.y+B.y),it=new tt(y.p1.x+B.x,y.p1.y+B.y);this._segList.addPt(K),this._segList.addPt(it)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,l,g){var y=oo.intersection(e.p0,e.p1,l.p0,l.p1);if(y!==null&&(g<=0?1:y.distance(t)/Math.abs(g))<=this._bufParams.getMitreLimit())return this._segList.addPt(y),null;this.addLimitedMitreJoin(e,l,g,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*u.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===q.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===q.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(t){this._segList.addPt(new tt(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new tt(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new tt(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new tt(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(t,e){this._segList.addPts(t,e)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(t,e,l,g,y){var w=e.x-t.x,T=e.y-t.y,A=Math.atan2(T,w),B=l.x-t.x,K=l.y-t.y,it=Math.atan2(K,B);g===Tt.CLOCKWISE?A<=it&&(A+=2*Math.PI):A>=it&&(A-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,A,it,g,y),this._segList.addPt(l)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(t,e,l){this._s1=t,this._s2=e,this._side=l,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,l,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(t,e,l,g){var y=this._seg0.p1,w=he.angle(y,this._seg0.p0),T=he.angleBetweenOriented(this._seg0.p0,y,this._seg1.p1)/2,A=he.normalize(w+T),B=he.normalize(A+Math.PI),K=g*l,it=l-K*Math.abs(Math.sin(T)),lt=y.x+K*Math.cos(B),gt=y.y+K*Math.sin(B),bt=new tt(lt,gt),wt=new Pe(y,bt),zt=wt.pointAlongOffset(1,it),Ot=wt.pointAlongOffset(1,-it);this._side===ct.LEFT?(this._segList.addPt(zt),this._segList.addPt(Ot)):(this._segList.addPt(Ot),this._segList.addPt(zt))}},{key:"addDirectedFillet",value:function(t,e,l,g,y){var w=g===Tt.CLOCKWISE?-1:1,T=Math.abs(e-l),A=Math.trunc(T/this._filletAngleQuantum+.5);if(A<1)return null;for(var B=T/A,K=new tt,it=0;it<A;it++){var lt=e+w*it*B;K.x=t.x+y*Math.cos(lt),K.y=t.y+y*Math.sin(lt),this._segList.addPt(K)}}},{key:"computeOffsetSegment",value:function(t,e,l,g){var y=e===ct.LEFT?1:-1,w=t.p1.x-t.p0.x,T=t.p1.y-t.p0.y,A=Math.sqrt(w*w+T*T),B=y*l*w/A,K=y*l*T/A;g.p0.x=t.p0.x-K,g.p0.y=t.p0.y+B,g.p1.x=t.p1.x-K,g.p1.y=t.p1.y+B}},{key:"addInsideTurn",value:function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*u.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var l=new tt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l);var g=new tt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(g)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(t){var e=new tt(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}},{key:"init",value:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new An,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*u.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===q.JOIN_BEVEL||this._bufParams.getJoinStyle()===q.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,Tt.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Pe,this._seg1=new Pe,this._offset0=new Pe,this._offset1=new Pe,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],l=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new pi,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===q.JOIN_ROUND&&(this._closingSegLengthFactor=u.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)}}])})();Pn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Pn.MAX_CLOSING_SEG_LEN_FACTOR=80;var Nn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getOffsetCurve",value:function(t,e){if(this._distance=e,e===0)return null;var l=e<0,g=Math.abs(e),y=this.getSegGen(g);t.length<=1?this.computePointCurve(t[0],y):this.computeOffsetCurve(t,l,y);var w=y.getCoordinates();return l&&se.reverse(w),w}},{key:"computeSingleSidedBufferCurve",value:function(t,e,l){var g=this.simplifyTolerance(this._distance);if(e){l.addSegments(t,!0);var y=ze.simplify(t,-g),w=y.length-1;l.initSideSegments(y[w],y[w-1],ct.LEFT),l.addFirstSegment();for(var T=w-2;T>=0;T--)l.addNextSegment(y[T],!0)}else{l.addSegments(t,!1);var A=ze.simplify(t,g),B=A.length-1;l.initSideSegments(A[0],A[1],ct.LEFT),l.addFirstSegment();for(var K=2;K<=B;K++)l.addNextSegment(A[K],!0)}l.addLastSegment(),l.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,l){var g=this.simplifyTolerance(this._distance);e===ct.RIGHT&&(g=-g);var y=ze.simplify(t,g),w=y.length-1;l.initSideSegments(y[w-1],y[0],e);for(var T=1;T<=w;T++){var A=T!==1;l.addNextSegment(y[T],A)}l.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var l=this.simplifyTolerance(this._distance),g=ze.simplify(t,l),y=g.length-1;e.initSideSegments(g[0],g[1],ct.LEFT);for(var w=2;w<=y;w++)e.addNextSegment(g[w],!0);e.addLastSegment(),e.addLineEndCap(g[y-1],g[y]);var T=ze.simplify(t,-l),A=T.length-1;e.initSideSegments(T[A],T[A-1],ct.LEFT);for(var B=A-2;B>=0;B--)e.addNextSegment(T[B],!0);e.addLastSegment(),e.addLineEndCap(T[1],T[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case q.CAP_ROUND:e.createCircle(t);break;case q.CAP_SQUARE:e.createSquare(t)}}},{key:"getLineCurve",value:function(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;var l=Math.abs(e),g=this.getSegGen(l);if(t.length<=1)this.computePointCurve(t[0],g);else if(this._bufParams.isSingleSided()){var y=e<0;this.computeSingleSidedBufferCurve(t,y,g)}else this.computeLineBufferCurve(t,g);return g.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,e,l){if(this._distance=l,t.length<=2)return this.getLineCurve(t,l);if(l===0)return u.copyCoordinates(t);var g=this.getSegGen(l);return this.computeRingBufferCurve(t,e,g),g.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,l){var g=this.simplifyTolerance(this._distance);if(e){var y=ze.simplify(t,-g),w=y.length-1;l.initSideSegments(y[w],y[w-1],ct.LEFT),l.addFirstSegment();for(var T=w-2;T>=0;T--)l.addNextSegment(y[T],!0)}else{var A=ze.simplify(t,g),B=A.length-1;l.initSideSegments(A[0],A[1],ct.LEFT),l.addFirstSegment();for(var K=2;K<=B;K++)l.addNextSegment(A[K],!0)}l.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return t===0||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new Pn(this._precisionModel,this._bufParams,t)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}},{key:"copyCoordinates",value:function(t){for(var e=new Array(t.length).fill(null),l=0;l<e.length;l++)e[l]=new tt(t[l]);return e}}])})(),Ne=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var u=arguments[0],t=new Lt,e=this._subgraphs.iterator();e.hasNext();){var l=e.next(),g=l.getEnvelope();u.y<g.getMinY()||u.y>g.getMaxY()||this.findStabbedSegments(u,l.getDirectedEdges(),t)}return t}if(arguments.length===3){if(St(arguments[2],ki)&&arguments[0]instanceof tt&&arguments[1]instanceof vo){for(var y=arguments[0],w=arguments[1],T=arguments[2],A=w.getEdge().getCoordinates(),B=0;B<A.length-1;B++)if(this._seg.p0=A[B],this._seg.p1=A[B+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<y.x||this._seg.isHorizontal()||y.y<this._seg.p0.y||y.y>this._seg.p1.y||Tt.index(this._seg.p0,this._seg.p1,y)===Tt.RIGHT)){var K=w.getDepth(ct.LEFT);this._seg.p0.equals(A[B])||(K=w.getDepth(ct.RIGHT));var it=new To(this._seg,K);T.add(it)}}else if(St(arguments[2],ki)&&arguments[0]instanceof tt&&St(arguments[1],ki))for(var lt=arguments[0],gt=arguments[2],bt=arguments[1].iterator();bt.hasNext();){var wt=bt.next();wt.isForward()&&this.findStabbedSegments(lt,wt,gt)}}}},{key:"getDepth",value:function(u){var t=this.findStabbedSegments(u);return t.size()===0?0:Hi.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Pe;var u=arguments[0];this._subgraphs=u}}])})(),To=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(u){var t=u;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var e=this._upwardSeg.orientationIndex(t._upwardSeg);return e!==0||(e=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?e:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(u,t){var e=u.p0.compareTo(t.p0);return e!==0?e:u.p1.compareTo(t.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var u=arguments[0],t=arguments[1];this._upwardSeg=new Pe(u),this._leftDepth=t}}])})();Ne.DepthSegment=To;var Io=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,null,[{key:"constructor_",value:function(){j.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(j),Co=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getY",value:function(){var t=this.y/this.w;if(rt.isNaN(t)||rt.isInfinite(t))throw new Io;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(rt.isNaN(t)||rt.isInfinite(t))throw new Io;return t}},{key:"getCoordinate",value:function(){var t=new tt;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],l=arguments[1];this.x=e,this.y=l,this.w=1}else if(arguments[0]instanceof u&&arguments[1]instanceof u){var g=arguments[0],y=arguments[1];this.x=g.y*y.w-y.y*g.w,this.y=y.x*g.w-g.x*y.w,this.w=g.x*y.y-y.x*g.y}else if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var w=arguments[0],T=arguments[1];this.x=w.y-T.y,this.y=T.x-w.x,this.w=w.x*T.y-T.x*w.y}}else if(arguments.length===3){var A=arguments[0],B=arguments[1],K=arguments[2];this.x=A,this.y=B,this.w=K}else if(arguments.length===4){var it=arguments[0],lt=arguments[1],gt=arguments[2],bt=arguments[3],wt=it.y-lt.y,zt=lt.x-it.x,Ot=it.x*lt.y-lt.x*it.y,Jt=gt.y-bt.y,ee=bt.x-gt.x,de=gt.x*bt.y-bt.x*gt.y;this.x=zt*de-ee*Ot,this.y=Jt*Ot-wt*de,this.w=wt*ee-Jt*zt}}}])})(),So=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"area",value:function(){return u.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return u.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(t===null)throw new X("Supplied point is null.");return u.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return u.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return u.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return u.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return u.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return u.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return u.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],l=arguments[2];this.p0=t,this.p1=e,this.p2=l}},{key:"area",value:function(t,e,l){return Math.abs(((l.x-t.x)*(e.y-t.y)-(e.x-t.x)*(l.y-t.y))/2)}},{key:"signedArea",value:function(t,e,l){return((l.x-t.x)*(e.y-t.y)-(e.x-t.x)*(l.y-t.y))/2}},{key:"det",value:function(t,e,l,g){return t*g-e*l}},{key:"interpolateZ",value:function(t,e,l,g){var y=e.x,w=e.y,T=l.x-y,A=g.x-y,B=l.y-w,K=g.y-w,it=T*K-A*B,lt=t.x-y,gt=t.y-w,bt=(K*lt-A*gt)/it,wt=(-B*lt+T*gt)/it;return e.getZ()+bt*(l.getZ()-e.getZ())+wt*(g.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,l){var g=t.distance(e),y=e.distance(l),w=l.distance(t),T=g;return y>T&&(T=y),w>T&&(T=w),T}},{key:"circumcentreDD",value:function(t,e,l){var g=Et.valueOf(t.x).subtract(l.x),y=Et.valueOf(t.y).subtract(l.y),w=Et.valueOf(e.x).subtract(l.x),T=Et.valueOf(e.y).subtract(l.y),A=Et.determinant(g,y,w,T).multiply(2),B=g.sqr().add(y.sqr()),K=w.sqr().add(T.sqr()),it=Et.determinant(y,B,T,K),lt=Et.determinant(g,B,w,K),gt=Et.valueOf(l.x).subtract(it.divide(A)).doubleValue(),bt=Et.valueOf(l.y).add(lt.divide(A)).doubleValue();return new tt(gt,bt)}},{key:"isAcute",value:function(t,e,l){return!!he.isAcute(t,e,l)&&!!he.isAcute(e,l,t)&&!!he.isAcute(l,t,e)}},{key:"circumcentre",value:function(t,e,l){var g=l.x,y=l.y,w=t.x-g,T=t.y-y,A=e.x-g,B=e.y-y,K=2*u.det(w,T,A,B),it=u.det(T,w*w+T*T,B,A*A+B*B),lt=u.det(w,w*w+T*T,A,A*A+B*B);return new tt(g-it/K,y+lt/K)}},{key:"perpendicularBisector",value:function(t,e){var l=e.x-t.x,g=e.y-t.y,y=new Co(t.x+l/2,t.y+g/2,1),w=new Co(t.x-g+l/2,t.y+l+g/2,1);return new Co(y,w)}},{key:"angleBisector",value:function(t,e,l){var g=e.distance(t),y=g/(g+e.distance(l)),w=l.x-t.x,T=l.y-t.y;return new tt(t.x+y*w,t.y+y*T)}},{key:"area3D",value:function(t,e,l){var g=e.x-t.x,y=e.y-t.y,w=e.getZ()-t.getZ(),T=l.x-t.x,A=l.y-t.y,B=l.getZ()-t.getZ(),K=y*B-w*A,it=w*T-g*B,lt=g*A-y*T,gt=K*K+it*it+lt*lt,bt=Math.sqrt(gt)/2;return bt}},{key:"centroid",value:function(t,e,l){var g=(t.x+e.x+l.x)/3,y=(t.y+e.y+l.y)/3;return new tt(g,y)}},{key:"inCentre",value:function(t,e,l){var g=e.distance(l),y=t.distance(l),w=t.distance(e),T=g+y+w,A=(g*t.x+y*e.x+w*l.x)/T,B=(g*t.y+y*e.y+w*l.y)/T;return new tt(A,B)}}])})(),Mo=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(u,t,e,l,g){if(t===0&&u.length<ei.MINIMUM_VALID_SIZE)return null;var y=l,w=g;u.length>=ei.MINIMUM_VALID_SIZE&&Tt.isCCW(u)&&(y=g,w=l,e=ct.opposite(e));var T=this._curveBuilder.getRingCurve(u,e,t);this.addCurve(T,y,w)}},{key:"addRingBothSides",value:function(u,t){this.addRingSide(u,t,ct.LEFT,U.EXTERIOR,U.INTERIOR),this.addRingSide(u,t,ct.RIGHT,U.INTERIOR,U.EXTERIOR)}},{key:"addPoint",value:function(u){if(this._distance<=0)return null;var t=u.getCoordinates(),e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,U.EXTERIOR,U.INTERIOR)}},{key:"addPolygon",value:function(u){var t=this._distance,e=ct.LEFT;this._distance<0&&(t=-this._distance,e=ct.RIGHT);var l=u.getExteriorRing(),g=se.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&g.length<3)return null;this.addRingSide(g,t,e,U.EXTERIOR,U.INTERIOR);for(var y=0;y<u.getNumInteriorRing();y++){var w=u.getInteriorRingN(y),T=se.removeRepeatedPoints(w.getCoordinates());this._distance>0&&this.isErodedCompletely(w,-this._distance)||this.addRingSide(T,t,ct.opposite(e),U.INTERIOR,U.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(u,t){var e=new So(u[0],u[1],u[2]),l=e.inCentre();return Ze.pointToSegment(l,e.p0,e.p1)<Math.abs(t)}},{key:"addLineString",value:function(u){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=se.removeRepeatedPoints(u.getCoordinates());if(se.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,U.EXTERIOR,U.INTERIOR)}}},{key:"addCurve",value:function(u,t,e){if(u===null||u.length<2)return null;var l=new mi(u,new Ie(0,U.BOUNDARY,t,e));this._curveList.add(l)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(u){if(u.isEmpty())return null;if(u instanceof Ln)this.addPolygon(u);else if(u instanceof kn)this.addLineString(u);else if(u instanceof ao)this.addPoint(u);else if(u instanceof lr)this.addCollection(u);else if(u instanceof fr)this.addCollection(u);else if(u instanceof co)this.addCollection(u);else{if(!(u instanceof xe))throw new Ut(u.getGeometryType());this.addCollection(u)}}},{key:"isErodedCompletely",value:function(u,t){var e=u.getCoordinates();if(e.length<4)return t<0;if(e.length===4)return this.isTriangleErodedCompletely(e,t);var l=u.getEnvelopeInternal(),g=Math.min(l.getHeight(),l.getWidth());return t<0&&2*Math.abs(t)>g}},{key:"addCollection",value:function(u){for(var t=0;t<u.getNumGeometries();t++){var e=u.getGeometryN(t);this.add(e)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Lt;var u=arguments[0],t=arguments[1],e=arguments[2];this._inputGeom=u,this._distance=t,this._curveBuilder=e}}])})(),_l=(function(){return d((function u(){r(this,u)}),[{key:"locate",value:function(u){}}])})(),vl=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,u.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new oe;var t=this._parent.getGeometryN(this._index++);return t instanceof xe?(this._subcollectionIterator=new u(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new Ut(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[ml]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}},{key:"isAtomic",value:function(t){return!(t instanceof xe)}}])})(),Bs=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"locate",value:function(t){return u.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[_l]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,e){if(e.isEmpty())return U.EXTERIOR;var l=e.getExteriorRing(),g=u.locatePointInRing(t,l);if(g!==U.INTERIOR)return g;for(var y=0;y<e.getNumInteriorRing();y++){var w=e.getInteriorRingN(y),T=u.locatePointInRing(t,w);if(T===U.BOUNDARY)return U.BOUNDARY;if(T===U.INTERIOR)return U.EXTERIOR}return U.INTERIOR}},{key:"locatePointInRing",value:function(t,e){return e.getEnvelopeInternal().intersects(t)?un.locateInRing(t,e.getCoordinates()):U.EXTERIOR}},{key:"containsPointInPolygon",value:function(t,e){return U.EXTERIOR!==u.locatePointInPolygon(t,e)}},{key:"locateInGeometry",value:function(t,e){if(e instanceof Ln)return u.locatePointInPolygon(t,e);if(e instanceof xe)for(var l=new vl(e);l.hasNext();){var g=l.next();if(g!==e){var y=u.locateInGeometry(t,g);if(y!==U.EXTERIOR)return y}}return U.EXTERIOR}},{key:"isContained",value:function(t,e){return U.EXTERIOR!==u.locate(t,e)}},{key:"locate",value:function(t,e){return e.isEmpty()?U.EXTERIOR:e.getEnvelopeInternal().intersects(t)?u.locateInGeometry(t,e):U.EXTERIOR}}])})(),bl=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(u){this.getEdges();var t=this._edgeList.indexOf(u),e=t-1;return t===0&&(e=this._edgeList.size()-1),this._edgeList.get(e)}},{key:"propagateSideLabels",value:function(u){for(var t=U.NONE,e=this.iterator();e.hasNext();){var l=e.next().getLabel();l.isArea(u)&&l.getLocation(u,ct.LEFT)!==U.NONE&&(t=l.getLocation(u,ct.LEFT))}if(t===U.NONE)return null;for(var g=t,y=this.iterator();y.hasNext();){var w=y.next(),T=w.getLabel();if(T.getLocation(u,ct.ON)===U.NONE&&T.setLocation(u,ct.ON,g),T.isArea(u)){var A=T.getLocation(u,ct.LEFT),B=T.getLocation(u,ct.RIGHT);if(B!==U.NONE){if(B!==g)throw new ti("side location conflict",w.getCoordinate());A===U.NONE&&dt.shouldNeverReachHere("found single null side (at "+w.getCoordinate()+")"),g=A}else dt.isTrue(T.getLocation(u,ct.LEFT)===U.NONE,"found single null side"),T.setLocation(u,ct.RIGHT,g),T.setLocation(u,ct.LEFT,g)}}}},{key:"getCoordinate",value:function(){var u=this.iterator();return u.hasNext()?u.next().getCoordinate():null}},{key:"print",value:function(u){Be.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"isAreaLabelsConsistent",value:function(u){return this.computeEdgeEndLabels(u.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(u){var t=this.getEdges();if(t.size()<=0)return!0;var e=t.size()-1,l=t.get(e).getLabel().getLocation(u,ct.LEFT);dt.isTrue(l!==U.NONE,"Found unlabelled area edge");for(var g=l,y=this.iterator();y.hasNext();){var w=y.next().getLabel();dt.isTrue(w.isArea(u),"Found non-area edge");var T=w.getLocation(u,ct.LEFT),A=w.getLocation(u,ct.RIGHT);if(T===A||A!==g)return!1;g=T}return!0}},{key:"findIndex",value:function(u){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===u)return t;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new Lt(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(u,t,e){return this._ptInAreaLocation[u]===U.NONE&&(this._ptInAreaLocation[u]=Bs.locate(t,e[u].getGeometry())),this._ptInAreaLocation[u]}},{key:"toString",value:function(){var u=new xn;u.append("EdgeEndStar: "+this.getCoordinate()),u.append(`
|
|
482
|
+
`,Jl=6378137,Fn=6356752314245e-6,pn=1/298.257223563,Sf=Math.PI/180,Mf=180/Math.PI,Uo=1e9;function Af(a){const n=BigInt(Math.round(a*Uo));return Number(n)/Uo}function Gn(a){return Af(a)*Sf}function Wl(a){const n=a*Mf%360;return n<0?n+360:n}function ca(a){const n=BigInt(Math.round(a*Uo));return Number(n)/Uo}function jl(a,n,i,s){const r=Pf(a,n,i,s);if(r.converged)return{meters:ca(r.distanceMeters),bearingDegrees:Wl(r.bearingRad),algorithm:"vincenty",iterations:r.iterations};const h=Nf(a,n,i,s);return{meters:ca(h.distanceMeters),bearingDegrees:Wl(h.bearingRad),algorithm:"karney",iterations:r.iterations}}function Pf(a,n,i,s){const r=Gn(a),h=Gn(i),f=Gn(s-n),d=Math.atan((1-pn)*Math.tan(r)),m=Math.atan((1-pn)*Math.tan(h)),_=Math.sin(d),x=Math.cos(d),b=Math.sin(m),E=Math.cos(m);let C=f,S=Number.POSITIVE_INFINITY,O=0;const N=200;let G=0,D=0,U=0,W=0,X=0;for(;Math.abs(C-S)>1e-12&&O<N;){const q=Math.sin(C),H=Math.cos(C);if(G=Math.sqrt((E*q)**2+(x*b-_*E*H)**2),G===0)return{distanceMeters:0,bearingRad:0,iterations:O,converged:!0};D=_*b+x*E*H,U=Math.atan2(G,D);const j=x*E*q/G;W=1-j**2,X=W===0?0:D-2*_*b/W;const B=pn/16*W*(4+pn*(4-3*W));S=C,C=f+(1-B)*pn*j*(U+B*G*(X+B*D*(-1+2*X**2))),O+=1}if(O>=N)return{distanceMeters:Number.NaN,bearingRad:0,iterations:O,converged:!1};const et=(Jl**2-Fn**2)/Fn**2*W,ot=1+et/16384*(4096+et*(-768+et*(320-175*et))),I=et/1024*(256+et*(-128+et*(74-47*et))),P=I*G*(X+I/4*(D*(-1+2*X**2)-I/6*X*(-3+4*G**2)*(-3+4*X**2))),R=Fn*ot*(U-P),F=Math.atan2(E*Math.sin(C),x*b-_*E*Math.cos(C));return{distanceMeters:R,bearingRad:F,iterations:O,converged:!0}}function Nf(a,n,i,s){const r=Gn(a),h=Gn(i),f=Gn(s-n),d=Math.atan((1-pn)*Math.tan(r)),m=Math.atan((1-pn)*Math.tan(h)),_=Math.sin(d),x=Math.cos(d),b=Math.sin(m),E=Math.cos(m),C=Math.sqrt((E*Math.sin(f))**2+(x*b-_*E*Math.cos(f))**2),S=_*b+x*E*Math.cos(f),O=Math.atan2(C,S);if(O===0)return{distanceMeters:0,bearingRad:0};const G=1-(x*E*Math.sin(f)/Math.sin(O))**2,D=G===0?0:S-2*_*b/G,U=(Jl**2-Fn**2)/Fn**2*G,W=1+U/16384*(4096+U*(-768+U*(320-175*U))),X=U/1024*(256+U*(-128+U*(74-47*U))),et=X*C*(D+X/4*(S*(-1+2*D**2)-X/6*D*(-3+4*C**2)*(-3+4*D**2))),ot=Fn*W*(O-et),I=Math.atan2(E*Math.sin(f),x*b-_*E*Math.cos(f));return{distanceMeters:ot,bearingRad:I}}const Xi=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),Un=a=>JSON.parse(JSON.stringify(a));function Ji(a){const n=[];let i=0;const s=new Set,r=(N,G,D,U="error")=>{n.push({code:N,path:G,message:D,severity:U})},h=(N,G)=>{"crs"in N&&r("crs-mismatch",`${G}.crs`,"RFC 7946 uses WGS84 longitude/latitude; legacy CRS is not reprojected.","warning")},f=(N,G)=>{if(Array.isArray(N)&&N.length===0&&r("empty-geometry",G,"Point has no coordinates."),!Array.isArray(N)||N.length<2||!N.every(D=>typeof D=="number"&&Number.isFinite(D))){r("invalid-position",G,"Expected at least two finite ordinates.");return}(Math.abs(N[0])>180||Math.abs(N[1])>90)&&r("crs-mismatch",G,"Position outside WGS84 longitude/latitude range.","warning")},d=(N,G,D)=>{if(!Array.isArray(N)||N.length===0){r("empty-geometry",G,"Expected a non-empty coordinate/geometry array.");return}N.forEach((U,W)=>D(U,`${G}[${W}]`))},m=(N,G)=>{d(N,G,f),Array.isArray(N)&&N.length<2&&r("invalid-line",G,"LineString requires at least two positions.")},_=(N,G)=>{d(N,G,f);const D=Array.isArray(N)?N[0]:void 0,U=Array.isArray(N)?N[N.length-1]:void 0,W=Array.isArray(D)&&Array.isArray(U)&&D.length===U.length&&D.every((X,et)=>X===U[et]);Array.isArray(N)&&(N.length<4||!W)&&r("invalid-ring",G,"Linear rings require four positions and exact closure.")},x=(N,G)=>d(N,G,_),b=(N,G,D)=>{if(D>64){r("nesting-limit",G,"Geometry nesting exceeds 64.");return}if(!Xi(N)){r("empty-geometry",G,"Missing or null geometry.");return}h(N,G);const U=`${G}.coordinates`;switch(N.type){case"Point":f(N.coordinates,U);break;case"LineString":m(N.coordinates,U);break;case"Polygon":x(N.coordinates,U);break;case"MultiPoint":d(N.coordinates,U,f);break;case"MultiLineString":d(N.coordinates,U,m);break;case"MultiPolygon":d(N.coordinates,U,x);break;case"GeometryCollection":d(N.geometries,`${G}.geometries`,(W,X)=>b(W,X,D+1));break;default:r("unsupported-geometry",G,`Unsupported geometry: ${typeof N.type=="string"?N.type:"missing or non-string type"}.`)}typeof N.type=="string"&&(N.type.startsWith("Multi")||N.type==="GeometryCollection")&&r("multi-expansion",G,"Editing adapters expand this geometry into single-geometry features.","info")},E=(N,G)=>{var W;if(i++,!Xi(N)||N.type!=="Feature"){r("invalid-feature",G,"Expected a Feature.");return}if(h(N,G),N.properties===null||Xi(N.properties)||r("invalid-properties",`${G}.properties`,"Expected an object or null."),Xi(N.properties)){const X=N.properties.id;N.id===void 0&&X!==void 0&&!(typeof X=="string"&&X.length>0)&&!(typeof X=="number"&&Number.isFinite(X))&&r("invalid-id",`${G}.properties.id`,"Fallback ID must be a non-empty string or finite number.");const et=N.properties["geokit:source"];et!==void 0&&(!Array.isArray(et)||et.length===0||et.length>64||!et.every(ot=>Xi(ot)&&typeof ot.type=="string"&&["MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"].includes(ot.type)&&(typeof ot.id=="string"||typeof ot.id=="number")&&typeof ot.hasPropertyId=="boolean"&&typeof ot.nullProperties=="boolean"))&&r("invalid-provenance",`${G}.properties.geokit:source`,"Reserved expansion provenance is malformed.")}N.id!==void 0&&!(typeof N.id=="string"&&N.id.length>0)&&!(typeof N.id=="number"&&Number.isFinite(N.id))&&r("invalid-id",`${G}.id`,"Feature ID must be a non-empty string or finite number.");const D=(W=N.id)!=null?W:Xi(N.properties)?N.properties.id:void 0,U=typeof D=="string"||typeof D=="number"?String(D):void 0;U!==void 0&&(s.has(U)&&r("duplicate-id",`${G}.id`,`Duplicate feature ID: ${U}.`),s.add(U)),b(N.geometry,`${G}.geometry`,0)},C=new Set;let S=!1;const O=(N,G,D)=>{if(D>128){S=!0,r("nesting-limit",G,"JSON nesting exceeds 128.");return}if(!(N===null||typeof N=="string"||typeof N=="boolean")&&!(typeof N=="number"&&Number.isFinite(N))){if(typeof N!="object"||N===null||C.has(N)){typeof N=="object"&&N!==null&&C.has(N)&&(S=!0),r("invalid-json",G,"Expected finite, acyclic JSON values.");return}if(!Array.isArray(N)&&Object.getPrototypeOf(N)!==Object.prototype&&Object.getPrototypeOf(N)!==null){r("invalid-json",G,"Expected a plain JSON object.");return}if(C.add(N),Array.isArray(N))for(let U=0;U<N.length;U++)O(N[U],`${G}[${U}]`,D+1);else Object.entries(N).forEach(([U,W])=>O(W,`${G}.${U}`,D+1));C.delete(N)}};return O(a,"$",0),S?{valid:!1,featureCount:i,diagnostics:n}:(Xi(a)?a.type==="FeatureCollection"?(h(a,"$"),Array.isArray(a.features)?a.features.forEach((N,G)=>E(N,`$.features[${G}]`)):r("invalid-collection","$.features","Expected a features array.")):a.type==="Feature"?E(a,"$"):(i=1,b(a,"$",0)):r("invalid-input","$","Expected a GeoJSON object."),{valid:!n.some(N=>N.severity==="error"),featureCount:i,diagnostics:n})}class Br extends Error{constructor(i){super("GeoJSON validation failed");Q(this,"summary");this.summary=i,this.name="GeoJSONValidationError"}}function qo(a,n={}){var d,m;const i=Ji(a);if(!i.valid)throw new Br(i);const s=Un(a),r=s.type==="FeatureCollection"?s:{type:"FeatureCollection",features:[s.type==="Feature"?s:{type:"Feature",properties:{},geometry:s}]};for(const _ of r.features)_.id=(m=(d=_.id)!=null?d:Ve(_))!=null?m:Mr();const h=n.expandMulti?js(r,{preserveMetadata:!0}):r,f=Ji(h);if(!f.valid)throw new Br(f);return Un(h)}function Kl(a,n={}){const i=Ji(a);if(!i.valid)return{...i,data:null};try{return{...i,data:qo(a,n)}}catch(s){if(s instanceof Br)return{...s.summary,data:null};throw s}}function Ql(a,n={}){let i;try{i=JSON.parse(a)}catch{return{valid:!1,featureCount:0,data:null,diagnostics:[{severity:"error",code:"invalid-json",path:"$",message:"Unable to parse JSON text."}]}}return Kl(i,n)}function Of(a,n={}){var h,f;const i=Ji(a);if(!i.valid)return{...i,data:null};if(n.adapter==="source"){const d=new Map;for(const[m,_]of a.features.entries()){const x=(h=_.properties)==null?void 0:h["geokit:source"];if(!Array.isArray(x)||!x.length)continue;const b=String((f=x[0])==null?void 0:f.id),E={..._.properties};delete E.id,delete E["geokit:source"];const C=zr(E);d.has(b)&&d.get(b)!==C&&i.diagnostics.push({severity:"error",code:"metadata-conflict",path:`$.features[${m}].properties`,message:"Expanded children have divergent properties; export editing data or reconcile before source export."}),d.set(b,C)}}if(i.valid=!i.diagnostics.some(d=>d.severity==="error"),!i.valid)return{...i,data:null};const s=Ks(Un(a),{...n,provenanceOnly:!0}),r=Ji(s);return{...r,diagnostics:[...i.diagnostics,...r.diagnostics],data:r.valid?s:null}}async function Rf(a,n={}){var s;const i=await((s=n.fetcher)!=null?s:fetch)(a,{signal:n.signal});if(!i.ok)throw new Error(`GeoJSON fetch failed: HTTP ${i.status}`);return Ql(await i.text(),n)}function Zo(a){const n=Ji(a);if(!n.valid)throw new Br(n);const i=a;if(i.type!=="FeatureCollection")throw new Error("Diff/patch requires a FeatureCollection.");return new Map(i.features.map(s=>{const r=Ve(s);if(r===void 0)throw new Error("Diff/patch requires stable feature IDs; normalize once before editing.");return[r,s]}))}function zr(a){return Array.isArray(a)?`[${a.map(zr).join(",")}]`:Xi(a)?`{${Object.keys(a).sort().map(n=>`${JSON.stringify(n)}:${zr(a[n])}`).join(",")}}`:JSON.stringify(a)}function Df(a,n){const i=Zo(a),s=Zo(n),r=[],h=[],f=[];for(const[d,m]of s)i.has(d)?zr(i.get(d))!==zr(m)&&h.push(Un(m)):r.push(Un(m));for(const d of i.keys())s.has(d)||f.push(d);return{created:r,updated:h,deleted:f,createdIds:r.map(d=>Ve(d)),updatedIds:h.map(d=>Ve(d)),deletedIds:[...f]}}function Bf(a,n){const i=Zo(a);if(!n||!Array.isArray(n.created)||!Array.isArray(n.updated)||!Array.isArray(n.deleted))throw new Error("Malformed GeoJSON patch.");const s=new Set,r=h=>{if(s.has(h))throw new Error(`Conflicting patch operations: ${h}`);s.add(h)};for(const h of n.deleted){if(typeof h!="string")throw new Error("Deleted IDs must be strings.");if(r(h),!i.delete(h))throw new Error(`Missing deleted feature: ${h}`)}for(const[h,f]of[["created",n.created],["updated",n.updated]]){const d=Zo({type:"FeatureCollection",features:f});for(const[m,_]of d){if(r(m),h==="created"?i.has(m):!i.has(m))throw new Error(`Invalid ${h} target: ${m}`);i.set(m,_)}}return Un({...a,features:[...i.values()]})}const zf={position:"topleft",circleMarker:{color:"red",radius:2},lineStyle:{color:"red",dashArray:"1,6"},angleUnit:{display:"°",decimal:2,factor:null,label:"Bearing:"}},Ff={display:"km",decimal:2,factor:null,label:"Distance (km):"},Gf={display:"mi",decimal:2,factor:.621371,label:"Distance (mi):"};function Uf(a){const n=a==="imperial"?{...Gf}:{...Ff};return{...zf,lengthUnit:n}}const qf={metric:"Meters / Kilometers",imperial:"Feet / Miles"};function fa(a,n={}){var h,f;const i=!!((h=a==null?void 0:a.Control)!=null&&h.Draw),s=!!a.draw,r=i&&s;return r||(f=n.onError)==null||f.call(n,"Leaflet.draw is not available on the provided Leaflet instance"),r}const Wi={osm:{urlTemplate:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19,subdomains:["a","b","c"]},here:{styles:{"lite.day":"lite.day","normal.day":"normal.day","satellite.day":"satellite.day"},defaultStyle:"lite.day",attribution:'Map Tiles © <a href="https://www.here.com">HERE</a>',maxZoom:20}};function $l(a){return typeof a=="string"?a.trim().toLowerCase():""}function tu(a){if(typeof a!="string")return;const n=a.trim();return n.length>0?n:void 0}function da(a){const{style:n,attribution:i}=a,s=$l(a.provider),r=tu(a.apiKey);switch(s){case"osm":return{urlTemplate:Wi.osm.urlTemplate,attribution:i||Wi.osm.attribution,maxZoom:Wi.osm.maxZoom,subdomains:[...Wi.osm.subdomains]};case"here":{if(!r)throw new Error("HERE Maps requires an API key");const h=typeof n=="string"?n.trim():"",f=h&&h in Wi.here.styles?h:Wi.here.defaultStyle;return{urlTemplate:`https://maps.hereapi.com/v3/base/mc/{z}/{x}/{y}/png8?style=${encodeURIComponent(f)}&apiKey=${encodeURIComponent(r)}`,attribution:i||Wi.here.attribution,maxZoom:Wi.here.maxZoom,subdomains:void 0}}default:throw new Error(`Unknown tile provider: ${a.provider}`)}}function Zf(a){const n=$l(a.provider),i=tu(a.apiKey);return n?n==="here"&&!i?{valid:!1,error:"HERE Maps requires an API key"}:{valid:!0}:{valid:!1,error:"Provider is required"}}function ga(a,n){return{kind:a.kind,attribution:n.trim()?"present":"missing",attributionRequired:a.capabilities.attributionRequired,offline:a.capabilities.offline,apiKey:a.capabilities.apiKey,drawing:"leaflet-draw",scope:"configuration"}}function eu(a){const n=a.provider.trim().toLowerCase(),i={...a};return{kind:"raster",capabilities:{attributionRequired:!0,offline:n==="osm"||n==="here"?"unsupported":"unknown",apiKey:n==="here"?"required":"none"},resolve:()=>da(i)}}function iu(a){var i;const n={...a,subdomains:(i=a.subdomains)==null?void 0:i.slice()};return{kind:"raster",capabilities:{attributionRequired:!0,offline:"unknown",apiKey:"host-defined"},resolve:()=>{var s;return{...n,subdomains:(s=n.subdomains)==null?void 0:s.slice()}}}}function Hf(a){var n,i;return{attribution:a.attribution,provider:{kind:"vector",capabilities:{attributionRequired:!0,offline:(n=a.offline)!=null?n:"unknown",apiKey:(i=a.apiKey)!=null?i:"host-defined"},createLayer:a.createLayer}}}const Ho={polygon:{control:"polygon",attribute:"draw-polygon",behavior:"draw",mutates:!0},polyline:{control:"polyline",attribute:"draw-polyline",behavior:"draw",mutates:!0},rectangle:{control:"rectangle",attribute:"draw-rectangle",behavior:"draw",mutates:!0},circle:{control:"circle",attribute:"draw-circle",behavior:"draw",mutates:!0},marker:{control:"marker",attribute:"draw-marker",behavior:"draw",mutates:!0},layerCake:{control:"cake",attribute:"draw-layer-cake",behavior:"draw",mutates:!0},move:{control:"move",attribute:"draw-move",behavior:"mode",mutates:!0,needsLayers:!0},edit:{control:"edit",attribute:"edit-features",behavior:"mode",mutates:!0,needsLayers:!0},delete:{control:"delete",attribute:"delete-features",behavior:"mode",mutates:!0,needsLayers:!0},ruler:{control:"ruler",attribute:"draw-ruler",behavior:"mode"},measurementSettings:{behavior:"action"},layerStyle:{behavior:"action"},save:{behavior:"action"},select:{behavior:"deactivate"}};function nu(a){var i,s,r,h,f;const n={};for(const d of Object.keys(Ho)){const m=Ho[d],_=(i=a.config)==null?void 0:i[d];let x=null,b="disabled";a.ready?m.mutates&&a.readOnly?x={code:"read_only",message:"Map is read-only",requirement:"read-only=false"}:m.control&&!a.controls[m.control]?x={code:"missing_attribute",message:`Enable ${m.attribute} to use this tool`,requirement:m.attribute}:d==="delete"&&!a.controls.edit?x={code:"missing_attribute",message:"Enable edit-features to use delete",requirement:"edit-features"}:m.control&&!a.available[d]?(b="unavailable",x={code:"unavailable_plugin",message:`Handler for ${d} is unavailable`}):m.needsLayers&&a.layerCount===0?x={code:"no_editable_layers",message:"No editable layers are loaded"}:(s=_==null?void 0:_.requirements)!=null&&s.selection&&a.selectedFeatureIds.length===0?x={code:"empty_selection",message:"Select a feature first",requirement:"selection"}:(r=_==null?void 0:_.requirements)!=null&&r.provider&&a.provider.state!=="enabled"?(x=a.provider.reason,b=a.provider.state):(h=a.errors)!=null&&h[d]?(b="unavailable",x={code:"runtime_error",message:a.errors[d]}):_!=null&&_.disabled?x={code:"configured_disabled",message:"Disabled by host button configuration"}:b="enabled":(b="unavailable",x={code:"not_ready",message:"Map controller is not ready"}),n[d]={tool:d,state:b,reason:x?{...x}:null,active:a.activeTool===d,groupIds:[...new Set(((f=a.groups)!=null?f:[]).filter(E=>E.tools.includes(d)).map(E=>E.id))],hotkey:null,commands:{activate:!0,deactivate:!0},commandEnabled:b==="enabled"||(x==null?void 0:x.code)==="configured_disabled"||(x==null?void 0:x.code)==="runtime_error",behavior:m.behavior}}return{tools:n,provider:{...a.provider,reason:a.provider.reason?{...a.provider.reason}:null},selectedFeatureIds:[...a.selectedFeatureIds]}}function ru(a,n){for(const i of Object.values(n.tools)){const s=i.tool.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`);a.querySelectorAll(`.leaflet-geokit-toolbar-button[data-geokit-tool="${s}"]`).forEach(r=>{var h,f;r.disabled=i.state!=="enabled",r.setAttribute("aria-disabled",String(r.disabled)),r.dataset.geokitDisabled=String(r.disabled),r.dataset.geokitDisabledReason=(f=(h=i.reason)==null?void 0:h.code)!=null?f:"",r.setAttribute("part",`toolbar-button${i.active?" active":""}${r.disabled?" disabled":""}`)})}}const Yf=["vertex","edge","grid","guide"],Yo=6378137,ou=1/298.257223563,mn=ou*(2-ou),Fr=Math.PI/180,pa=89.9;function ma(a){const n=a[0],i=a[1];return Number.isFinite(n)&&Number.isFinite(i)?[n,i]:null}function su(a,n){if(a)switch(a.type){case"LineString":n(a.coordinates);return;case"MultiLineString":a.coordinates.forEach(n);return;case"Polygon":a.coordinates.forEach(n);return;case"MultiPolygon":a.coordinates.forEach(i=>i.forEach(n));return;case"GeometryCollection":a.geometries.forEach(i=>su(i,n));return;default:return}}function au(a,n){if(a)switch(a.type){case"Point":n(a.coordinates);return;case"MultiPoint":case"LineString":a.coordinates.forEach(n);return;case"MultiLineString":case"Polygon":a.coordinates.flat().forEach(n);return;case"MultiPolygon":a.coordinates.flat(2).forEach(n);return;case"GeometryCollection":a.geometries.forEach(i=>au(i,n));return}}function Vf(a,n){return Math.hypot(a.x-n.x,a.y-n.y)}function Xf(a,n,i){const s=i.x-n.x,r=i.y-n.y,h=s*s+r*r;if(h===0)return{...n};const f=Math.max(0,Math.min(1,((a.x-n.x)*s+(a.y-n.y)*r)/h));return{x:n.x+f*s,y:n.y+f*r}}function Jf(a){var i;const n=(i=a.modes)!=null&&i.length?a.modes:Yf;return[...new Set(n)]}function Wf(a){const n=Math.sin(a);return Yo*(1-mn)/(1-mn*n**2)**1.5}function ya(a){const n=mn**2,i=mn**3;return Yo*((1-mn/4-3*n/64-5*i/256)*a-(3*mn/8+3*n/32+45*i/1024)*Math.sin(2*a)+(15*n/256+45*i/1024)*Math.sin(4*a)-35*i/3072*Math.sin(6*a))}function jf(a){let n=Math.max(-Math.PI/2,Math.min(Math.PI/2,a/Yo));for(let i=0;i<8;i++)n-=(ya(n)-a)/Wf(n);return n/Fr}function Kf(a){const n=a*Fr;return Yo/Math.sqrt(1-mn*Math.sin(n)**2)*Math.cos(n)*Fr}function Qf(a,n){var b;const i=n.gridSizeMeters,[s,r]=(b=n.gridOrigin)!=null?b:[0,0];if(!Number.isFinite(i)||i<=0||!Number.isFinite(a.lat)||!Number.isFinite(a.lng)||!Number.isFinite(s)||!Number.isFinite(r)||Math.abs(a.lat)>pa||Math.abs(r)>pa)return null;const h=ya(r*Fr),f=ya(a.lat*Fr),d=h+Math.round((f-h)/i)*i,m=jf(d);if(!Number.isFinite(m)||Math.abs(m)>pa)return null;const _=Kf(m);return!Number.isFinite(_)||_<=0?null:{lng:s+Math.round((a.lng-s)*_/i)*i/_,lat:m}}function lu(a,n,i,s,r={},h){var b,E;if(r.enabled===!1)return null;const f=Jf(r),d=(b=r.tolerancePx)!=null?b:12;if(!Number.isFinite(d)||d<=0)return null;const m=i(a);let _=null;const x=(C,S,O={},N)=>{const G=Vf(m,C);if(G>d)return;const D=f.indexOf(S),U=_?f.indexOf(_.mode):Number.MAX_SAFE_INTEGER;_&&(G>_.distancePx+.001||G>=_.distancePx-.001&&D>U)||(_={latlng:N!=null?N:s(C),point:C,distancePx:G,mode:S,...O})};for(const C of n){if(!C.visible||C.layerKind==="measurement"||C.featureId===h)continue;const S=C.layerKind==="guide"?f.includes("guide")?["guide"]:[]:f.filter(O=>O==="vertex"||O==="edge");for(const O of S)O==="vertex"?au(C.feature.geometry,N=>{const G=ma(N);G&&x(i({lng:G[0],lat:G[1]}),O,{targetFeatureId:C.featureId,targetLayerId:C.layerId},{lng:G[0],lat:G[1]})}):su(C.feature.geometry,N=>{for(let G=1;G<N.length;G++){const D=ma(N[G-1]),U=ma(N[G]);if(!D||!U)continue;const W=i({lng:D[0],lat:D[1]}),X=i({lng:U[0],lat:U[1]}),et=Xf(m,W,X),ot=(X.x-W.x)**2+(X.y-W.y)**2,I=ot===0?0:Math.max(0,Math.min(1,((et.x-W.x)*(X.x-W.x)+(et.y-W.y)*(X.y-W.y))/ot));x(et,O,{targetFeatureId:C.featureId,targetLayerId:C.layerId},{lng:D[0]+(U[0]-D[0])*I,lat:D[1]+(U[1]-D[1])*I})}})}if(f.includes("grid")&&Number.isFinite(r.gridSizeMeters)&&((E=r.gridSizeMeters)!=null?E:0)>0){const C=Qf(a,r);if(C){const S=i(C);x(S,"grid",{},C)}}return _}var Kt=63710088e-1,uu={centimeters:Kt*100,centimetres:Kt*100,cm:Kt*100,degrees:360/(2*Math.PI),deg:360/(2*Math.PI),feet:Kt*3.28084,ft:Kt*3.28084,inches:Kt*39.37,in:Kt*39.37,kilometers:Kt/1e3,kilometres:Kt/1e3,km:Kt/1e3,meters:Kt,metres:Kt,m:Kt,miles:Kt/1609.344,mi:Kt/1609.344,millimeters:Kt*1e3,millimetres:Kt*1e3,mm:Kt*1e3,nauticalmiles:Kt/1852,nmi:Kt/1852,radians:1,rad:1,yards:Kt*1.0936,yd:Kt*1.0936};function Xe(a,n,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=n||{},s.geometry=a,s}function Ue(a,n,i={}){if(!a)throw new Error("coordinates is required");if(!Array.isArray(a))throw new Error("coordinates must be an Array");if(a.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!du(a[0])||!du(a[1]))throw new Error("coordinates must contain numbers");return Xe({type:"Point",coordinates:a},n,i)}function yn(a,n,i={}){for(const r of a){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let h=0;h<r[r.length-1].length;h++)if(r[r.length-1][h]!==r[0][h])throw new Error("First and last Position are not equivalent.")}return Xe({type:"Polygon",coordinates:a},n,i)}function Pi(a,n,i={}){if(a.length<2)throw new Error("coordinates must be an array of two or more positions");return Xe({type:"LineString",coordinates:a},n,i)}function Re(a,n={}){const i={type:"FeatureCollection"};return n.id&&(i.id=n.id),n.bbox&&(i.bbox=n.bbox),i.features=a,i}function hu(a,n,i={}){return Xe({type:"MultiLineString",coordinates:a},n,i)}function $f(a,n,i={}){return Xe({type:"MultiPolygon",coordinates:a},n,i)}function cu(a,n="kilometers"){const i=uu[n];if(!i)throw new Error(n+" units is invalid");return a*i}function fu(a,n="kilometers"){const i=uu[n];if(!i)throw new Error(n+" units is invalid");return a/i}function td(a,n){return _a(fu(a,n))}function _a(a){return a%(2*Math.PI)*180/Math.PI}function qn(a){return a%360*Math.PI/180}function du(a){return!isNaN(a)&&a!==null&&!Array.isArray(a)}function va(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Vo(a,n,i){if(a!==null)for(var s,r,h,f,d,m,_,x=0,b=0,E,C=a.type,S=C==="FeatureCollection",O=C==="Feature",N=S?a.features.length:1,G=0;G<N;G++){_=S?a.features[G].geometry:O?a.geometry:a,E=_?_.type==="GeometryCollection":!1,d=E?_.geometries.length:1;for(var D=0;D<d;D++){var U=0,W=0;if(f=E?_.geometries[D]:_,f!==null){m=f.coordinates;var X=f.type;switch(x=i&&(X==="Polygon"||X==="MultiPolygon")?1:0,X){case null:break;case"Point":if(n(m,b,G,U,W)===!1)return!1;b++,U++;break;case"LineString":case"MultiPoint":for(s=0;s<m.length;s++){if(n(m[s],b,G,U,W)===!1)return!1;b++,X==="MultiPoint"&&U++}X==="LineString"&&U++;break;case"Polygon":case"MultiLineString":for(s=0;s<m.length;s++){for(r=0;r<m[s].length-x;r++){if(n(m[s][r],b,G,U,W)===!1)return!1;b++}X==="MultiLineString"&&U++,X==="Polygon"&&W++}X==="Polygon"&&U++;break;case"MultiPolygon":for(s=0;s<m.length;s++){for(W=0,r=0;r<m[s].length;r++){for(h=0;h<m[s][r].length-x;h++){if(n(m[s][r][h],b,G,U,W)===!1)return!1;b++}W++}U++}break;case"GeometryCollection":for(s=0;s<f.geometries.length;s++)if(Vo(f.geometries[s],n,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Zn(a,n){if(a.type==="Feature")n(a,0);else if(a.type==="FeatureCollection")for(var i=0;i<a.features.length&&n(a.features[i],i)!==!1;i++);}function ed(a,n,i){var s=i;return Zn(a,function(r,h){h===0&&i===void 0?s=r:s=n(s,r,h)}),s}function Hn(a,n){var i,s,r,h,f,d,m,_,x,b,E=0,C=a.type==="FeatureCollection",S=a.type==="Feature",O=C?a.features.length:1;for(i=0;i<O;i++){for(d=C?a.features[i].geometry:S?a.geometry:a,_=C?a.features[i].properties:S?a.properties:{},x=C?a.features[i].bbox:S?a.bbox:void 0,b=C?a.features[i].id:S?a.id:void 0,m=d?d.type==="GeometryCollection":!1,f=m?d.geometries.length:1,r=0;r<f;r++){if(h=m?d.geometries[r]:d,h===null){if(n(null,E,_,x,b)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(n(h,E,_,x,b)===!1)return!1;break}case"GeometryCollection":{for(s=0;s<h.geometries.length;s++)if(n(h.geometries[s],E,_,x,b)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}E++}}function id(a,n,i){var s=i;return Hn(a,function(r,h,f,d,m){h===0&&i===void 0?s=r:s=n(s,r,h,f,d,m)}),s}function Yn(a,n){Hn(a,function(i,s,r,h,f){var d=i===null?null:i.type;switch(d){case null:case"Point":case"LineString":case"Polygon":return n(Xe(i,r,{bbox:h,id:f}),s,0)===!1?!1:void 0}var m;switch(d){case"MultiPoint":m="Point";break;case"MultiLineString":m="LineString";break;case"MultiPolygon":m="Polygon";break}for(var _=0;_<i.coordinates.length;_++){var x=i.coordinates[_],b={type:m,coordinates:x};if(n(Xe(b,r),s,_)===!1)return!1}})}function nd(a){return id(a,(n,i)=>n+rd(i),0)}function rd(a){let n=0,i;switch(a.type){case"Polygon":return gu(a.coordinates);case"MultiPolygon":for(i=0;i<a.coordinates.length;i++)n+=gu(a.coordinates[i]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function gu(a){let n=0;if(a&&a.length>0){n+=Math.abs(pu(a[0]));for(let i=1;i<a.length;i++)n-=Math.abs(pu(a[i]))}return n}var od=Kt*Kt/2,ba=Math.PI/180;function pu(a){const n=a.length-1;if(n<=2)return 0;let i=0,s=0;for(;s<n;){const r=a[s],h=a[s+1===n?0:s+1],f=a[s+2>=n?(s+2)%n:s+2],d=r[0]*ba,m=h[1]*ba,_=f[0]*ba;i+=(_-d)*Math.sin(m),s++}return i*od}function ji(a,n={}){if(a.bbox!=null&&n.recompute!==!0)return a.bbox;const i=[1/0,1/0,-1/0,-1/0];return Vo(a,s=>{i[0]>s[0]&&(i[0]=s[0]),i[1]>s[1]&&(i[1]=s[1]),i[2]<s[0]&&(i[2]=s[0]),i[3]<s[1]&&(i[3]=s[1])}),i}function bi(a){if(!a)throw new Error("coord is required");if(!Array.isArray(a)){if(a.type==="Feature"&&a.geometry!==null&&a.geometry.type==="Point")return[...a.geometry.coordinates];if(a.type==="Point")return[...a.coordinates]}if(Array.isArray(a)&&a.length>=2&&!Array.isArray(a[0])&&!Array.isArray(a[1]))return[...a];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Je(a){if(Array.isArray(a))return a;if(a.type==="Feature"){if(a.geometry!==null)return a.geometry.coordinates}else if(a.coordinates)return a.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Ni(a){return a.type==="Feature"?a.geometry:a}function Xo(a,n){return a.type==="FeatureCollection"?"FeatureCollection":a.type==="GeometryCollection"?"GeometryCollection":a.type==="Feature"&&a.geometry!==null?a.geometry.type:a.type}const Oi=11102230246251565e-32,Ee=134217729,sd=(3+8*Oi)*Oi;function xa(a,n,i,s,r){let h,f,d,m,_=n[0],x=s[0],b=0,E=0;x>_==x>-_?(h=_,_=n[++b]):(h=x,x=s[++E]);let C=0;if(b<a&&E<i)for(x>_==x>-_?(f=_+h,d=h-(f-_),_=n[++b]):(f=x+h,d=h-(f-x),x=s[++E]),h=f,d!==0&&(r[C++]=d);b<a&&E<i;)x>_==x>-_?(f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b]):(f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E]),h=f,d!==0&&(r[C++]=d);for(;b<a;)f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b],h=f,d!==0&&(r[C++]=d);for(;E<i;)f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E],h=f,d!==0&&(r[C++]=d);return(h!==0||C===0)&&(r[C++]=h),C}function ad(a,n){let i=n[0];for(let s=1;s<a;s++)i+=n[s];return i}function Gr(a){return new Float64Array(a)}const ld=(3+16*Oi)*Oi,ud=(2+12*Oi)*Oi,hd=(9+64*Oi)*Oi*Oi,Vn=Gr(4),mu=Gr(8),yu=Gr(12),_u=Gr(16),Ce=Gr(4);function cd(a,n,i,s,r,h,f){let d,m,_,x,b,E,C,S,O,N,G,D,U,W,X,et,ot,I;const P=a-r,R=i-r,F=n-h,q=s-h;W=P*q,E=Ee*P,C=E-(E-P),S=P-C,E=Ee*q,O=E-(E-q),N=q-O,X=S*N-(W-C*O-S*O-C*N),et=F*R,E=Ee*F,C=E-(E-F),S=F-C,E=Ee*R,O=E-(E-R),N=R-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Vn[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Vn[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Vn[2]=D-(I-b)+(G-b),Vn[3]=I;let H=ad(4,Vn),j=ud*f;if(H>=j||-H>=j||(b=a-P,d=a-(P+b)+(b-r),b=i-R,_=i-(R+b)+(b-r),b=n-F,m=n-(F+b)+(b-h),b=s-q,x=s-(q+b)+(b-h),d===0&&m===0&&_===0&&x===0)||(j=hd*f+sd*Math.abs(H),H+=P*x+q*d-(F*_+R*m),H>=j||-H>=j))return H;W=d*q,E=Ee*d,C=E-(E-d),S=d-C,E=Ee*q,O=E-(E-q),N=q-O,X=S*N-(W-C*O-S*O-C*N),et=m*R,E=Ee*m,C=E-(E-m),S=m-C,E=Ee*R,O=E-(E-R),N=R-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Ce[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Ce[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Ce[2]=D-(I-b)+(G-b),Ce[3]=I;const B=xa(4,Vn,4,Ce,mu);W=P*x,E=Ee*P,C=E-(E-P),S=P-C,E=Ee*x,O=E-(E-x),N=x-O,X=S*N-(W-C*O-S*O-C*N),et=F*_,E=Ee*F,C=E-(E-F),S=F-C,E=Ee*_,O=E-(E-_),N=_-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Ce[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Ce[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Ce[2]=D-(I-b)+(G-b),Ce[3]=I;const Y=xa(B,mu,4,Ce,yu);W=d*x,E=Ee*d,C=E-(E-d),S=d-C,E=Ee*x,O=E-(E-x),N=x-O,X=S*N-(W-C*O-S*O-C*N),et=m*_,E=Ee*m,C=E-(E-m),S=m-C,E=Ee*_,O=E-(E-_),N=_-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Ce[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Ce[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Ce[2]=D-(I-b)+(G-b),Ce[3]=I;const $=xa(Y,yu,4,Ce,_u);return _u[$-1]}function fd(a,n,i,s,r,h){const f=(n-h)*(i-r),d=(a-r)*(s-h),m=f-d,_=Math.abs(f+d);return Math.abs(m)>=ld*_?m:-cd(a,n,i,s,r,h,_)}function dd(a,n){var i,s,r=0,h,f,d,m,_,x,b,E=a[0],C=a[1],S=n.length;for(i=0;i<S;i++){s=0;var O=n[i],N=O.length-1;if(x=O[0],x[0]!==O[N][0]&&x[1]!==O[N][1])throw new Error("First and last coordinates in a ring must be the same");for(f=x[0]-E,d=x[1]-C,s;s<N;s++){if(b=O[s+1],m=b[0]-E,_=b[1]-C,d===0&&_===0){if(m<=0&&f>=0||f<=0&&m>=0)return 0}else if(_>=0&&d<=0||_<=0&&d>=0){if(h=fd(f,m,d,_,0,0),h===0)return 0;(h>0&&_>0&&d<=0||h<0&&_<=0&&d>0)&&r++}x=b,d=_,f=m}}return r%2!==0}function Xn(a,n,i={}){if(!a)throw new Error("point is required");if(!n)throw new Error("polygon is required");const s=bi(a),r=Ni(n),h=r.type,f=n.bbox;let d=r.coordinates;if(f&&gd(s,f)===!1)return!1;h==="Polygon"&&(d=[d]);for(var m=0;m<d.length;++m){const _=dd(s,d[m]);if(_===0&&!i.ignoreBoundary)return!0;if(_)return!0}return!1}function gd(a,n){return n[0]<=a[0]&&n[1]<=a[1]&&n[2]>=a[0]&&n[3]>=a[1]}class vu{constructor(n=[],i=pd){if(this.data=n,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(n){this.data.push(n),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const n=this.data[0],i=this.data.pop();return this.length--,this.length>0&&(this.data[0]=i,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:i,compare:s}=this,r=i[n];for(;n>0;){const h=n-1>>1,f=i[h];if(s(r,f)>=0)break;i[n]=f,n=h}i[n]=r}_down(n){const{data:i,compare:s}=this,r=this.length>>1,h=i[n];for(;n<r;){let f=(n<<1)+1,d=i[f];const m=f+1;if(m<this.length&&s(i[m],d)<0&&(f=m,d=i[m]),s(d,h)>=0)break;i[n]=d,n=f}i[n]=h}}function pd(a,n){return a<n?-1:a>n?1:0}const Ri=11102230246251565e-32,Te=134217729,md=(3+8*Ri)*Ri;function wa(a,n,i,s,r){let h,f,d,m,_=n[0],x=s[0],b=0,E=0;x>_==x>-_?(h=_,_=n[++b]):(h=x,x=s[++E]);let C=0;if(b<a&&E<i)for(x>_==x>-_?(f=_+h,d=h-(f-_),_=n[++b]):(f=x+h,d=h-(f-x),x=s[++E]),h=f,d!==0&&(r[C++]=d);b<a&&E<i;)x>_==x>-_?(f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b]):(f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E]),h=f,d!==0&&(r[C++]=d);for(;b<a;)f=h+_,m=f-h,d=h-(f-m)+(_-m),_=n[++b],h=f,d!==0&&(r[C++]=d);for(;E<i;)f=h+x,m=f-h,d=h-(f-m)+(x-m),x=s[++E],h=f,d!==0&&(r[C++]=d);return(h!==0||C===0)&&(r[C++]=h),C}function yd(a,n){let i=n[0];for(let s=1;s<a;s++)i+=n[s];return i}function Ur(a){return new Float64Array(a)}const _d=(3+16*Ri)*Ri,vd=(2+12*Ri)*Ri,bd=(9+64*Ri)*Ri*Ri,Jn=Ur(4),bu=Ur(8),xu=Ur(12),wu=Ur(16),Se=Ur(4);function xd(a,n,i,s,r,h,f){let d,m,_,x,b,E,C,S,O,N,G,D,U,W,X,et,ot,I;const P=a-r,R=i-r,F=n-h,q=s-h;W=P*q,E=Te*P,C=E-(E-P),S=P-C,E=Te*q,O=E-(E-q),N=q-O,X=S*N-(W-C*O-S*O-C*N),et=F*R,E=Te*F,C=E-(E-F),S=F-C,E=Te*R,O=E-(E-R),N=R-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Jn[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Jn[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Jn[2]=D-(I-b)+(G-b),Jn[3]=I;let H=yd(4,Jn),j=vd*f;if(H>=j||-H>=j||(b=a-P,d=a-(P+b)+(b-r),b=i-R,_=i-(R+b)+(b-r),b=n-F,m=n-(F+b)+(b-h),b=s-q,x=s-(q+b)+(b-h),d===0&&m===0&&_===0&&x===0)||(j=bd*f+md*Math.abs(H),H+=P*x+q*d-(F*_+R*m),H>=j||-H>=j))return H;W=d*q,E=Te*d,C=E-(E-d),S=d-C,E=Te*q,O=E-(E-q),N=q-O,X=S*N-(W-C*O-S*O-C*N),et=m*R,E=Te*m,C=E-(E-m),S=m-C,E=Te*R,O=E-(E-R),N=R-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Se[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Se[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Se[2]=D-(I-b)+(G-b),Se[3]=I;const B=wa(4,Jn,4,Se,bu);W=P*x,E=Te*P,C=E-(E-P),S=P-C,E=Te*x,O=E-(E-x),N=x-O,X=S*N-(W-C*O-S*O-C*N),et=F*_,E=Te*F,C=E-(E-F),S=F-C,E=Te*_,O=E-(E-_),N=_-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Se[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Se[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Se[2]=D-(I-b)+(G-b),Se[3]=I;const Y=wa(B,bu,4,Se,xu);W=d*x,E=Te*d,C=E-(E-d),S=d-C,E=Te*x,O=E-(E-x),N=x-O,X=S*N-(W-C*O-S*O-C*N),et=m*_,E=Te*m,C=E-(E-m),S=m-C,E=Te*_,O=E-(E-_),N=_-O,ot=S*N-(et-C*O-S*O-C*N),G=X-ot,b=X-G,Se[0]=X-(G+b)+(b-ot),D=W+G,b=D-W,U=W-(D-b)+(G-b),G=U-et,b=U-G,Se[1]=U-(G+b)+(b-et),I=D+G,b=I-D,Se[2]=D-(I-b)+(G-b),Se[3]=I;const $=wa(Y,xu,4,Se,wu);return wu[$-1]}function ku(a,n,i,s,r,h){const f=(n-h)*(i-r),d=(a-r)*(s-h),m=f-d;if(f===0||d===0||f>0!=d>0)return m;const _=Math.abs(f+d);return Math.abs(m)>=_d*_?m:-xd(a,n,i,s,r,h,_)}function wd(a,n){const i=new vu([],Lu);return Ld(a,i),Ed(i,n)}function Lu(a,n){return a.p.x>n.p.x?1:a.p.x<n.p.x||a.p.x===n.p.x&&(a.featureId!==n.featureId||a.ringId!==n.ringId)&&a.isLeftEndpoint&&!n.isLeftEndpoint?-1:a.p.y!==n.p.y?a.p.y>n.p.y?1:-1:1}function kd(a,n){return a.rightSweepEvent.p.x>n.rightSweepEvent.p.x?1:a.rightSweepEvent.p.x<n.rightSweepEvent.p.x?-1:a.rightSweepEvent.p.y!==n.rightSweepEvent.p.y?a.rightSweepEvent.p.y<n.rightSweepEvent.p.y?1:-1:1}function Ld(a,n){if(a.type==="FeatureCollection"){const i=a.features;for(let s=0;s<i.length;s++)Eu(i[s],n)}else Eu(a,n)}var Jo=0,Wo=0,jo=0;function Eu(a,n){const i=a.type==="Feature"?a.geometry:a;let s=i.coordinates;(i.type==="Polygon"||i.type==="MultiLineString")&&(s=[s]),i.type==="LineString"&&(s=[[s]]);for(let r=0;r<s.length;r++)for(let h=0;h<s[r].length;h++){let f=s[r][h][0],d=null;Wo=Wo+1;for(let m=0;m<s[r][h].length-1;m++){d=s[r][h][m+1];const _=new Tu(f,Jo,Wo,jo),x=new Tu(d,Jo,Wo,jo+1);_.otherEvent=x,x.otherEvent=_,Lu(_,x)>0?(x.isLeftEndpoint=!0,_.isLeftEndpoint=!1):(_.isLeftEndpoint=!0,x.isLeftEndpoint=!1),n.push(_),n.push(x),f=d,jo=jo+1}}Jo=Jo+1}var Tu=class{constructor(a,n,i,s){this.p={x:a[0],y:a[1]},this.featureId=n,this.ringId=i,this.eventId=s,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(a){return this.p.x===a.p.x&&this.p.y===a.p.y}asNewXY(){return[this.p.x,this.p.y]}};function Ed(a,n=!1){const i=[],s=new vu([],kd);for(;a.length;){const r=a.pop();if(r.isLeftEndpoint){const h=new Td(r);for(let f=0;f<s.data.length;f++){const d=s.data[f];if(n&&d.leftSweepEvent.featureId===r.featureId)continue;const m=Id(h,d);m!==!1&&i.push(m)}s.push(h)}else r.isLeftEndpoint===!1&&s.pop()}return i}var Td=class{constructor(n){this.leftSweepEvent=n,this.rightSweepEvent=n.otherEvent}};function Id(a,n){if(a===null||n===null)return!1;const i=a.leftSweepEvent.p.x,s=a.leftSweepEvent.p.y,r=a.rightSweepEvent.p.x,h=a.rightSweepEvent.p.y,f=n.leftSweepEvent.p.x,d=n.leftSweepEvent.p.y,m=n.rightSweepEvent.p.x,_=n.rightSweepEvent.p.y,x=ku(i,s,r,h,f,d),b=ku(i,s,r,h,m,_);if(x>0&&b>0)return!1;if(x<0&&b<0)return!1;if(a.leftSweepEvent.ringId===n.leftSweepEvent.ringId){if(a.rightSweepEvent.isSamePoint(n.leftSweepEvent)||a.rightSweepEvent.isSamePoint(n.rightSweepEvent)||a.leftSweepEvent.isSamePoint(n.leftSweepEvent)||a.leftSweepEvent.isSamePoint(n.rightSweepEvent))return!1}else{if(a.rightSweepEvent.isSamePoint(n.leftSweepEvent))return n.leftSweepEvent.asNewXY();if(a.rightSweepEvent.isSamePoint(n.rightSweepEvent))return n.rightSweepEvent.asNewXY();if(a.leftSweepEvent.isSamePoint(n.leftSweepEvent))return n.leftSweepEvent.asNewXY();if(a.leftSweepEvent.isSamePoint(n.rightSweepEvent))return n.rightSweepEvent.asNewXY()}const E=(_-d)*(r-i)-(m-f)*(h-s),C=(m-f)*(s-d)-(_-d)*(i-f),S=(r-i)*(s-d)-(h-s)*(i-f);if(E===0)return!1;const O=C/E,N=S/E;if(O>=0&&O<=1&&N>=0&&N<=1){const G=i+O*(r-i),D=s+O*(h-s);return[G,D]}return!1}function Ki(a,n,i={}){const{removeDuplicates:s=!0,ignoreSelfIntersections:r=!0}=i;let h=[];a.type==="FeatureCollection"?h=h.concat(a.features):a.type==="Feature"?h.push(a):(a.type==="LineString"||a.type==="Polygon"||a.type==="MultiLineString"||a.type==="MultiPolygon")&&h.push(Xe(a)),n.type==="FeatureCollection"?h=h.concat(n.features):n.type==="Feature"?h.push(n):(n.type==="LineString"||n.type==="Polygon"||n.type==="MultiLineString"||n.type==="MultiPolygon")&&h.push(Xe(n));const f=wd(Re(h),r);let d=[];if(s){const m={};f.forEach(_=>{const x=_.join(",");m[x]||(m[x]=!0,d.push(_))})}else d=f;return Re(d.map(m=>Ue(m)))}function Ko(a,n={}){const i=Ni(a);switch(!n.properties&&a.type==="Feature"&&(n.properties=a.properties),i.type){case"Polygon":return Cd(i,n);case"MultiPolygon":return Sd(i,n);default:throw new Error("invalid poly")}}function Cd(a,n={}){const s=Ni(a).coordinates,r=n.properties?n.properties:a.type==="Feature"?a.properties:{};return Iu(s,r)}function Sd(a,n={}){const s=Ni(a).coordinates,r=n.properties?n.properties:a.type==="Feature"?a.properties:{},h=[];return s.forEach(f=>{h.push(Iu(f,r))}),Re(h)}function Iu(a,n){return a.length>1?hu(a,n):Pi(a[0],n)}function Md(a,n,{ignoreSelfIntersections:i=!0}={ignoreSelfIntersections:!0}){let s=!0;return Yn(a,r=>{Yn(n,h=>{if(s===!1)return!1;s=Ad(r.geometry,h.geometry,i)})}),s}function Ad(a,n,i){switch(a.type){case"Point":switch(n.type){case"Point":return!Rd(a.coordinates,n.coordinates);case"LineString":return!Qo(n,a);case"Polygon":return!Xn(a,n)}break;case"LineString":switch(n.type){case"Point":return!Qo(a,n);case"LineString":return!Pd(a,n,i);case"Polygon":return!Cu(n,a,i)}break;case"Polygon":switch(n.type){case"Point":return!Xn(n,a);case"LineString":return!Cu(a,n,i);case"Polygon":return!Nd(n,a,i)}}return!1}function Qo(a,n){for(let i=0;i<a.coordinates.length-1;i++)if(Od(a.coordinates[i],a.coordinates[i+1],n.coordinates))return!0;return!1}function Pd(a,n,i){if(Ki(a,n,{ignoreSelfIntersections:i}).features.length>0)return!0;for(const r of a.coordinates)if(Qo(n,{coordinates:r}))return!0;for(const r of n.coordinates)if(Qo(a,{coordinates:r}))return!0;return!1}function Cu(a,n,i){for(const r of n.coordinates)if(Xn(r,a))return!0;return Ki(n,Ko(a),{ignoreSelfIntersections:i}).features.length>0}function Nd(a,n,i){for(const r of a.coordinates[0])if(Xn(r,n))return!0;for(const r of n.coordinates[0])if(Xn(r,a))return!0;return Ki(Ko(a),Ko(n),{ignoreSelfIntersections:i}).features.length>0}function Od(a,n,i){const s=i[0]-a[0],r=i[1]-a[1],h=n[0]-a[0],f=n[1]-a[1];return s*f-r*h!==0?!1:Math.abs(h)>=Math.abs(f)?h>0?a[0]<=i[0]&&i[0]<=n[0]:n[0]<=i[0]&&i[0]<=a[0]:f>0?a[1]<=i[1]&&i[1]<=n[1]:n[1]<=i[1]&&i[1]<=a[1]}function Rd(a,n){return a[0]===n[0]&&a[1]===n[1]}var Dd=Object.defineProperty,Wn=(a,n)=>Dd(a,"name",{value:n,configurable:!0}),Su=class{constructor(n){this.direction=!1,this.compareProperties=!0;var i,s,r;this.precision=10**-((i=n==null?void 0:n.precision)!=null?i:17),this.direction=(s=n==null?void 0:n.direction)!=null?s:!1,this.compareProperties=(r=n==null?void 0:n.compareProperties)!=null?r:!0}compare(n,i){if(n.type!==i.type||!qr(n,i))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,i.coordinates);case"LineString":return this.compareLine(n.coordinates,i.coordinates);case"Polygon":return this.comparePolygon(n,i);case"GeometryCollection":return this.compareGeometryCollection(n,i);case"Feature":return this.compareFeature(n,i);case"FeatureCollection":return this.compareFeatureCollection(n,i);default:if(n.type.startsWith("Multi")){const s=ka(n),r=ka(i);return s.every(h=>r.some(f=>this.compare(h,f)))}}return!1}compareCoord(n,i){return n.length===i.length&&n.every((s,r)=>Math.abs(s-i[r])<this.precision)}compareLine(n,i,s=0,r=!1){if(!qr(n,i))return!1;const h=n;let f=i;if(r&&!this.compareCoord(h[0],f[0])){const m=this.fixStartIndex(f,h);if(m)f=m;else return!1}const d=this.compareCoord(h[s],f[s]);return this.direction||d?this.comparePath(h,f):this.compareCoord(h[s],f[f.length-(1+s)])?this.comparePath(h.slice().reverse(),f):!1}fixStartIndex(n,i){let s,r=-1;for(let h=0;h<n.length;h++)if(this.compareCoord(n[h],i[0])){r=h;break}return r>=0&&(s=[].concat(n.slice(r,n.length),n.slice(1,r+1))),s}comparePath(n,i){return n.every((s,r)=>this.compareCoord(s,i[r]))}comparePolygon(n,i){if(this.compareLine(n.coordinates[0],i.coordinates[0],1,!0)){const s=n.coordinates.slice(1,n.coordinates.length),r=i.coordinates.slice(1,i.coordinates.length);return s.every(h=>r.some(f=>this.compareLine(h,f,1,!0)))}return!1}compareGeometryCollection(n,i){return qr(n.geometries,i.geometries)&&this.compareBBox(n,i)&&n.geometries.every((s,r)=>this.compare(s,i.geometries[r]))}compareFeature(n,i){return n.id===i.id&&(this.compareProperties?La(n.properties,i.properties):!0)&&this.compareBBox(n,i)&&this.compare(n.geometry,i.geometry)}compareFeatureCollection(n,i){return qr(n.features,i.features)&&this.compareBBox(n,i)&&n.features.every((s,r)=>this.compare(s,i.features[r]))}compareBBox(n,i){return!n.bbox&&!i.bbox||(n.bbox&&i.bbox?this.compareCoord(n.bbox,i.bbox):!1)}};Wn(Su,"GeojsonEquality");var Bd=Su;function qr(a,n){return a.coordinates?a.coordinates.length===n.coordinates.length:a.length===n.length}Wn(qr,"sameLength");function ka(a){return a.coordinates.map(n=>({type:a.type.replace("Multi",""),coordinates:n}))}Wn(ka,"explode");function Mu(a,n,i){return new Bd(i).compare(a,n)}Wn(Mu,"geojsonEquality");function La(a,n){if(a===null&&n===null)return!0;if(a===null||n===null)return!1;const i=Object.keys(a),s=Object.keys(n);if(i.length!==s.length)return!1;for(var r of i){const h=a[r],f=n[r],d=Au(h)&&Au(f);if(d&&!La(h,f)||!d&&h!==f)return!1}return!0}Wn(La,"equal");var Au=Wn(a=>a!=null&&typeof a=="object","isObject");function Ea(a,n,i={}){const s=bi(a),r=Je(n);for(let h=0;h<r.length-1;h++){let f=!1;if(i.ignoreEndVertices&&(h===0&&(f="start"),h===r.length-2&&(f="end"),h===0&&h+1===r.length-1&&(f="both")),zd(r[h],r[h+1],s,f,typeof i.epsilon=="undefined"?null:i.epsilon))return!0}return!1}function zd(a,n,i,s,r){const h=i[0],f=i[1],d=a[0],m=a[1],_=n[0],x=n[1],b=i[0]-d,E=i[1]-m,C=_-d,S=x-m,O=b*S-E*C;if(r!==null){if(Math.abs(O)>r)return!1}else if(O!==0)return!1;if(Math.abs(C)===Math.abs(S)&&Math.abs(C)===0)return s?!1:i[0]===a[0]&&i[1]===a[1];if(s){if(s==="start")return Math.abs(C)>=Math.abs(S)?C>0?d<h&&h<=_:_<=h&&h<d:S>0?m<f&&f<=x:x<=f&&f<m;if(s==="end")return Math.abs(C)>=Math.abs(S)?C>0?d<=h&&h<_:_<h&&h<=d:S>0?m<=f&&f<x:x<f&&f<=m;if(s==="both")return Math.abs(C)>=Math.abs(S)?C>0?d<h&&h<_:_<h&&h<d:S>0?m<f&&f<x:x<f&&f<m}else return Math.abs(C)>=Math.abs(S)?C>0?d<=h&&h<=_:_<=h&&h<=d:S>0?m<=f&&f<=x:x<=f&&f<=m;return!1}function Ta(a,n={}){var i=typeof n=="object"?n.mutate:n;if(!a)throw new Error("geojson is required");var s=Xo(a),r=[];switch(s){case"LineString":r=Ia(a,s);break;case"MultiLineString":case"Polygon":Je(a).forEach(function(f){r.push(Ia(f,s))});break;case"MultiPolygon":Je(a).forEach(function(f){var d=[];f.forEach(function(m){d.push(Ia(m,s))}),r.push(d)});break;case"Point":return a;case"MultiPoint":var h={};Je(a).forEach(function(f){var d=f.join("-");Object.prototype.hasOwnProperty.call(h,d)||(r.push(f),h[d]=!0)});break;default:throw new Error(s+" geometry not supported")}return a.coordinates?i===!0?(a.coordinates=r,a):{type:s,coordinates:r}:i===!0?(a.geometry.coordinates=r,a):Xe({type:s,coordinates:r},a.properties,{bbox:a.bbox,id:a.id})}function Ia(a,n){const i=Je(a);if(i.length===2&&!Pu(i[0],i[1]))return i;const s=[];let r=0,h=1,f=2;for(s.push(i[r]);f<i.length;)Ea(i[h],Pi([i[r],i[f]]))?h=f:(s.push(i[h]),r=h,h++,f=h),f++;if(s.push(i[h]),n==="Polygon"||n==="MultiPolygon"){if(Ea(s[0],Pi([s[1],s[s.length-2]]))&&(s.shift(),s.pop(),s.push(s[0])),s.length<4)throw new Error("invalid polygon, fewer than 4 points");if(!Pu(s[0],s[s.length-1]))throw new Error("invalid polygon, first and last points not equal")}return s}function Pu(a,n){return a[0]===n[0]&&a[1]===n[1]}function $o(a,n,i={}){let s=i.precision;if(s=s==null||isNaN(s)?6:s,typeof s!="number"||!(s>=0))throw new Error("precision must be a positive number");const r=Ni(a).type,h=Ni(n).type;return r!==h?!1:Mu(Ta(a),Ta(n),{precision:s})}function Fd(a,n){var i=Ni(a),s=Ni(n),r=i.type,h=s.type;switch(r){case"MultiPoint":switch(h){case"LineString":return Nu(i,s);case"Polygon":return Ru(i,s);default:throw new Error("feature2 "+h+" geometry not supported")}case"LineString":switch(h){case"MultiPoint":return Nu(s,i);case"LineString":return Gd(i,s);case"Polygon":return Ou(i,s);default:throw new Error("feature2 "+h+" geometry not supported")}case"Polygon":switch(h){case"MultiPoint":return Ru(s,i);case"LineString":return Ou(s,i);default:throw new Error("feature2 "+h+" geometry not supported")}default:throw new Error("feature1 "+r+" geometry not supported")}}function Nu(a,n){for(var i=!1,s=!1,r=a.coordinates.length,h=0;h<r&&(!i||!s);h++){for(var f=!1,d=0;d<n.coordinates.length-1;d++){var m=!0;if((d===0||d===n.coordinates.length-2)&&(m=!1),Ud(n.coordinates[d],n.coordinates[d+1],a.coordinates[h],m)){f=!0;break}}f?i=!0:s=!0}return i&&s}function Gd(a,n){const i=Ki(a,n);if(i.features.length===0)return!1;for(const s of i.features)if(!$o(s,Ue(a.coordinates[0]))&&!$o(s,Ue(a.coordinates[a.coordinates.length-1]))&&!$o(s,Ue(n.coordinates[0]))&&!$o(s,Ue(n.coordinates[n.coordinates.length-1])))return!0;return!1}function Ou(a,n){const i=Ko(n);return Ki(a,i).features.length>0}function Ru(a,n){var i=!1,s=!1,r=a.coordinates.length;for(let h=0;h<r&&(!i||!s);h++)Xn(Ue(a.coordinates[h]),n)?i=!0:s=!0;return s&&i}function Ud(a,n,i,s){var r=i[0]-a[0],h=i[1]-a[1],f=n[0]-a[0],d=n[1]-a[1],m=r*d-h*f;return m!==0?!1:s?Math.abs(f)>=Math.abs(d)?f>0?a[0]<=i[0]&&i[0]<=n[0]:n[0]<=i[0]&&i[0]<=a[0]:d>0?a[1]<=i[1]&&i[1]<=n[1]:n[1]<=i[1]&&i[1]<=a[1]:Math.abs(f)>=Math.abs(d)?f>0?a[0]<i[0]&&i[0]<n[0]:n[0]<i[0]&&i[0]<a[0]:d>0?a[1]<i[1]&&i[1]<n[1]:n[1]<i[1]&&i[1]<a[1]}var qd=new Set(["Point","LineString","MultiLineString","MultiPoint","Polygon","MultiPolygon"]);function Du(a){if(!a.type)return!1;const n=Ni(a),i=n.type,s=n.coordinates;switch(i){case"Point":return s.length>1;case"MultiPoint":for(var r=0;r<s.length;r++)if(s[r].length<2)return!1;return!0;case"LineString":if(s.length<2)return!1;for(var r=0;r<s.length;r++)if(s[r].length<2)return!1;return!0;case"MultiLineString":if(s.length<1)return!1;for(var r=0;r<s.length;r++)if(s[r].length<2)return!1;return!0;case"Polygon":for(var r=0;r<n.coordinates.length;r++)if(s[r].length<4||!Bu(s[r])||zu(s[r])||r>0&&Ki(yn([s[0]]),yn([s[r]])).features.length>1)return!1;return!0;case"MultiPolygon":for(var r=0;r<n.coordinates.length;r++)for(var h=n.coordinates[r],f=0;f<h.length;f++)if(h[f].length<4||!Bu(h[f])||zu(h[f])||f===0&&!Zd(h,n.coordinates,r)||f>0&&Ki(yn([h[0]]),yn([h[f]])).features.length>1)return!1;return!0;case"GeometryCollection":return n.geometries?Array.isArray(n.geometries)&&n.geometries.length>0&&n.geometries.every(d=>qd.has(d.type)&&Du(d)):!1;default:return!1}}function Bu(a){return a[0][0]===a[a.length-1][0]&&a[0][1]===a[a.length-1][1]}function zu(a){for(var n=0;n<a.length-1;n++)for(var i=a[n],s=n+1;s<a.length-2;s++){var r=[a[s],a[s+1]];if(Ea(i,Pi(r)))return!0}return!1}function Zd(a,n,i){for(var s=yn(a),r=i+1;r<n.length;r++)if(!Md(s,yn(n[r]))&&Fd(s,Pi(n[r][0])))return!1;return!0}function Hd(a,n={}){const i=ji(a),s=(i[0]+i[2])/2,r=(i[1]+i[3])/2;return Ue([s,r],n.properties,n)}var ts={exports:{}},Yd=ts.exports,Fu;function Vd(){return Fu||(Fu=1,(function(a,n){(function(i,s){a.exports=s()})(Yd,(function(){function i(u,t){(t==null||t>u.length)&&(t=u.length);for(var e=0,l=Array(t);e<t;e++)l[e]=u[e];return l}function s(u,t,e){return t=x(t),(function(l,g){if(g&&(typeof g=="object"||typeof g=="function"))return g;if(g!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y})(l)})(u,E()?Reflect.construct(t,e||[],x(u).constructor):t.apply(u,e))}function r(u,t){if(!(u instanceof t))throw new TypeError("Cannot call a class as a function")}function h(u,t,e){if(E())return Reflect.construct.apply(null,arguments);var l=[null];l.push.apply(l,t);var g=new(u.bind.apply(u,l));return e&&C(g,e.prototype),g}function f(u,t){for(var e=0;e<t.length;e++){var l=t[e];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(u,N(l.key),l)}}function d(u,t,e){return t&&f(u.prototype,t),e&&f(u,e),Object.defineProperty(u,"prototype",{writable:!1}),u}function m(u,t){var e=typeof Symbol!="undefined"&&u[Symbol.iterator]||u["@@iterator"];if(!e){if(Array.isArray(u)||(e=G(u))||t){e&&(u=e);var l=0,g=function(){};return{s:g,n:function(){return l>=u.length?{done:!0}:{done:!1,value:u[l++]}},e:function(M){throw M},f:g}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
483
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var y,w=!0,T=!1;return{s:function(){e=e.call(u)},n:function(){var M=e.next();return w=M.done,M},e:function(M){T=!0,y=M},f:function(){try{w||e.return==null||e.return()}finally{if(T)throw y}}}}function _(){return _=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(u,t,e){var l=(function(y,w){for(;!{}.hasOwnProperty.call(y,w)&&(y=x(y))!==null;);return y})(u,t);if(l){var g=Object.getOwnPropertyDescriptor(l,t);return g.get?g.get.call(arguments.length<3?u:e):g.value}},_.apply(null,arguments)}function x(u){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(u)}function b(u,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(t&&t.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),t&&C(u,t)}function E(){try{var u=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(E=function(){return!!u})()}function C(u,t){return C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,l){return e.__proto__=l,e},C(u,t)}function S(u,t,e,l){var g=_(x(1&l?u.prototype:u),t,e);return 2&l&&typeof g=="function"?function(y){return g.apply(e,y)}:g}function O(u){return(function(t){if(Array.isArray(t))return i(t)})(u)||(function(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)})(u)||G(u)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
484
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function N(u){var t=(function(e,l){if(typeof e!="object"||!e)return e;var g=e[Symbol.toPrimitive];if(g!==void 0){var y=g.call(e,l);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)})(u,"string");return typeof t=="symbol"?t:t+""}function G(u,t){if(u){if(typeof u=="string")return i(u,t);var e={}.toString.call(u).slice(8,-1);return e==="Object"&&u.constructor&&(e=u.constructor.name),e==="Map"||e==="Set"?Array.from(u):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(u,t):void 0}}function D(u){var t=typeof Map=="function"?new Map:void 0;return D=function(e){if(e===null||!(function(g){try{return Function.toString.call(g).indexOf("[native code]")!==-1}catch{return typeof g=="function"}})(e))return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,l)}function l(){return h(e,arguments,x(this).constructor)}return l.prototype=Object.create(e.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),C(l,e)},D(u)}var U=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=u.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=u.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==u.JOIN_ROUND&&(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(t){this._joinStyle=t}},{key:"setSimplifyFactor",value:function(t){this._simplifyFactor=t<0?0:t}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(t){this._endCapStyle=t}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(t){this._mitreLimit=t}},{key:"setSingleSided",value:function(t){this._isSingleSided=t}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=u.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=u.CAP_ROUND,this._joinStyle=u.JOIN_ROUND,this._mitreLimit=u.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=u.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(l)}else if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3];this.setQuadrantSegments(g),this.setEndCapStyle(y),this.setJoinStyle(w),this.setMitreLimit(T)}}}},{key:"bufferDistanceError",value:function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)}}])})();U.CAP_ROUND=1,U.CAP_FLAT=2,U.CAP_SQUARE=3,U.JOIN_ROUND=1,U.JOIN_MITRE=2,U.JOIN_BEVEL=3,U.DEFAULT_QUADRANT_SEGMENTS=8,U.DEFAULT_MITRE_LIMIT=5,U.DEFAULT_SIMPLIFY_FACTOR=.01;var W=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({Exception:t})[0],l}return b(t,u),d(t,[{key:"toString",value:function(){return this.message}}])})(D(Error)),X=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({IllegalArgumentException:t})[0],l}return b(t,u),d(t)})(W),et=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u){}}])})();function ot(){}function I(){}function P(){}var R,F,q,H,j,B,Y,$,J=(function(){return d((function u(){r(this,u)}),null,[{key:"equalsWithTolerance",value:function(u,t,e){return Math.abs(u-t)<=e}}])})(),at=(function(){return d((function u(t,e){r(this,u),this.low=e||0,this.high=t||0}),null,[{key:"toBinaryString",value:function(u){var t,e="";for(t=2147483648;t>0;t>>>=1)e+=(u.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)e+=(u.low&t)===t?"1":"0";return e}}])})();function rt(){}function ht(){}rt.NaN=NaN,rt.isNaN=function(u){return Number.isNaN(u)},rt.isInfinite=function(u){return!Number.isFinite(u)},rt.MAX_VALUE=Number.MAX_VALUE,rt.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,rt.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(B=2146435072,Y=new Float64Array(1),$=new Int32Array(Y.buffer),rt.doubleToLongBits=function(u){Y[0]=u;var t=0|$[0],e=0|$[1];return(e&B)===B&&1048575&e&&t!==0&&(t=0,e=2146959360),new at(e,t)},rt.longBitsToDouble=function(u){return $[0]=u.low,$[1]=u.high,Y[0]}):(R=1023,F=Math.log2,q=Math.floor,H=Math.pow,j=(function(){for(var u=53;u>0;u--){var t=H(2,u)-1;if(q(F(t))+1===u)return t}return 0})(),rt.doubleToLongBits=function(u){var t,e,l,g,y,w,T,M,z;if(u<0||1/u===Number.NEGATIVE_INFINITY?(w=1<<31,u=-u):w=0,u===0)return new at(M=w,z=0);if(u===1/0)return new at(M=2146435072|w,z=0);if(u!=u)return new at(M=2146959360,z=0);if(g=0,z=0,(t=q(u))>1)if(t<=j)(g=q(F(t)))<=20?(z=0,M=t<<20-g&1048575):(z=t%(e=H(2,l=g-20))<<32-l,M=t/e&1048575);else for(l=t,z=0;(l=q(e=l/2))!==0;)g++,z>>>=1,z|=(1&M)<<31,M>>>=1,e!==l&&(M|=524288);if(T=g+R,y=t===0,t=u-t,g<52&&t!==0)for(l=0;;){if((e=2*t)>=1?(t=e-1,y?(T--,y=!1):(l<<=1,l|=1,g++)):(t=e,y?--T==0&&(g++,y=!1):(l<<=1,g++)),g===20)M|=l,l=0;else if(g===52){z|=l;break}if(e===1){g<20?M|=l<<20-g:g<52&&(z|=l<<52-g);break}}return M|=T<<20,new at(M|=w,z)},rt.longBitsToDouble=function(u){var t,e,l,g,y=u.high,w=u.low,T=y&1<<31?-1:1;for(l=((2146435072&y)>>20)-R,g=0,e=1<<19,t=1;t<=20;t++)y&e&&(g+=H(2,-t)),e>>>=1;for(e=1<<31,t=21;t<=52;t++)w&e&&(g+=H(2,-t)),e>>>=1;if(l===-1023){if(g===0)return 0*T;l=-1022}else{if(l===1024)return g===0?T/0:NaN;g+=1}return T*g*H(2,l)});var _t=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({RuntimeException:t})[0],l}return b(t,u),d(t)})(W),kt=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)_t.constructor_.call(this);else if(arguments.length===1){var e=arguments[0];_t.constructor_.call(this,e)}}}])})(_t),dt=(function(){function u(){r(this,u)}return d(u,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)u.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new kt("Should never reach here"+(t!==null?": "+t:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var t=arguments[0];u.isTrue(t,null)}else if(arguments.length===2){var e=arguments[1];if(!arguments[0])throw e===null?new kt:new kt(e)}}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];u.equals(t,e,null)}else if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2];if(!g.equals(l))throw new kt("Expected "+l+" but encountered "+g+(y!==null?": "+y:""))}}}])})(),pt=new ArrayBuffer(8),vt=new Float64Array(pt),Yt=new Int32Array(pt),tt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getM",value:function(){return rt.NaN}},{key:"setOrdinate",value:function(t,e){switch(t){case u.X:this.x=e;break;case u.Y:this.y=e;break;case u.Z:this.setZ(e);break;default:throw new X("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var e=arguments[0],l=arguments[1];return!!J.equalsWithTolerance(this.x,e.x,l)&&!!J.equalsWithTolerance(this.y,e.y,l)}}},{key:"setM",value:function(t){throw new X("Invalid ordinate index: "+u.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case u.X:return this.x;case u.Y:return this.y;case u.Z:return this.getZ()}throw new X("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||rt.isNaN(this.getZ())&&rt.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof u&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return J.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(t){this.z=t}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return dt.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(t){var e=this.x-t.x,l=this.y-t.y,g=this.getZ()-t.getZ();return Math.sqrt(e*e+l*l+g*g)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){this.y=t}},{key:"distance",value:function(t){var e=this.x-t.x,l=this.y-t.y;return Math.sqrt(e*e+l*l)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*t+u.hashCode(this.x))+u.hashCode(this.y)}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}},{key:"interfaces_",get:function(){return[ot,I,P]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)u.constructor_.call(this,0,0);else if(arguments.length===1){var t=arguments[0];u.constructor_.call(this,t.x,t.y,t.getZ())}else if(arguments.length===2){var e=arguments[0],l=arguments[1];u.constructor_.call(this,e,l,u.NULL_ORDINATE)}else if(arguments.length===3){var g=arguments[0],y=arguments[1],w=arguments[2];this.x=g,this.y=y,this.z=w}}},{key:"hashCode",value:function(t){return vt[0]=t,Yt[0]^Yt[1]}}])})(),en=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"compare",value:function(t,e){var l=u.compare(t.x,e.x);if(l!==0)return l;var g=u.compare(t.y,e.y);return g!==0?g:this._dimensionsToTest<=2?0:u.compare(t.getZ(),e.getZ())}},{key:"interfaces_",get:function(){return[ht]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)u.constructor_.call(this,2);else if(arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new X("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return t<e?-1:t>e?1:rt.isNaN(t)?rt.isNaN(e)?0:-1:rt.isNaN(e)?1:0}}])})();tt.DimensionalComparator=en,tt.NULL_ORDINATE=rt.NaN,tt.X=0,tt.Y=1,tt.Z=2,tt.M=3;var qt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){if(!(t instanceof u))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new u;var e=this._minx>t._minx?this._minx:t._minx,l=this._miny>t._miny?this._miny:t._miny;return new u(e,this._maxx<t._maxx?this._maxx:t._maxx,l,this._maxy<t._maxy?this._maxy:t._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof u){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];return!this.isNull()&&l>=this._minx&&l<=this._maxx&&g>=this._miny&&g<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof tt){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var l=arguments[0],g=arguments[1];return!this.isNull()&&!((l.x<g.x?l.x:g.x)>this._maxx)&&!((l.x>g.x?l.x:g.x)<this._minx)&&!((l.y<g.y?l.y:g.y)>this._maxy)&&!((l.y>g.y?l.y:g.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var y=arguments[0],w=arguments[1];return!this.isNull()&&!(y>this._maxx||y<this._minx||w>this._maxy||w<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof u){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.isNull()?(this._minx=l,this._maxx=l,this._miny=g,this._maxy=g):(l<this._minx&&(this._minx=l),l>this._maxx&&(this._maxx=l),g<this._miny&&(this._miny=g),g>this._maxy&&(this._maxy=g))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0}},{key:"translate",value:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e}},{key:"expandBy",value:function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=l,this._maxy+=l,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof tt){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];return this.covers(l,g)}}},{key:"centre",value:function(){return this.isNull()?null:new tt((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof u){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.init(l.x,g.x,l.y,g.y)}else if(arguments.length===4){var y=arguments[0],w=arguments[1],T=arguments[2],M=arguments[3];y<w?(this._minx=y,this._maxx=w):(this._minx=w,this._maxx=y),T<M?(this._miny=T,this._maxy=M):(this._miny=M,this._maxy=T)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var l=0;return this._maxy<t._miny?l=t._miny-this._maxy:this._miny>t._maxy&&(l=this._miny-t._maxy),e===0?l:l===0?e:Math.sqrt(e*e+l*l)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+tt.hashCode(this._minx))+tt.hashCode(this._maxx))+tt.hashCode(this._miny))+tt.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[ot,P]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof u){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.init(l.x,g.x,l.y,g.y)}else if(arguments.length===4){var y=arguments[0],w=arguments[1],T=arguments[2],M=arguments[3];this.init(y,w,T,M)}}},{key:"intersects",value:function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],l=arguments[2];return l.x>=(t.x<e.x?t.x:e.x)&&l.x<=(t.x>e.x?t.x:e.x)&&l.y>=(t.y<e.y?t.y:e.y)&&l.y<=(t.y>e.y?t.y:e.y)}if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],M=Math.min(w.x,T.x),z=Math.max(w.x,T.x),K=Math.min(g.x,y.x),it=Math.max(g.x,y.x);return!(K>z)&&!(it<M)&&(M=Math.min(w.y,T.y),z=Math.max(w.y,T.y),K=Math.min(g.y,y.y),it=Math.max(g.y,y.y),!(K>z)&&!(it<M))}}}])})(),mt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(t){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(t){return this===t||this.equalsExact(t,0)}},{key:"geometryChanged",value:function(){this.apply(u.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(t){return t!==null&&this.norm().equalsExact(t.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var t;if(arguments.length===1){var e=arguments[0];return t=e,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e)}if(arguments.length===2){var l=arguments[0],g=arguments[1];return t=l,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(l,g)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(t){if(t.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION)throw new X("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(t,e,l){return l===0?t.equals(e):t.distance(e)<=l}},{key:"norm",value:function(){var t=this.copy();return t.normalize(),t}},{key:"reverse",value:function(){var t=this.reverseInternal();return this.envelope!=null&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}},{key:"copy",value:function(){var t=this.copyInternal();return t.envelope=this._envelope==null?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new qt(this._envelope)}},{key:"setSRID",value:function(t){this._SRID=t}},{key:"setUserData",value:function(t){this._userData=t}},{key:"compare",value:function(t,e){for(var l=t.iterator(),g=e.iterator();l.hasNext()&&g.hasNext();){var y=l.next(),w=g.next(),T=y.compareTo(w);if(T!==0)return T}return l.hasNext()?1:g.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(t){return this.getClass()===t.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===u.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===u.TYPECODE_MULTIPOINT||this.getTypeCode()===u.TYPECODE_MULTILINESTRING||this.getTypeCode()===u.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[I,ot,P]}},{key:"getClass",value:function(){return u}}],[{key:"hasNonEmptyElements",value:function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1}}])})();mt.constructor_=function(u){u&&(this._envelope=null,this._userData=null,this._factory=u,this._SRID=u.getSRID())},mt.TYPECODE_POINT=0,mt.TYPECODE_MULTIPOINT=1,mt.TYPECODE_LINESTRING=2,mt.TYPECODE_LINEARRING=3,mt.TYPECODE_MULTILINESTRING=4,mt.TYPECODE_POLYGON=5,mt.TYPECODE_MULTIPOLYGON=6,mt.TYPECODE_GEOMETRYCOLLECTION=7,mt.TYPENAME_POINT="Point",mt.TYPENAME_MULTIPOINT="MultiPoint",mt.TYPENAME_LINESTRING="LineString",mt.TYPENAME_LINEARRING="LinearRing",mt.TYPENAME_MULTILINESTRING="MultiLineString",mt.TYPENAME_POLYGON="Polygon",mt.TYPENAME_MULTIPOLYGON="MultiPolygon",mt.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",mt.geometryChangedFilter={get interfaces_(){return[et]},filter:function(u){u.geometryChangedAction()}};var Z=(function(){function u(){r(this,u)}return d(u,null,[{key:"toLocationSymbol",value:function(t){switch(t){case u.EXTERIOR:return"e";case u.BOUNDARY:return"b";case u.INTERIOR:return"i";case u.NONE:return"-"}throw new X("Unknown location value: "+t)}}])})();Z.INTERIOR=0,Z.BOUNDARY=1,Z.EXTERIOR=2,Z.NONE=-1;var Wt=(function(){return d((function u(){r(this,u)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),oe=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({NoSuchElementException:t})[0],l}return b(t,u),d(t)})(W),Ut=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({UnsupportedOperationException:t})[0],l}return b(t,u),d(t)})(W),eo=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t,[{key:"contains",value:function(){}}])})(Wt),bn=(function(u){function t(e){var l;return r(this,t),(l=s(this,t)).map=new Map,e instanceof Wt&&l.addAll(e),l}return b(t,u),d(t,[{key:"contains",value:function(e){var l=e.hashCode?e.hashCode():e;return!!this.map.has(l)}},{key:"add",value:function(e){var l=e.hashCode?e.hashCode():e;return!this.map.has(l)&&!!this.map.set(l,e)}},{key:"addAll",value:function(e){var l,g=m(e);try{for(g.s();!(l=g.n()).done;){var y=l.value;this.add(y)}}catch(w){g.e(w)}finally{g.f()}return!0}},{key:"remove",value:function(){throw new Ut}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new nr(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(eo),nr=(function(){return d((function u(t){r(this,u),this.iterator=t.values();var e=this.iterator.next(),l=e.done,g=e.value;this.done=l,this.value=g}),[{key:"next",value:function(){if(this.done)throw new oe;var u=this.value,t=this.iterator.next(),e=t.done,l=t.value;return this.done=e,this.value=l,u}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new Ut}}])})(),ct=(function(){function u(){r(this,u)}return d(u,null,[{key:"opposite",value:function(t){return t===u.LEFT?u.RIGHT:t===u.RIGHT?u.LEFT:t}}])})();ct.ON=0,ct.LEFT=1,ct.RIGHT=2;var io=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({EmptyStackException:t})[0],l}return b(t,u),d(t)})(W),rr=(function(u){function t(e){var l;return r(this,t),(l=s(this,t,[e])).name=Object.keys({IndexOutOfBoundsException:t})[0],l}return b(t,u),d(t)})(W),ki=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})(Wt),Es=(function(u){function t(){var e;return r(this,t),(e=s(this,t)).array=[],e}return b(t,u),d(t,[{key:"add",value:function(e){return this.array.push(e),!0}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new rr;return this.array[e]}},{key:"push",value:function(e){return this.array.push(e),e}},{key:"pop",value:function(){if(this.array.length===0)throw new io;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new io;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(e){return this.array.indexOf(e)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(ki);function St(u,t){return u.interfaces_&&u.interfaces_.indexOf(t)>-1}var xn=(function(){return d((function u(t){r(this,u),this.str=t}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,t){this.str=this.str.substr(0,u)+t+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),nn=(function(){function u(t){r(this,u),this.value=t}return d(u,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(t){return this.value<t?-1:this.value>t?1:0}}],[{key:"compare",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"isNan",value:function(t){return Number.isNaN(t)}},{key:"valueOf",value:function(t){return new u(t)}}])})(),or=(function(){return d((function u(){r(this,u)}),null,[{key:"isWhitespace",value:function(u){return u<=32&&u>=0||u===127}},{key:"toUpperCase",value:function(u){return u.toUpperCase()}}])})(),Et=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"le",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}},{key:"extractSignificantDigits",value:function(t,e){var l=this.abs(),g=u.magnitude(l._hi),y=u.TEN.pow(g);(l=l.divide(y)).gt(u.TEN)?(l=l.divide(u.TEN),g+=1):l.lt(u.ONE)&&(l=l.multiply(u.TEN),g-=1);for(var w=g+1,T=new xn,M=u.MAX_PRINT_DIGITS-1,z=0;z<=M;z++){t&&z===w&&T.append(".");var K=Math.trunc(l._hi);if(K<0)break;var it=!1,lt=0;K>9?(it=!0,lt="9"):lt="0"+K,T.append(lt),l=l.subtract(u.valueOf(K)).multiply(u.TEN),it&&l.selfAdd(u.TEN);var gt=!0,bt=u.magnitude(l._hi);if(bt<0&&Math.abs(bt)>=M-z&&(gt=!1),!gt)break}return e[0]=g,T.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof u){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(t){return this.le(t)?this:t}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var l,g,y,w,T=arguments[0],M=arguments[1],z=null,K=null,it=null,lt=null;return y=this._hi/T,lt=(z=(it=u.SPLIT*y)-(z=it-y))*(K=(lt=u.SPLIT*T)-(K=lt-T))-(w=y*T)+z*(g=T-K)+(l=y-z)*K+l*g,lt=y+(it=(this._hi-w-lt+this._lo-y*M)/T),this._hi=lt,this._lo=y-lt+it,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof u){var t,e,l,g,y=arguments[0],w=null,T=null,M=null,z=null;return t=(l=this._hi/y._hi)-(w=(M=u.SPLIT*l)-(w=M-l)),z=w*(T=(z=u.SPLIT*y._hi)-(T=z-y._hi))-(g=l*y._hi)+w*(e=y._hi-T)+t*T+t*e,new u(z=l+(M=(this._hi-g-z+this._lo-l*y._lo)/y._hi),l-z+M)}if(typeof arguments[0]=="number"){var K=arguments[0];return rt.isNaN(K)?u.createNaN():u.copy(this).selfDivide(K,0)}}},{key:"ge",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}},{key:"pow",value:function(t){if(t===0)return u.valueOf(1);var e=new u(this),l=u.valueOf(1),g=Math.abs(t);if(g>1)for(;g>0;)g%2==1&&l.selfMultiply(e),(g/=2)>0&&(e=e.sqr());else l=e;return t<0?l.reciprocal():l}},{key:"ceil",value:function(){if(this.isNaN())return u.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new u(t,e)}},{key:"compareTo",value:function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return u.valueOf(0);if(this.isNegative())return u.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,l=u.valueOf(e),g=this.subtract(l.sqr())._hi*(.5*t);return l.add(g)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e,l,g,y,w,T=arguments[0],M=null;return M=(g=this._hi+T)-(y=g-this._hi),l=(w=(M=T-y+(this._hi-M))+this._lo)+(g-(e=g+w)),this._hi=e+l,this._lo=l+(e-this._hi),this}}else if(arguments.length===2){var z,K,it,lt,gt=arguments[0],bt=arguments[1],wt=null,zt=null,Ot=null;it=this._hi+gt,K=this._lo+bt,zt=it-(Ot=it-this._hi),wt=K-(lt=K-this._lo);var Jt=(z=it+(Ot=(zt=gt-Ot+(this._hi-zt))+K))+(Ot=(wt=bt-lt+(this._lo-wt))+(Ot+(it-z))),ee=Ot+(z-Jt);return this._hi=Jt,this._lo=ee,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof u){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var l,g,y=arguments[0],w=arguments[1],T=null,M=null,z=null,K=null;T=(z=u.SPLIT*this._hi)-this._hi,K=u.SPLIT*y,T=z-T,l=this._hi-T,M=K-y;var it=(z=this._hi*y)+(K=T*(M=K-M)-z+T*(g=y-M)+l*M+l*g+(this._hi*w+this._lo*y)),lt=K+(T=z-it);return this._hi=it,this._lo=lt,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return u.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new u(t,e)}},{key:"negate",value:function(){return this.isNaN()?this:new u(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}},{key:"multiply",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return t.isNaN()?u.createNaN():u.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return rt.isNaN(e)?u.createNaN():u.copy(this).selfMultiply(e,0)}}},{key:"isNaN",value:function(){return rt.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=u.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),l=this.extractSignificantDigits(!0,e),g=e[0]+1,y=l;if(l.charAt(0)===".")y="0"+l;else if(g<0)y="0."+u.stringOfChar("0",-g)+l;else if(l.indexOf(".")===-1){var w=g-l.length;y=l+u.stringOfChar("0",w)+".0"}return this.isNegative()?"-"+y:y}},{key:"reciprocal",value:function(){var t,e,l,g,y=null,w=null,T=null,M=null;t=(l=1/this._hi)-(y=(T=u.SPLIT*l)-(y=T-l)),w=(M=u.SPLIT*this._hi)-this._hi;var z=l+(T=(1-(g=l*this._hi)-(M=y*(w=M-w)-g+y*(e=this._hi-w)+t*w+t*e)-l*this._lo)/this._hi);return new u(z,l-z+T)}},{key:"toSciNotation",value:function(){if(this.isZero())return u.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),l=this.extractSignificantDigits(!1,e),g=u.SCI_NOT_EXPONENT_CHAR+e[0];if(l.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+l);var y="";l.length>1&&(y=l.substring(1));var w=l.charAt(0)+"."+y;return this.isNegative()?"-"+w+g:w+g}},{key:"abs",value:function(){return this.isNaN()?u.NaN:this.isNegative()?this.negate():new u(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}},{key:"add",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return u.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return u.copy(this).selfAdd(e)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof u){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this._hi=l,this._lo=g}}},{key:"gt",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?u.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[P,ot,I]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof u){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var l=arguments[0];u.constructor_.call(this,u.parse(l))}}else if(arguments.length===2){var g=arguments[0],y=arguments[1];this.init(g,y)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],l=arguments[2],g=arguments[3];return u.determinant(u.valueOf(t),u.valueOf(e),u.valueOf(l),u.valueOf(g))}if(arguments[3]instanceof u&&arguments[2]instanceof u&&arguments[0]instanceof u&&arguments[1]instanceof u){var y=arguments[1],w=arguments[2],T=arguments[3];return arguments[0].multiply(T).selfSubtract(y.multiply(w))}}},{key:"sqr",value:function(t){return u.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var t=arguments[0];return u.parse(t)}if(typeof arguments[0]=="number")return new u(arguments[0])}},{key:"sqrt",value:function(t){return u.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var e=0,l=t.length;or.isWhitespace(t.charAt(e));)e++;var g=!1;if(e<l){var y=t.charAt(e);y!=="-"&&y!=="+"||(e++,y==="-"&&(g=!0))}for(var w=new u,T=0,M=0,z=0,K=!1;!(e>=l);){var it=t.charAt(e);if(e++,or.isDigit(it)){var lt=it-"0";w.selfMultiply(u.TEN),w.selfAdd(lt),T++}else{if(it!=="."){if(it==="e"||it==="E"){var gt=t.substring(e);try{z=nn.parseInt(gt)}catch(Jt){throw Jt instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+gt+" in string "+t):Jt}break}throw new NumberFormatException("Unexpected character '"+it+"' at position "+e+" in string "+t)}M=T,K=!0}}var bt=w;K||(M=T);var wt=T-M-z;if(wt===0)bt=w;else if(wt>0){var zt=u.TEN.pow(wt);bt=w.divide(zt)}else if(wt<0){var Ot=u.TEN.pow(-wt);bt=w.multiply(Ot)}return g?bt.negate():bt}},{key:"createNaN",value:function(){return new u(rt.NaN,rt.NaN)}},{key:"copy",value:function(t){return new u(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),l=Math.log(e)/Math.log(10),g=Math.trunc(Math.floor(l));return 10*Math.pow(10,g)<=e&&(g+=1),g}},{key:"stringOfChar",value:function(t,e){for(var l=new xn,g=0;g<e;g++)l.append(t);return l.toString()}}])})();Et.PI=new Et(3.141592653589793,12246467991473532e-32),Et.TWO_PI=new Et(6.283185307179586,24492935982947064e-32),Et.PI_2=new Et(1.5707963267948966,6123233995736766e-32),Et.E=new Et(2.718281828459045,14456468917292502e-32),Et.NaN=new Et(rt.NaN,rt.NaN),Et.EPS=123259516440783e-46,Et.SPLIT=134217729,Et.MAX_PRINT_DIGITS=32,Et.TEN=Et.valueOf(10),Et.ONE=Et.valueOf(1),Et.SCI_NOT_EXPONENT_CHAR="E",Et.SCI_NOT_ZERO="0.0E0";var no=(function(){function u(){r(this,u)}return d(u,null,[{key:"orientationIndex",value:function(t,e,l){var g=u.orientationIndexFilter(t,e,l);if(g<=1)return g;var y=Et.valueOf(e.x).selfAdd(-t.x),w=Et.valueOf(e.y).selfAdd(-t.y),T=Et.valueOf(l.x).selfAdd(-e.x),M=Et.valueOf(l.y).selfAdd(-e.y);return y.selfMultiply(M).selfSubtract(w.selfMultiply(T)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof Et&&arguments[2]instanceof Et&&arguments[0]instanceof Et&&arguments[1]instanceof Et){var t=arguments[1],e=arguments[2],l=arguments[3];return arguments[0].multiply(l).selfSubtract(t.multiply(e)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],M=Et.valueOf(g),z=Et.valueOf(y),K=Et.valueOf(w),it=Et.valueOf(T);return M.multiply(it).selfSubtract(z.multiply(K)).signum()}}},{key:"intersection",value:function(t,e,l,g){var y=new Et(t.y).selfSubtract(e.y),w=new Et(e.x).selfSubtract(t.x),T=new Et(t.x).selfMultiply(e.y).selfSubtract(new Et(e.x).selfMultiply(t.y)),M=new Et(l.y).selfSubtract(g.y),z=new Et(g.x).selfSubtract(l.x),K=new Et(l.x).selfMultiply(g.y).selfSubtract(new Et(g.x).selfMultiply(l.y)),it=w.multiply(K).selfSubtract(z.multiply(T)),lt=M.multiply(T).selfSubtract(y.multiply(K)),gt=y.multiply(z).selfSubtract(M.multiply(w)),bt=it.selfDivide(gt).doubleValue(),wt=lt.selfDivide(gt).doubleValue();return rt.isNaN(bt)||rt.isInfinite(bt)||rt.isNaN(wt)||rt.isInfinite(wt)?null:new tt(bt,wt)}},{key:"orientationIndexFilter",value:function(t,e,l){var g=null,y=(t.x-l.x)*(e.y-l.y),w=(t.y-l.y)*(e.x-l.x),T=y-w;if(y>0){if(w<=0)return u.signum(T);g=y+w}else{if(!(y<0)||w>=0)return u.signum(T);g=-y-w}var M=u.DP_SAFE_EPSILON*g;return T>=M||-T>=M?u.signum(T):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}])})();no.DP_SAFE_EPSILON=1e-15;var Dt=(function(){return d((function u(){r(this,u)}),[{key:"getM",value:function(u){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(u,t)}return rt.NaN}},{key:"setOrdinate",value:function(u,t,e){}},{key:"getZ",value:function(u){return this.hasZ()?this.getOrdinate(u,2):rt.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(u,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(u){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(u){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(u){}},{key:"copy",value:function(){}},{key:"getY",value:function(u){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[I]}}])})();Dt.X=0,Dt.Y=1,Dt.Z=2,Dt.M=3;var Tt=(function(){function u(){r(this,u)}return d(u,null,[{key:"index",value:function(t,e,l){return no.orientationIndex(t,e,l)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],e=t.length-1;if(e<3)throw new X("Ring has fewer than 4 points, so orientation cannot be determined");for(var l=t[0],g=0,y=1;y<=e;y++){var w=t[y];w.y>l.y&&(l=w,g=y)}var T=g;do(T-=1)<0&&(T=e);while(t[T].equals2D(l)&&T!==g);var M=g;do M=(M+1)%e;while(t[M].equals2D(l)&&M!==g);var z=t[T],K=t[M];if(z.equals2D(l)||K.equals2D(l)||z.equals2D(K))return!1;var it=u.index(z,l,K);return it===0?z.x>K.x:it>0}if(St(arguments[0],Dt)){var lt=arguments[0],gt=lt.size()-1;if(gt<3)throw new X("Ring has fewer than 4 points, so orientation cannot be determined");for(var bt=lt.getCoordinate(0),wt=0,zt=1;zt<=gt;zt++){var Ot=lt.getCoordinate(zt);Ot.y>bt.y&&(bt=Ot,wt=zt)}var Jt=null,ee=wt;do(ee-=1)<0&&(ee=gt),Jt=lt.getCoordinate(ee);while(Jt.equals2D(bt)&&ee!==wt);var de=null,Ai=wt;do Ai=(Ai+1)%gt,de=lt.getCoordinate(Ai);while(de.equals2D(bt)&&Ai!==wt);if(Jt.equals2D(bt)||de.equals2D(bt)||Jt.equals2D(de))return!1;var Dn=u.index(Jt,bt,de);return Dn===0?Jt.x>de.x:Dn>0}}}])})();Tt.CLOCKWISE=-1,Tt.RIGHT=Tt.CLOCKWISE,Tt.COUNTERCLOCKWISE=1,Tt.LEFT=Tt.COUNTERCLOCKWISE,Tt.COLLINEAR=0,Tt.STRAIGHT=Tt.COLLINEAR;var al=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(u,t){var e=this.getRightmostSideOfSegment(u,t);return e<0&&(e=this.getRightmostSideOfSegment(u,t-1)),e<0&&(this._minCoord=null,this.checkForRightmostCoordinate(u)),e}},{key:"findRightmostEdgeAtVertex",value:function(){var u=this._minDe.getEdge().getCoordinates();dt.isTrue(this._minIndex>0&&this._minIndex<u.length,"rightmost point expected to be interior vertex of edge");var t=u[this._minIndex-1],e=u[this._minIndex+1],l=Tt.index(this._minCoord,e,t),g=!1;(t.y<this._minCoord.y&&e.y<this._minCoord.y&&l===Tt.COUNTERCLOCKWISE||t.y>this._minCoord.y&&e.y>this._minCoord.y&&l===Tt.CLOCKWISE)&&(g=!0),g&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(u,t){var e=u.getEdge().getCoordinates();if(t<0||t+1>=e.length||e[t].y===e[t+1].y)return-1;var l=ct.LEFT;return e[t].y<e[t+1].y&&(l=ct.RIGHT),l}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(u){for(var t=u.getEdge().getCoordinates(),e=0;e<t.length-1;e++)(this._minCoord===null||t[e].x>this._minCoord.x)&&(this._minDe=u,this._minIndex=e,this._minCoord=t[e])}},{key:"findRightmostEdgeAtNode",value:function(){var u=this._minDe.getNode().getEdges();this._minDe=u.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(u){for(var t=u.iterator();t.hasNext();){var e=t.next();e.isForward()&&this.checkForRightmostCoordinate(e)}dt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===ct.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),ti=(function(u){function t(e,l){var g;return r(this,t),(g=s(this,t,[l?e+" [ "+l+" ]":e])).pt=l?new tt(l):void 0,g.name=Object.keys({TopologyException:t})[0],g}return b(t,u),d(t,[{key:"getCoordinate",value:function(){return this.pt}}])})(_t),ro=(function(){return d((function u(){r(this,u),this.array=[]}),[{key:"addLast",value:function(u){this.array.push(u)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),Lt=(function(u){function t(e){var l;return r(this,t),(l=s(this,t)).array=[],e instanceof Wt&&l.addAll(e),l}return b(t,u),d(t,[{key:"interfaces_",get:function(){return[ki,Wt]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(e){return arguments.length===1?this.array.push(e):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(e){var l,g=m(e);try{for(g.s();!(l=g.n()).done;){var y=l.value;this.array.push(y)}}catch(w){g.e(w)}finally{g.f()}}},{key:"set",value:function(e,l){var g=this.array[e];return this.array[e]=l,g}},{key:"iterator",value:function(){return new ll(this)}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new rr;return this.array[e]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(e){e?this.array.sort((function(l,g){return e.compare(l,g)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(e){for(var l=0,g=this.array.length;l<g;l++)if(this.array[l]===e)return!!this.array.splice(l,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(ki),ll=(function(){return d((function u(t){r(this,u),this.arrayList=t,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new oe;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(u){return this.arrayList.set(this.position-1,u)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),wn=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();)u.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(u){for(var t=null,e=u.getEdges().iterator();e.hasNext();){var l=e.next();if(l.isVisited()||l.getSym().isVisited()){t=l;break}}if(t===null)throw new ti("unable to find edge to compute depths at "+u.getCoordinate());u.getEdges().computeDepths(t);for(var g=u.getEdges().iterator();g.hasNext();){var y=g.next();y.setVisited(!0),this.copySymDepths(y)}}},{key:"computeDepth",value:function(u){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(ct.RIGHT,u),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(u){this.addReachable(u),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var u=this._dirEdgeList.iterator();u.hasNext();){var t=u.next();t.getDepth(ct.RIGHT)>=1&&t.getDepth(ct.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(u){var t=new bn,e=new ro,l=u.getNode();for(e.addLast(l),t.add(l),u.setVisited(!0);!e.isEmpty();){var g=e.removeFirst();t.add(g),this.computeNodeDepth(g);for(var y=g.getEdges().iterator();y.hasNext();){var w=y.next().getSym();if(!w.isVisited()){var T=w.getNode();t.contains(T)||(e.addLast(T),t.add(T))}}}}},{key:"compareTo",value:function(u){var t=u;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var u=new qt,t=this._dirEdgeList.iterator();t.hasNext();)for(var e=t.next().getEdge().getCoordinates(),l=0;l<e.length-1;l++)u.expandToInclude(e[l]);this._env=u}return this._env}},{key:"addReachable",value:function(u){var t=new Es;for(t.add(u);!t.empty();){var e=t.pop();this.add(e,t)}}},{key:"copySymDepths",value:function(u){var t=u.getSym();t.setDepth(ct.LEFT,u.getDepth(ct.RIGHT)),t.setDepth(ct.RIGHT,u.getDepth(ct.LEFT))}},{key:"add",value:function(u,t){u.setVisited(!0),this._nodes.add(u);for(var e=u.getEdges().iterator();e.hasNext();){var l=e.next();this._dirEdgeList.add(l);var g=l.getSym().getNode();g.isVisited()||t.push(g)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new Lt,this._nodes=new Lt,this._rightMostCoord=null,this._env=null,this._finder=new al}}])})(),oo=(function(){return d((function u(){r(this,u)}),null,[{key:"intersection",value:function(u,t,e,l){var g=u.x<t.x?u.x:t.x,y=u.y<t.y?u.y:t.y,w=u.x>t.x?u.x:t.x,T=u.y>t.y?u.y:t.y,M=e.x<l.x?e.x:l.x,z=e.y<l.y?e.y:l.y,K=e.x>l.x?e.x:l.x,it=e.y>l.y?e.y:l.y,lt=((g>M?g:M)+(w<K?w:K))/2,gt=((y>z?y:z)+(T<it?T:it))/2,bt=u.x-lt,wt=u.y-gt,zt=t.x-lt,Ot=t.y-gt,Jt=e.x-lt,ee=e.y-gt,de=l.x-lt,Ai=l.y-gt,Dn=wt-Ot,ui=zt-bt,Po=bt*Ot-zt*wt,No=ee-Ai,gn=de-Jt,Hs=Jt*Ai-de*ee,Bn=Dn*gn-No*ui,Vi=(ui*Hs-gn*Po)/Bn,Ir=(No*Po-Dn*Hs)/Bn;return rt.isNaN(Vi)||rt.isInfinite(Vi)||rt.isNaN(Ir)||rt.isInfinite(Ir)?null:new tt(Vi+lt,Ir+gt)}}])})(),Be=(function(){return d((function u(){r(this,u)}),null,[{key:"arraycopy",value:function(u,t,e,l,g){for(var y=0,w=t;w<t+g;w++)e[l+y]=u[w],y++}},{key:"getProperty",value:function(u){return{"line.separator":`
|
|
485
|
+
`}[u]}}])})(),rn=(function(){function u(){r(this,u)}return d(u,null,[{key:"log10",value:function(t){var e=Math.log(t);return rt.isInfinite(e)||rt.isNaN(e)?e:e/u.LOG_10}},{key:"min",value:function(t,e,l,g){var y=t;return e<y&&(y=e),l<y&&(y=l),g<y&&(y=g),y}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],l=arguments[2];return t<e?e:t>l?l:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var g=arguments[0],y=arguments[1],w=arguments[2];return g<y?y:g>w?w:g}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(arguments.length===3){var t=arguments[1],e=arguments[2],l=arguments[0];return t>l&&(l=t),e>l&&(l=e),l}if(arguments.length===4){var g=arguments[1],y=arguments[2],w=arguments[3],T=arguments[0];return g>T&&(T=g),y>T&&(T=y),w>T&&(T=w),T}}},{key:"average",value:function(t,e){return(t+e)/2}}])})();rn.LOG_10=Math.log(10);var Ze=(function(){function u(){r(this,u)}return d(u,null,[{key:"segmentToSegment",value:function(t,e,l,g){if(t.equals(e))return u.pointToSegment(t,l,g);if(l.equals(g))return u.pointToSegment(g,t,e);var y=!1;if(qt.intersects(t,e,l,g)){var w=(e.x-t.x)*(g.y-l.y)-(e.y-t.y)*(g.x-l.x);if(w===0)y=!0;else{var T=(t.y-l.y)*(g.x-l.x)-(t.x-l.x)*(g.y-l.y),M=((t.y-l.y)*(e.x-t.x)-(t.x-l.x)*(e.y-t.y))/w,z=T/w;(z<0||z>1||M<0||M>1)&&(y=!0)}}else y=!0;return y?rn.min(u.pointToSegment(t,l,g),u.pointToSegment(e,l,g),u.pointToSegment(l,t,e),u.pointToSegment(g,t,e)):0}},{key:"pointToSegment",value:function(t,e,l){if(e.x===l.x&&e.y===l.y)return t.distance(e);var g=(l.x-e.x)*(l.x-e.x)+(l.y-e.y)*(l.y-e.y),y=((t.x-e.x)*(l.x-e.x)+(t.y-e.y)*(l.y-e.y))/g;if(y<=0)return t.distance(e);if(y>=1)return t.distance(l);var w=((e.y-t.y)*(l.x-e.x)-(e.x-t.x)*(l.y-e.y))/g;return Math.abs(w)*Math.sqrt(g)}},{key:"pointToLinePerpendicular",value:function(t,e,l){var g=(l.x-e.x)*(l.x-e.x)+(l.y-e.y)*(l.y-e.y),y=((e.y-t.y)*(l.x-e.x)-(e.x-t.x)*(l.y-e.y))/g;return Math.abs(y)*Math.sqrt(g)}},{key:"pointToSegmentString",value:function(t,e){if(e.length===0)throw new X("Line array must contain at least one vertex");for(var l=t.distance(e[0]),g=0;g<e.length-1;g++){var y=u.pointToSegment(t,e[g],e[g+1]);y<l&&(l=y)}return l}}])})(),so=(function(){return d((function u(){r(this,u)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||St(arguments[0],Dt);else if(arguments.length!==2){if(arguments.length===3){var u=arguments[0],t=arguments[1];return this.create(u,t)}}}}])})(),sr=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u){}}])})(),ul=(function(){return d((function u(){r(this,u)}),null,[{key:"ofLine",value:function(u){var t=u.size();if(t<=1)return 0;var e=0,l=new tt;u.getCoordinate(0,l);for(var g=l.x,y=l.y,w=1;w<t;w++){u.getCoordinate(w,l);var T=l.x,M=l.y,z=T-g,K=M-y;e+=Math.sqrt(z*z+K*K),g=T,y=M}return e}}])})(),Ts=d((function u(){r(this,u)})),Fi=(function(){function u(){r(this,u)}return d(u,null,[{key:"copyCoord",value:function(t,e,l,g){for(var y=Math.min(t.getDimension(),l.getDimension()),w=0;w<y;w++)l.setOrdinate(g,w,t.getOrdinate(e,w))}},{key:"isRing",value:function(t){var e=t.size();return e===0||!(e<=3)&&t.getOrdinate(0,Dt.X)===t.getOrdinate(e-1,Dt.X)&&t.getOrdinate(0,Dt.Y)===t.getOrdinate(e-1,Dt.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(St(arguments[0],Dt)&&Number.isInteger(arguments[1])){var t=arguments[0],e=arguments[1];u.scroll(t,e,u.isRing(t))}else if(St(arguments[0],Dt)&&arguments[1]instanceof tt){var l=arguments[0],g=arguments[1],y=u.indexOf(g,l);if(y<=0)return null;u.scroll(l,y)}}else if(arguments.length===3){var w=arguments[0],T=arguments[1],M=arguments[2];if(T<=0)return null;for(var z=w.copy(),K=M?w.size()-1:w.size(),it=0;it<K;it++)for(var lt=0;lt<w.getDimension();lt++)w.setOrdinate(it,lt,z.getOrdinate((T+it)%K,lt));if(M)for(var gt=0;gt<w.getDimension();gt++)w.setOrdinate(K,gt,w.getOrdinate(0,gt))}}},{key:"isEqual",value:function(t,e){var l=t.size();if(l!==e.size())return!1;for(var g=Math.min(t.getDimension(),e.getDimension()),y=0;y<l;y++)for(var w=0;w<g;w++){var T=t.getOrdinate(y,w),M=e.getOrdinate(y,w);if(t.getOrdinate(y,w)!==e.getOrdinate(y,w)&&(!rt.isNaN(T)||!rt.isNaN(M)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var t=arguments[0];return u.minCoordinateIndex(t,0,t.size()-1)}if(arguments.length===3){for(var e=arguments[0],l=arguments[2],g=-1,y=null,w=arguments[1];w<=l;w++){var T=e.getCoordinate(w);(y===null||y.compareTo(T)>0)&&(y=T,g=w)}return g}}},{key:"extend",value:function(t,e,l){var g=t.create(l,e.getDimension()),y=e.size();if(u.copy(e,0,g,0,y),y>0)for(var w=y;w<l;w++)u.copy(e,y-1,g,w,1);return g}},{key:"reverse",value:function(t){for(var e=t.size()-1,l=Math.trunc(e/2),g=0;g<=l;g++)u.swap(t,g,e-g)}},{key:"swap",value:function(t,e,l){if(e===l)return null;for(var g=0;g<t.getDimension();g++){var y=t.getOrdinate(e,g);t.setOrdinate(e,g,t.getOrdinate(l,g)),t.setOrdinate(l,g,y)}}},{key:"copy",value:function(t,e,l,g,y){for(var w=0;w<y;w++)u.copyCoord(t,e+w,l,g+w)}},{key:"ensureValidRing",value:function(t,e){var l=e.size();return l===0?e:l<=3?u.createClosedRing(t,e,4):e.getOrdinate(0,Dt.X)===e.getOrdinate(l-1,Dt.X)&&e.getOrdinate(0,Dt.Y)===e.getOrdinate(l-1,Dt.Y)?e:u.createClosedRing(t,e,l+1)}},{key:"indexOf",value:function(t,e){for(var l=0;l<e.size();l++)if(t.x===e.getOrdinate(l,Dt.X)&&t.y===e.getOrdinate(l,Dt.Y))return l;return-1}},{key:"createClosedRing",value:function(t,e,l){var g=t.create(l,e.getDimension()),y=e.size();u.copy(e,0,g,0,y);for(var w=y;w<l;w++)u.copy(e,0,g,w,1);return g}},{key:"minCoordinate",value:function(t){for(var e=null,l=0;l<t.size();l++){var g=t.getCoordinate(l);(e===null||e.compareTo(g)>0)&&(e=g)}return e}}])})(),ft=(function(){function u(){r(this,u)}return d(u,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case u.FALSE:return u.SYM_FALSE;case u.TRUE:return u.SYM_TRUE;case u.DONTCARE:return u.SYM_DONTCARE;case u.P:return u.SYM_P;case u.L:return u.SYM_L;case u.A:return u.SYM_A}throw new X("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(or.toUpperCase(t)){case u.SYM_FALSE:return u.FALSE;case u.SYM_TRUE:return u.TRUE;case u.SYM_DONTCARE:return u.DONTCARE;case u.SYM_P:return u.P;case u.SYM_L:return u.L;case u.SYM_A:return u.A}throw new X("Unknown dimension symbol: "+t)}}])})();ft.P=0,ft.L=1,ft.A=2,ft.FALSE=-1,ft.TRUE=-2,ft.DONTCARE=-3,ft.SYM_FALSE="F",ft.SYM_TRUE="T",ft.SYM_DONTCARE="*",ft.SYM_P="0",ft.SYM_L="1",ft.SYM_A="2";var ar=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u){}}])})(),on=(function(){return d((function u(){r(this,u)}),[{key:"filter",value:function(u,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),kn=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new qt:this._points.expandEnvelope(new qt)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];if(!this.isEquivalentClass(e))return!1;var g=e;if(this._points.size()!==g._points.size())return!1;for(var y=0;y<this._points.size();y++)if(!this.equal(this._points.getCoordinate(y),g._points.getCoordinate(y),l))return!1;return!0}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<Math.trunc(this._points.size()/2);e++){var l=this._points.size()-1-e;if(!this._points.getCoordinate(e).equals(this._points.getCoordinate(l))){if(this._points.getCoordinate(e).compareTo(this._points.getCoordinate(l))>0){var g=this._points.copy();Fi.reverse(g),this._points=g}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ft.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var e=this._points.copy();return Fi.reverse(e),this.getFactory().createLineString(e)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return ul.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var e=arguments[0],l=0,g=0;l<this._points.size()&&g<e._points.size();){var y=this._points.getCoordinate(l).compareTo(e._points.getCoordinate(g));if(y!==0)return y;l++,g++}return l<this._points.size()?1:g<e._points.size()?-1:0}if(arguments.length===2){var w=arguments[0];return arguments[1].compare(this._points,w._points)}}},{key:"apply",value:function(){if(St(arguments[0],sr))for(var e=arguments[0],l=0;l<this._points.size();l++)e.filter(this._points.getCoordinate(l));else if(St(arguments[0],on)){var g=arguments[0];if(this._points.size()===0)return null;for(var y=0;y<this._points.size()&&(g.filter(this._points,y),!g.isDone());y++);g.isGeometryChanged()&&this.geometryChanged()}else St(arguments[0],ar)?arguments[0].filter(this):St(arguments[0],et)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new Ut}},{key:"isEquivalentClass",value:function(e){return e instanceof t}},{key:"getCoordinateN",value:function(e){return this._points.getCoordinate(e)}},{key:"getGeometryType",value:function(){return mt.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(e){if(e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),e.size()===1)throw new X("Invalid number of points in LineString (found "+e.size()+" - must be 0 or >= 2)");this._points=e}},{key:"isCoordinate",value:function(e){for(var l=0;l<this._points.size();l++)if(this._points.getCoordinate(l).equals(e))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(e){return this.getFactory().createPoint(this._points.getCoordinate(e))}},{key:"interfaces_",get:function(){return[Ts]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],l=arguments[1];mt.constructor_.call(this,l),this.init(e)}}}}])})(mt),Is=d((function u(){r(this,u)})),ao=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new qt;var e=new qt;return e.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),e}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new t(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),l))}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return ft.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return mt.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0];return this.getCoordinate().compareTo(e.getCoordinate())}if(arguments.length===2){var l=arguments[0];return arguments[1].compare(this._coordinates,l._coordinates)}}},{key:"apply",value:function(){if(St(arguments[0],sr)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this.getCoordinate())}else if(St(arguments[0],on)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this._coordinates,0),l.isGeometryChanged()&&this.geometryChanged()}else St(arguments[0],ar)?arguments[0].filter(this):St(arguments[0],et)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return mt.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(e){e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),dt.isTrue(e.size()<=1),this._coordinates=e}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Is]}}],[{key:"constructor_",value:function(){this._coordinates=null;var e=arguments[0],l=arguments[1];mt.constructor_.call(this,l),this.init(e)}}])})(mt),Cs=(function(){function u(){r(this,u)}return d(u,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(u.ofRingSigned(t))}if(St(arguments[0],Dt)){var e=arguments[0];return Math.abs(u.ofRingSigned(e))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,l=t[0].x,g=1;g<t.length-1;g++){var y=t[g].x-l,w=t[g+1].y;e+=y*(t[g-1].y-w)}return e/2}if(St(arguments[0],Dt)){var T=arguments[0],M=T.size();if(M<3)return 0;var z=new tt,K=new tt,it=new tt;T.getCoordinate(0,K),T.getCoordinate(1,it);var lt=K.x;it.x-=lt;for(var gt=0,bt=1;bt<M-1;bt++)z.y=K.y,K.x=it.x,K.y=it.y,T.getCoordinate(bt+1,it),it.x-=lt,gt+=K.x*(z.y-it.y);return gt/2}}}])})(),pe=(function(){return d((function u(){r(this,u)}),null,[{key:"sort",value:function(){var u=arguments,t=arguments[0];if(arguments.length===1)t.sort((function(lt,gt){return lt.compareTo(gt)}));else if(arguments.length===2)t.sort((function(lt,gt){return u[1].compare(lt,gt)}));else if(arguments.length===3){var e=t.slice(arguments[1],arguments[2]);e.sort();var l=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);var g,y=m(l);try{for(y.s();!(g=y.n()).done;){var w=g.value;t.push(w)}}catch(lt){y.e(lt)}finally{y.f()}}else if(arguments.length===4){var T=t.slice(arguments[1],arguments[2]);T.sort((function(lt,gt){return u[3].compare(lt,gt)}));var M=t.slice(0,arguments[1]).concat(T,t.slice(arguments[2],t.length));t.splice(0,t.length);var z,K=m(M);try{for(K.s();!(z=K.n()).done;){var it=z.value;t.push(it)}}catch(lt){K.e(lt)}finally{K.f()}}}},{key:"asList",value:function(u){var t,e=new Lt,l=m(u);try{for(l.s();!(t=l.n()).done;){var g=t.value;e.add(g)}}catch(y){l.e(y)}finally{l.f()}return e}},{key:"copyOf",value:function(u,t){return u.slice(0,t)}}])})(),xt=d((function u(){r(this,u)})),Ln=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var e=new Array(this.getNumPoints()).fill(null),l=-1,g=this._shell.getCoordinates(),y=0;y<g.length;y++)e[++l]=g[y];for(var w=0;w<this._holes.length;w++)for(var T=this._holes[w].getCoordinates(),M=0;M<T.length;M++)e[++l]=T[M];return e}},{key:"getArea",value:function(){var e=0;e+=Cs.ofRing(this._shell.getCoordinateSequence());for(var l=0;l<this._holes.length;l++)e-=Cs.ofRing(this._holes[l].getCoordinateSequence());return e}},{key:"copyInternal",value:function(){for(var e=this._shell.copy(),l=new Array(this._holes.length).fill(null),g=0;g<this._holes.length;g++)l[g]=this._holes[g].copy();return new t(e,l,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var e=this._shell.getCoordinateSequence(),l=this.getEnvelopeInternal(),g=0;g<5;g++){var y=e.getX(g);if(y!==l.getMinX()&&y!==l.getMaxX())return!1;var w=e.getY(g);if(w!==l.getMinY()&&w!==l.getMaxY())return!1}for(var T=e.getX(0),M=e.getY(0),z=1;z<=4;z++){var K=e.getX(z),it=e.getY(z);if(K!==T==(it!==M))return!1;T=K,M=it}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];if(!this.isEquivalentClass(e))return!1;var g=e,y=this._shell,w=g._shell;if(!y.equalsExact(w,l)||this._holes.length!==g._holes.length)return!1;for(var T=0;T<this._holes.length;T++)if(!this._holes[T].equalsExact(g._holes[T],l))return!1;return!0}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var e=0;e<this._holes.length;e++)this._holes[e]=this.normalized(this._holes[e],!1);pe.sort(this._holes)}else if(arguments.length===2){var l=arguments[0],g=arguments[1];if(l.isEmpty())return null;var y=l.getCoordinateSequence(),w=Fi.minCoordinateIndex(y,0,y.size()-2);Fi.scroll(y,w,!0),Tt.isCCW(y)===g&&Fi.reverse(y)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var e=this.getExteriorRing().reverse(),l=new Array(this.getNumInteriorRing()).fill(null),g=0;g<l.length;g++)l[g]=this.getInteriorRingN(g).reverse();return this.getFactory().createPolygon(e,l)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var e=0;e+=this._shell.getLength();for(var l=0;l<this._holes.length;l++)e+=this._holes[l].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=this._shell.getNumPoints(),l=0;l<this._holes.length;l++)e+=this._holes[l].getNumPoints();return e}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(e,l){var g=e.copy();return this.normalize(g,l),g}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],l=this._shell,g=e._shell;return l.compareToSameClass(g)}if(arguments.length===2){var y=arguments[1],w=arguments[0],T=this._shell,M=w._shell,z=T.compareToSameClass(M,y);if(z!==0)return z;for(var K=this.getNumInteriorRing(),it=w.getNumInteriorRing(),lt=0;lt<K&<<it;){var gt=this.getInteriorRingN(lt),bt=w.getInteriorRingN(lt),wt=gt.compareToSameClass(bt,y);if(wt!==0)return wt;lt++}return lt<K?1:lt<it?-1:0}}},{key:"apply",value:function(){if(St(arguments[0],sr)){var e=arguments[0];this._shell.apply(e);for(var l=0;l<this._holes.length;l++)this._holes[l].apply(e)}else if(St(arguments[0],on)){var g=arguments[0];if(this._shell.apply(g),!g.isDone())for(var y=0;y<this._holes.length&&(this._holes[y].apply(g),!g.isDone());y++);g.isGeometryChanged()&&this.geometryChanged()}else if(St(arguments[0],ar))arguments[0].filter(this);else if(St(arguments[0],et)){var w=arguments[0];w.filter(this),this._shell.apply(w);for(var T=0;T<this._holes.length;T++)this._holes[T].apply(w)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var e=new Array(this._holes.length+1).fill(null);e[0]=this._shell;for(var l=0;l<this._holes.length;l++)e[l+1]=this._holes[l];return e.length<=1?this.getFactory().createLinearRing(e[0].getCoordinateSequence()):this.getFactory().createMultiLineString(e)}},{key:"getGeometryType",value:function(){return mt.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(e){return this._holes[e]}},{key:"interfaces_",get:function(){return[xt]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var e=arguments[0],l=arguments[1],g=arguments[2];if(mt.constructor_.call(this,g),e===null&&(e=this.getFactory().createLinearRing()),l===null&&(l=[]),mt.hasNullElements(l))throw new X("holes must not contain null elements");if(e.isEmpty()&&mt.hasNonEmptyElements(l))throw new X("shell is empty but holes are not");this._shell=e,this._holes=l}}])})(mt),Ss=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t)})(eo),lo=(function(u){function t(e){var l;return r(this,t),(l=s(this,t)).array=[],e instanceof Wt&&l.addAll(e),l}return b(t,u),d(t,[{key:"contains",value:function(e){var l,g=m(this.array);try{for(g.s();!(l=g.n()).done;)if(l.value.compareTo(e)===0)return!0}catch(y){g.e(y)}finally{g.f()}return!1}},{key:"add",value:function(e){if(this.contains(e))return!1;for(var l=0,g=this.array.length;l<g;l++)if(this.array[l].compareTo(e)===1)return!!this.array.splice(l,0,e);return this.array.push(e),!0}},{key:"addAll",value:function(e){var l,g=m(e);try{for(g.s();!(l=g.n()).done;){var y=l.value;this.add(y)}}catch(w){g.e(w)}finally{g.f()}return!0}},{key:"remove",value:function(){throw new Ut}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new Ms(this.array)}}])})(Ss),Ms=(function(){return d((function u(t){r(this,u),this.array=t,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new oe;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new Ut}}])})(),xe=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeEnvelopeInternal",value:function(){for(var e=new qt,l=0;l<this._geometries.length;l++)e.expandToInclude(this._geometries[l].getEnvelopeInternal());return e}},{key:"getGeometryN",value:function(e){return this._geometries[e]}},{key:"getCoordinates",value:function(){for(var e=new Array(this.getNumPoints()).fill(null),l=-1,g=0;g<this._geometries.length;g++)for(var y=this._geometries[g].getCoordinates(),w=0;w<y.length;w++)e[++l]=y[w];return e}},{key:"getArea",value:function(){for(var e=0,l=0;l<this._geometries.length;l++)e+=this._geometries[l].getArea();return e}},{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];if(!this.isEquivalentClass(e))return!1;var g=e;if(this._geometries.length!==g._geometries.length)return!1;for(var y=0;y<this._geometries.length;y++)if(!this._geometries[y].equalsExact(g._geometries[y],l))return!1;return!0}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<this._geometries.length;e++)this._geometries[e].normalize();pe.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var e=ft.FALSE,l=0;l<this._geometries.length;l++)e=Math.max(e,this._geometries[l].getBoundaryDimension());return e}},{key:"reverseInternal",value:function(){for(var e=this._geometries.length,l=new Lt(e),g=0;g<e;g++)l.add(this._geometries[g].reverse());return this.getFactory().buildGeometry(l)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var e=ft.FALSE,l=0;l<this._geometries.length;l++)e=Math.max(e,this._geometries[l].getDimension());return e}},{key:"getLength",value:function(){for(var e=0,l=0;l<this._geometries.length;l++)e+=this._geometries[l].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=0,l=0;l<this._geometries.length;l++)e+=this._geometries[l].getNumPoints();return e}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],l=new lo(pe.asList(this._geometries)),g=new lo(pe.asList(e._geometries));return this.compare(l,g)}if(arguments.length===2){for(var y=arguments[1],w=arguments[0],T=this.getNumGeometries(),M=w.getNumGeometries(),z=0;z<T&&z<M;){var K=this.getGeometryN(z),it=w.getGeometryN(z),lt=K.compareToSameClass(it,y);if(lt!==0)return lt;z++}return z<T?1:z<M?-1:0}}},{key:"apply",value:function(){if(St(arguments[0],sr))for(var e=arguments[0],l=0;l<this._geometries.length;l++)this._geometries[l].apply(e);else if(St(arguments[0],on)){var g=arguments[0];if(this._geometries.length===0)return null;for(var y=0;y<this._geometries.length&&(this._geometries[y].apply(g),!g.isDone());y++);g.isGeometryChanged()&&this.geometryChanged()}else if(St(arguments[0],ar)){var w=arguments[0];w.filter(this);for(var T=0;T<this._geometries.length;T++)this._geometries[T].apply(w)}else if(St(arguments[0],et)){var M=arguments[0];M.filter(this);for(var z=0;z<this._geometries.length;z++)this._geometries[z].apply(M)}}},{key:"getBoundary",value:function(){return mt.checkNotGeometryCollection(this),dt.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return mt.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],l=arguments[1];if(mt.constructor_.call(this,l),e===null&&(e=[]),mt.hasNullElements(e))throw new X("geometries must not contain null elements");this._geometries=e}}}}])})(mt),lr=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&S(t,"equalsExact",this,1).call(this,e,l)}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var e=arguments[0];return this._geometries[e].getCoordinate()}return S(t,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return ft.FALSE}},{key:"getTypeCode",value:function(){return mt.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return mt.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Is]}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];xe.constructor_.call(this,e,l)}}])})(xe),ei=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return ft.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||S(t,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var e=this._points.copy();return Fi.reverse(e),this.getFactory().createLinearRing(e)}},{key:"getTypeCode",value:function(){return mt.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!S(t,"isClosed",this,1).call(this))throw new X("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new X("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return mt.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];kn.constructor_.call(this,e,l),this.validateConstruction()}}])})(kn);ei.MINIMUM_VALID_SIZE=4;var Li=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"setOrdinate",value:function(e,l){switch(e){case t.X:this.x=l;break;case t.Y:this.y=l;break;default:throw new X("Invalid ordinate index: "+e)}}},{key:"getZ",value:function(){return tt.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y}throw new X("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new X("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)tt.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];tt.constructor_.call(this,e.x,e.y)}else if(arguments[0]instanceof tt){var l=arguments[0];tt.constructor_.call(this,l.x,l.y)}}else if(arguments.length===2){var g=arguments[0],y=arguments[1];tt.constructor_.call(this,g,y,tt.NULL_ORDINATE)}}}])})(tt);Li.X=0,Li.Y=1,Li.Z=-1,Li.M=-1;var Gi=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,l){switch(e){case t.X:this.x=l;break;case t.Y:this.y=l;break;case t.M:this._m=l;break;default:throw new X("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getZ",value:function(){return tt.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new X("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new X("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)tt.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];tt.constructor_.call(this,e.x,e.y),this._m=e._m}else if(arguments[0]instanceof tt){var l=arguments[0];tt.constructor_.call(this,l.x,l.y),this._m=this.getM()}}else if(arguments.length===3){var g=arguments[0],y=arguments[1],w=arguments[2];tt.constructor_.call(this,g,y,tt.NULL_ORDINATE),this._m=w}}}])})(tt);Gi.X=0,Gi.Y=1,Gi.Z=-1,Gi.M=2;var uo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,l){switch(e){case tt.X:this.x=l;break;case tt.Y:this.y=l;break;case tt.Z:this.z=l;break;case tt.M:this._m=l;break;default:throw new X("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getOrdinate",value:function(e){switch(e){case tt.X:return this.x;case tt.Y:return this.y;case tt.Z:return this.getZ();case tt.M:return this.getM()}throw new X("Invalid ordinate index: "+e)}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)tt.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];tt.constructor_.call(this,e),this._m=e._m}else if(arguments[0]instanceof tt){var l=arguments[0];tt.constructor_.call(this,l),this._m=this.getM()}}else if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3];tt.constructor_.call(this,g,y,w),this._m=T}}}])})(tt),ur=(function(){function u(){r(this,u)}return d(u,null,[{key:"measures",value:function(t){return t instanceof Li?0:t instanceof Gi||t instanceof uo?1:0}},{key:"dimension",value:function(t){return t instanceof Li?2:t instanceof Gi?3:t instanceof uo?4:3}},{key:"create",value:function(){if(arguments.length===1){var t=arguments[0];return u.create(t,0)}if(arguments.length===2){var e=arguments[0],l=arguments[1];return e===2?new Li:e===3&&l===0?new tt:e===3&&l===1?new Gi:e===4&&l===1?new uo:new tt}}}])})(),En=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getCoordinate",value:function(e){return this.get(e)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&St(arguments[0],Wt)){for(var e=arguments[1],l=!1,g=arguments[0].iterator();g.hasNext();)this.add(g.next(),e),l=!0;return l}return S(t,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var e=S(t,"clone",this,1).call(this),l=0;l<this.size();l++)e.add(l,this.get(l).clone());return e}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(t.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(t.coordArrayType);for(var e=this.size(),l=new Array(e).fill(null),g=0;g<e;g++)l[g]=this.get(e-g-1);return l}}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];return S(t,"add",this,1).call(this,e)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var l=arguments[0],g=arguments[1];return this.add(l,g,!0),!0}if(arguments[0]instanceof tt&&typeof arguments[1]=="boolean"){var y=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(y))return null;S(t,"add",this,1).call(this,y)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var w=arguments[0],T=arguments[1];return this.add(w,T),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var M=arguments[0],z=arguments[1];if(arguments[2])for(var K=0;K<M.length;K++)this.add(M[K],z);else for(var it=M.length-1;it>=0;it--)this.add(M[it],z);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof tt){var lt=arguments[0],gt=arguments[1];if(!arguments[2]){var bt=this.size();if(bt>0&&(lt>0&&this.get(lt-1).equals2D(gt)||lt<bt&&this.get(lt).equals2D(gt)))return null}S(t,"add",this,1).call(this,lt,gt)}}else if(arguments.length===4){var wt=arguments[0],zt=arguments[1],Ot=arguments[2],Jt=arguments[3],ee=1;Ot>Jt&&(ee=-1);for(var de=Ot;de!==Jt;de+=ee)this.add(wt[de],zt);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var e=this.get(0).copy();this.add(e,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.ensureCapacity(l.length),this.add(l,g)}}}}])})(Lt);En.coordArrayType=new Array(0).fill(null);var se=(function(){function u(){r(this,u)}return d(u,null,[{key:"isRing",value:function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}},{key:"ptNotInList",value:function(t,e){for(var l=0;l<t.length;l++){var g=t[l];if(u.indexOf(g,e)<0)return g}return null}},{key:"scroll",value:function(t,e){var l=u.indexOf(e,t);if(l<0)return null;var g=new Array(t.length).fill(null);Be.arraycopy(t,l,g,0,t.length-l),Be.arraycopy(t,0,g,t.length-l,l),Be.arraycopy(g,0,t,0,t.length)}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(var l=0;l<t.length;l++)if(!t[l].equals(e[l]))return!1;return!0}if(arguments.length===3){var g=arguments[0],y=arguments[1],w=arguments[2];if(g===y)return!0;if(g===null||y===null||g.length!==y.length)return!1;for(var T=0;T<g.length;T++)if(w.compare(g[T],y[T])!==0)return!1;return!0}}},{key:"intersection",value:function(t,e){for(var l=new En,g=0;g<t.length;g++)e.intersects(t[g])&&l.add(t[g],!0);return l.toCoordinateArray()}},{key:"measures",value:function(t){if(t===null||t.length===0)return 0;var e,l=0,g=m(t);try{for(g.s();!(e=g.n()).done;){var y=e.value;l=Math.max(l,ur.measures(y))}}catch(w){g.e(w)}finally{g.f()}return l}},{key:"hasRepeatedPoints",value:function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(t){return u.hasRepeatedPoints(t)?new En(t,!1).toCoordinateArray():t}},{key:"reverse",value:function(t){for(var e=t.length-1,l=Math.trunc(e/2),g=0;g<=l;g++){var y=t[g];t[g]=t[e-g],t[e-g]=y}}},{key:"removeNull",value:function(t){for(var e=0,l=0;l<t.length;l++)t[l]!==null&&e++;var g=new Array(e).fill(null);if(e===0)return g;for(var y=0,w=0;w<t.length;w++)t[w]!==null&&(g[y++]=t[w]);return g}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),l=0;l<t.length;l++)e[l]=t[l].copy();return e}if(arguments.length===5)for(var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],M=arguments[4],z=0;z<M;z++)w[T+z]=g[y+z].copy()}},{key:"isEqualReversed",value:function(t,e){for(var l=0;l<t.length;l++){var g=t[l],y=e[t.length-l-1];if(g.compareTo(y)!==0)return!1}return!0}},{key:"envelope",value:function(t){for(var e=new qt,l=0;l<t.length;l++)e.expandToInclude(t[l]);return e}},{key:"toCoordinateArray",value:function(t){return t.toArray(u.coordArrayType)}},{key:"dimension",value:function(t){if(t===null||t.length===0)return 3;var e,l=0,g=m(t);try{for(g.s();!(e=g.n()).done;){var y=e.value;l=Math.max(l,ur.dimension(y))}}catch(w){g.e(w)}finally{g.f()}return l}},{key:"atLeastNCoordinatesOrNothing",value:function(t,e){return e.length>=t?e:[]}},{key:"indexOf",value:function(t,e){for(var l=0;l<e.length;l++)if(t.equals(e[l]))return l;return-1}},{key:"increasingDirection",value:function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var l=t.length-1-e,g=t[e].compareTo(t[l]);if(g!==0)return g}return 1}},{key:"compare",value:function(t,e){for(var l=0;l<t.length&&l<e.length;){var g=t[l].compareTo(e[l]);if(g!==0)return g;l++}return l<e.length?-1:l<t.length?1:0}},{key:"minCoordinate",value:function(t){for(var e=null,l=0;l<t.length;l++)(e===null||e.compareTo(t[l])>0)&&(e=t[l]);return e}},{key:"extract",value:function(t,e,l){e=rn.clamp(e,0,t.length);var g=(l=rn.clamp(l,-1,t.length))-e+1;l<0&&(g=0),e>=t.length&&(g=0),l<e&&(g=0);var y=new Array(g).fill(null);if(g===0)return y;for(var w=0,T=e;T<=l;T++)y[w++]=t[T];return y}}])})(),hl=(function(){return d((function u(){r(this,u)}),[{key:"compare",value:function(u,t){var e=u,l=t;return se.compare(e,l)}},{key:"interfaces_",get:function(){return[ht]}}])})(),hr=(function(){return d((function u(){r(this,u)}),[{key:"compare",value:function(u,t){var e=u,l=t;if(e.length<l.length)return-1;if(e.length>l.length)return 1;if(e.length===0)return 0;var g=se.compare(e,l);return se.isEqualReversed(e,l)?0:g}},{key:"OLDcompare",value:function(u,t){var e=u,l=t;if(e.length<l.length)return-1;if(e.length>l.length)return 1;if(e.length===0)return 0;for(var g=se.increasingDirection(e),y=se.increasingDirection(l),w=g>0?0:e.length-1,T=y>0?0:e.length-1,M=0;M<e.length;M++){var z=e[w].compareTo(l[T]);if(z!==0)return z;w+=g,T+=y}return 0}},{key:"interfaces_",get:function(){return[ht]}}])})();se.ForwardComparator=hl,se.BidirectionalComparator=hr,se.coordArrayType=new Array(0).fill(null);var cr=(function(){return d((function u(t){r(this,u),this.str=t}),[{key:"append",value:function(u){this.str+=u}},{key:"setCharAt",value:function(u,t){this.str=this.str.substr(0,u)+t+this.str.substr(u+1)}},{key:"toString",value:function(){return this.str}}])})(),Tn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getM",value:function(t){return this.hasM()?this._coordinates[t].getM():rt.NaN}},{key:"setOrdinate",value:function(t,e,l){switch(e){case Dt.X:this._coordinates[t].x=l;break;case Dt.Y:this._coordinates[t].y=l;break;default:this._coordinates[t].setOrdinate(e,l)}}},{key:"getZ",value:function(t){return this.hasZ()?this._coordinates[t].getZ():rt.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(t,e){switch(e){case Dt.X:return this._coordinates[t].x;case Dt.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var e=arguments[0];arguments[1].setCoordinate(this._coordinates[e])}}},{key:"getCoordinateCopy",value:function(t){var e=this.createCoordinate();return e.setCoordinate(this._coordinates[t]),e}},{key:"createCoordinate",value:function(){return ur.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(t){return this._coordinates[t].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t}},{key:"copy",value:function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++){var l=this.createCoordinate();l.setCoordinate(this._coordinates[e]),t[e]=l}return new u(t,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var t=new cr(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"}},{key:"getY",value:function(t){return this._coordinates[t].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[Dt,P]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];u.constructor_.call(this,t,se.dimension(t),se.measures(t))}else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var l=0;l<e;l++)this._coordinates[l]=new tt}else if(St(arguments[0],Dt)){var g=arguments[0];if(g===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=g.getDimension(),this._measures=g.getMeasures(),this._coordinates=new Array(g.size()).fill(null);for(var y=0;y<this._coordinates.length;y++)this._coordinates[y]=g.getCoordinateCopy(y)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var w=arguments[0],T=arguments[1];u.constructor_.call(this,w,T,se.measures(w))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var M=arguments[0],z=arguments[1];this._coordinates=new Array(M).fill(null),this._dimension=z;for(var K=0;K<M;K++)this._coordinates[K]=ur.create(z)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var it=arguments[0],lt=arguments[1],gt=arguments[2];this._dimension=lt,this._measures=gt,this._coordinates=it===null?new Array(0).fill(null):it}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var bt=arguments[0],wt=arguments[1],zt=arguments[2];this._coordinates=new Array(bt).fill(null),this._dimension=wt,this._measures=zt;for(var Ot=0;Ot<bt;Ot++)this._coordinates[Ot]=this.createCoordinate()}}}}])})(),ho=(function(){function u(){r(this,u)}return d(u,[{key:"readResolve",value:function(){return u.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new Tn(arguments[0]);if(St(arguments[0],Dt))return new Tn(arguments[0])}else{if(arguments.length===2){var t=arguments[1];return t>3&&(t=3),t<2&&(t=2),new Tn(arguments[0],t)}if(arguments.length===3){var e=arguments[2],l=arguments[1]-e;return e>1&&(e=1),l>3&&(l=3),l<2&&(l=2),new Tn(arguments[0],l+e,e)}}}},{key:"interfaces_",get:function(){return[so,P]}}],[{key:"instance",value:function(){return u.instanceObject}}])})();ho.instanceObject=new ho;var co=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&S(t,"equalsExact",this,1).call(this,e,l)}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return mt.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var e=new Lt,l=0;l<this._geometries.length;l++)for(var g=this._geometries[l].getBoundary(),y=0;y<g.getNumGeometries();y++)e.add(g.getGeometryN(y));var w=new Array(e.size()).fill(null);return this.getFactory().createMultiLineString(e.toArray(w))}},{key:"getGeometryType",value:function(){return mt.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[xt]}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];xe.constructor_.call(this,e,l)}}])})(xe),As=(function(){return d((function u(){r(this,u)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),fo=(function(u){function t(){var e;return r(this,t),(e=s(this,t)).map=new Map,e}return b(t,u),d(t,[{key:"get",value:function(e){return this.map.get(e)||null}},{key:"put",value:function(e,l){return this.map.set(e,l),l}},{key:"values",value:function(){for(var e=new Lt,l=this.map.values(),g=l.next();!g.done;)e.add(g.value),g=l.next();return e}},{key:"entrySet",value:function(){var e=new bn;return this.map.entries().forEach((function(l){return e.add(l)})),e}},{key:"size",value:function(){return this.map.size()}}])})(As),we=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"equals",value:function(t){if(!(t instanceof u))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale}},{key:"compareTo",value:function(t){var e=t,l=this.getMaximumSignificantDigits(),g=e.getMaximumSignificantDigits();return nn.compare(l,g)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===u.FLOATING||this._modelType===u.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var t="UNKNOWN";return this._modelType===u.FLOATING?t="Floating":this._modelType===u.FLOATING_SINGLE?t="Floating-Single":this._modelType===u.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var t=arguments[0];return rt.isNaN(t)||this._modelType===u.FLOATING_SINGLE?t:this._modelType===u.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof tt){var e=arguments[0];if(this._modelType===u.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}}},{key:"getMaximumSignificantDigits",value:function(){var t=16;return this._modelType===u.FLOATING?t=16:this._modelType===u.FLOATING_SINGLE?t=6:this._modelType===u.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}},{key:"setScale",value:function(t){this._scale=Math.abs(t)}},{key:"interfaces_",get:function(){return[P,ot]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=u.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Ui){var t=arguments[0];this._modelType=t,t===u.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=u.FIXED,this.setScale(e)}else if(arguments[0]instanceof u){var l=arguments[0];this._modelType=l._modelType,this._scale=l._scale}}}},{key:"mostPrecise",value:function(t,e){return t.compareTo(e)>=0?t:e}}])})(),Ui=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"readResolve",value:function(){return u.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[P]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,u.nameToTypeMap.put(t,this)}}])})();Ui.nameToTypeMap=new fo,we.Type=Ui,we.FIXED=new Ui("FIXED"),we.FLOATING=new Ui("FLOATING"),we.FLOATING_SINGLE=new Ui("FLOATING SINGLE"),we.maximumPreciseValue=9007199254740992;var fr=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),l=0;l<e.length;l++)e[l]=this._geometries[l].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof mt){var e=arguments[0],l=arguments[1];return!!this.isEquivalentClass(e)&&S(t,"equalsExact",this,1).call(this,e,l)}return S(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?ft.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return mt.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new Ut}},{key:"getGeometryType",value:function(){return mt.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[Ts]}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];xe.constructor_.call(this,e,l)}}])})(xe),ii=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"createEmpty",value:function(t){switch(t){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new X("Invalid dimension: "+t)}}},{key:"toGeometry",value:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new tt(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new tt(t.getMinX(),t.getMinY()),new tt(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new tt(t.getMinX(),t.getMinY()),new tt(t.getMinX(),t.getMaxY()),new tt(t.getMaxX(),t.getMaxY()),new tt(t.getMaxX(),t.getMinY()),new tt(t.getMinX(),t.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(St(arguments[0],Dt))return new kn(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new fr(null,this):arguments.length===1?new fr(arguments[0],this):void 0}},{key:"buildGeometry",value:function(t){for(var e=null,l=!1,g=!1,y=t.iterator();y.hasNext();){var w=y.next(),T=w.getTypeCode();e===null&&(e=T),T!==e&&(l=!0),w instanceof xe&&(g=!0)}if(e===null)return this.createGeometryCollection();if(l||g)return this.createGeometryCollection(u.toGeometryArray(t));var M=t.iterator().next();if(t.size()>1){if(M instanceof Ln)return this.createMultiPolygon(u.toPolygonArray(t));if(M instanceof kn)return this.createMultiLineString(u.toLineStringArray(t));if(M instanceof ao)return this.createMultiPoint(u.toPointArray(t));dt.shouldNeverReachHere("Unhandled geometry type: "+M.getGeometryType())}return M}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof tt){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(St(arguments[0],Dt))return new ao(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(St(arguments[0],Dt)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof ei){var l=arguments[0];return this.createPolygon(l,null)}}else if(arguments.length===2)return new Ln(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new xe(null,this):arguments.length===1?new xe(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(St(arguments[0],Dt))return new ei(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new co(null,this):arguments.length===1?new co(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new lr(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new lr(arguments[0],this);if(St(arguments[0],Dt)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),l=0;l<t.size();l++){var g=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());Fi.copy(t,l,g,0,1),e[l]=this.createPoint(g)}return this.createMultiPoint(e)}}}},{key:"interfaces_",get:function(){return[P]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)u.constructor_.call(this,new we,0);else if(arguments.length===1){if(St(arguments[0],so)){var t=arguments[0];u.constructor_.call(this,new we,0,t)}else if(arguments[0]instanceof we){var e=arguments[0];u.constructor_.call(this,e,0,u.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];u.constructor_.call(this,l,g,u.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this._precisionModel=y,this._coordinateSequenceFactory=T,this._SRID=w}}},{key:"toMultiPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toGeometryArray",value:function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return ho.instance()}},{key:"toMultiLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toMultiPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLinearRingArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"createPointFromInternalCoord",value:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}}])})(),Bt="XY",$t="XYZ",dr="XYM",sn="XYZM",qi={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},gr="EMPTY",Ct=1,Ht=2,ni=3,In=4,fe=5,cl=6;for(var pr in qi)qi[pr].toUpperCase();var Zi=(function(){return d((function u(t){r(this,u),this.wkt=t,this.index_=-1}),[{key:"isAlpha_",value:function(u){return u>="a"&&u<="z"||u>="A"&&u<="Z"}},{key:"isNumeric_",value:function(u,t){return u>="0"&&u<="9"||u=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(u){return u==" "||u==" "||u=="\r"||u==`
|
|
486
|
+
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var u,t=this.nextChar_(),e=this.index_,l=t;if(t=="(")u=Ht;else if(t==",")u=fe;else if(t==")")u=ni;else if(this.isNumeric_(t)||t=="-")u=In,l=this.readNumber_();else if(this.isAlpha_(t))u=Ct,l=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);u=cl}return{position:e,value:l,type:u}}},{key:"readNumber_",value:function(){var u,t=this.index_,e=!1,l=!1;do u=="."?e=!0:u!="e"&&u!="E"||(l=!0),u=this.nextChar_();while(this.isNumeric_(u,e)||!l&&(u=="e"||u=="E")||l&&(u=="-"||u=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var u,t=this.index_;do u=this.nextChar_();while(this.isAlpha_(u));return this.wkt.substring(t,this.index_--).toUpperCase()}}])})(),ae=(function(){return d((function u(t,e){r(this,u),this.lexer_=t,this.token_,this.layout_=Bt,this.factory=e}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(u){return this.token_.type==u}},{key:"match",value:function(u){var t=this.isTokenType(u);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var u=Bt,t=this.token_;if(this.isTokenType(Ct)){var e=t.value;e==="Z"?u=$t:e==="M"?u=dr:e==="ZM"&&(u=sn),u!==Bt&&this.consume_()}return u}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Ht)){var u=[];do u.push(this.parseGeometry_());while(this.match(fe));if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Ht)){var u=this.parsePoint_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Ht)){var u=this.parsePointList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Ht)){var u=this.parseLineStringTextList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var u;if(this.match(Ht)){if(u=this.token_.type==Ht?this.parsePointTextList_():this.parsePointList_(),this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Ht)){var u=this.parseLineStringTextList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Ht)){var u=this.parsePolygonTextList_();if(this.match(ni))return u}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var u=[],t=this.layout_.length,e=0;e<t;++e){var l=this.token_;if(!this.match(In))break;u.push(l.value)}if(u.length==t)return u;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var u=[this.parsePoint_()];this.match(fe);)u.push(this.parsePoint_());return u}},{key:"parsePointTextList_",value:function(){for(var u=[this.parsePointText_()];this.match(fe);)u.push(this.parsePointText_());return u}},{key:"parseLineStringTextList_",value:function(){for(var u=[this.parseLineStringText_()];this.match(fe);)u.push(this.parseLineStringText_());return u}},{key:"parsePolygonTextList_",value:function(){for(var u=[this.parsePolygonText_()];this.match(fe);)u.push(this.parsePolygonText_());return u}},{key:"isEmptyGeometry_",value:function(){var u=this.isTokenType(Ct)&&this.token_.value==gr;return u&&this.consume_(),u}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var u=this.factory,t=function(wt){return h(tt,O(wt))},e=function(wt){var zt=wt.map((function(Ot){return u.createLinearRing(Ot.map(t))}));return zt.length>1?u.createPolygon(zt[0],zt.slice(1)):u.createPolygon(zt[0])},l=this.token_;if(this.match(Ct)){var g=l.value;if(this.layout_=this.parseGeometryLayout_(),g=="GEOMETRYCOLLECTION"){var y=this.parseGeometryCollectionText_();return u.createGeometryCollection(y)}switch(g){case"POINT":var w=this.parsePointText_();return w?u.createPoint(h(tt,O(w))):u.createPoint();case"LINESTRING":var T=this.parseLineStringText_().map(t);return u.createLineString(T);case"LINEARRING":var M=this.parseLineStringText_().map(t);return u.createLinearRing(M);case"POLYGON":var z=this.parsePolygonText_();return z&&z.length!==0?e(z):u.createPolygon();case"MULTIPOINT":var K=this.parseMultiPointText_();if(!K||K.length===0)return u.createMultiPoint();var it=K.map(t).map((function(wt){return u.createPoint(wt)}));return u.createMultiPoint(it);case"MULTILINESTRING":var lt=this.parseMultiLineStringText_().map((function(wt){return u.createLineString(wt.map(t))}));return u.createMultiLineString(lt);case"MULTIPOLYGON":var gt=this.parseMultiPolygonText_();if(!gt||gt.length===0)return u.createMultiPolygon();var bt=gt.map(e);return u.createMultiPolygon(bt);default:throw new Error("Invalid geometry type: "+g)}}throw new Error(this.formatErrorMessage_())}}])})();function Ei(u){if(u.isEmpty())return"";var t=u.getCoordinate(),e=[t.x,t.y];return t.z===void 0||Number.isNaN(t.z)||e.push(t.z),t.m===void 0||Number.isNaN(t.m)||e.push(t.m),e.join(" ")}function gi(u){for(var t=u.getCoordinates().map((function(y){var w=[y.x,y.y];return y.z===void 0||Number.isNaN(y.z)||w.push(y.z),y.m===void 0||Number.isNaN(y.m)||w.push(y.m),w})),e=[],l=0,g=t.length;l<g;++l)e.push(t[l].join(" "));return e.join(", ")}function an(u){var t=[];t.push("("+gi(u.getExteriorRing())+")");for(var e=0,l=u.getNumInteriorRing();e<l;++e)t.push("("+gi(u.getInteriorRingN(e))+")");return t.join(", ")}var go={Point:Ei,LineString:gi,LinearRing:gi,Polygon:an,MultiPoint:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push("("+Ei(u.getGeometryN(e))+")");return t.join(", ")},MultiLineString:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push("("+gi(u.getGeometryN(e))+")");return t.join(", ")},MultiPolygon:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push("("+an(u.getGeometryN(e))+")");return t.join(", ")},GeometryCollection:function(u){for(var t=[],e=0,l=u.getNumGeometries();e<l;++e)t.push(ln(u.getGeometryN(e)));return t.join(", ")}};function ln(u){var t=u.getGeometryType(),e=go[t];t=t.toUpperCase();var l=(function(g){var y="";if(g.isEmpty())return y;var w=g.getCoordinate();return w.z===void 0||Number.isNaN(w.z)||(y+="Z"),w.m===void 0||Number.isNaN(w.m)||(y+="M"),y})(u);return l.length>0&&(t+=" "+l),u.isEmpty()?t+" "+gr:t+" ("+e(u)+")"}var po=(function(){return d((function u(t){r(this,u),this.geometryFactory=t||new ii,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(u){var t=new Zi(u);return new ae(t,this.geometryFactory).parse()}},{key:"write",value:function(u){return ln(u)}}])})(),Cn=(function(){return d((function u(t){r(this,u),this.parser=new po(t)}),[{key:"write",value:function(u){return this.parser.write(u)}}],[{key:"toLineString",value:function(u,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+u.x+" "+u.y+", "+t.x+" "+t.y+" )"}}])})(),Vt=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new cr;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}},{key:"computeIntersection",value:function(t,e,l,g){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=l,this._inputLines[1][1]=g,this._result=this.computeIntersect(t,e,l,g)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}}},{key:"getIntersection",value:function(t){return this._intPt[t]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==u.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(t,e){return u.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])}},{key:"isCollinear",value:function(){return this._result===u.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return Cn.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Cn.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(t,e){return this._inputLines[t][e]}},{key:"isIntersection",value:function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new tt,this._intPt[1]=new tt,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(t,e,l){var g=Math.abs(l.x-e.x),y=Math.abs(l.y-e.y),w=-1;if(t.equals(e))w=0;else if(t.equals(l))w=g>y?g:y;else{var T=Math.abs(t.x-e.x),M=Math.abs(t.y-e.y);(w=g>y?T:M)!==0||t.equals(e)||(w=Math.max(T,M))}return dt.isTrue(!(w===0&&!t.equals(e)),"Bad distance calculation"),w}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,l){var g=t.x-e.x,y=t.y-e.y,w=Math.sqrt(g*g+y*y);return dt.isTrue(!(w===0&&!t.equals(e)),"Invalid distance calculation"),w}}])})();Vt.DONT_INTERSECT=0,Vt.DO_INTERSECT=1,Vt.COLLINEAR=2,Vt.NO_INTERSECTION=0,Vt.POINT_INTERSECTION=1,Vt.COLLINEAR_INTERSECTION=2;var pi=(function(u){function t(){return r(this,t),s(this,t)}return b(t,u),d(t,[{key:"isInSegmentEnvelopes",value:function(e){var l=new qt(this._inputLines[0][0],this._inputLines[0][1]),g=new qt(this._inputLines[1][0],this._inputLines[1][1]);return l.contains(e)&&g.contains(e)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return S(t,"computeIntersection",this,1).apply(this,arguments);var e=arguments[0],l=arguments[1],g=arguments[2];if(this._isProper=!1,qt.intersects(l,g,e)&&Tt.index(l,g,e)===0&&Tt.index(g,l,e)===0)return this._isProper=!0,(e.equals(l)||e.equals(g))&&(this._isProper=!1),this._result=Vt.POINT_INTERSECTION,null;this._result=Vt.NO_INTERSECTION}},{key:"intersection",value:function(e,l,g,y){var w=this.intersectionSafe(e,l,g,y);return this.isInSegmentEnvelopes(w)||(w=new tt(t.nearestEndpoint(e,l,g,y))),this._precisionModel!==null&&this._precisionModel.makePrecise(w),w}},{key:"checkDD",value:function(e,l,g,y,w){var T=no.intersection(e,l,g,y),M=this.isInSegmentEnvelopes(T);Be.out.println("DD in env = "+M+" --------------------- "+T),w.distance(T)>1e-4&&Be.out.println("Distance = "+w.distance(T))}},{key:"intersectionSafe",value:function(e,l,g,y){var w=oo.intersection(e,l,g,y);return w===null&&(w=t.nearestEndpoint(e,l,g,y)),w}},{key:"computeCollinearIntersection",value:function(e,l,g,y){var w=qt.intersects(e,l,g),T=qt.intersects(e,l,y),M=qt.intersects(g,y,e),z=qt.intersects(g,y,l);return w&&T?(this._intPt[0]=g,this._intPt[1]=y,Vt.COLLINEAR_INTERSECTION):M&&z?(this._intPt[0]=e,this._intPt[1]=l,Vt.COLLINEAR_INTERSECTION):w&&M?(this._intPt[0]=g,this._intPt[1]=e,!g.equals(e)||T||z?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):w&&z?(this._intPt[0]=g,this._intPt[1]=l,!g.equals(l)||T||M?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):T&&M?(this._intPt[0]=y,this._intPt[1]=e,!y.equals(e)||w||z?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):T&&z?(this._intPt[0]=y,this._intPt[1]=l,!y.equals(l)||w||M?Vt.COLLINEAR_INTERSECTION:Vt.POINT_INTERSECTION):Vt.NO_INTERSECTION}},{key:"computeIntersect",value:function(e,l,g,y){if(this._isProper=!1,!qt.intersects(e,l,g,y))return Vt.NO_INTERSECTION;var w=Tt.index(e,l,g),T=Tt.index(e,l,y);if(w>0&&T>0||w<0&&T<0)return Vt.NO_INTERSECTION;var M=Tt.index(g,y,e),z=Tt.index(g,y,l);return M>0&&z>0||M<0&&z<0?Vt.NO_INTERSECTION:w===0&&T===0&&M===0&&z===0?this.computeCollinearIntersection(e,l,g,y):(w===0||T===0||M===0||z===0?(this._isProper=!1,e.equals2D(g)||e.equals2D(y)?this._intPt[0]=e:l.equals2D(g)||l.equals2D(y)?this._intPt[0]=l:w===0?this._intPt[0]=new tt(g):T===0?this._intPt[0]=new tt(y):M===0?this._intPt[0]=new tt(e):z===0&&(this._intPt[0]=new tt(l))):(this._isProper=!0,this._intPt[0]=this.intersection(e,l,g,y)),Vt.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(e,l,g,y){var w=e,T=Ze.pointToSegment(e,g,y),M=Ze.pointToSegment(l,g,y);return M<T&&(T=M,w=l),(M=Ze.pointToSegment(g,e,l))<T&&(T=M,w=g),(M=Ze.pointToSegment(y,e,l))<T&&(T=M,w=y),w}}])})(Vt),mo=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"countSegment",value:function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var l=t.x,g=e.x;return l>g&&(l=e.x,g=t.x),this._p.x>=l&&this._p.x<=g&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var y=Tt.index(t,e,this._p);if(y===Tt.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(y=-y),y===Tt.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==Z.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?Z.BOUNDARY:this._crossingCount%2==1?Z.INTERIOR:Z.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof tt&&St(arguments[1],Dt)){for(var t=arguments[1],e=new u(arguments[0]),l=new tt,g=new tt,y=1;y<t.size();y++)if(t.getCoordinate(y,l),t.getCoordinate(y-1,g),e.countSegment(l,g),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof tt&&arguments[1]instanceof Array){for(var w=arguments[1],T=new u(arguments[0]),M=1;M<w.length;M++){var z=w[M],K=w[M-1];if(T.countSegment(z,K),T.isOnSegment())return T.getLocation()}return T.getLocation()}}}])})(),un=(function(){function u(){r(this,u)}return d(u,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof tt&&St(arguments[1],Dt)){for(var t=arguments[0],e=arguments[1],l=new pi,g=new tt,y=new tt,w=e.size(),T=1;T<w;T++)if(e.getCoordinate(T-1,g),e.getCoordinate(T,y),l.computeIntersection(t,g,y),l.hasIntersection())return!0;return!1}if(arguments[0]instanceof tt&&arguments[1]instanceof Array){for(var M=arguments[0],z=arguments[1],K=new pi,it=1;it<z.length;it++){var lt=z[it-1],gt=z[it];if(K.computeIntersection(M,lt,gt),K.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(t,e){return mo.locatePointInRing(t,e)}},{key:"isInRing",value:function(t,e){return u.locateInRing(t,e)!==Z.EXTERIOR}}])})(),Ae=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"setAllLocations",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t}},{key:"isNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==Z.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===Z.NONE&&(this.location[e]=t)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[ct.ON]=this.location[ct.ON],e[ct.LEFT]=Z.NONE,e[ct.RIGHT]=Z.NONE,this.location=e}for(var l=0;l<this.location.length;l++)this.location[l]===Z.NONE&&l<t.location.length&&(this.location[l]=t.location[l])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var t=this.location[ct.LEFT];this.location[ct.LEFT]=this.location[ct.RIGHT],this.location[ct.RIGHT]=t}},{key:"toString",value:function(){var t=new xn;return this.location.length>1&&t.append(Z.toLocationSymbol(this.location[ct.LEFT])),t.append(Z.toLocationSymbol(this.location[ct.ON])),this.location.length>1&&t.append(Z.toLocationSymbol(this.location[ct.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,l){this.location[ct.ON]=t,this.location[ct.LEFT]=e,this.location[ct.RIGHT]=l}},{key:"get",value:function(t){return t<this.location.length?this.location[t]:Z.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===Z.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var t=arguments[0];this.setLocation(ct.ON,t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.location[e]=l}}},{key:"init",value:function(t){this.location=new Array(t).fill(null),this.setAllLocations(Z.NONE)}},{key:"isEqualOnSide",value:function(t,e){return this.location[e]===t.location[e]}},{key:"allPositionsEqual",value:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[ct.ON]=e}else if(arguments[0]instanceof u){var l=arguments[0];if(this.init(l.location.length),l!==null)for(var g=0;g<this.location.length;g++)this.location[g]=l.location[g]}}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this.init(3),this.location[ct.ON]=y,this.location[ct.LEFT]=w,this.location[ct.RIGHT]=T}}}])})(),Ie=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getGeometryCount",value:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t}},{key:"setAllLocations",value:function(t,e){this.elt[t].setAllLocations(e)}},{key:"isNull",value:function(t){return this.elt[t].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.elt[e].setAllLocationsIfNull(l)}}},{key:"isLine",value:function(t){return this.elt[t].isLine()}},{key:"merge",value:function(t){for(var e=0;e<2;e++)this.elt[e]===null&&t.elt[e]!==null?this.elt[e]=new Ae(t.elt[e]):this.elt[e].merge(t.elt[e])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(ct.ON)}if(arguments.length===2){var e=arguments[0],l=arguments[1];return this.elt[e].get(l)}}},{key:"toString",value:function(){var t=new xn;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}}},{key:"isAnyNull",value:function(t){return this.elt[t].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(ct.ON,e)}else if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2];this.elt[l].setLocation(g,y)}}},{key:"isEqualOnSide",value:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)}},{key:"allPositionsEqual",value:function(t,e){return this.elt[t].allPositionsEqual(e)}},{key:"toLine",value:function(t){this.elt[t].isArea()&&(this.elt[t]=new Ae(this.elt[t].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new Ae(t),this.elt[1]=new Ae(t)}else if(arguments[0]instanceof u){var e=arguments[0];this.elt[0]=new Ae(e.elt[0]),this.elt[1]=new Ae(e.elt[1])}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.elt[0]=new Ae(Z.NONE),this.elt[1]=new Ae(Z.NONE),this.elt[l].setLocation(g)}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this.elt[0]=new Ae(y,w,T),this.elt[1]=new Ae(y,w,T)}else if(arguments.length===4){var M=arguments[0],z=arguments[1],K=arguments[2],it=arguments[3];this.elt[0]=new Ae(Z.NONE,Z.NONE,Z.NONE),this.elt[1]=new Ae(Z.NONE,Z.NONE,Z.NONE),this.elt[M].setLocations(z,K,it)}}},{key:"toLineLabel",value:function(t){for(var e=new u(Z.NONE),l=0;l<2;l++)e.setLocation(l,t.getLocation(l));return e}}])})(),mr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var u=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)u[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(u),this._isHole=Tt.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(u){this._startDe=u;var t=u,e=!0;do{if(t===null)throw new ti("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new ti("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var l=t.getLabel();dt.isTrue(l.isArea()),this.mergeLabel(l),this.addPoints(t.getEdge(),t.isForward(),e),e=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(u){return this._pts.get(u)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var u=this._startDe;do{var t=u.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),u=this.getNext(u)}while(u!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(u,t,e){var l=u.getCoordinates();if(t){var g=1;e&&(g=0);for(var y=g;y<l.length;y++)this._pts.add(l[y])}else{var w=l.length-2;e&&(w=l.length-1);for(var T=w;T>=0;T--)this._pts.add(l[T])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var u=this._startDe;do u.getEdge().setInResult(!0),u=u.getNext();while(u!==this._startDe)}},{key:"containsPoint",value:function(u){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(u)||!un.isInRing(u,t.getCoordinates()))return!1;for(var e=this._holes.iterator();e.hasNext();)if(e.next().containsPoint(u))return!1;return!0}},{key:"addHole",value:function(u){this._holes.add(u)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var u=arguments[0];this.mergeLabel(u,0),this.mergeLabel(u,1)}else if(arguments.length===2){var t=arguments[1],e=arguments[0].getLocation(t,ct.RIGHT);if(e===Z.NONE)return null;if(this._label.getLocation(t)===Z.NONE)return this._label.setLocation(t,e),null}}},{key:"setShell",value:function(u){this._shell=u,u!==null&&u.addHole(this)}},{key:"toPolygon",value:function(u){for(var t=new Array(this._holes.size()).fill(null),e=0;e<this._holes.size();e++)t[e]=this._holes.get(e).getLinearRing();return u.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new Lt,this._pts=new Lt,this._label=new Ie(Z.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Lt,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var u=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(u),this.computeRing()}}}}])})(),Mt=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"setEdgeRing",value:function(e,l){e.setMinEdgeRing(l)}},{key:"getNext",value:function(e){return e.getNextMin()}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];mr.constructor_.call(this,e,l)}}])})(mr),ri=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"buildMinimalRings",value:function(){var e=new Lt,l=this._startDe;do{if(l.getMinEdgeRing()===null){var g=new Mt(l,this._geometryFactory);e.add(g)}l=l.getNext()}while(l!==this._startDe);return e}},{key:"setEdgeRing",value:function(e,l){e.setEdgeRing(l)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var e=this._startDe;do e.getNode().getEdges().linkMinimalDirectedEdges(this),e=e.getNext();while(e!==this._startDe)}},{key:"getNext",value:function(e){return e.getNext()}}],[{key:"constructor_",value:function(){var e=arguments[0],l=arguments[1];mr.constructor_.call(this,e,l)}}])})(mr),Xt=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(u){this._isVisited=u}},{key:"setInResult",value:function(u){this._isInResult=u}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(u){this._label=u}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(u){this._isCovered=u,this._isCoveredSet=!0}},{key:"updateIM",value:function(u){dt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(u)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._label=u}}}}])})(),Sn=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"isIncidentEdgeInResult",value:function(){for(var e=this.getEdges().getEdges().iterator();e.hasNext();)if(e.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(e){e.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(e){}},{key:"computeMergedLocation",value:function(e,l){var g=Z.NONE;if(g=this._label.getLocation(l),!e.isNull(l)){var y=e.getLocation(l);g!==Z.BOUNDARY&&(g=y)}return g}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return S(t,"setLabel",this,1).apply(this,arguments);var e=arguments[0],l=arguments[1];this._label===null?this._label=new Ie(e,l):this._label.setLocation(e,l)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var e=arguments[0];this.mergeLabel(e._label)}else if(arguments[0]instanceof Ie)for(var l=arguments[0],g=0;g<2;g++){var y=this.computeMergedLocation(l,g);this._label.getLocation(g)===Z.NONE&&this._label.setLocation(g,y)}}},{key:"add",value:function(e){this._edges.insert(e),e.setNode(this)}},{key:"setLabelBoundary",value:function(e){if(this._label===null)return null;var l=Z.NONE;this._label!==null&&(l=this._label.getLocation(e));var g=null;switch(l){case Z.BOUNDARY:g=Z.INTERIOR;break;case Z.INTERIOR:default:g=Z.BOUNDARY}this._label.setLocation(e,g)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var e=arguments[0],l=arguments[1];this._coord=e,this._edges=l,this._label=new Ie(0,Z.NONE)}}])})(Xt),yo=(function(u){function t(){return r(this,t),s(this,t,arguments)}return b(t,u),d(t)})(As);function yr(u){return u==null?0:u.color}function Ft(u){return u==null?null:u.parent}function me(u,t){u!==null&&(u.color=t)}function Mn(u){return u==null?null:u.left}function hn(u){return u==null?null:u.right}var re=(function(u){function t(){var e;return r(this,t),(e=s(this,t)).root_=null,e.size_=0,e}return b(t,u),d(t,[{key:"get",value:function(e){for(var l=this.root_;l!==null;){var g=e.compareTo(l.key);if(g<0)l=l.left;else{if(!(g>0))return l.value;l=l.right}}return null}},{key:"put",value:function(e,l){if(this.root_===null)return this.root_={key:e,value:l,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var g,y,w=this.root_;do if(g=w,(y=e.compareTo(w.key))<0)w=w.left;else{if(!(y>0)){var T=w.value;return w.value=l,T}w=w.right}while(w!==null);var M={key:e,left:null,right:null,value:l,parent:g,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return y<0?g.left=M:g.right=M,this.fixAfterInsertion(M),this.size_++,null}},{key:"fixAfterInsertion",value:function(e){var l;for(e.color=1;e!=null&&e!==this.root_&&e.parent.color===1;)Ft(e)===Mn(Ft(Ft(e)))?yr(l=hn(Ft(Ft(e))))===1?(me(Ft(e),0),me(l,0),me(Ft(Ft(e)),1),e=Ft(Ft(e))):(e===hn(Ft(e))&&(e=Ft(e),this.rotateLeft(e)),me(Ft(e),0),me(Ft(Ft(e)),1),this.rotateRight(Ft(Ft(e)))):yr(l=Mn(Ft(Ft(e))))===1?(me(Ft(e),0),me(l,0),me(Ft(Ft(e)),1),e=Ft(Ft(e))):(e===Mn(Ft(e))&&(e=Ft(e),this.rotateRight(e)),me(Ft(e),0),me(Ft(Ft(e)),1),this.rotateLeft(Ft(Ft(e))));this.root_.color=0}},{key:"values",value:function(){var e=new Lt,l=this.getFirstEntry();if(l!==null)for(e.add(l.value);(l=t.successor(l))!==null;)e.add(l.value);return e}},{key:"entrySet",value:function(){var e=new bn,l=this.getFirstEntry();if(l!==null)for(e.add(l);(l=t.successor(l))!==null;)e.add(l);return e}},{key:"rotateLeft",value:function(e){if(e!=null){var l=e.right;e.right=l.left,l.left!=null&&(l.left.parent=e),l.parent=e.parent,e.parent==null?this.root_=l:e.parent.left===e?e.parent.left=l:e.parent.right=l,l.left=e,e.parent=l}}},{key:"rotateRight",value:function(e){if(e!=null){var l=e.left;e.left=l.right,l.right!=null&&(l.right.parent=e),l.parent=e.parent,e.parent==null?this.root_=l:e.parent.right===e?e.parent.right=l:e.parent.left=l,l.right=e,e.parent=l}}},{key:"getFirstEntry",value:function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(e){for(var l=this.root_;l!==null;){var g=e.compareTo(l.key);if(g<0)l=l.left;else{if(!(g>0))return!0;l=l.right}}return!1}}],[{key:"successor",value:function(e){var l;if(e===null)return null;if(e.right!==null){for(l=e.right;l.left!==null;)l=l.left;return l}l=e.parent;for(var g=e;l!==null&&g===l.right;)g=l,l=l.parent;return l}}])})(yo),Ti=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"find",value:function(u){return this.nodeMap.get(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof tt){var u=arguments[0],t=this.nodeMap.get(u);return t===null&&(t=this.nodeFact.createNode(u),this.nodeMap.put(u,t)),t}if(arguments[0]instanceof Sn){var e=arguments[0],l=this.nodeMap.get(e.getCoordinate());return l===null?(this.nodeMap.put(e.getCoordinate(),e),e):(l.mergeLabel(e),l)}}},{key:"print",value:function(u){for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(u){for(var t=new Lt,e=this.iterator();e.hasNext();){var l=e.next();l.getLabel().getLocation(u)===Z.BOUNDARY&&t.add(l)}return t}},{key:"add",value:function(u){var t=u.getCoordinate();this.addNode(t).add(u)}}],[{key:"constructor_",value:function(){this.nodeMap=new re,this.nodeFact=null;var u=arguments[0];this.nodeFact=u}}])})(),ye=(function(){function u(){r(this,u)}return d(u,null,[{key:"isNorthern",value:function(t){return t===u.NE||t===u.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&(t-e+4)%4===2}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if((t-e+4)%4===2)return-1;var l=t<e?t:e;return l===0&&(t>e?t:e)===3?3:l}},{key:"isInHalfPlane",value:function(t,e){return e===u.SE?t===u.SE||t===u.SW:t===e||t===e+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new X("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?u.NE:u.SE:e>=0?u.NW:u.SW}if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var l=arguments[0],g=arguments[1];if(g.x===l.x&&g.y===l.y)throw new X("Cannot compute the quadrant for two identical points "+l);return g.x>=l.x?g.y>=l.y?u.NE:u.SE:g.y>=l.y?u.NW:u.SW}}}])})();ye.NE=0,ye.NW=1,ye.SW=2,ye.SE=3;var _o=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"compareDirection",value:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:Tt.index(t._p0,t._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(t){this._node=t}},{key:"print",value:function(t){var e=Math.atan2(this._dy,this._dx),l=this.getClass().getName(),g=l.lastIndexOf("."),y=l.substring(g+1);t.print(" "+y+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)}},{key:"compareTo",value:function(t){var e=t;return this.compareDirection(e)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),l=e.lastIndexOf(".");return" "+e.substring(l+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label}},{key:"computeLabel",value:function(t){}},{key:"init",value:function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=ye.quadrant(this._dx,this._dy),dt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],l=arguments[1],g=arguments[2];u.constructor_.call(this,e,l,g,null)}else if(arguments.length===4){var y=arguments[0],w=arguments[1],T=arguments[2],M=arguments[3];u.constructor_.call(this,y),this.init(w,T),this._label=M}}}])})(),vo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(e){return this._depth[e]}},{key:"setVisited",value:function(e){this._isVisited=e}},{key:"computeDirectedLabel",value:function(){this._label=new Ie(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(e,l){if(this._depth[e]!==-999&&this._depth[e]!==l)throw new ti("assigned depths do not match",this.getCoordinate());this._depth[e]=l}},{key:"isInteriorAreaEdge",value:function(){for(var e=!0,l=0;l<2;l++)this._label.isArea(l)&&this._label.getLocation(l,ct.LEFT)===Z.INTERIOR&&this._label.getLocation(l,ct.RIGHT)===Z.INTERIOR||(e=!1);return e}},{key:"setNextMin",value:function(e){this._nextMin=e}},{key:"print",value:function(e){S(t,"print",this,1).call(this,e),e.print(" "+this._depth[ct.LEFT]+"/"+this._depth[ct.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")}},{key:"setMinEdgeRing",value:function(e){this._minEdgeRing=e}},{key:"isLineEdge",value:function(){var e=this._label.isLine(0)||this._label.isLine(1),l=!this._label.isArea(0)||this._label.allPositionsEqual(0,Z.EXTERIOR),g=!this._label.isArea(1)||this._label.allPositionsEqual(1,Z.EXTERIOR);return e&&l&&g}},{key:"setEdgeRing",value:function(e){this._edgeRing=e}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var e=this._edge.getDepthDelta();return this._isForward||(e=-e),e}},{key:"setInResult",value:function(e){this._isInResult=e}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(e){this.print(e),e.print(" "),this._isForward?this._edge.print(e):this._edge.printReverse(e)}},{key:"setSym",value:function(e){this._sym=e}},{key:"setVisitedEdge",value:function(e){this.setVisited(e),this._sym.setVisited(e)}},{key:"setEdgeDepths",value:function(e,l){var g=this.getEdge().getDepthDelta();this._isForward||(g=-g);var y=1;e===ct.LEFT&&(y=-1);var w=ct.opposite(e),T=l+g*y;this.setDepth(e,l),this.setDepth(w,T)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(e){this._next=e}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var e=arguments[0],l=arguments[1];if(_o.constructor_.call(this,e),this._isForward=l,l)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var g=e.getNumPoints()-1;this.init(e.getCoordinate(g),e.getCoordinate(g-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(e,l){return e===Z.EXTERIOR&&l===Z.INTERIOR?1:e===Z.INTERIOR&&l===Z.EXTERIOR?-1:0}}])})(_o),bo=(function(){return d((function u(){r(this,u)}),[{key:"createNode",value:function(u){return new Sn(u,null)}}])})(),_r=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(u){u.println("Edges:");for(var t=0;t<this._edges.size();t++){u.println("edge "+t+":");var e=this._edges.get(t);e.print(u),e.eiList.print(u)}}},{key:"find",value:function(u){return this._nodes.find(u)}},{key:"addNode",value:function(){if(arguments[0]instanceof Sn){var u=arguments[0];return this._nodes.addNode(u)}if(arguments[0]instanceof tt){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(u){Be.out.println(u)}},{key:"isBoundaryNode",value:function(u,t){var e=this._nodes.find(t);if(e===null)return!1;var l=e.getLabel();return l!==null&&l.getLocation(u)===Z.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var u=this._nodes.iterator();u.hasNext();)u.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(u,t,e,l){return!!u.equals(e)&&Tt.index(u,t,l)===Tt.COLLINEAR&&ye.quadrant(u,t)===ye.quadrant(e,l)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(u){Be.out.print(u)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(u,t){for(var e=0;e<this._edges.size();e++){var l=this._edges.get(e),g=l.getCoordinates();if(this.matchInSameDirection(u,t,g[0],g[1])||this.matchInSameDirection(u,t,g[g.length-1],g[g.length-2]))return l}return null}},{key:"insertEdge",value:function(u){this._edges.add(u)}},{key:"findEdgeEnd",value:function(u){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var e=t.next();if(e.getEdge()===u)return e}return null}},{key:"addEdges",value:function(u){for(var t=u.iterator();t.hasNext();){var e=t.next();this._edges.add(e);var l=new vo(e,!0),g=new vo(e,!1);l.setSym(g),g.setSym(l),this.add(l),this.add(g)}}},{key:"add",value:function(u){this._nodes.add(u),this._edgeEndList.add(u)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(u,t){for(var e=0;e<this._edges.size();e++){var l=this._edges.get(e),g=l.getCoordinates();if(u.equals(g[0])&&t.equals(g[1]))return l}return null}}],[{key:"constructor_",value:function(){if(this._edges=new Lt,this._nodes=null,this._edgeEndList=new Lt,arguments.length===0)this._nodes=new Ti(new bo);else if(arguments.length===1){var u=arguments[0];this._nodes=new Ti(u)}}},{key:"linkResultDirectedEdges",value:function(u){for(var t=u.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}])})(),fl=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"sortShellsAndHoles",value:function(t,e,l){for(var g=t.iterator();g.hasNext();){var y=g.next();y.isHole()?l.add(y):e.add(y)}}},{key:"computePolygons",value:function(t){for(var e=new Lt,l=t.iterator();l.hasNext();){var g=l.next().toPolygon(this._geometryFactory);e.add(g)}return e}},{key:"placeFreeHoles",value:function(t,e){for(var l=e.iterator();l.hasNext();){var g=l.next();if(g.getShell()===null){var y=u.findEdgeRingContaining(g,t);if(y===null)throw new ti("unable to assign hole to a shell",g.getCoordinate(0));g.setShell(y)}}}},{key:"buildMinimalEdgeRings",value:function(t,e,l){for(var g=new Lt,y=t.iterator();y.hasNext();){var w=y.next();if(w.getMaxNodeDegree()>2){w.linkDirectedEdgesForMinimalEdgeRings();var T=w.buildMinimalRings(),M=this.findShell(T);M!==null?(this.placePolygonHoles(M,T),e.add(M)):l.addAll(T)}else g.add(w)}return g}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new Lt,l=t.iterator();l.hasNext();){var g=l.next();if(g.isInResult()&&g.getLabel().isArea()&&g.getEdgeRing()===null){var y=new ri(g,this._geometryFactory);e.add(y),y.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var l=e.iterator();l.hasNext();){var g=l.next();g.isHole()&&g.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,l=null,g=t.iterator();g.hasNext();){var y=g.next();y.isHole()||(l=y,e++)}return dt.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),l}},{key:"add",value:function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],l=arguments[1];_r.linkResultDirectedEdges(l);var g=this.buildMaximalEdgeRings(e),y=new Lt,w=this.buildMinimalEdgeRings(g,this._shellList,y);this.sortShellsAndHoles(w,this._shellList,y),this.placeFreeHoles(this._shellList,y)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new Lt;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var l=t.getLinearRing(),g=l.getEnvelopeInternal(),y=l.getCoordinateN(0),w=null,T=null,M=e.iterator();M.hasNext();){var z=M.next(),K=z.getLinearRing(),it=K.getEnvelopeInternal();if(!it.equals(g)&&it.contains(g)){y=se.ptNotInList(l.getCoordinates(),K.getCoordinates());var lt=!1;un.isInRing(y,K.getCoordinates())&&(lt=!0),lt&&(w===null||T.contains(it))&&(T=(w=z).getLinearRing().getEnvelopeInternal())}}return w}}])})(),xo=(function(){return d((function u(){r(this,u)}),[{key:"getBounds",value:function(){}}])})(),At=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[xo,P]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var u=arguments[0],t=arguments[1];this._bounds=u,this._item=t}}])})(),vr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var u=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),u}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(u){for(var t=null,e=this._items.get(u);2*u<=this._size&&((t=2*u)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(e)<0);u=t)this._items.set(u,this._items.get(t));this._items.set(u,e)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(u){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,u);u.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,u)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new Lt,this._items.add(null)}}])})(),He=(function(){return d((function u(){r(this,u)}),[{key:"insert",value:function(u,t){}},{key:"remove",value:function(u,t){}},{key:"query",value:function(){}}])})(),_e=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(u){dt.isTrue(this._bounds===null),this._childBoundables.add(u)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[xo,P]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new Lt,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this._level=u}}}}])})(),Hi={reverseOrder:function(){return{compare:function(u,t){return t.compareTo(u)}}},min:function(u){return Hi.sort(u),u.get(0)},sort:function(u,t){var e=u.toArray();t?pe.sort(e,t):pe.sort(e);for(var l=u.iterator(),g=0,y=e.length;g<y;g++)l.next(),l.set(e[g])},singletonList:function(u){var t=new Lt;return t.add(u),t}},dl=(function(){function u(){r(this,u)}return d(u,null,[{key:"maxDistance",value:function(t,e,l,g,y,w,T,M){var z=u.distance(t,e,y,w);return z=Math.max(z,u.distance(t,e,T,M)),z=Math.max(z,u.distance(l,g,y,w)),z=Math.max(z,u.distance(l,g,T,M))}},{key:"distance",value:function(t,e,l,g){var y=l-t,w=g-e;return Math.sqrt(y*y+w*w)}},{key:"maximumDistance",value:function(t,e){var l=Math.min(t.getMinX(),e.getMinX()),g=Math.min(t.getMinY(),e.getMinY()),y=Math.max(t.getMaxX(),e.getMaxX()),w=Math.max(t.getMaxY(),e.getMaxY());return u.distance(l,g,y,w)}},{key:"minMaxDistance",value:function(t,e){var l=t.getMinX(),g=t.getMinY(),y=t.getMaxX(),w=t.getMaxY(),T=e.getMinX(),M=e.getMinY(),z=e.getMaxX(),K=e.getMaxY(),it=u.maxDistance(l,g,l,w,T,M,T,K);return it=Math.min(it,u.maxDistance(l,g,l,w,T,M,z,M)),it=Math.min(it,u.maxDistance(l,g,l,w,z,K,T,K)),it=Math.min(it,u.maxDistance(l,g,l,w,z,K,z,M)),it=Math.min(it,u.maxDistance(l,g,y,g,T,M,T,K)),it=Math.min(it,u.maxDistance(l,g,y,g,T,M,z,M)),it=Math.min(it,u.maxDistance(l,g,y,g,z,K,T,K)),it=Math.min(it,u.maxDistance(l,g,y,g,z,K,z,M)),it=Math.min(it,u.maxDistance(y,w,l,w,T,M,T,K)),it=Math.min(it,u.maxDistance(y,w,l,w,T,M,z,M)),it=Math.min(it,u.maxDistance(y,w,l,w,z,K,T,K)),it=Math.min(it,u.maxDistance(y,w,l,w,z,K,z,M)),it=Math.min(it,u.maxDistance(y,w,y,g,T,M,T,K)),it=Math.min(it,u.maxDistance(y,w,y,g,T,M,z,M)),it=Math.min(it,u.maxDistance(y,w,y,g,z,K,T,K)),it=Math.min(it,u.maxDistance(y,w,y,g,z,K,z,M))}}])})(),Ii=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"maximumDistance",value:function(){return dl.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(t,e){var l=u.isComposite(this._boundable1),g=u.isComposite(this._boundable2);if(l&&g)return u.area(this._boundable1)>u.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(l)return this.expand(this._boundable1,this._boundable2,!1,t,e),null;if(g)return this.expand(this._boundable2,this._boundable1,!0,t,e),null;throw new X("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(u.isComposite(this._boundable1)||u.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0}},{key:"expand",value:function(t,e,l,g,y){for(var w=t.getChildBoundables().iterator();w.hasNext();){var T=w.next(),M=null;(M=l?new u(e,T,this._itemDistance):new u(T,e,this._itemDistance)).getDistance()<y&&g.add(M)}}},{key:"getBoundable",value:function(t){return t===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],l=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=l,this._distance=this.distance()}},{key:"area",value:function(t){return t.getBounds().getArea()}},{key:"isComposite",value:function(t){return t instanceof _e}}])})(),Ps=(function(){return d((function u(){r(this,u)}),[{key:"visitItem",value:function(u){}}])})(),Yi=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"queryInternal",value:function(){if(St(arguments[2],Ps)&&arguments[0]instanceof Object&&arguments[1]instanceof _e)for(var t=arguments[0],e=arguments[2],l=arguments[1].getChildBoundables(),g=0;g<l.size();g++){var y=l.get(g);this.getIntersectsOp().intersects(y.getBounds(),t)&&(y instanceof _e?this.queryInternal(t,y,e):y instanceof At?e.visitItem(y.getItem()):dt.shouldNeverReachHere())}else if(St(arguments[2],ki)&&arguments[0]instanceof Object&&arguments[1]instanceof _e)for(var w=arguments[0],T=arguments[2],M=arguments[1].getChildBoundables(),z=0;z<M.size();z++){var K=M.get(z);this.getIntersectsOp().intersects(K.getBounds(),w)&&(K instanceof _e?this.queryInternal(w,K,T):K instanceof At?T.add(K.getItem()):dt.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(t){return t.get(t.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var l=e.next();l instanceof _e?t+=this.size(l):l instanceof At&&(t+=1)}return t}}},{key:"removeItem",value:function(t,e){for(var l=null,g=t.getChildBoundables().iterator();g.hasNext();){var y=g.next();y instanceof At&&y.getItem()===e&&(l=y)}return l!==null&&(t.getChildBoundables().remove(l),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new Lt:t}if(arguments.length===1){for(var e=arguments[0],l=new Lt,g=e.getChildBoundables().iterator();g.hasNext();){var y=g.next();if(y instanceof _e){var w=this.itemsTree(y);w!==null&&l.add(w)}else y instanceof At?l.add(y.getItem()):dt.shouldNeverReachHere()}return l.size()<=0?null:l}}},{key:"insert",value:function(t,e){dt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new At(t,e))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var t=arguments[0],e=new Lt;return this.boundablesAtLevel(t,this._root,e),e}if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2];if(dt.isTrue(l>-2),g.getLevel()===l)return y.add(g),null;for(var w=g.getChildBoundables().iterator();w.hasNext();){var T=w.next();T instanceof _e?this.boundablesAtLevel(l,T,y):(dt.isTrue(T instanceof At),l===-1&&y.add(T))}return null}}},{key:"query",value:function(){if(arguments.length===1){var t=arguments[0];this.build();var e=new Lt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(arguments.length===2){var l=arguments[0],g=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),l)&&this.queryInternal(l,this._root,g)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(arguments.length===3){var l=arguments[0],g=arguments[1],y=arguments[2],w=this.removeItem(g,y);if(w)return!0;for(var T=null,M=g.getChildBoundables().iterator();M.hasNext();){var z=M.next();if(this.getIntersectsOp().intersects(z.getBounds(),l)&&z instanceof _e&&(w=this.remove(l,z,y))){T=z;break}}return T!==null&&T.getChildBoundables().isEmpty()&&g.getChildBoundables().remove(T),w}}},{key:"createHigherLevels",value:function(t,e){dt.isTrue(!t.isEmpty());var l=this.createParentBoundables(t,e+1);return l.size()===1?l.get(0):this.createHigherLevels(l,e+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var l=e.next();if(l instanceof _e){var g=this.depth(l);g>t&&(t=g)}}return t+1}}},{key:"createParentBoundables",value:function(t,e){dt.isTrue(!t.isEmpty());var l=new Lt;l.add(this.createNode(e));var g=new Lt(t);Hi.sort(g,this.getComparator());for(var y=g.iterator();y.hasNext();){var w=y.next();this.lastNode(l).getChildBoundables().size()===this.getNodeCapacity()&&l.add(this.createNode(e)),this.lastNode(l).addChildBoundable(w)}return l}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[P]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new Lt,this._nodeCapacity=null,arguments.length===0)u.constructor_.call(this,u.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var t=arguments[0];dt.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}},{key:"compareDoubles",value:function(t,e){return t>e?1:t<e?-1:0}}])})();Yi.IntersectsOp=function(){},Yi.DEFAULT_NODE_CAPACITY=10;var gl=(function(){return d((function u(){r(this,u)}),[{key:"distance",value:function(u,t){}}])})(),oi=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(e,l){dt.isTrue(e.length>0);for(var g=new Lt,y=0;y<e.length;y++)g.addAll(this.createParentBoundablesFromVerticalSlice(e[y],l));return g}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var e=arguments[0],l=arguments[1];return this.nearestNeighbourK(e,rt.POSITIVE_INFINITY,l)}if(arguments.length===3){var g=arguments[0],y=arguments[2],w=arguments[1],T=new vr;T.add(g);for(var M=new vr;!T.isEmpty()&&w>=0;){var z=T.poll(),K=z.getDistance();if(K>=w)break;z.isLeaves()?M.size()<y?M.add(z):(M.peek().getDistance()>K&&(M.poll(),M.add(z)),w=M.peek().getDistance()):z.expandToQueue(T,w)}return t.getItems(M)}}},{key:"createNode",value:function(e){return new br(e)}},{key:"size",value:function(){return arguments.length===0?S(t,"size",this,1).call(this):S(t,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof qt))return S(t,"insert",this,1).apply(this,arguments);var e=arguments[0],l=arguments[1];if(e.isNull())return null;S(t,"insert",this,1).call(this,e,l)}},{key:"getIntersectsOp",value:function(){return t.intersectsOp}},{key:"verticalSlices",value:function(e,l){for(var g=Math.trunc(Math.ceil(e.size()/l)),y=new Array(l).fill(null),w=e.iterator(),T=0;T<l;T++){y[T]=new Lt;for(var M=0;w.hasNext()&&M<g;){var z=w.next();y[T].add(z),M++}}return y}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];return S(t,"query",this,1).call(this,e)}if(arguments.length===2){var l=arguments[0],g=arguments[1];S(t,"query",this,1).call(this,l,g)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(e,l){return S(t,"createParentBoundables",this,1).call(this,e,l)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof qt){var e=arguments[0],l=arguments[1];return S(t,"remove",this,1).call(this,e,l)}return S(t,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?S(t,"depth",this,1).call(this):S(t,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(e,l){dt.isTrue(!e.isEmpty());var g=Math.trunc(Math.ceil(e.size()/this.getNodeCapacity())),y=new Lt(e);Hi.sort(y,t.xComparator);var w=this.verticalSlices(y,Math.trunc(Math.ceil(Math.sqrt(g))));return this.createParentBoundablesFromVerticalSlices(w,l)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(St(arguments[0],gl)){var e=arguments[0];if(this.isEmpty())return null;var l=new Ii(this.getRoot(),this.getRoot(),e);return this.nearestNeighbour(l)}if(arguments[0]instanceof Ii){var g=arguments[0],y=rt.POSITIVE_INFINITY,w=null,T=new vr;for(T.add(g);!T.isEmpty()&&y>0;){var M=T.poll(),z=M.getDistance();if(z>=y)break;M.isLeaves()?(y=z,w=M):M.expandToQueue(T,y)}return w===null?null:[w.getBoundable(0).getItem(),w.getBoundable(1).getItem()]}}else{if(arguments.length===2){var K=arguments[0],it=arguments[1];if(this.isEmpty()||K.isEmpty())return null;var lt=new Ii(this.getRoot(),K.getRoot(),it);return this.nearestNeighbour(lt)}if(arguments.length===3){var gt=arguments[2],bt=new At(arguments[0],arguments[1]),wt=new Ii(this.getRoot(),bt,gt);return this.nearestNeighbour(wt)[0]}if(arguments.length===4){var zt=arguments[2],Ot=arguments[3],Jt=new At(arguments[0],arguments[1]),ee=new Ii(this.getRoot(),Jt,zt);return this.nearestNeighbourK(ee,Ot)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var e=arguments[0],l=arguments[1],g=rt.POSITIVE_INFINITY,y=new vr;for(y.add(e);!y.isEmpty();){var w=y.poll(),T=w.getDistance();if(T>l)return!1;if(w.maximumDistance()<=l)return!0;if(w.isLeaves()){if((g=T)<=l)return!0}else w.expandToQueue(y,g)}return!1}if(arguments.length===3){var M=arguments[0],z=arguments[1],K=arguments[2],it=new Ii(this.getRoot(),M.getRoot(),z);return this.isWithinDistance(it,K)}}},{key:"interfaces_",get:function(){return[He,P]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var e=arguments[0];Yi.constructor_.call(this,e)}}},{key:"centreX",value:function(e){return t.avg(e.getMinX(),e.getMaxX())}},{key:"avg",value:function(e,l){return(e+l)/2}},{key:"getItems",value:function(e){for(var l=new Array(e.size()).fill(null),g=0;!e.isEmpty();){var y=e.poll();l[g]=y.getBoundable(0).getItem(),g++}return l}},{key:"centreY",value:function(e){return t.avg(e.getMinY(),e.getMaxY())}}])})(Yi),br=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"computeBounds",value:function(){for(var e=null,l=this.getChildBoundables().iterator();l.hasNext();){var g=l.next();e===null?e=new qt(g.getBounds()):e.expandToInclude(g.getBounds())}return e}}],[{key:"constructor_",value:function(){var e=arguments[0];_e.constructor_.call(this,e)}}])})(_e);oi.STRtreeNode=br,oi.xComparator=new((function(){return d((function u(){r(this,u)}),[{key:"interfaces_",get:function(){return[ht]}},{key:"compare",value:function(u,t){return Yi.compareDoubles(oi.centreX(u.getBounds()),oi.centreX(t.getBounds()))}}])})()),oi.yComparator=new((function(){return d((function u(){r(this,u)}),[{key:"interfaces_",get:function(){return[ht]}},{key:"compare",value:function(u,t){return Yi.compareDoubles(oi.centreY(u.getBounds()),oi.centreY(t.getBounds()))}}])})()),oi.intersectsOp=new((function(){return d((function u(){r(this,u)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(u,t){return u.intersects(t)}}])})()),oi.DEFAULT_NODE_CAPACITY=10;var pl=(function(){function u(){r(this,u)}return d(u,null,[{key:"relativeSign",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"compare",value:function(t,e,l){if(e.equals2D(l))return 0;var g=u.relativeSign(e.x,l.x),y=u.relativeSign(e.y,l.y);switch(t){case 0:return u.compareValue(g,y);case 1:return u.compareValue(y,g);case 2:return u.compareValue(y,-g);case 3:return u.compareValue(-g,y);case 4:return u.compareValue(-g,-y);case 5:return u.compareValue(-y,-g);case 6:return u.compareValue(-y,g);case 7:return u.compareValue(g,-y)}return dt.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}])})(),si=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(u){var t=u;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?pl.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===u}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var u=arguments[0],t=arguments[1],e=arguments[2],l=arguments[3];this._segString=u,this.coord=new tt(t),this.segmentIndex=e,this._segmentOctant=l,this._isInterior=!t.equals2D(u.getCoordinate(e))}}])})(),ml=(function(){return d((function u(){r(this,u)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),Ns=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var u=new En;this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var l=t.next();this.addEdgeCoordinates(e,l,u),e=l}return u.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var u=new Lt;this.findCollapsesFromInsertedNodes(u),this.findCollapsesFromExistingVertices(u);for(var t=u.iterator();t.hasNext();){var e=t.next().intValue();this.add(this._edge.getCoordinate(e),e)}}},{key:"createSplitEdgePts",value:function(u,t){var e=t.segmentIndex-u.segmentIndex+2;if(e===2)return[new tt(u.coord),new tt(t.coord)];var l=this._edge.getCoordinate(t.segmentIndex),g=t.isInterior()||!t.coord.equals2D(l);g||e--;var y=new Array(e).fill(null),w=0;y[w++]=new tt(u.coord);for(var T=u.segmentIndex+1;T<=t.segmentIndex;T++)y[w++]=this._edge.getCoordinate(T);return g&&(y[w]=new tt(t.coord)),y}},{key:"print",value:function(u){u.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"findCollapsesFromExistingVertices",value:function(u){for(var t=0;t<this._edge.size()-2;t++){var e=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var l=this._edge.getCoordinate(t+2);e.equals2D(l)&&u.add(nn.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(u,t,e){var l=this.createSplitEdgePts(u,t);e.add(l,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),e=t.next();t.hasNext();){var l=t.next(),g=this.createSplitEdge(e,l);u.add(g),e=l}}},{key:"findCollapseIndex",value:function(u,t,e){if(!u.coord.equals2D(t.coord))return!1;var l=t.segmentIndex-u.segmentIndex;return t.isInterior()||l--,l===1&&(e[0]=u.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(u){for(var t=new Array(1).fill(null),e=this.iterator(),l=e.next();e.hasNext();){var g=e.next();this.findCollapseIndex(l,g,t)&&u.add(nn.valueOf(t[0])),l=g}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var u=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(u),u)}},{key:"createSplitEdge",value:function(u,t){var e=this.createSplitEdgePts(u,t);return new mi(e,this._edge.getData())}},{key:"add",value:function(u,t){var e=new si(this._edge,u,t,this._edge.getSegmentOctant(t)),l=this._nodeMap.get(e);return l!==null?(dt.isTrue(l.coord.equals2D(u),"Found equal nodes with different coordinates"),l):(this._nodeMap.put(e,e),e)}},{key:"checkSplitEdgesCorrectness",value:function(u){var t=this._edge.getCoordinates(),e=u.get(0).getCoordinate(0);if(!e.equals2D(t[0]))throw new _t("bad split edge start point at "+e);var l=u.get(u.size()-1).getCoordinates(),g=l[l.length-1];if(!g.equals2D(t[t.length-1]))throw new _t("bad split edge end point at "+g)}}],[{key:"constructor_",value:function(){this._nodeMap=new re,this._edge=null;var u=arguments[0];this._edge=u}}])})(),Ci=(function(){function u(){r(this,u)}return d(u,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new X("Cannot compute the octant for point ( "+t+", "+e+" )");var l=Math.abs(t),g=Math.abs(e);return t>=0?e>=0?l>=g?0:1:l>=g?7:6:e>=0?l>=g?3:2:l>=g?4:5}if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var y=arguments[0],w=arguments[1],T=w.x-y.x,M=w.y-y.y;if(T===0&&M===0)throw new X("Cannot compute the octant for two identical points "+y);return u.octant(T,M)}}}])})(),Os=(function(){return d((function u(){r(this,u)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(u){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(u){}},{key:"getData",value:function(){}}])})(),Rs=(function(){return d((function u(){r(this,u)}),[{key:"addIntersection",value:function(u,t){}},{key:"interfaces_",get:function(){return[Os]}}])})(),mi=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(t){return this._pts[t]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}},{key:"setData",value:function(t){this._data=t}},{key:"safeOctant",value:function(t,e){return t.equals2D(e)?0:Ci.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var l=arguments[1],g=arguments[3],y=new tt(arguments[0].getIntersection(g));this.addIntersection(y,l)}}},{key:"toString",value:function(){return Cn.toLineString(new Tn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var l=e,g=l+1;if(g<this._pts.length){var y=this._pts[g];t.equals2D(y)&&(l=g)}return this._nodeList.add(t,l)}},{key:"addIntersections",value:function(t,e,l){for(var g=0;g<t.getIntersectionNum();g++)this.addIntersection(t,e,l,g)}},{key:"interfaces_",get:function(){return[Rs]}}],[{key:"constructor_",value:function(){this._nodeList=new Ns(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var t=arguments[0],e=new Lt;return u.getNodedSubstrings(t,e),e}if(arguments.length===2)for(var l=arguments[1],g=arguments[0].iterator();g.hasNext();)g.next().getNodeList().addSplitEdges(l)}}])})(),Pe=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof u){var t=arguments[0],e=Tt.index(this.p0,this.p1,t.p0),l=Tt.index(this.p0,this.p1,t.p1);return e>=0&&l>=0||e<=0&&l<=0?Math.max(e,l):0}if(arguments[0]instanceof tt){var g=arguments[0];return Tt.index(this.p0,this.p1,g)}}},{key:"toGeometry",value:function(t){return t.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(t){if(!(t instanceof u))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}},{key:"intersection",value:function(t){var e=new pi;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof tt){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new tt(t);var e=this.projectionFactor(t),l=new tt;return l.x=this.p0.x+e*(this.p1.x-this.p0.x),l.y=this.p0.y+e*(this.p1.y-this.p0.y),l}if(arguments[0]instanceof u){var g=arguments[0],y=this.projectionFactor(g.p0),w=this.projectionFactor(g.p1);if(y>=1&&w>=1||y<=0&&w<=0)return null;var T=this.project(g.p0);y<0&&(T=this.p0),y>1&&(T=this.p1);var M=this.project(g.p1);return w<0&&(M=this.p0),w>1&&(M=this.p1),new u(T,M)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(t){return t===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return Ze.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return u.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,l=this.p1.y-this.p0.y,g=e*e+l*l;return g<=0?rt.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*l)/g}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(e!==null)return[e,e];var l=new Array(2).fill(null),g=rt.MAX_VALUE,y=null,w=this.closestPoint(t.p0);g=w.distance(t.p0),l[0]=w,l[1]=t.p0;var T=this.closestPoint(t.p1);(y=T.distance(t.p1))<g&&(g=y,l[0]=T,l[1]=t.p1);var M=t.closestPoint(this.p0);(y=M.distance(this.p0))<g&&(g=y,l[0]=this.p0,l[1]=M);var z=t.closestPoint(this.p1);return(y=z.distance(this.p1))<g&&(g=y,l[0]=this.p1,l[1]=z),l}},{key:"closestPoint",value:function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(t){var e=t,l=this.p0.compareTo(e.p0);return l!==0?l:this.p1.compareTo(e.p1)}},{key:"reverse",value:function(){var t=this.p0;this.p0=this.p1,this.p1=t}},{key:"equalsTopo",value:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)}},{key:"lineIntersection",value:function(t){return oo.intersection(this.p0,this.p1,t.p0,t.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(t,e){var l=this.p0.x+t*(this.p1.x-this.p0.x),g=this.p0.y+t*(this.p1.y-this.p0.y),y=this.p1.x-this.p0.x,w=this.p1.y-this.p0.y,T=Math.sqrt(y*y+w*w),M=0,z=0;if(e!==0){if(T<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");M=e*y/T,z=e*w/T}return new tt(l-z,g+M)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=l.x,this.p1.y=l.y}}},{key:"segmentFraction",value:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||rt.isNaN(e))&&(e=1),e}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(t){var e=this.p1.getY()-this.p0.getY(),l=this.p0.getX()-this.p1.getX(),g=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),y=e*e+l*l,w=e*e-l*l,T=t.getX(),M=t.getY();return new tt((-w*T-2*e*l*M-2*e*g)/y,(w*M-2*e*l*T-2*l*g)/y)}},{key:"distance",value:function(){if(arguments[0]instanceof u){var t=arguments[0];return Ze.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof tt){var e=arguments[0];return Ze.pointToSegment(e,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new tt;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}},{key:"hashCode",value:function(){var t=rt.doubleToLongBits(this.p0.x);t^=31*rt.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),l=rt.doubleToLongBits(this.p1.x);return l^=31*rt.doubleToLongBits(this.p1.y),e^(Math.trunc(l)^Math.trunc(l>>32))}},{key:"interfaces_",get:function(){return[ot,P]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)u.constructor_.call(this,new tt,new tt);else if(arguments.length===1){var t=arguments[0];u.constructor_.call(this,t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this.p0=e,this.p1=l}else if(arguments.length===4){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3];u.constructor_.call(this,new tt(g,y),new tt(w,T))}}},{key:"midPoint",value:function(t,e){return new tt((t.x+e.x)/2,(t.y+e.y)/2)}}])})(),Ds=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var u=arguments[1],t=arguments[2],e=arguments[3];arguments[0].getLineSegment(u,this._overlapSeg1),t.getLineSegment(e,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Pe,this._overlapSeg2=new Pe}}])})(),wo=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(u,t){t.p0=this._pts[u],t.p1=this._pts[u+1]}},{key:"computeSelect",value:function(u,t,e,l){var g=this._pts[t],y=this._pts[e];if(e-t==1)return l.select(this,t),null;if(!u.intersects(g,y))return null;var w=Math.trunc((t+e)/2);t<w&&this.computeSelect(u,t,w,l),w<e&&this.computeSelect(u,w,e,l)}},{key:"getCoordinates",value:function(){for(var u=new Array(this._end-this._start+1).fill(null),t=0,e=this._start;e<=this._end;e++)u[t++]=this._pts[e];return u}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var u=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,u,u._start,u._end,t)}else if(arguments.length===6){var e=arguments[0],l=arguments[1],g=arguments[2],y=arguments[3],w=arguments[4],T=arguments[5];if(l-e==1&&w-y==1)return T.overlap(this,e,g,y),null;if(!this.overlaps(e,l,g,y,w))return null;var M=Math.trunc((e+l)/2),z=Math.trunc((y+w)/2);e<M&&(y<z&&this.computeOverlaps(e,M,g,y,z,T),z<w&&this.computeOverlaps(e,M,g,z,w,T)),M<l&&(y<z&&this.computeOverlaps(M,l,g,y,z,T),z<w&&this.computeOverlaps(M,l,g,z,w,T))}}},{key:"setId",value:function(u){this._id=u}},{key:"select",value:function(u,t){this.computeSelect(u,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var u=this._pts[this._start],t=this._pts[this._end];this._env=new qt(u,t)}return this._env}},{key:"overlaps",value:function(u,t,e,l,g){return qt.intersects(this._pts[u],this._pts[t],e._pts[l],e._pts[g])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var u=arguments[0],t=arguments[1],e=arguments[2],l=arguments[3];this._pts=u,this._start=t,this._end=e,this._context=l}}])})(),yl=(function(){function u(){r(this,u)}return d(u,null,[{key:"findChainEnd",value:function(t,e){for(var l=e;l<t.length-1&&t[l].equals2D(t[l+1]);)l++;if(l>=t.length-1)return t.length-1;for(var g=ye.quadrant(t[l],t[l+1]),y=e+1;y<t.length&&!(!t[y-1].equals2D(t[y])&&ye.quadrant(t[y-1],t[y])!==g);)y++;return y-1}},{key:"getChains",value:function(){if(arguments.length===1){var t=arguments[0];return u.getChains(t,null)}if(arguments.length===2){var e=arguments[0],l=arguments[1],g=new Lt,y=0;do{var w=u.findChainEnd(e,y),T=new wo(e,y,w,l);g.add(T),y=w}while(y<e.length-1);return g}}}])})(),ko=(function(){return d((function u(){r(this,u)}),[{key:"computeNodes",value:function(u){}},{key:"getNodedSubstrings",value:function(){}}])})(),xr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(u){this._segInt=u}},{key:"interfaces_",get:function(){return[ko]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.setSegmentIntersector(u)}}}}])})(),Lo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return mi.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(e){for(var l=yl.getChains(e.getCoordinates(),e).iterator();l.hasNext();){var g=l.next();g.setId(this._idCounter++),this._index.insert(g.getEnvelope(),g),this._monoChains.add(g)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e;for(var l=e.iterator();l.hasNext();)this.add(l.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var e=new Eo(this._segInt),l=this._monoChains.iterator();l.hasNext();)for(var g=l.next(),y=this._index.query(g.getEnvelope()).iterator();y.hasNext();){var w=y.next();if(w.getId()>g.getId()&&(g.computeOverlaps(w,e),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new Lt,this._index=new oi,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var e=arguments[0];xr.constructor_.call(this,e)}}}}])})(xr),Eo=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"overlap",value:function(){if(arguments.length!==4)return S(t,"overlap",this,1).apply(this,arguments);var e=arguments[1],l=arguments[2],g=arguments[3],y=arguments[0].getContext(),w=l.getContext();this._si.processIntersections(y,e,w,g)}}],[{key:"constructor_",value:function(){this._si=null;var e=arguments[0];this._si=e}}])})(Ds);Lo.SegmentOverlapAction=Eo;var ze=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isDeletable",value:function(t,e,l,g){var y=this._inputLine[t],w=this._inputLine[e],T=this._inputLine[l];return!!this.isConcave(y,w,T)&&!!this.isShallow(y,w,T,g)&&this.isShallowSampled(y,w,t,l,g)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,e=this.findNextNonDeletedIndex(t),l=this.findNextNonDeletedIndex(e),g=!1;l<this._inputLine.length;){var y=!1;this.isDeletable(t,e,l,this._distanceTol)&&(this._isDeleted[e]=u.DELETE,y=!0,g=!0),t=y?l:e,e=this.findNextNonDeletedIndex(t),l=this.findNextNonDeletedIndex(e)}return g}},{key:"isShallowConcavity",value:function(t,e,l,g){return Tt.index(t,e,l)===this._angleOrientation&&Ze.pointToSegment(e,t,l)<g}},{key:"isShallowSampled",value:function(t,e,l,g,y){var w=Math.trunc((g-l)/u.NUM_PTS_TO_CHECK);w<=0&&(w=1);for(var T=l;T<g;T+=w)if(!this.isShallow(t,e,this._inputLine[T],y))return!1;return!0}},{key:"isConcave",value:function(t,e,l){var g=Tt.index(t,e,l)===this._angleOrientation;return g}},{key:"simplify",value:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=Tt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===u.DELETE;)e++;return e}},{key:"isShallow",value:function(t,e,l,g){return Ze.pointToSegment(e,t,l)<g}},{key:"collapseLine",value:function(){for(var t=new En,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==u.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Tt.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}},{key:"simplify",value:function(t,e){return new u(t).simplify(e)}}])})();ze.INIT=0,ze.DELETE=1,ze.KEEP=1,ze.NUM_PTS_TO_CHECK=10;var An=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getCoordinates",value:function(){return this._ptList.toArray(u.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"addPt",value:function(t){var e=new tt(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(t,e){if(e)for(var l=0;l<t.length;l++)this.addPt(t[l]);else for(var g=t.length-1;g>=0;g--)this.addPt(t[g])}},{key:"isRedundant",value:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}},{key:"toString",value:function(){return new ii().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var t=new tt(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)}},{key:"setMinimumVertexDistance",value:function(t){this._minimimVertexDistance=t}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Lt}}])})();An.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var he=(function(){function u(){r(this,u)}return d(u,null,[{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"normalize",value:function(t){for(;t>Math.PI;)t-=u.PI_TIMES_2;for(;t<=-Math.PI;)t+=u.PI_TIMES_2;return t}},{key:"angle",value:function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var e=arguments[0],l=arguments[1],g=l.x-e.x,y=l.y-e.y;return Math.atan2(y,g)}}},{key:"isAcute",value:function(t,e,l){var g=t.x-e.x,y=t.y-e.y;return g*(l.x-e.x)+y*(l.y-e.y)>0}},{key:"isObtuse",value:function(t,e,l){var g=t.x-e.x,y=t.y-e.y;return g*(l.x-e.x)+y*(l.y-e.y)<0}},{key:"interiorAngle",value:function(t,e,l){var g=u.angle(e,t),y=u.angle(e,l);return Math.abs(y-g)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=u.PI_TIMES_2;t>=u.PI_TIMES_2&&(t=0)}else{for(;t>=u.PI_TIMES_2;)t-=u.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,e,l){var g=u.angle(e,t),y=u.angle(e,l);return u.diff(g,y)}},{key:"diff",value:function(t,e){var l=null;return(l=t<e?e-t:t-e)>Math.PI&&(l=2*Math.PI-l),l}},{key:"toRadians",value:function(t){return t*Math.PI/180}},{key:"getTurn",value:function(t,e){var l=Math.sin(e-t);return l>0?u.COUNTERCLOCKWISE:l<0?u.CLOCKWISE:u.NONE}},{key:"angleBetweenOriented",value:function(t,e,l){var g=u.angle(e,t),y=u.angle(e,l)-g;return y<=-Math.PI?y+u.PI_TIMES_2:y>Math.PI?y-u.PI_TIMES_2:y}}])})();he.PI_TIMES_2=2*Math.PI,he.PI_OVER_2=Math.PI/2,he.PI_OVER_4=Math.PI/4,he.COUNTERCLOCKWISE=Tt.COUNTERCLOCKWISE,he.CLOCKWISE=Tt.CLOCKWISE,he.NONE=Tt.COLLINEAR;var Pn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"addNextSegment",value:function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var l=Tt.index(this._s0,this._s1,this._s2),g=l===Tt.CLOCKWISE&&this._side===ct.LEFT||l===Tt.COUNTERCLOCKWISE&&this._side===ct.RIGHT;l===0?this.addCollinear(e):g?this.addOutsideTurn(l,e):this.addInsideTurn(l,e)}},{key:"addLineEndCap",value:function(t,e){var l=new Pe(t,e),g=new Pe;this.computeOffsetSegment(l,ct.LEFT,this._distance,g);var y=new Pe;this.computeOffsetSegment(l,ct.RIGHT,this._distance,y);var w=e.x-t.x,T=e.y-t.y,M=Math.atan2(T,w);switch(this._bufParams.getEndCapStyle()){case U.CAP_ROUND:this._segList.addPt(g.p1),this.addDirectedFillet(e,M+Math.PI/2,M-Math.PI/2,Tt.CLOCKWISE,this._distance),this._segList.addPt(y.p1);break;case U.CAP_FLAT:this._segList.addPt(g.p1),this._segList.addPt(y.p1);break;case U.CAP_SQUARE:var z=new tt;z.x=Math.abs(this._distance)*Math.cos(M),z.y=Math.abs(this._distance)*Math.sin(M);var K=new tt(g.p1.x+z.x,g.p1.y+z.y),it=new tt(y.p1.x+z.x,y.p1.y+z.y);this._segList.addPt(K),this._segList.addPt(it)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,l,g){var y=oo.intersection(e.p0,e.p1,l.p0,l.p1);if(y!==null&&(g<=0?1:y.distance(t)/Math.abs(g))<=this._bufParams.getMitreLimit())return this._segList.addPt(y),null;this.addLimitedMitreJoin(e,l,g,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*u.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===U.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===U.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(t){this._segList.addPt(new tt(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new tt(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new tt(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new tt(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(t,e){this._segList.addPts(t,e)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(t,e,l,g,y){var w=e.x-t.x,T=e.y-t.y,M=Math.atan2(T,w),z=l.x-t.x,K=l.y-t.y,it=Math.atan2(K,z);g===Tt.CLOCKWISE?M<=it&&(M+=2*Math.PI):M>=it&&(M-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,M,it,g,y),this._segList.addPt(l)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(t,e,l){this._s1=t,this._s2=e,this._side=l,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,l,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(t,e,l,g){var y=this._seg0.p1,w=he.angle(y,this._seg0.p0),T=he.angleBetweenOriented(this._seg0.p0,y,this._seg1.p1)/2,M=he.normalize(w+T),z=he.normalize(M+Math.PI),K=g*l,it=l-K*Math.abs(Math.sin(T)),lt=y.x+K*Math.cos(z),gt=y.y+K*Math.sin(z),bt=new tt(lt,gt),wt=new Pe(y,bt),zt=wt.pointAlongOffset(1,it),Ot=wt.pointAlongOffset(1,-it);this._side===ct.LEFT?(this._segList.addPt(zt),this._segList.addPt(Ot)):(this._segList.addPt(Ot),this._segList.addPt(zt))}},{key:"addDirectedFillet",value:function(t,e,l,g,y){var w=g===Tt.CLOCKWISE?-1:1,T=Math.abs(e-l),M=Math.trunc(T/this._filletAngleQuantum+.5);if(M<1)return null;for(var z=T/M,K=new tt,it=0;it<M;it++){var lt=e+w*it*z;K.x=t.x+y*Math.cos(lt),K.y=t.y+y*Math.sin(lt),this._segList.addPt(K)}}},{key:"computeOffsetSegment",value:function(t,e,l,g){var y=e===ct.LEFT?1:-1,w=t.p1.x-t.p0.x,T=t.p1.y-t.p0.y,M=Math.sqrt(w*w+T*T),z=y*l*w/M,K=y*l*T/M;g.p0.x=t.p0.x-K,g.p0.y=t.p0.y+z,g.p1.x=t.p1.x-K,g.p1.y=t.p1.y+z}},{key:"addInsideTurn",value:function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*u.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var l=new tt((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l);var g=new tt((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(g)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(t){var e=new tt(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}},{key:"init",value:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new An,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*u.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===U.JOIN_BEVEL||this._bufParams.getJoinStyle()===U.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,Tt.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Pe,this._seg1=new Pe,this._offset0=new Pe,this._offset1=new Pe,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],l=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new pi,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===U.JOIN_ROUND&&(this._closingSegLengthFactor=u.MAX_CLOSING_SEG_LEN_FACTOR),this.init(l)}}])})();Pn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Pn.MAX_CLOSING_SEG_LEN_FACTOR=80;var Nn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getOffsetCurve",value:function(t,e){if(this._distance=e,e===0)return null;var l=e<0,g=Math.abs(e),y=this.getSegGen(g);t.length<=1?this.computePointCurve(t[0],y):this.computeOffsetCurve(t,l,y);var w=y.getCoordinates();return l&&se.reverse(w),w}},{key:"computeSingleSidedBufferCurve",value:function(t,e,l){var g=this.simplifyTolerance(this._distance);if(e){l.addSegments(t,!0);var y=ze.simplify(t,-g),w=y.length-1;l.initSideSegments(y[w],y[w-1],ct.LEFT),l.addFirstSegment();for(var T=w-2;T>=0;T--)l.addNextSegment(y[T],!0)}else{l.addSegments(t,!1);var M=ze.simplify(t,g),z=M.length-1;l.initSideSegments(M[0],M[1],ct.LEFT),l.addFirstSegment();for(var K=2;K<=z;K++)l.addNextSegment(M[K],!0)}l.addLastSegment(),l.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,l){var g=this.simplifyTolerance(this._distance);e===ct.RIGHT&&(g=-g);var y=ze.simplify(t,g),w=y.length-1;l.initSideSegments(y[w-1],y[0],e);for(var T=1;T<=w;T++){var M=T!==1;l.addNextSegment(y[T],M)}l.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var l=this.simplifyTolerance(this._distance),g=ze.simplify(t,l),y=g.length-1;e.initSideSegments(g[0],g[1],ct.LEFT);for(var w=2;w<=y;w++)e.addNextSegment(g[w],!0);e.addLastSegment(),e.addLineEndCap(g[y-1],g[y]);var T=ze.simplify(t,-l),M=T.length-1;e.initSideSegments(T[M],T[M-1],ct.LEFT);for(var z=M-2;z>=0;z--)e.addNextSegment(T[z],!0);e.addLastSegment(),e.addLineEndCap(T[1],T[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case U.CAP_ROUND:e.createCircle(t);break;case U.CAP_SQUARE:e.createSquare(t)}}},{key:"getLineCurve",value:function(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;var l=Math.abs(e),g=this.getSegGen(l);if(t.length<=1)this.computePointCurve(t[0],g);else if(this._bufParams.isSingleSided()){var y=e<0;this.computeSingleSidedBufferCurve(t,y,g)}else this.computeLineBufferCurve(t,g);return g.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,e,l){if(this._distance=l,t.length<=2)return this.getLineCurve(t,l);if(l===0)return u.copyCoordinates(t);var g=this.getSegGen(l);return this.computeRingBufferCurve(t,e,g),g.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,l){var g=this.simplifyTolerance(this._distance);if(e){var y=ze.simplify(t,-g),w=y.length-1;l.initSideSegments(y[w],y[w-1],ct.LEFT),l.addFirstSegment();for(var T=w-2;T>=0;T--)l.addNextSegment(y[T],!0)}else{var M=ze.simplify(t,g),z=M.length-1;l.initSideSegments(M[0],M[1],ct.LEFT),l.addFirstSegment();for(var K=2;K<=z;K++)l.addNextSegment(M[K],!0)}l.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return t===0||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new Pn(this._precisionModel,this._bufParams,t)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}},{key:"copyCoordinates",value:function(t){for(var e=new Array(t.length).fill(null),l=0;l<e.length;l++)e[l]=new tt(t[l]);return e}}])})(),Ne=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var u=arguments[0],t=new Lt,e=this._subgraphs.iterator();e.hasNext();){var l=e.next(),g=l.getEnvelope();u.y<g.getMinY()||u.y>g.getMaxY()||this.findStabbedSegments(u,l.getDirectedEdges(),t)}return t}if(arguments.length===3){if(St(arguments[2],ki)&&arguments[0]instanceof tt&&arguments[1]instanceof vo){for(var y=arguments[0],w=arguments[1],T=arguments[2],M=w.getEdge().getCoordinates(),z=0;z<M.length-1;z++)if(this._seg.p0=M[z],this._seg.p1=M[z+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<y.x||this._seg.isHorizontal()||y.y<this._seg.p0.y||y.y>this._seg.p1.y||Tt.index(this._seg.p0,this._seg.p1,y)===Tt.RIGHT)){var K=w.getDepth(ct.LEFT);this._seg.p0.equals(M[z])||(K=w.getDepth(ct.RIGHT));var it=new To(this._seg,K);T.add(it)}}else if(St(arguments[2],ki)&&arguments[0]instanceof tt&&St(arguments[1],ki))for(var lt=arguments[0],gt=arguments[2],bt=arguments[1].iterator();bt.hasNext();){var wt=bt.next();wt.isForward()&&this.findStabbedSegments(lt,wt,gt)}}}},{key:"getDepth",value:function(u){var t=this.findStabbedSegments(u);return t.size()===0?0:Hi.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Pe;var u=arguments[0];this._subgraphs=u}}])})(),To=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(u){var t=u;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var e=this._upwardSeg.orientationIndex(t._upwardSeg);return e!==0||(e=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?e:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(u,t){var e=u.p0.compareTo(t.p0);return e!==0?e:u.p1.compareTo(t.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var u=arguments[0],t=arguments[1];this._upwardSeg=new Pe(u),this._leftDepth=t}}])})();Ne.DepthSegment=To;var Io=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,null,[{key:"constructor_",value:function(){W.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(W),Co=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getY",value:function(){var t=this.y/this.w;if(rt.isNaN(t)||rt.isInfinite(t))throw new Io;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(rt.isNaN(t)||rt.isInfinite(t))throw new Io;return t}},{key:"getCoordinate",value:function(){var t=new tt;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],l=arguments[1];this.x=e,this.y=l,this.w=1}else if(arguments[0]instanceof u&&arguments[1]instanceof u){var g=arguments[0],y=arguments[1];this.x=g.y*y.w-y.y*g.w,this.y=y.x*g.w-g.x*y.w,this.w=g.x*y.y-y.x*g.y}else if(arguments[0]instanceof tt&&arguments[1]instanceof tt){var w=arguments[0],T=arguments[1];this.x=w.y-T.y,this.y=T.x-w.x,this.w=w.x*T.y-T.x*w.y}}else if(arguments.length===3){var M=arguments[0],z=arguments[1],K=arguments[2];this.x=M,this.y=z,this.w=K}else if(arguments.length===4){var it=arguments[0],lt=arguments[1],gt=arguments[2],bt=arguments[3],wt=it.y-lt.y,zt=lt.x-it.x,Ot=it.x*lt.y-lt.x*it.y,Jt=gt.y-bt.y,ee=bt.x-gt.x,de=gt.x*bt.y-bt.x*gt.y;this.x=zt*de-ee*Ot,this.y=Jt*Ot-wt*de,this.w=wt*ee-Jt*zt}}}])})(),So=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"area",value:function(){return u.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return u.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(t===null)throw new X("Supplied point is null.");return u.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return u.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return u.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return u.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return u.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return u.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return u.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],l=arguments[2];this.p0=t,this.p1=e,this.p2=l}},{key:"area",value:function(t,e,l){return Math.abs(((l.x-t.x)*(e.y-t.y)-(e.x-t.x)*(l.y-t.y))/2)}},{key:"signedArea",value:function(t,e,l){return((l.x-t.x)*(e.y-t.y)-(e.x-t.x)*(l.y-t.y))/2}},{key:"det",value:function(t,e,l,g){return t*g-e*l}},{key:"interpolateZ",value:function(t,e,l,g){var y=e.x,w=e.y,T=l.x-y,M=g.x-y,z=l.y-w,K=g.y-w,it=T*K-M*z,lt=t.x-y,gt=t.y-w,bt=(K*lt-M*gt)/it,wt=(-z*lt+T*gt)/it;return e.getZ()+bt*(l.getZ()-e.getZ())+wt*(g.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,l){var g=t.distance(e),y=e.distance(l),w=l.distance(t),T=g;return y>T&&(T=y),w>T&&(T=w),T}},{key:"circumcentreDD",value:function(t,e,l){var g=Et.valueOf(t.x).subtract(l.x),y=Et.valueOf(t.y).subtract(l.y),w=Et.valueOf(e.x).subtract(l.x),T=Et.valueOf(e.y).subtract(l.y),M=Et.determinant(g,y,w,T).multiply(2),z=g.sqr().add(y.sqr()),K=w.sqr().add(T.sqr()),it=Et.determinant(y,z,T,K),lt=Et.determinant(g,z,w,K),gt=Et.valueOf(l.x).subtract(it.divide(M)).doubleValue(),bt=Et.valueOf(l.y).add(lt.divide(M)).doubleValue();return new tt(gt,bt)}},{key:"isAcute",value:function(t,e,l){return!!he.isAcute(t,e,l)&&!!he.isAcute(e,l,t)&&!!he.isAcute(l,t,e)}},{key:"circumcentre",value:function(t,e,l){var g=l.x,y=l.y,w=t.x-g,T=t.y-y,M=e.x-g,z=e.y-y,K=2*u.det(w,T,M,z),it=u.det(T,w*w+T*T,z,M*M+z*z),lt=u.det(w,w*w+T*T,M,M*M+z*z);return new tt(g-it/K,y+lt/K)}},{key:"perpendicularBisector",value:function(t,e){var l=e.x-t.x,g=e.y-t.y,y=new Co(t.x+l/2,t.y+g/2,1),w=new Co(t.x-g+l/2,t.y+l+g/2,1);return new Co(y,w)}},{key:"angleBisector",value:function(t,e,l){var g=e.distance(t),y=g/(g+e.distance(l)),w=l.x-t.x,T=l.y-t.y;return new tt(t.x+y*w,t.y+y*T)}},{key:"area3D",value:function(t,e,l){var g=e.x-t.x,y=e.y-t.y,w=e.getZ()-t.getZ(),T=l.x-t.x,M=l.y-t.y,z=l.getZ()-t.getZ(),K=y*z-w*M,it=w*T-g*z,lt=g*M-y*T,gt=K*K+it*it+lt*lt,bt=Math.sqrt(gt)/2;return bt}},{key:"centroid",value:function(t,e,l){var g=(t.x+e.x+l.x)/3,y=(t.y+e.y+l.y)/3;return new tt(g,y)}},{key:"inCentre",value:function(t,e,l){var g=e.distance(l),y=t.distance(l),w=t.distance(e),T=g+y+w,M=(g*t.x+y*e.x+w*l.x)/T,z=(g*t.y+y*e.y+w*l.y)/T;return new tt(M,z)}}])})(),Mo=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(u,t,e,l,g){if(t===0&&u.length<ei.MINIMUM_VALID_SIZE)return null;var y=l,w=g;u.length>=ei.MINIMUM_VALID_SIZE&&Tt.isCCW(u)&&(y=g,w=l,e=ct.opposite(e));var T=this._curveBuilder.getRingCurve(u,e,t);this.addCurve(T,y,w)}},{key:"addRingBothSides",value:function(u,t){this.addRingSide(u,t,ct.LEFT,Z.EXTERIOR,Z.INTERIOR),this.addRingSide(u,t,ct.RIGHT,Z.INTERIOR,Z.EXTERIOR)}},{key:"addPoint",value:function(u){if(this._distance<=0)return null;var t=u.getCoordinates(),e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,Z.EXTERIOR,Z.INTERIOR)}},{key:"addPolygon",value:function(u){var t=this._distance,e=ct.LEFT;this._distance<0&&(t=-this._distance,e=ct.RIGHT);var l=u.getExteriorRing(),g=se.removeRepeatedPoints(l.getCoordinates());if(this._distance<0&&this.isErodedCompletely(l,this._distance)||this._distance<=0&&g.length<3)return null;this.addRingSide(g,t,e,Z.EXTERIOR,Z.INTERIOR);for(var y=0;y<u.getNumInteriorRing();y++){var w=u.getInteriorRingN(y),T=se.removeRepeatedPoints(w.getCoordinates());this._distance>0&&this.isErodedCompletely(w,-this._distance)||this.addRingSide(T,t,ct.opposite(e),Z.INTERIOR,Z.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(u,t){var e=new So(u[0],u[1],u[2]),l=e.inCentre();return Ze.pointToSegment(l,e.p0,e.p1)<Math.abs(t)}},{key:"addLineString",value:function(u){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=se.removeRepeatedPoints(u.getCoordinates());if(se.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,Z.EXTERIOR,Z.INTERIOR)}}},{key:"addCurve",value:function(u,t,e){if(u===null||u.length<2)return null;var l=new mi(u,new Ie(0,Z.BOUNDARY,t,e));this._curveList.add(l)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(u){if(u.isEmpty())return null;if(u instanceof Ln)this.addPolygon(u);else if(u instanceof kn)this.addLineString(u);else if(u instanceof ao)this.addPoint(u);else if(u instanceof lr)this.addCollection(u);else if(u instanceof fr)this.addCollection(u);else if(u instanceof co)this.addCollection(u);else{if(!(u instanceof xe))throw new Ut(u.getGeometryType());this.addCollection(u)}}},{key:"isErodedCompletely",value:function(u,t){var e=u.getCoordinates();if(e.length<4)return t<0;if(e.length===4)return this.isTriangleErodedCompletely(e,t);var l=u.getEnvelopeInternal(),g=Math.min(l.getHeight(),l.getWidth());return t<0&&2*Math.abs(t)>g}},{key:"addCollection",value:function(u){for(var t=0;t<u.getNumGeometries();t++){var e=u.getGeometryN(t);this.add(e)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Lt;var u=arguments[0],t=arguments[1],e=arguments[2];this._inputGeom=u,this._distance=t,this._curveBuilder=e}}])})(),_l=(function(){return d((function u(){r(this,u)}),[{key:"locate",value:function(u){}}])})(),vl=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,u.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new oe;var t=this._parent.getGeometryN(this._index++);return t instanceof xe?(this._subcollectionIterator=new u(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new Ut(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[ml]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}},{key:"isAtomic",value:function(t){return!(t instanceof xe)}}])})(),Bs=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"locate",value:function(t){return u.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[_l]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,e){if(e.isEmpty())return Z.EXTERIOR;var l=e.getExteriorRing(),g=u.locatePointInRing(t,l);if(g!==Z.INTERIOR)return g;for(var y=0;y<e.getNumInteriorRing();y++){var w=e.getInteriorRingN(y),T=u.locatePointInRing(t,w);if(T===Z.BOUNDARY)return Z.BOUNDARY;if(T===Z.INTERIOR)return Z.EXTERIOR}return Z.INTERIOR}},{key:"locatePointInRing",value:function(t,e){return e.getEnvelopeInternal().intersects(t)?un.locateInRing(t,e.getCoordinates()):Z.EXTERIOR}},{key:"containsPointInPolygon",value:function(t,e){return Z.EXTERIOR!==u.locatePointInPolygon(t,e)}},{key:"locateInGeometry",value:function(t,e){if(e instanceof Ln)return u.locatePointInPolygon(t,e);if(e instanceof xe)for(var l=new vl(e);l.hasNext();){var g=l.next();if(g!==e){var y=u.locateInGeometry(t,g);if(y!==Z.EXTERIOR)return y}}return Z.EXTERIOR}},{key:"isContained",value:function(t,e){return Z.EXTERIOR!==u.locate(t,e)}},{key:"locate",value:function(t,e){return e.isEmpty()?Z.EXTERIOR:e.getEnvelopeInternal().intersects(t)?u.locateInGeometry(t,e):Z.EXTERIOR}}])})(),bl=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(u){this.getEdges();var t=this._edgeList.indexOf(u),e=t-1;return t===0&&(e=this._edgeList.size()-1),this._edgeList.get(e)}},{key:"propagateSideLabels",value:function(u){for(var t=Z.NONE,e=this.iterator();e.hasNext();){var l=e.next().getLabel();l.isArea(u)&&l.getLocation(u,ct.LEFT)!==Z.NONE&&(t=l.getLocation(u,ct.LEFT))}if(t===Z.NONE)return null;for(var g=t,y=this.iterator();y.hasNext();){var w=y.next(),T=w.getLabel();if(T.getLocation(u,ct.ON)===Z.NONE&&T.setLocation(u,ct.ON,g),T.isArea(u)){var M=T.getLocation(u,ct.LEFT),z=T.getLocation(u,ct.RIGHT);if(z!==Z.NONE){if(z!==g)throw new ti("side location conflict",w.getCoordinate());M===Z.NONE&&dt.shouldNeverReachHere("found single null side (at "+w.getCoordinate()+")"),g=M}else dt.isTrue(T.getLocation(u,ct.LEFT)===Z.NONE,"found single null side"),T.setLocation(u,ct.RIGHT,g),T.setLocation(u,ct.LEFT,g)}}}},{key:"getCoordinate",value:function(){var u=this.iterator();return u.hasNext()?u.next().getCoordinate():null}},{key:"print",value:function(u){Be.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"isAreaLabelsConsistent",value:function(u){return this.computeEdgeEndLabels(u.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(u){var t=this.getEdges();if(t.size()<=0)return!0;var e=t.size()-1,l=t.get(e).getLabel().getLocation(u,ct.LEFT);dt.isTrue(l!==Z.NONE,"Found unlabelled area edge");for(var g=l,y=this.iterator();y.hasNext();){var w=y.next().getLabel();dt.isTrue(w.isArea(u),"Found non-area edge");var T=w.getLocation(u,ct.LEFT),M=w.getLocation(u,ct.RIGHT);if(T===M||M!==g)return!1;g=T}return!0}},{key:"findIndex",value:function(u){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===u)return t;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new Lt(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(u,t,e){return this._ptInAreaLocation[u]===Z.NONE&&(this._ptInAreaLocation[u]=Bs.locate(t,e[u].getGeometry())),this._ptInAreaLocation[u]}},{key:"toString",value:function(){var u=new xn;u.append("EdgeEndStar: "+this.getCoordinate()),u.append(`
|
|
490
487
|
`);for(var t=this.iterator();t.hasNext();){var e=t.next();u.append(e),u.append(`
|
|
491
|
-
`)}return u.toString()}},{key:"computeEdgeEndLabels",value:function(u){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(u)}},{key:"computeLabelling",value:function(u){this.computeEdgeEndLabels(u[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],e=this.iterator();e.hasNext();)for(var l=e.next().getLabel(),g=0;g<2;g++)l.isLine(g)&&l.getLocation(g)===U.BOUNDARY&&(t[g]=!0);for(var y=this.iterator();y.hasNext();)for(var w=y.next(),T=w.getLabel(),A=0;A<2;A++)if(T.isAnyNull(A)){var B=U.NONE;if(t[A])B=U.EXTERIOR;else{var K=w.getCoordinate();B=this.getLocation(A,K,u)}T.setAllLocationsIfNull(A,B)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(u,t){this._edgeMap.put(u,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new re,this._edgeList=null,this._ptInAreaLocation=[U.NONE,U.NONE]}}])})(),Ye=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var e=null,l=null,g=this._SCANNING_FOR_INCOMING,y=0;y<this._resultAreaEdgeList.size();y++){var w=this._resultAreaEdgeList.get(y),T=w.getSym();if(w.getLabel().isArea())switch(e===null&&w.isInResult()&&(e=w),g){case this._SCANNING_FOR_INCOMING:if(!T.isInResult())continue;l=T,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!w.isInResult())continue;l.setNext(w),g=this._SCANNING_FOR_INCOMING}}if(g===this._LINKING_TO_OUTGOING){if(e===null)throw new ti("no outgoing dirEdge found",this.getCoordinate());dt.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),l.setNext(e)}}},{key:"insert",value:function(e){var l=e;this.insertEdgeEnd(l,l)}},{key:"getRightmostEdge",value:function(){var e=this.getEdges(),l=e.size();if(l<1)return null;var g=e.get(0);if(l===1)return g;var y=e.get(l-1),w=g.getQuadrant(),T=y.getQuadrant();return ye.isNorthern(w)&&ye.isNorthern(T)?g:ye.isNorthern(w)||ye.isNorthern(T)?g.getDy()!==0?g:y.getDy()!==0?y:(dt.shouldNeverReachHere("found two horizontal edges incident on node"),null):y}},{key:"print",value:function(e){Be.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var l=this.iterator();l.hasNext();){var g=l.next();e.print("out "),g.print(e),e.println(),e.print("in "),g.getSym().print(e),e.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Lt;for(var e=this.iterator();e.hasNext();){var l=e.next();(l.isInResult()||l.getSym().isInResult())&&this._resultAreaEdgeList.add(l)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(e){for(var l=this.iterator();l.hasNext();){var g=l.next().getLabel();g.setAllLocationsIfNull(0,e.getLocation(0)),g.setAllLocationsIfNull(1,e.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var e=null,l=null,g=this._edgeList.size()-1;g>=0;g--){var y=this._edgeList.get(g),w=y.getSym();l===null&&(l=w),e!==null&&w.setNext(e),e=y}l.setNext(e)}},{key:"computeDepths",value:function(){if(arguments.length===1){var e=arguments[0],l=this.findIndex(e),g=e.getDepth(ct.LEFT),y=e.getDepth(ct.RIGHT),w=this.computeDepths(l+1,this._edgeList.size(),g);if(this.computeDepths(0,l,w)!==y)throw new ti("depth mismatch at "+e.getCoordinate())}else if(arguments.length===3){for(var T=arguments[1],A=arguments[2],B=arguments[0];B<T;B++){var K=this._edgeList.get(B);K.setEdgeDepths(ct.RIGHT,A),A=K.getDepth(ct.LEFT)}return A}}},{key:"mergeSymLabels",value:function(){for(var e=this.iterator();e.hasNext();){var l=e.next();l.getLabel().merge(l.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(e){for(var l=null,g=null,y=this._SCANNING_FOR_INCOMING,w=this._resultAreaEdgeList.size()-1;w>=0;w--){var T=this._resultAreaEdgeList.get(w),A=T.getSym();switch(l===null&&T.getEdgeRing()===e&&(l=T),y){case this._SCANNING_FOR_INCOMING:if(A.getEdgeRing()!==e)continue;g=A,y=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(T.getEdgeRing()!==e)continue;g.setNextMin(T),y=this._SCANNING_FOR_INCOMING}}y===this._LINKING_TO_OUTGOING&&(dt.isTrue(l!==null,"found null for first outgoing dirEdge"),dt.isTrue(l.getEdgeRing()===e,"unable to link last incoming dirEdge"),g.setNextMin(l))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var e=0,l=this.iterator();l.hasNext();)l.next().isInResult()&&e++;return e}if(arguments.length===1){for(var g=arguments[0],y=0,w=this.iterator();w.hasNext();)w.next().getEdgeRing()===g&&y++;return y}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var e=U.NONE,l=this.iterator();l.hasNext();){var g=l.next(),y=g.getSym();if(!g.isLineEdge()){if(g.isInResult()){e=U.INTERIOR;break}if(y.isInResult()){e=U.EXTERIOR;break}}}if(e===U.NONE)return null;for(var w=e,T=this.iterator();T.hasNext();){var A=T.next(),B=A.getSym();A.isLineEdge()?A.getEdge().setCovered(w===U.INTERIOR):(A.isInResult()&&(w=U.EXTERIOR),B.isInResult()&&(w=U.INTERIOR))}}},{key:"computeLabelling",value:function(e){M(t,"computeLabelling",this,1).call(this,e),this._label=new Ie(U.NONE);for(var l=this.iterator();l.hasNext();)for(var g=l.next().getEdge().getLabel(),y=0;y<2;y++){var w=g.getLocation(y);w!==U.INTERIOR&&w!==U.BOUNDARY||this._label.setLocation(y,U.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})(bl),cn=(function(u){function t(){return r(this,t),s(this,t)}return b(t,u),d(t,[{key:"createNode",value:function(e){return new Sn(e,new Ye)}}])})(bo),zs=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"compareTo",value:function(t){var e=t;return u.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=u.orientation(t)}},{key:"orientation",value:function(t){return se.increasingDirection(t)===1}},{key:"compareOriented",value:function(t,e,l,g){for(var y=e?1:-1,w=g?1:-1,T=e?t.length:-1,A=g?l.length:-1,B=e?0:t.length-1,K=g?0:l.length-1;;){var it=t[B].compareTo(l[K]);if(it!==0)return it;var lt=(B+=y)===T,gt=(K+=w)===A;if(lt&&!gt)return-1;if(!lt&>)return 1;if(lt&>)return 0}}}])})(),yi=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var e=this._edges.get(t);t>0&&u.print(","),u.print("(");for(var l=e.getCoordinates(),g=0;g<l.length;g++)g>0&&u.print(","),u.print(l[g].x+" "+l[g].y);u.println(")")}u.print(") ")}},{key:"addAll",value:function(u){for(var t=u.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(u){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(u))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(u){return this._edges.get(u)}},{key:"findEqualEdge",value:function(u){var t=new zs(u.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(u){this._edges.add(u);var t=new zs(u.getCoordinates());this._ocaMap.put(t,u)}}],[{key:"constructor_",value:function(){this._edges=new Lt,this._ocaMap=new re}}])})(),Fs=(function(){return d((function u(){r(this,u)}),[{key:"processIntersections",value:function(u,t,e,l){}},{key:"isDone",value:function(){}}])})(),fn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isTrivialIntersection",value:function(t,e,l,g){if(t===l&&this._li.getIntersectionNum()===1){if(u.isAdjacentSegments(e,g))return!0;if(t.isClosed()){var y=t.size()-1;if(e===0&&g===y||g===0&&e===y)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(t,e,l,g){if(t===l&&e===g)return null;this.numTests++;var y=t.getCoordinates()[e],w=t.getCoordinates()[e+1],T=l.getCoordinates()[g],A=l.getCoordinates()[g+1];this._li.computeIntersection(y,w,T,A),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,l,g)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),l.addIntersections(this._li,g,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[Fs]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t}},{key:"isAdjacentSegments",value:function(t,e){return Math.abs(t-e)===1}}])})(),xl=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex),u.println(" dist = "+this.dist)}},{key:"compareTo",value:function(u){var t=u;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===u}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(u,t){return this.segmentIndex<u?-1:this.segmentIndex>u?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var u=arguments[0],t=arguments[1],e=arguments[2];this.coord=new tt(u),this.segmentIndex=t,this.dist=e}}])})(),On=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var l=t.next(),g=this.createSplitEdge(e,l);u.add(g),e=l}}},{key:"addEndpoints",value:function(){var u=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[u],u,0)}},{key:"createSplitEdge",value:function(u,t){var e=t.segmentIndex-u.segmentIndex+2,l=this.edge.pts[t.segmentIndex],g=t.dist>0||!t.coord.equals2D(l);g||e--;var y=new Array(e).fill(null),w=0;y[w++]=new tt(u.coord);for(var T=u.segmentIndex+1;T<=t.segmentIndex;T++)y[w++]=this.edge.pts[T];return g&&(y[w]=t.coord),new Us(y,new Ie(this.edge._label))}},{key:"add",value:function(u,t,e){var l=new xl(u,t,e),g=this._nodeMap.get(l);return g!==null?g:(this._nodeMap.put(l,l),l)}},{key:"isIntersection",value:function(u){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(u))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new re,this.edge=null;var u=arguments[0];this.edge=u}}])})(),Gs=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])||u.isTrue(this._matrix[U.INTERIOR][U.BOUNDARY])||u.isTrue(this._matrix[U.BOUNDARY][U.INTERIOR])||u.isTrue(this._matrix[U.BOUNDARY][U.BOUNDARY]))&&this._matrix[U.EXTERIOR][U.INTERIOR]===ft.FALSE&&this._matrix[U.EXTERIOR][U.BOUNDARY]===ft.FALSE}},{key:"isCoveredBy",value:function(){return(u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])||u.isTrue(this._matrix[U.INTERIOR][U.BOUNDARY])||u.isTrue(this._matrix[U.BOUNDARY][U.INTERIOR])||u.isTrue(this._matrix[U.BOUNDARY][U.BOUNDARY]))&&this._matrix[U.INTERIOR][U.EXTERIOR]===ft.FALSE&&this._matrix[U.BOUNDARY][U.EXTERIOR]===ft.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var l=Math.trunc(e/3),g=e%3;this._matrix[l][g]=ft.toDimensionValue(t.charAt(e))}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this._matrix[y][w]=T}}},{key:"isContains",value:function(){return u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])&&this._matrix[U.EXTERIOR][U.INTERIOR]===ft.FALSE&&this._matrix[U.EXTERIOR][U.BOUNDARY]===ft.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var l=Math.trunc(e/3),g=e%3;this.setAtLeast(l,g,ft.toDimensionValue(t.charAt(e)))}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this._matrix[y][w]<T&&(this._matrix[y][w]=T)}}},{key:"setAtLeastIfValid",value:function(t,e,l){t>=0&&e>=0&&this.setAtLeast(t,e,l)}},{key:"isWithin",value:function(){return u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])&&this._matrix[U.INTERIOR][U.EXTERIOR]===ft.FALSE&&this._matrix[U.BOUNDARY][U.EXTERIOR]===ft.FALSE}},{key:"isTouches",value:function(t,e){return t>e?this.isTouches(e,t):(t===ft.A&&e===ft.A||t===ft.L&&e===ft.L||t===ft.L&&e===ft.A||t===ft.P&&e===ft.A||t===ft.P&&e===ft.L)&&this._matrix[U.INTERIOR][U.INTERIOR]===ft.FALSE&&(u.isTrue(this._matrix[U.INTERIOR][U.BOUNDARY])||u.isTrue(this._matrix[U.BOUNDARY][U.INTERIOR])||u.isTrue(this._matrix[U.BOUNDARY][U.BOUNDARY]))}},{key:"isOverlaps",value:function(t,e){return t===ft.P&&e===ft.P||t===ft.A&&e===ft.A?u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])&&u.isTrue(this._matrix[U.INTERIOR][U.EXTERIOR])&&u.isTrue(this._matrix[U.EXTERIOR][U.INTERIOR]):t===ft.L&&e===ft.L&&this._matrix[U.INTERIOR][U.INTERIOR]===1&&u.isTrue(this._matrix[U.INTERIOR][U.EXTERIOR])&&u.isTrue(this._matrix[U.EXTERIOR][U.INTERIOR])}},{key:"isEquals",value:function(t,e){return t===e&&u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])&&this._matrix[U.INTERIOR][U.EXTERIOR]===ft.FALSE&&this._matrix[U.BOUNDARY][U.EXTERIOR]===ft.FALSE&&this._matrix[U.EXTERIOR][U.INTERIOR]===ft.FALSE&&this._matrix[U.EXTERIOR][U.BOUNDARY]===ft.FALSE}},{key:"toString",value:function(){for(var t=new cr("123456789"),e=0;e<3;e++)for(var l=0;l<3;l++)t.setCharAt(3*e+l,ft.toDimensionSymbol(this._matrix[e][l]));return t.toString()}},{key:"setAll",value:function(t){for(var e=0;e<3;e++)for(var l=0;l<3;l++)this._matrix[e][l]=t}},{key:"get",value:function(t,e){return this._matrix[t][e]}},{key:"transpose",value:function(){var t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}},{key:"matches",value:function(t){if(t.length!==9)throw new X("Should be length 9: "+t);for(var e=0;e<3;e++)for(var l=0;l<3;l++)if(!u.matches(this._matrix[e][l],t.charAt(3*e+l)))return!1;return!0}},{key:"add",value:function(t){for(var e=0;e<3;e++)for(var l=0;l<3;l++)this.setAtLeast(e,l,t.get(e,l))}},{key:"isDisjoint",value:function(){return this._matrix[U.INTERIOR][U.INTERIOR]===ft.FALSE&&this._matrix[U.INTERIOR][U.BOUNDARY]===ft.FALSE&&this._matrix[U.BOUNDARY][U.INTERIOR]===ft.FALSE&&this._matrix[U.BOUNDARY][U.BOUNDARY]===ft.FALSE}},{key:"isCrosses",value:function(t,e){return t===ft.P&&e===ft.L||t===ft.P&&e===ft.A||t===ft.L&&e===ft.A?u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])&&u.isTrue(this._matrix[U.INTERIOR][U.EXTERIOR]):t===ft.L&&e===ft.P||t===ft.A&&e===ft.P||t===ft.A&&e===ft.L?u.isTrue(this._matrix[U.INTERIOR][U.INTERIOR])&&u.isTrue(this._matrix[U.EXTERIOR][U.INTERIOR]):t===ft.L&&e===ft.L&&this._matrix[U.INTERIOR][U.INTERIOR]===0}},{key:"interfaces_",get:function(){return[I]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(ft.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var t=arguments[0];u.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof u){var e=arguments[0];u.constructor_.call(this),this._matrix[U.INTERIOR][U.INTERIOR]=e._matrix[U.INTERIOR][U.INTERIOR],this._matrix[U.INTERIOR][U.BOUNDARY]=e._matrix[U.INTERIOR][U.BOUNDARY],this._matrix[U.INTERIOR][U.EXTERIOR]=e._matrix[U.INTERIOR][U.EXTERIOR],this._matrix[U.BOUNDARY][U.INTERIOR]=e._matrix[U.BOUNDARY][U.INTERIOR],this._matrix[U.BOUNDARY][U.BOUNDARY]=e._matrix[U.BOUNDARY][U.BOUNDARY],this._matrix[U.BOUNDARY][U.EXTERIOR]=e._matrix[U.BOUNDARY][U.EXTERIOR],this._matrix[U.EXTERIOR][U.INTERIOR]=e._matrix[U.EXTERIOR][U.INTERIOR],this._matrix[U.EXTERIOR][U.BOUNDARY]=e._matrix[U.EXTERIOR][U.BOUNDARY],this._matrix[U.EXTERIOR][U.EXTERIOR]=e._matrix[U.EXTERIOR][U.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var t=arguments[0],e=arguments[1];return e===ft.SYM_DONTCARE||e===ft.SYM_TRUE&&(t>=0||t===ft.TRUE)||e===ft.SYM_FALSE&&t===ft.FALSE||e===ft.SYM_P&&t===ft.P||e===ft.SYM_L&&t===ft.L||e===ft.SYM_A&&t===ft.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var l=arguments[1];return new u(arguments[0]).matches(l)}}},{key:"isTrue",value:function(t){return t>=0||t===ft.TRUE}}])})(),wr=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return t===null||t.length===0?null:(this.ensureCapacity(this._size+t.length),Be.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}},{key:"ensureCapacity",value:function(t){if(t<=this._data.length)return null;var e=Math.max(t,2*this._data.length);this._data=pe.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=new Array(this._size).fill(null);return Be.arraycopy(this._data,0,t,0,this._size),t}},{key:"add",value:function(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)u.constructor_.call(this,10);else if(arguments.length===1){var t=arguments[0];this._data=new Array(t).fill(null)}}}])})(),wl=(function(){function u(){r(this,u)}return d(u,[{key:"getChainStartIndices",value:function(t){var e=0,l=new wr(Math.trunc(t.length/2));l.add(e);do{var g=this.findChainEnd(t,e);l.add(g),e=g}while(e<t.length-1);return l.toArray()}},{key:"findChainEnd",value:function(t,e){for(var l=ye.quadrant(t[e],t[e+1]),g=e+1;g<t.length&&ye.quadrant(t[g-1],t[g])===l;)g++;return g-1}},{key:"OLDgetChainStartIndices",value:function(t){var e=0,l=new Lt;l.add(e);do{var g=this.findChainEnd(t,e);l.add(g),e=g}while(e<t.length-1);return u.toIntArray(l)}}],[{key:"toIntArray",value:function(t){for(var e=new Array(t.size()).fill(null),l=0;l<e.length;l++)e[l]=t.get(l).intValue();return e}}])})(),Si=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(u){var t=this.pts[this.startIndex[u]].x,e=this.pts[this.startIndex[u+1]].x;return t>e?t:e}},{key:"getMinX",value:function(u){var t=this.pts[this.startIndex[u]].x,e=this.pts[this.startIndex[u+1]].x;return t<e?t:e}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var u=arguments[0],t=arguments[1],e=arguments[2],l=arguments[3];this.computeIntersectsForChain(this.startIndex[u],this.startIndex[u+1],t,t.startIndex[e],t.startIndex[e+1],l)}else if(arguments.length===6){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],A=arguments[4],B=arguments[5];if(y-g==1&&A-T==1)return B.addIntersections(this.e,g,w.e,T),null;if(!this.overlaps(g,y,w,T,A))return null;var K=Math.trunc((g+y)/2),it=Math.trunc((T+A)/2);g<K&&(T<it&&this.computeIntersectsForChain(g,K,w,T,it,B),it<A&&this.computeIntersectsForChain(g,K,w,it,A,B)),K<y&&(T<it&&this.computeIntersectsForChain(K,y,w,T,it,B),it<A&&this.computeIntersectsForChain(K,y,w,it,A,B))}}},{key:"overlaps",value:function(u,t,e,l,g){return qt.intersects(this.pts[u],this.pts[t],e.pts[l],e.pts[g])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(u,t){for(var e=0;e<this.startIndex.length-1;e++)for(var l=0;l<u.startIndex.length-1;l++)this.computeIntersectsForChain(e,u,l,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var u=arguments[0];this.e=u,this.pts=u.getCoordinates();var t=new wl;this.startIndex=t.getChainStartIndices(this.pts)}}])})(),Rn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getDepth",value:function(t,e){return this._depth[t][e]}},{key:"setDepth",value:function(t,e,l){this._depth[t][e]=l}},{key:"isNull",value:function(){if(arguments.length===0){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==u.NULL_VALUE)return!1;return!0}if(arguments.length===1){var l=arguments[0];return this._depth[l][1]===u.NULL_VALUE}if(arguments.length===2){var g=arguments[0],y=arguments[1];return this._depth[g][y]===u.NULL_VALUE}}},{key:"normalize",value:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var l=1;l<3;l++){var g=0;this._depth[t][l]>e&&(g=1),this._depth[t][l]=g}}}},{key:"getDelta",value:function(t){return this._depth[t][ct.RIGHT]-this._depth[t][ct.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?U.EXTERIOR:U.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<2;e++)for(var l=1;l<3;l++){var g=t.getLocation(e,l);g!==U.EXTERIOR&&g!==U.INTERIOR||(this.isNull(e,l)?this._depth[e][l]=u.depthAtLocation(g):this._depth[e][l]+=u.depthAtLocation(g))}else if(arguments.length===3){var y=arguments[0],w=arguments[1];arguments[2]===U.INTERIOR&&this._depth[y][w]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=u.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===U.EXTERIOR?0:t===U.INTERIOR?1:u.NULL_VALUE}}])})();Rn.NULL_VALUE=-1;var Us=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var e=new Array(2).fill(null);return e[0]=this.pts[0],e[1]=this.pts[1],new t(e,Ie.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(e){this._isIsolated=e}},{key:"setName",value:function(e){this._name=e}},{key:"equals",value:function(e){if(!(e instanceof t))return!1;var l=e;if(this.pts.length!==l.pts.length)return!1;for(var g=!0,y=!0,w=this.pts.length,T=0;T<this.pts.length;T++)if(this.pts[T].equals2D(l.pts[T])||(g=!1),this.pts[T].equals2D(l.pts[--w])||(y=!1),!g&&!y)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var e=arguments[0];return this.pts[e]}}},{key:"print",value:function(e){e.print("edge "+this._name+": "),e.print("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&e.print(","),e.print(this.pts[l].x+" "+this.pts[l].y);e.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(e){t.updateIM(this._label,e)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(e){e.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)e.print(this.pts[l]+" ");e.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Si(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new qt;for(var e=0;e<this.pts.length;e++)this._env.expandToInclude(this.pts[e])}return this._env}},{key:"addIntersection",value:function(e,l,g,y){var w=new tt(e.getIntersection(y)),T=l,A=e.getEdgeDistance(g,y),B=T+1;if(B<this.pts.length){var K=this.pts[B];w.equals2D(K)&&(T=B,A=0)}this.eiList.add(w,T,A)}},{key:"toString",value:function(){var e=new cr;e.append("edge "+this._name+": "),e.append("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&e.append(","),e.append(this.pts[l].x+" "+this.pts[l].y);return e.append(") "+this._label+" "+this._depthDelta),e.toString()}},{key:"isPointwiseEqual",value:function(e){if(this.pts.length!==e.pts.length)return!1;for(var l=0;l<this.pts.length;l++)if(!this.pts[l].equals2D(e.pts[l]))return!1;return!0}},{key:"setDepthDelta",value:function(e){this._depthDelta=e}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(e,l,g){for(var y=0;y<e.getIntersectionNum();y++)this.addIntersection(e,l,g,y)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new On(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Rn,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.constructor_.call(this,e,null)}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.pts=l,this._label=g}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Gs&&arguments[0]instanceof Ie))return M(t,"updateIM",this).apply(this,arguments);var e=arguments[0],l=arguments[1];l.setAtLeastIfValid(e.getLocation(0,ct.ON),e.getLocation(1,ct.ON),1),e.isArea()&&(l.setAtLeastIfValid(e.getLocation(0,ct.LEFT),e.getLocation(1,ct.LEFT),2),l.setAtLeastIfValid(e.getLocation(0,ct.RIGHT),e.getLocation(1,ct.RIGHT),2))}}])})(Xt),kr=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"setWorkingPrecisionModel",value:function(t){this._workingPrecisionModel=t}},{key:"insertUniqueEdge",value:function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var l=e.getLabel(),g=t.getLabel();e.isPointwiseEqual(t)||(g=new Ie(t.getLabel())).flip(),l.merge(g);var y=u.depthDelta(g),w=e.getDepthDelta()+y;e.setDepthDelta(w)}else this._edgeList.add(t),t.setDepthDelta(u.depthDelta(t.getLabel()))}},{key:"buildSubgraphs",value:function(t,e){for(var l=new Lt,g=t.iterator();g.hasNext();){var y=g.next(),w=y.getRightmostCoordinate(),T=new Ne(l).getDepth(w);y.computeDepth(T),y.findResultEdges(),l.add(y),e.add(y.getDirectedEdges(),y.getNodes())}}},{key:"createSubgraphs",value:function(t){for(var e=new Lt,l=t.getNodes().iterator();l.hasNext();){var g=l.next();if(!g.isVisited()){var y=new wn;y.create(g),e.add(y)}}return Hi.sort(e,Hi.reverseOrder()),e}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Lo,l=new pi;return l.setPrecisionModel(t),e.setSegmentIntersector(new fn(l)),e}},{key:"buffer",value:function(t,e){var l=this._workingPrecisionModel;l===null&&(l=t.getPrecisionModel()),this._geomFact=t.getFactory();var g=new Nn(l,this._bufParams),y=new Mo(t,e,g).getCurves();if(y.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(y,l),this._graph=new _r(new cn),this._graph.addEdges(this._edgeList.getEdges());var w=this.createSubgraphs(this._graph),T=new fl(this._geomFact);this.buildSubgraphs(w,T);var A=T.getPolygons();return A.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(A)}},{key:"computeNodedEdges",value:function(t,e){var l=this.getNoder(e);l.computeNodes(t);for(var g=l.getNodedSubstrings().iterator();g.hasNext();){var y=g.next(),w=y.getCoordinates();if(w.length!==2||!w[0].equals2D(w[1])){var T=y.getData(),A=new Us(y.getCoordinates(),new Ie(T));this.insertUniqueEdge(A)}}}},{key:"setNoder",value:function(t){this._workingNoder=t}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new yi;var t=arguments[0];this._bufParams=t}},{key:"depthDelta",value:function(t){var e=t.getLocation(0,ct.LEFT),l=t.getLocation(0,ct.RIGHT);return e===U.INTERIOR&&l===U.EXTERIOR?1:e===U.EXTERIOR&&l===U.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(t){for(var e=new ii,l=new Lt;t.hasNext();){var g=t.next(),y=e.createLineString(g.getCoordinates());l.add(y)}return e.buildGeometry(l)}}])})(),kl=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"rescale",value:function(){if(St(arguments[0],Wt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var l=arguments[0],g=0;g<l.length;g++)l[g].x=l[g].x/this._scaleFactor+this._offsetX,l[g].y=l[g].y/this._scaleFactor+this._offsetY;l.length===2&&l[0].equals2D(l[1])&&Be.out.println(l)}}},{key:"scale",value:function(){if(St(arguments[0],Wt)){for(var t=arguments[0],e=new Lt(t.size()),l=t.iterator();l.hasNext();){var g=l.next();e.add(new mi(this.scale(g.getCoordinates()),g.getData()))}return e}if(arguments[0]instanceof Array){for(var y=arguments[0],w=new Array(y.length).fill(null),T=0;T<y.length;T++)w[T]=new tt(Math.round((y[T].x-this._offsetX)*this._scaleFactor),Math.round((y[T].y-this._offsetY)*this._scaleFactor),y[T].getZ());return se.removeRepeatedPoints(w)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t}},{key:"computeNodes",value:function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)}},{key:"interfaces_",get:function(){return[ko]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];u.constructor_.call(this,t,e,0,0)}else if(arguments.length===4){var l=arguments[0],g=arguments[1];this._noder=l,this._scaleFactor=g,this._isScaled=!this.isIntegerPrecision()}}}])})(),ai=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(arguments.length===2){for(var l=arguments[0],g=arguments[1].iterator();g.hasNext();)for(var y=g.next().getCoordinates(),w=1;w<y.length-1;w++)if(y[w].equals(l))throw new _t("found endpt/interior pt intersection at index "+w+" :pt "+l)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),l=this._segStrings.iterator();l.hasNext();){var g=l.next();this.checkInteriorIntersections(e,g)}else if(arguments.length===2)for(var y=arguments[0],w=arguments[1],T=y.getCoordinates(),A=w.getCoordinates(),B=0;B<T.length-1;B++)for(var K=0;K<A.length-1;K++)this.checkInteriorIntersections(y,B,w,K);else if(arguments.length===4){var it=arguments[0],lt=arguments[1],gt=arguments[2],bt=arguments[3];if(it===gt&<===bt)return null;var wt=it.getCoordinates()[lt],zt=it.getCoordinates()[lt+1],Ot=gt.getCoordinates()[bt],Jt=gt.getCoordinates()[bt+1];if(this._li.computeIntersection(wt,zt,Ot,Jt),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,wt,zt)||this.hasInteriorIntersection(this._li,Ot,Jt)))throw new _t("found non-noded intersection at "+wt+"-"+zt+" and "+Ot+"-"+Jt)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(arguments.length===1)for(var l=arguments[0].getCoordinates(),g=0;g<l.length-2;g++)this.checkCollapse(l[g],l[g+1],l[g+2])}},{key:"hasInteriorIntersection",value:function(t,e,l){for(var g=0;g<t.getIntersectionNum();g++){var y=t.getIntersection(g);if(!y.equals(e)&&!y.equals(l))return!0}return!1}},{key:"checkCollapse",value:function(t,e,l){if(t.equals(l))throw new _t("found non-noded collapse at "+u.fact.createLineString([t,e,l]))}}],[{key:"constructor_",value:function(){this._li=new pi,this._segStrings=null;var t=arguments[0];this._segStrings=t}}])})();ai.fact=new ii;var Ao=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"intersectsScaled",value:function(t,e){var l=Math.min(t.x,e.x),g=Math.max(t.x,e.x),y=Math.min(t.y,e.y),w=Math.max(t.y,e.y),T=this._maxx<l||this._minx>g||this._maxy<y||this._miny>w;if(T)return!1;var A=this.intersectsToleranceSquare(t,e);return dt.isTrue(!(T&&A),"Found bad envelope test"),A}},{key:"initCorners",value:function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new tt(this._maxx,this._maxy),this._corner[1]=new tt(this._minx,this._maxy),this._corner[2]=new tt(this._minx,this._miny),this._corner[3]=new tt(this._maxx,this._miny)}},{key:"intersects",value:function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(t){return Math.round(t*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var t=u.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new qt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(t,e){var l=!1,g=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(g=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!l||!g)||!!t.equals(this._pt)||!!e.equals(this._pt))))}},{key:"addSnappedNode",value:function(t,e){var l=t.getCoordinate(e),g=t.getCoordinate(e+1);return!!this.intersects(l,g)&&(t.addIntersection(this.getCoordinate(),e),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],l=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=l,e<=0)throw new X("Scale factor must be non-zero");e!==1&&(this._pt=new tt(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new tt,this._p1Scaled=new tt),this.initCorners(this._pt)}}])})();Ao.SAFE_ENV_EXPANSION_FACTOR=.75;var dn=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var u=arguments[1];arguments[0].getLineSegment(u,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Pe}}])})(),qs=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var u=arguments[0];return this.snap(u,null,-1)}if(arguments.length===3){var t=arguments[0],e=arguments[1],l=arguments[2],g=t.getSafeEnvelope(),y=new li(t,e,l);return this._index.query(g,new((function(){return d((function w(){r(this,w)}),[{key:"interfaces_",get:function(){return[Ps]}},{key:"visitItem",value:function(w){w.select(g,y)}}])})())),y.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var u=arguments[0];this._index=u}}])})(),li=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof wo))return M(t,"select",this,1).apply(this,arguments);var e=arguments[1],l=arguments[0].getContext();if(this._parentEdge===l&&(e===this._hotPixelVertexIndex||e+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(l,e)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],l=arguments[1],g=arguments[2];this._hotPixel=e,this._parentEdge=l,this._hotPixelVertexIndex=g}}])})(dn);qs.HotPixelSnapAction=li;var Lr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(u,t,e,l){if(u===e&&t===l)return null;var g=u.getCoordinates()[t],y=u.getCoordinates()[t+1],w=e.getCoordinates()[l],T=e.getCoordinates()[l+1];if(this._li.computeIntersection(g,y,w,T),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var A=0;A<this._li.getIntersectionNum();A++)this._interiorIntersections.add(this._li.getIntersection(A));u.addIntersections(this._li,t,0),e.addIntersections(this._li,l,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[Fs]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var u=arguments[0];this._li=u,this._interiorIntersections=new Lt}}])})(),Zs=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(u){var t=mi.getNodedSubstrings(u),e=new ai(t);try{e.checkValid()}catch(l){if(!(l instanceof j))throw l;l.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return mi.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(u,t){var e=this.findInteriorIntersections(u,t);this.computeIntersectionSnaps(e),this.computeVertexSnaps(u)}},{key:"findInteriorIntersections",value:function(u,t){var e=new Lr(t);return this._noder.setSegmentIntersector(e),this._noder.computeNodes(u),e.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(St(arguments[0],Wt))for(var u=arguments[0].iterator();u.hasNext();){var t=u.next();this.computeVertexSnaps(t)}else if(arguments[0]instanceof mi)for(var e=arguments[0],l=e.getCoordinates(),g=0;g<l.length;g++){var y=new Ao(l[g],this._scaleFactor,this._li);this._pointSnapper.snap(y,e,g)&&e.addIntersection(l[g],g)}}},{key:"computeNodes",value:function(u){this._nodedSegStrings=u,this._noder=new Lo,this._pointSnapper=new qs(this._noder.getIndex()),this.snapRound(u,this._li)}},{key:"computeIntersectionSnaps",value:function(u){for(var t=u.iterator();t.hasNext();){var e=t.next(),l=new Ao(e,this._scaleFactor,this._li);this._pointSnapper.snap(l)}}},{key:"interfaces_",get:function(){return[ko]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var u=arguments[0];this._pm=u,this._li=new pi,this._li.setPrecisionModel(u),this._scaleFactor=u.getScale()}}])})(),Mi=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"bufferFixedPrecision",value:function(t){var e=new kl(new Zs(new we(1)),t.getScale()),l=new kr(this._bufParams);l.setWorkingPrecisionModel(t),l.setNoder(e),this._resultGeometry=l.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var t=u.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(y){if(!(y instanceof ti))throw y;this._saveException=y}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var e=arguments[0],l=u.precisionScaleFactor(this._argGeom,this._distance,e),g=new we(l);this.bufferFixedPrecision(g)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===we.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new kr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof _t))throw e;this._saveException=e}}},{key:"getResultGeometry",value:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(t){this._bufParams.setEndCapStyle(t)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new q,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this._argGeom=e,this._bufParams=l}}},{key:"bufferOp",value:function(){if(arguments.length===2){var t=arguments[1];return new u(arguments[0]).getResultGeometry(t)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof mt&&typeof arguments[1]=="number"){var e=arguments[1],l=arguments[2],g=new u(arguments[0]);return g.setQuadrantSegments(l),g.getResultGeometry(e)}if(arguments[2]instanceof q&&arguments[0]instanceof mt&&typeof arguments[1]=="number"){var y=arguments[1];return new u(arguments[0],arguments[2]).getResultGeometry(y)}}else if(arguments.length===4){var w=arguments[1],T=arguments[2],A=arguments[3],B=new u(arguments[0]);return B.setQuadrantSegments(T),B.setEndCapStyle(A),B.getResultGeometry(w)}}},{key:"precisionScaleFactor",value:function(t,e,l){var g=t.getEnvelopeInternal(),y=rn.max(Math.abs(g.getMaxX()),Math.abs(g.getMaxY()),Math.abs(g.getMinX()),Math.abs(g.getMinY()))+2*(e>0?e:0),w=l-Math.trunc(Math.log(y)/Math.log(10)+1);return Math.pow(10,w)}}])})();Mi.CAP_ROUND=q.CAP_ROUND,Mi.CAP_BUTT=q.CAP_FLAT,Mi.CAP_FLAT=q.CAP_FLAT,Mi.CAP_SQUARE=q.CAP_SQUARE,Mi.MAX_PRECISION_DIGITS=12;var Er=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Tr=(function(){return d((function u(t){r(this,u),this.geometryFactory=t||new ii}),[{key:"read",value:function(u){var t,e=(t=typeof u=="string"?JSON.parse(u):u).type;if(!ke[e])throw new Error("Unknown GeoJSON type: "+t.type);return Er.indexOf(e)!==-1?ke[e].call(this,t.coordinates):e==="GeometryCollection"?ke[e].call(this,t.geometries):ke[e].call(this,t)}},{key:"write",value:function(u){var t=u.getGeometryType();if(!Le[t])throw new Error("Geometry is not supported");return Le[t].call(this,u)}}])})(),ke={Feature:function(u){var t={};for(var e in u)t[e]=u[e];if(u.geometry){var l=u.geometry.type;if(!ke[l])throw new Error("Unknown GeoJSON type: "+u.type);t.geometry=this.read(u.geometry)}return u.bbox&&(t.bbox=ke.bbox.call(this,u.bbox)),t},FeatureCollection:function(u){var t={};if(u.features){t.features=[];for(var e=0;e<u.features.length;++e)t.features.push(this.read(u.features[e]))}return u.bbox&&(t.bbox=this.parse.bbox.call(this,u.bbox)),t},coordinates:function(u){for(var t=[],e=0;e<u.length;++e){var l=u[e];t.push(h(tt,S(l)))}return t},bbox:function(u){return this.geometryFactory.createLinearRing([new tt(u[0],u[1]),new tt(u[2],u[1]),new tt(u[2],u[3]),new tt(u[0],u[3]),new tt(u[0],u[1])])},Point:function(u){var t=h(tt,S(u));return this.geometryFactory.createPoint(t)},MultiPoint:function(u){for(var t=[],e=0;e<u.length;++e)t.push(ke.Point.call(this,u[e]));return this.geometryFactory.createMultiPoint(t)},LineString:function(u){var t=ke.coordinates.call(this,u);return this.geometryFactory.createLineString(t)},MultiLineString:function(u){for(var t=[],e=0;e<u.length;++e)t.push(ke.LineString.call(this,u[e]));return this.geometryFactory.createMultiLineString(t)},Polygon:function(u){for(var t=ke.coordinates.call(this,u[0]),e=this.geometryFactory.createLinearRing(t),l=[],g=1;g<u.length;++g){var y=u[g],w=ke.coordinates.call(this,y),T=this.geometryFactory.createLinearRing(w);l.push(T)}return this.geometryFactory.createPolygon(e,l)},MultiPolygon:function(u){for(var t=[],e=0;e<u.length;++e){var l=u[e];t.push(ke.Polygon.call(this,l))}return this.geometryFactory.createMultiPolygon(t)},GeometryCollection:function(u){for(var t=[],e=0;e<u.length;++e){var l=u[e];t.push(this.read(l))}return this.geometryFactory.createGeometryCollection(t)}},Le={coordinate:function(u){var t=[u.x,u.y];return u.z&&t.push(u.z),u.m&&t.push(u.m),t},Point:function(u){return{type:"Point",coordinates:Le.coordinate.call(this,u.getCoordinate())}},MultiPoint:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=Le.Point.call(this,l);t.push(g.coordinates)}return{type:"MultiPoint",coordinates:t}},LineString:function(u){for(var t=[],e=u.getCoordinates(),l=0;l<e.length;++l){var g=e[l];t.push(Le.coordinate.call(this,g))}return{type:"LineString",coordinates:t}},MultiLineString:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=Le.LineString.call(this,l);t.push(g.coordinates)}return{type:"MultiLineString",coordinates:t}},Polygon:function(u){var t=[],e=Le.LineString.call(this,u._shell);t.push(e.coordinates);for(var l=0;l<u._holes.length;++l){var g=u._holes[l],y=Le.LineString.call(this,g);t.push(y.coordinates)}return{type:"Polygon",coordinates:t}},MultiPolygon:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=Le.Polygon.call(this,l);t.push(g.coordinates)}return{type:"MultiPolygon",coordinates:t}},GeometryCollection:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=l.getGeometryType();t.push(Le[g].call(this,l))}return{type:"GeometryCollection",geometries:t}}};return{BufferOp:Mi,GeoJSONReader:(function(){return d((function u(t){r(this,u),this.parser=new Tr(t||new ii)}),[{key:"read",value:function(u){return this.parser.read(u)}}])})(),GeoJSONWriter:(function(){return d((function u(){r(this,u),this.parser=new Tr(this.geometryFactory)}),[{key:"write",value:function(u){return this.parser.write(u)}}])})()}}))})(ts)),ts.exports}var Xd=Vd();const Jd=Il(Xd);class Wd{constructor(){this._partials=new Float64Array(32),this._n=0}add(n){const i=this._partials;let s=0;for(let r=0;r<this._n&&r<32;r++){const h=i[r],f=n+h,d=Math.abs(n)<Math.abs(h)?n-(f-h):h-(f-n);d&&(i[s++]=d),n=f}return i[s]=n,this._n=s+1,this}valueOf(){const n=this._partials;let i=this._n,s,r,h,f=0;if(i>0){for(f=n[--i];i>0&&(s=f,r=n[--i],f=s+r,h=r-(f-s),!h););i>0&&(h<0&&n[i-1]<0||h>0&&n[i-1]>0)&&(r=h*2,s=f+r,r==s-f&&(f=s))}return f}}function*jd(a){for(const n of a)yield*n}function Gu(a){return Array.from(jd(a))}var jt=1e-6,Gt=Math.PI,We=Gt/2,Uu=Gt/4,ci=Gt*2,Di=180/Gt,qe=Gt/180,ue=Math.abs,Kd=Math.atan,jn=Math.atan2,te=Math.cos,Qt=Math.sin,Qd=Math.sign||function(a){return a>0?1:a<0?-1:0},Zr=Math.sqrt;function qu(a){return a>1?0:a<-1?Gt:Math.acos(a)}function Kn(a){return a>1?We:a<-1?-We:Math.asin(a)}function Hr(){}function es(a,n){a&&Hu.hasOwnProperty(a.type)&&Hu[a.type](a,n)}var Zu={Feature:function(a,n){es(a.geometry,n)},FeatureCollection:function(a,n){for(var i=a.features,s=-1,r=i.length;++s<r;)es(i[s].geometry,n)}},Hu={Sphere:function(a,n){n.sphere()},Point:function(a,n){a=a.coordinates,n.point(a[0],a[1],a[2])},MultiPoint:function(a,n){for(var i=a.coordinates,s=-1,r=i.length;++s<r;)a=i[s],n.point(a[0],a[1],a[2])},LineString:function(a,n){Ca(a.coordinates,n,0)},MultiLineString:function(a,n){for(var i=a.coordinates,s=-1,r=i.length;++s<r;)Ca(i[s],n,0)},Polygon:function(a,n){Yu(a.coordinates,n)},MultiPolygon:function(a,n){for(var i=a.coordinates,s=-1,r=i.length;++s<r;)Yu(i[s],n)},GeometryCollection:function(a,n){for(var i=a.geometries,s=-1,r=i.length;++s<r;)es(i[s],n)}};function Ca(a,n,i){var s=-1,r=a.length-i,h;for(n.lineStart();++s<r;)h=a[s],n.point(h[0],h[1],h[2]);n.lineEnd()}function Yu(a,n){var i=-1,s=a.length;for(n.polygonStart();++i<s;)Ca(a[i],n,1);n.polygonEnd()}function $d(a,n){a&&Zu.hasOwnProperty(a.type)?Zu[a.type](a,n):es(a,n)}function Sa(a){return[jn(a[1],a[0]),Kn(a[2])]}function Qn(a){var n=a[0],i=a[1],s=te(i);return[s*te(n),s*Qt(n),Qt(i)]}function is(a,n){return a[0]*n[0]+a[1]*n[1]+a[2]*n[2]}function ns(a,n){return[a[1]*n[2]-a[2]*n[1],a[2]*n[0]-a[0]*n[2],a[0]*n[1]-a[1]*n[0]]}function Ma(a,n){a[0]+=n[0],a[1]+=n[1],a[2]+=n[2]}function rs(a,n){return[a[0]*n,a[1]*n,a[2]*n]}function Aa(a){var n=Zr(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=n,a[1]/=n,a[2]/=n}function Pa(a,n){function i(s,r){return s=a(s,r),n(s[0],s[1])}return a.invert&&n.invert&&(i.invert=function(s,r){return s=n.invert(s,r),s&&a.invert(s[0],s[1])}),i}function Na(a,n){return[ue(a)>Gt?a+Math.round(-a/ci)*ci:a,n]}Na.invert=Na;function tg(a,n,i){return(a%=ci)?n||i?Pa(Xu(a),Ju(n,i)):Xu(a):n||i?Ju(n,i):Na}function Vu(a){return function(n,i){return n+=a,[n>Gt?n-ci:n<-Gt?n+ci:n,i]}}function Xu(a){var n=Vu(a);return n.invert=Vu(-a),n}function Ju(a,n){var i=te(a),s=Qt(a),r=te(n),h=Qt(n);function f(d,m){var _=te(m),x=te(d)*_,b=Qt(d)*_,E=Qt(m),C=E*i+x*s;return[jn(b*r-C*h,x*i-E*s),Kn(C*r+b*h)]}return f.invert=function(d,m){var _=te(m),x=te(d)*_,b=Qt(d)*_,E=Qt(m),C=E*r-b*h;return[jn(b*r+E*h,x*i+C*s),Kn(C*i-x*s)]},f}function eg(a,n,i,s,r,h){if(i){var f=te(n),d=Qt(n),m=s*i;r==null?(r=n+s*ci,h=n-m/2):(r=Wu(f,r),h=Wu(f,h),(s>0?r<h:r>h)&&(r+=s*ci));for(var _,x=r;s>0?x>h:x<h;x-=m)_=Sa([f,-d*te(x),-d*Qt(x)]),a.point(_[0],_[1])}}function Wu(a,n){n=Qn(n),n[0]-=a,Aa(n);var i=qu(-n[1]);return((-n[2]<0?-i:i)+ci-jt)%ci}function ju(){var a=[],n;return{point:function(i,s,r){n.push([i,s,r])},lineStart:function(){a.push(n=[])},lineEnd:Hr,rejoin:function(){a.length>1&&a.push(a.pop().concat(a.shift()))},result:function(){var i=a;return a=[],n=null,i}}}function os(a,n){return ue(a[0]-n[0])<jt&&ue(a[1]-n[1])<jt}function ss(a,n,i,s){this.x=a,this.z=n,this.o=i,this.e=s,this.v=!1,this.n=this.p=null}function Ku(a,n,i,s,r){var h=[],f=[],d,m;if(a.forEach(function(M){if(!((S=M.length-1)<=0)){var S,z=M[0],Z=M[S],O;if(os(z,Z)){if(!z[2]&&!Z[2]){for(r.lineStart(),d=0;d<S;++d)r.point((z=M[d])[0],z[1]);r.lineEnd();return}Z[0]+=2*jt}h.push(O=new ss(z,M,null,!0)),f.push(O.o=new ss(z,null,O,!1)),h.push(O=new ss(Z,M,null,!1)),f.push(O.o=new ss(Z,null,O,!0))}}),!!h.length){for(f.sort(n),Qu(h),Qu(f),d=0,m=f.length;d<m;++d)f[d].e=i=!i;for(var _=h[0],x,b;;){for(var E=_,C=!0;E.v;)if((E=E.n)===_)return;x=E.z,r.lineStart();do{if(E.v=E.o.v=!0,E.e){if(C)for(d=0,m=x.length;d<m;++d)r.point((b=x[d])[0],b[1]);else s(E.x,E.n.x,1,r);E=E.n}else{if(C)for(x=E.p.z,d=x.length-1;d>=0;--d)r.point((b=x[d])[0],b[1]);else s(E.x,E.p.x,-1,r);E=E.p}E=E.o,x=E.z,C=!C}while(!E.v);r.lineEnd()}}}function Qu(a){if(n=a.length){for(var n,i=0,s=a[0],r;++i<n;)s.n=r=a[i],r.p=s,s=r;s.n=r=a[0],r.p=s}}function Oa(a){return ue(a[0])<=Gt?a[0]:Qd(a[0])*((ue(a[0])+Gt)%ci-Gt)}function ig(a,n){var i=Oa(n),s=n[1],r=Qt(s),h=[Qt(i),-te(i),0],f=0,d=0,m=new Wd;r===1?s=We+jt:r===-1&&(s=-We-jt);for(var _=0,x=a.length;_<x;++_)if(E=(b=a[_]).length)for(var b,E,C=b[E-1],M=Oa(C),S=C[1]/2+Uu,z=Qt(S),Z=te(S),O=0;O<E;++O,M=j,z=et,Z=ot,C=q){var q=b[O],j=Oa(q),X=q[1]/2+Uu,et=Qt(X),ot=te(X),I=j-M,N=I>=0?1:-1,R=N*I,F=R>Gt,G=z*et;if(m.add(jn(G*N*Qt(R),Z*ot+G*te(R))),f+=F?I+N*ci:I,F^M>=i^j>=i){var H=ns(Qn(C),Qn(q));Aa(H);var W=ns(h,H);Aa(W);var D=(F^I>=0?-1:1)*Kn(W[2]);(s>D||s===D&&(H[0]||H[1]))&&(d+=F^I>=0?1:-1)}}return(f<-jt||f<jt&&m<-1e-12)^d&1}function $u(a,n,i,s){return function(r){var h=n(r),f=ju(),d=n(f),m=!1,_,x,b,E={point:C,lineStart:S,lineEnd:z,polygonStart:function(){E.point=Z,E.lineStart=O,E.lineEnd=q,x=[],_=[]},polygonEnd:function(){E.point=C,E.lineStart=S,E.lineEnd=z,x=Gu(x);var j=ig(_,s);x.length?(m||(r.polygonStart(),m=!0),Ku(x,rg,j,i,r)):j&&(m||(r.polygonStart(),m=!0),r.lineStart(),i(null,null,1,r),r.lineEnd()),m&&(r.polygonEnd(),m=!1),x=_=null},sphere:function(){r.polygonStart(),r.lineStart(),i(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function C(j,X){a(j,X)&&r.point(j,X)}function M(j,X){h.point(j,X)}function S(){E.point=M,h.lineStart()}function z(){E.point=C,h.lineEnd()}function Z(j,X){b.push([j,X]),d.point(j,X)}function O(){d.lineStart(),b=[]}function q(){Z(b[0][0],b[0][1]),d.lineEnd();var j=d.clean(),X=f.result(),et,ot=X.length,I,N,R;if(b.pop(),_.push(b),b=null,!!ot){if(j&1){if(N=X[0],(I=N.length-1)>0){for(m||(r.polygonStart(),m=!0),r.lineStart(),et=0;et<I;++et)r.point((R=N[et])[0],R[1]);r.lineEnd()}return}ot>1&&j&2&&X.push(X.pop().concat(X.shift())),x.push(X.filter(ng))}}return E}}function ng(a){return a.length>1}function rg(a,n){return((a=a.x)[0]<0?a[1]-We-jt:We-a[1])-((n=n.x)[0]<0?n[1]-We-jt:We-n[1])}const th=$u(function(){return!0},og,ag,[-Gt,-We]);function og(a){var n=NaN,i=NaN,s=NaN,r;return{lineStart:function(){a.lineStart(),r=1},point:function(h,f){var d=h>0?Gt:-Gt,m=ue(h-n);ue(m-Gt)<jt?(a.point(n,i=(i+f)/2>0?We:-We),a.point(s,i),a.lineEnd(),a.lineStart(),a.point(d,i),a.point(h,i),r=0):s!==d&&m>=Gt&&(ue(n-s)<jt&&(n-=s*jt),ue(h-d)<jt&&(h-=d*jt),i=sg(n,i,h,f),a.point(s,i),a.lineEnd(),a.lineStart(),a.point(d,i),r=0),a.point(n=h,i=f),s=d},lineEnd:function(){a.lineEnd(),n=i=NaN},clean:function(){return 2-r}}}function sg(a,n,i,s){var r,h,f=Qt(a-i);return ue(f)>jt?Kd((Qt(n)*(h=te(s))*Qt(i)-Qt(s)*(r=te(n))*Qt(a))/(r*h*f)):(n+s)/2}function ag(a,n,i,s){var r;if(a==null)r=i*We,s.point(-Gt,r),s.point(0,r),s.point(Gt,r),s.point(Gt,0),s.point(Gt,-r),s.point(0,-r),s.point(-Gt,-r),s.point(-Gt,0),s.point(-Gt,r);else if(ue(a[0]-n[0])>jt){var h=a[0]<n[0]?Gt:-Gt;r=i*h/2,s.point(-h,r),s.point(0,r),s.point(h,r)}else s.point(n[0],n[1])}function lg(a){var n=te(a),i=6*qe,s=n>0,r=ue(n)>jt;function h(x,b,E,C){eg(C,a,i,E,x,b)}function f(x,b){return te(x)*te(b)>n}function d(x){var b,E,C,M,S;return{lineStart:function(){M=C=!1,S=1},point:function(z,Z){var O=[z,Z],q,j=f(z,Z),X=s?j?0:_(z,Z):j?_(z+(z<0?Gt:-Gt),Z):0;if(!b&&(M=C=j)&&x.lineStart(),j!==C&&(q=m(b,O),(!q||os(b,q)||os(O,q))&&(O[2]=1)),j!==C)S=0,j?(x.lineStart(),q=m(O,b),x.point(q[0],q[1])):(q=m(b,O),x.point(q[0],q[1],2),x.lineEnd()),b=q;else if(r&&b&&s^j){var et;!(X&E)&&(et=m(O,b,!0))&&(S=0,s?(x.lineStart(),x.point(et[0][0],et[0][1]),x.point(et[1][0],et[1][1]),x.lineEnd()):(x.point(et[1][0],et[1][1]),x.lineEnd(),x.lineStart(),x.point(et[0][0],et[0][1],3)))}j&&(!b||!os(b,O))&&x.point(O[0],O[1]),b=O,C=j,E=X},lineEnd:function(){C&&x.lineEnd(),b=null},clean:function(){return S|(M&&C)<<1}}}function m(x,b,E){var C=Qn(x),M=Qn(b),S=[1,0,0],z=ns(C,M),Z=is(z,z),O=z[0],q=Z-O*O;if(!q)return!E&&x;var j=n*Z/q,X=-n*O/q,et=ns(S,z),ot=rs(S,j),I=rs(z,X);Ma(ot,I);var N=et,R=is(ot,N),F=is(N,N),G=R*R-F*(is(ot,ot)-1);if(!(G<0)){var H=Zr(G),W=rs(N,(-R-H)/F);if(Ma(W,ot),W=Sa(W),!E)return W;var D=x[0],Y=b[0],$=x[1],J=b[1],at;Y<D&&(at=D,D=Y,Y=at);var rt=Y-D,ht=ue(rt-Gt)<jt,_t=ht||rt<jt;if(!ht&&J<$&&(at=$,$=J,J=at),_t?ht?$+J>0^W[1]<(ue(W[0]-D)<jt?$:J):$<=W[1]&&W[1]<=J:rt>Gt^(D<=W[0]&&W[0]<=Y)){var kt=rs(N,(-R+H)/F);return Ma(kt,ot),[W,Sa(kt)]}}}function _(x,b){var E=s?a:Gt-a,C=0;return x<-E?C|=1:x>E&&(C|=2),b<-E?C|=4:b>E&&(C|=8),C}return $u(f,d,h,s?[0,-a]:[-Gt,a-Gt])}function ug(a,n,i,s,r,h){var f=a[0],d=a[1],m=n[0],_=n[1],x=0,b=1,E=m-f,C=_-d,M;if(M=i-f,!(!E&&M>0)){if(M/=E,E<0){if(M<x)return;M<b&&(b=M)}else if(E>0){if(M>b)return;M>x&&(x=M)}if(M=r-f,!(!E&&M<0)){if(M/=E,E<0){if(M>b)return;M>x&&(x=M)}else if(E>0){if(M<x)return;M<b&&(b=M)}if(M=s-d,!(!C&&M>0)){if(M/=C,C<0){if(M<x)return;M<b&&(b=M)}else if(C>0){if(M>b)return;M>x&&(x=M)}if(M=h-d,!(!C&&M<0)){if(M/=C,C<0){if(M>b)return;M>x&&(x=M)}else if(C>0){if(M<x)return;M<b&&(b=M)}return x>0&&(a[0]=f+x*E,a[1]=d+x*C),b<1&&(n[0]=f+b*E,n[1]=d+b*C),!0}}}}}var Yr=1e9,as=-Yr;function hg(a,n,i,s){function r(_,x){return a<=_&&_<=i&&n<=x&&x<=s}function h(_,x,b,E){var C=0,M=0;if(_==null||(C=f(_,b))!==(M=f(x,b))||m(_,x)<0^b>0)do E.point(C===0||C===3?a:i,C>1?s:n);while((C=(C+b+4)%4)!==M);else E.point(x[0],x[1])}function f(_,x){return ue(_[0]-a)<jt?x>0?0:3:ue(_[0]-i)<jt?x>0?2:1:ue(_[1]-n)<jt?x>0?1:0:x>0?3:2}function d(_,x){return m(_.x,x.x)}function m(_,x){var b=f(_,1),E=f(x,1);return b!==E?b-E:b===0?x[1]-_[1]:b===1?_[0]-x[0]:b===2?_[1]-x[1]:x[0]-_[0]}return function(_){var x=_,b=ju(),E,C,M,S,z,Z,O,q,j,X,et,ot={point:I,lineStart:G,lineEnd:H,polygonStart:R,polygonEnd:F};function I(D,Y){r(D,Y)&&x.point(D,Y)}function N(){for(var D=0,Y=0,$=C.length;Y<$;++Y)for(var J=C[Y],at=1,rt=J.length,ht=J[0],_t,kt,dt=ht[0],pt=ht[1];at<rt;++at)_t=dt,kt=pt,ht=J[at],dt=ht[0],pt=ht[1],kt<=s?pt>s&&(dt-_t)*(s-kt)>(pt-kt)*(a-_t)&&++D:pt<=s&&(dt-_t)*(s-kt)<(pt-kt)*(a-_t)&&--D;return D}function R(){x=b,E=[],C=[],et=!0}function F(){var D=N(),Y=et&&D,$=(E=Gu(E)).length;(Y||$)&&(_.polygonStart(),Y&&(_.lineStart(),h(null,null,1,_),_.lineEnd()),$&&Ku(E,d,D,h,_),_.polygonEnd()),x=_,E=C=M=null}function G(){ot.point=W,C&&C.push(M=[]),X=!0,j=!1,O=q=NaN}function H(){E&&(W(S,z),Z&&j&&b.rejoin(),E.push(b.result())),ot.point=I,j&&x.lineEnd()}function W(D,Y){var $=r(D,Y);if(C&&M.push([D,Y]),X)S=D,z=Y,Z=$,X=!1,$&&(x.lineStart(),x.point(D,Y));else if($&&j)x.point(D,Y);else{var J=[O=Math.max(as,Math.min(Yr,O)),q=Math.max(as,Math.min(Yr,q))],at=[D=Math.max(as,Math.min(Yr,D)),Y=Math.max(as,Math.min(Yr,Y))];ug(J,at,a,n,i,s)?(j||(x.lineStart(),x.point(J[0],J[1])),x.point(at[0],at[1]),$||x.lineEnd(),et=!1):$&&(x.lineStart(),x.point(D,Y),et=!1)}O=D,q=Y,j=$}return ot}}const eh=a=>a;var $n=1/0,ls=$n,Vr=-$n,us=Vr,ih={point:cg,lineStart:Hr,lineEnd:Hr,polygonStart:Hr,polygonEnd:Hr,result:function(){var a=[[$n,ls],[Vr,us]];return Vr=us=-(ls=$n=1/0),a}};function cg(a,n){a<$n&&($n=a),a>Vr&&(Vr=a),n<ls&&(ls=n),n>us&&(us=n)}function Ra(a){return function(n){var i=new Da;for(var s in a)i[s]=a[s];return i.stream=n,i}}function Da(){}Da.prototype={constructor:Da,point:function(a,n){this.stream.point(a,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Ba(a,n,i){var s=a.clipExtent&&a.clipExtent();return a.scale(150).translate([0,0]),s!=null&&a.clipExtent(null),$d(i,a.stream(ih)),n(ih.result()),s!=null&&a.clipExtent(s),a}function nh(a,n,i){return Ba(a,function(s){var r=n[1][0]-n[0][0],h=n[1][1]-n[0][1],f=Math.min(r/(s[1][0]-s[0][0]),h/(s[1][1]-s[0][1])),d=+n[0][0]+(r-f*(s[1][0]+s[0][0]))/2,m=+n[0][1]+(h-f*(s[1][1]+s[0][1]))/2;a.scale(150*f).translate([d,m])},i)}function fg(a,n,i){return nh(a,[[0,0],n],i)}function dg(a,n,i){return Ba(a,function(s){var r=+n,h=r/(s[1][0]-s[0][0]),f=(r-h*(s[1][0]+s[0][0]))/2,d=-h*s[0][1];a.scale(150*h).translate([f,d])},i)}function gg(a,n,i){return Ba(a,function(s){var r=+n,h=r/(s[1][1]-s[0][1]),f=-h*s[0][0],d=(r-h*(s[1][1]+s[0][1]))/2;a.scale(150*h).translate([f,d])},i)}var rh=16,pg=te(30*qe);function oh(a,n){return+n?yg(a,n):mg(a)}function mg(a){return Ra({point:function(n,i){n=a(n,i),this.stream.point(n[0],n[1])}})}function yg(a,n){function i(s,r,h,f,d,m,_,x,b,E,C,M,S,z){var Z=_-s,O=x-r,q=Z*Z+O*O;if(q>4*n&&S--){var j=f+E,X=d+C,et=m+M,ot=Zr(j*j+X*X+et*et),I=Kn(et/=ot),N=ue(ue(et)-1)<jt||ue(h-b)<jt?(h+b)/2:jn(X,j),R=a(N,I),F=R[0],G=R[1],H=F-s,W=G-r,D=O*H-Z*W;(D*D/q>n||ue((Z*H+O*W)/q-.5)>.3||f*E+d*C+m*M<pg)&&(i(s,r,h,f,d,m,F,G,N,j/=ot,X/=ot,et,S,z),z.point(F,G),i(F,G,N,j,X,et,_,x,b,E,C,M,S,z))}}return function(s){var r,h,f,d,m,_,x,b,E,C,M,S,z={point:Z,lineStart:O,lineEnd:j,polygonStart:function(){s.polygonStart(),z.lineStart=X},polygonEnd:function(){s.polygonEnd(),z.lineStart=O}};function Z(I,N){I=a(I,N),s.point(I[0],I[1])}function O(){b=NaN,z.point=q,s.lineStart()}function q(I,N){var R=Qn([I,N]),F=a(I,N);i(b,E,x,C,M,S,b=F[0],E=F[1],x=I,C=R[0],M=R[1],S=R[2],rh,s),s.point(b,E)}function j(){z.point=Z,s.lineEnd()}function X(){O(),z.point=et,z.lineEnd=ot}function et(I,N){q(r=I,N),h=b,f=E,d=C,m=M,_=S,z.point=q}function ot(){i(b,E,x,C,M,S,h,f,r,d,m,_,rh,s),z.lineEnd=j,j()}return z}}var _g=Ra({point:function(a,n){this.stream.point(a*qe,n*qe)}});function vg(a){return Ra({point:function(n,i){var s=a(n,i);return this.stream.point(s[0],s[1])}})}function bg(a,n,i,s,r){function h(f,d){return f*=s,d*=r,[n+a*f,i-a*d]}return h.invert=function(f,d){return[(f-n)/a*s,(i-d)/a*r]},h}function sh(a,n,i,s,r,h){if(!h)return bg(a,n,i,s,r);var f=te(h),d=Qt(h),m=f*a,_=d*a,x=f/a,b=d/a,E=(d*i-f*n)/a,C=(d*n+f*i)/a;function M(S,z){return S*=s,z*=r,[m*S-_*z+n,i-_*S-m*z]}return M.invert=function(S,z){return[s*(x*S-b*z+E),r*(C-b*S-x*z)]},M}function xg(a){return wg(function(){return a})()}function wg(a){var n,i=150,s=480,r=250,h=0,f=0,d=0,m=0,_=0,x,b=0,E=1,C=1,M=null,S=th,z=null,Z,O,q,j=eh,X=.5,et,ot,I,N,R;function F(D){return I(D[0]*qe,D[1]*qe)}function G(D){return D=I.invert(D[0],D[1]),D&&[D[0]*Di,D[1]*Di]}F.stream=function(D){return N&&R===D?N:N=_g(vg(x)(S(et(j(R=D)))))},F.preclip=function(D){return arguments.length?(S=D,M=void 0,W()):S},F.postclip=function(D){return arguments.length?(j=D,z=Z=O=q=null,W()):j},F.clipAngle=function(D){return arguments.length?(S=+D?lg(M=D*qe):(M=null,th),W()):M*Di},F.clipExtent=function(D){return arguments.length?(j=D==null?(z=Z=O=q=null,eh):hg(z=+D[0][0],Z=+D[0][1],O=+D[1][0],q=+D[1][1]),W()):z==null?null:[[z,Z],[O,q]]},F.scale=function(D){return arguments.length?(i=+D,H()):i},F.translate=function(D){return arguments.length?(s=+D[0],r=+D[1],H()):[s,r]},F.center=function(D){return arguments.length?(h=D[0]%360*qe,f=D[1]%360*qe,H()):[h*Di,f*Di]},F.rotate=function(D){return arguments.length?(d=D[0]%360*qe,m=D[1]%360*qe,_=D.length>2?D[2]%360*qe:0,H()):[d*Di,m*Di,_*Di]},F.angle=function(D){return arguments.length?(b=D%360*qe,H()):b*Di},F.reflectX=function(D){return arguments.length?(E=D?-1:1,H()):E<0},F.reflectY=function(D){return arguments.length?(C=D?-1:1,H()):C<0},F.precision=function(D){return arguments.length?(et=oh(ot,X=D*D),W()):Zr(X)},F.fitExtent=function(D,Y){return nh(F,D,Y)},F.fitSize=function(D,Y){return fg(F,D,Y)},F.fitWidth=function(D,Y){return dg(F,D,Y)},F.fitHeight=function(D,Y){return gg(F,D,Y)};function H(){var D=sh(i,0,0,E,C,b).apply(null,n(h,f)),Y=sh(i,s-D[0],r-D[1],E,C,b);return x=tg(d,m,_),ot=Pa(n,Y),I=Pa(x,ot),et=oh(ot,X),W()}function W(){return N=R=null,F}return function(){return n=a.apply(this,arguments),F.invert=n.invert&&G,H()}}function kg(a){return function(n,i){var s=te(n),r=te(i),h=a(s*r);return h===1/0?[2,0]:[h*r*Qt(n),h*Qt(i)]}}function Lg(a){return function(n,i){var s=Zr(n*n+i*i),r=a(s),h=Qt(r),f=te(r);return[jn(n*h,s*f),Kn(s&&i*h/s)]}}var ah=kg(function(a){return(a=qu(a))&&a/Qt(a)});ah.invert=Lg(function(a){return a});function Eg(){return xg(ah).scale(79.4188).clipAngle(180-.001)}var{BufferOp:Tg,GeoJSONReader:Ig,GeoJSONWriter:Cg}=Jd;function lh(a,n,i){i=i||{};var s=i.units||"kilometers",r=i.steps||8;if(!a)throw new Error("geojson is required");if(typeof i!="object")throw new Error("options must be an object");if(typeof r!="number")throw new Error("steps must be an number");if(n===void 0)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var h=[];switch(a.type){case"GeometryCollection":return Hn(a,function(f){var d=hs(f,n,s,r);d&&h.push(d)}),Re(h);case"FeatureCollection":return Zn(a,function(f){var d=hs(f,n,s,r);d&&Zn(d,function(m){m&&h.push(m)})}),Re(h)}return hs(a,n,s,r)}function hs(a,n,i,s){var r=a.properties||{},h=a.type==="Feature"?a.geometry:a;if(h.type==="GeometryCollection"){var f=[];return Hn(a,function(S){var z=hs(S,n,i,s);z&&f.push(z)}),Re(f)}var d=Sg(h),m={type:h.type,coordinates:hh(h.coordinates,d)},_=new Ig,x=_.read(m),b=cu(fu(n,i),"meters"),E=Tg.bufferOp(x,b,s),C=new Cg;if(E=C.write(E),!uh(E.coordinates)){var M={type:E.type,coordinates:ch(E.coordinates,d)};return Xe(M,r)}}function uh(a){return Array.isArray(a[0])?uh(a[0]):isNaN(a[0])}function hh(a,n){return typeof a[0]!="object"?n(a):a.map(function(i){return hh(i,n)})}function ch(a,n){return typeof a[0]!="object"?n.invert(a):a.map(function(i){return ch(i,n)})}function Sg(a){var n=Hd(a).geometry.coordinates,i=[-n[0],-n[1]];return Eg().rotate(i).scale(Kt)}function Mg(a,n={}){let i=0,s=0,r=0;return Vo(a,function(h){i+=h[0],s+=h[1],r++},!0),Ue([i/r,s/r],n.properties)}function Ag(a){let n,i;const s={type:"FeatureCollection",features:[]};if(a.type==="Feature"?i=a.geometry:i=a,i.type==="LineString")n=[i.coordinates];else if(i.type==="MultiLineString")n=i.coordinates;else if(i.type==="MultiPolygon")n=[].concat(...i.coordinates);else if(i.type==="Polygon")n=i.coordinates;else throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");return n.forEach(r=>{n.forEach(h=>{for(let f=0;f<r.length-1;f++)for(let d=f;d<h.length-1;d++){if(r===h&&(Math.abs(f-d)===1||f===0&&d===r.length-2&&r[f][0]===r[r.length-1][0]&&r[f][1]===r[r.length-1][1]))continue;const m=Pg(r[f][0],r[f][1],r[f+1][0],r[f+1][1],h[d][0],h[d][1],h[d+1][0],h[d+1][1]);m&&s.features.push(Ue([m[0],m[1]]))}})}),s}function Pg(a,n,i,s,r,h,f,d){let m,_,x,b,E;const C={x:null,y:null,onLine1:!1,onLine2:!1};return m=(d-h)*(i-a)-(f-r)*(s-n),m===0?C.x!==null&&C.y!==null?C:!1:(_=n-h,x=a-r,b=(f-r)*_-(d-h)*x,E=(i-a)*_-(s-n)*x,_=b/m,x=E/m,C.x=a+_*(i-a),C.y=n+_*(s-n),_>=0&&_<=1&&(C.onLine1=!0),x>=0&&x<=1&&(C.onLine2=!0),C.onLine1&&C.onLine2?[C.x,C.y]:!1)}function cs(a){var n=a[0],i=a[1];return[i[0]-n[0],i[1]-n[1]]}function za(a,n){return a[0]*n[1]-n[0]*a[1]}function Ng(a,n){return[a[0]+n[0],a[1]+n[1]]}function Og(a,n){return[a[0]-n[0],a[1]-n[1]]}function Rg(a,n){return[a*n[0],a*n[1]]}function Dg(a,n){var i=a[0],s=cs(a),r=n[0],h=cs(n),f=za(s,h),d=Og(r,i),m=za(d,h),_=m/f,x=Ng(i,Rg(_,s));return x}function Bg(a,n){var i=cs(a),s=cs(n);return za(i,s)===0}function zg(a,n){return Bg(a,n)?!1:Dg(a,n)}function Fa(a,n,i={}){if(i=i||{},!va(i))throw new Error("options is invalid");const{units:s="kilometers"}=i;if(!a)throw new Error("geojson is required");if(n==null||isNaN(n))throw new Error("distance is required");var r=Xo(a),h=a.type==="Feature"?a.properties:{};switch(r){case"LineString":return fh(a,n,s);case"MultiLineString":var f=[];return Yn(a,function(d){f.push(fh(d,n,s).geometry.coordinates)}),hu(f,h);default:throw new Error("geometry "+r+" is not supported")}}function fh(a,n,i){var s=[],r=td(n,i),h=Je(a),f=[];return h.forEach(function(d,m){if(m!==h.length-1){var _=Fg(d,h[m+1],r);if(s.push(_),m>0){var x=s[m-1],b=zg(_,x);b!==!1&&(x[1]=b,_[0]=b),f.push(x[0]),m===h.length-2&&(f.push(_[0]),f.push(_[1]))}h.length===2&&(f.push(_[0]),f.push(_[1]))}}),Pi(f,a.type==="Feature"?a.properties:{})}function Fg(a,n,i){var s=Math.sqrt((a[0]-n[0])*(a[0]-n[0])+(a[1]-n[1])*(a[1]-n[1])),r=a[0]+i*(n[1]-a[1])/s,h=n[0]+i*(n[1]-a[1])/s,f=a[1]+i*(a[0]-n[0])/s,d=n[1]+i*(a[0]-n[0])/s;return[[r,f],[h,d]]}function Gg(a,n,i,s,r){dh(a,n,i||0,s||a.length-1,r||Ug)}function dh(a,n,i,s,r){for(;s>i;){if(s-i>600){var h=s-i+1,f=n-i+1,d=Math.log(h),m=.5*Math.exp(2*d/3),_=.5*Math.sqrt(d*m*(h-m)/h)*(f-h/2<0?-1:1),x=Math.max(i,Math.floor(n-f*m/h+_)),b=Math.min(s,Math.floor(n+(h-f)*m/h+_));dh(a,n,x,b,r)}var E=a[n],C=i,M=s;for(Xr(a,i,n),r(a[s],E)>0&&Xr(a,i,s);C<M;){for(Xr(a,C,M),C++,M--;r(a[C],E)<0;)C++;for(;r(a[M],E)>0;)M--}r(a[i],E)===0?Xr(a,i,M):(M++,Xr(a,M,s)),M<=n&&(i=M+1),n<=M&&(s=M-1)}}function Xr(a,n,i){var s=a[n];a[n]=a[i],a[i]=s}function Ug(a,n){return a<n?-1:a>n?1:0}let qg=class{constructor(n=9){this._maxEntries=Math.max(4,n),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(n){let i=this.data;const s=[];if(!ds(n,i))return s;const r=this.toBBox,h=[];for(;i;){for(let f=0;f<i.children.length;f++){const d=i.children[f],m=i.leaf?r(d):d;ds(n,m)&&(i.leaf?s.push(d):Ua(n,m)?this._all(d,s):h.push(d))}i=h.pop()}return s}collides(n){let i=this.data;if(!ds(n,i))return!1;const s=[];for(;i;){for(let r=0;r<i.children.length;r++){const h=i.children[r],f=i.leaf?this.toBBox(h):h;if(ds(n,f)){if(i.leaf||Ua(n,f))return!0;s.push(h)}}i=s.pop()}return!1}load(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(let s=0;s<n.length;s++)this.insert(n[s]);return this}let i=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){const s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}return this}insert(n){return n&&this._insert(n,this.data.height-1),this}clear(){return this.data=er([]),this}remove(n,i){if(!n)return this;let s=this.data;const r=this.toBBox(n),h=[],f=[];let d,m,_;for(;s||h.length;){if(s||(s=h.pop(),m=h[h.length-1],d=f.pop(),_=!0),s.leaf){const x=Zg(n,s.children,i);if(x!==-1)return s.children.splice(x,1),h.push(s),this._condense(h),this}!_&&!s.leaf&&Ua(s,r)?(h.push(s),f.push(d),d=0,m=s,s=s.children[0]):m?(d++,s=m.children[d],_=!1):s=null}return this}toBBox(n){return n}compareMinX(n,i){return n.minX-i.minX}compareMinY(n,i){return n.minY-i.minY}toJSON(){return this.data}fromJSON(n){return this.data=n,this}_all(n,i){const s=[];for(;n;)n.leaf?i.push(...n.children):s.push(...n.children),n=s.pop();return i}_build(n,i,s,r){const h=s-i+1;let f=this._maxEntries,d;if(h<=f)return d=er(n.slice(i,s+1)),tr(d,this.toBBox),d;r||(r=Math.ceil(Math.log(h)/Math.log(f)),f=Math.ceil(h/Math.pow(f,r-1))),d=er([]),d.leaf=!1,d.height=r;const m=Math.ceil(h/f),_=m*Math.ceil(Math.sqrt(f));gh(n,i,s,_,this.compareMinX);for(let x=i;x<=s;x+=_){const b=Math.min(x+_-1,s);gh(n,x,b,m,this.compareMinY);for(let E=x;E<=b;E+=m){const C=Math.min(E+m-1,b);d.children.push(this._build(n,E,C,r-1))}}return tr(d,this.toBBox),d}_chooseSubtree(n,i,s,r){for(;r.push(i),!(i.leaf||r.length-1===s);){let h=1/0,f=1/0,d;for(let m=0;m<i.children.length;m++){const _=i.children[m],x=Ga(_),b=Vg(n,_)-x;b<f?(f=b,h=x<h?x:h,d=_):b===f&&x<h&&(h=x,d=_)}i=d||i.children[0]}return i}_insert(n,i,s){const r=s?n:this.toBBox(n),h=[],f=this._chooseSubtree(r,this.data,i,h);for(f.children.push(n),Wr(f,r);i>=0&&h[i].children.length>this._maxEntries;)this._split(h,i),i--;this._adjustParentBBoxes(r,h,i)}_split(n,i){const s=n[i],r=s.children.length,h=this._minEntries;this._chooseSplitAxis(s,h,r);const f=this._chooseSplitIndex(s,h,r),d=er(s.children.splice(f,s.children.length-f));d.height=s.height,d.leaf=s.leaf,tr(s,this.toBBox),tr(d,this.toBBox),i?n[i-1].children.push(d):this._splitRoot(s,d)}_splitRoot(n,i){this.data=er([n,i]),this.data.height=n.height+1,this.data.leaf=!1,tr(this.data,this.toBBox)}_chooseSplitIndex(n,i,s){let r,h=1/0,f=1/0;for(let d=i;d<=s-i;d++){const m=Jr(n,0,d,this.toBBox),_=Jr(n,d,s,this.toBBox),x=Xg(m,_),b=Ga(m)+Ga(_);x<h?(h=x,r=d,f=b<f?b:f):x===h&&b<f&&(f=b,r=d)}return r||s-i}_chooseSplitAxis(n,i,s){const r=n.leaf?this.compareMinX:Hg,h=n.leaf?this.compareMinY:Yg,f=this._allDistMargin(n,i,s,r),d=this._allDistMargin(n,i,s,h);f<d&&n.children.sort(r)}_allDistMargin(n,i,s,r){n.children.sort(r);const h=this.toBBox,f=Jr(n,0,i,h),d=Jr(n,s-i,s,h);let m=fs(f)+fs(d);for(let _=i;_<s-i;_++){const x=n.children[_];Wr(f,n.leaf?h(x):x),m+=fs(f)}for(let _=s-i-1;_>=i;_--){const x=n.children[_];Wr(d,n.leaf?h(x):x),m+=fs(d)}return m}_adjustParentBBoxes(n,i,s){for(let r=s;r>=0;r--)Wr(i[r],n)}_condense(n){for(let i=n.length-1,s;i>=0;i--)n[i].children.length===0?i>0?(s=n[i-1].children,s.splice(s.indexOf(n[i]),1)):this.clear():tr(n[i],this.toBBox)}};function Zg(a,n,i){if(!i)return n.indexOf(a);for(let s=0;s<n.length;s++)if(i(a,n[s]))return s;return-1}function tr(a,n){Jr(a,0,a.children.length,n,a)}function Jr(a,n,i,s,r){r||(r=er(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let h=n;h<i;h++){const f=a.children[h];Wr(r,a.leaf?s(f):f)}return r}function Wr(a,n){return a.minX=Math.min(a.minX,n.minX),a.minY=Math.min(a.minY,n.minY),a.maxX=Math.max(a.maxX,n.maxX),a.maxY=Math.max(a.maxY,n.maxY),a}function Hg(a,n){return a.minX-n.minX}function Yg(a,n){return a.minY-n.minY}function Ga(a){return(a.maxX-a.minX)*(a.maxY-a.minY)}function fs(a){return a.maxX-a.minX+(a.maxY-a.minY)}function Vg(a,n){return(Math.max(n.maxX,a.maxX)-Math.min(n.minX,a.minX))*(Math.max(n.maxY,a.maxY)-Math.min(n.minY,a.minY))}function Xg(a,n){const i=Math.max(a.minX,n.minX),s=Math.max(a.minY,n.minY),r=Math.min(a.maxX,n.maxX),h=Math.min(a.maxY,n.maxY);return Math.max(0,r-i)*Math.max(0,h-s)}function Ua(a,n){return a.minX<=n.minX&&a.minY<=n.minY&&n.maxX<=a.maxX&&n.maxY<=a.maxY}function ds(a,n){return n.minX<=a.maxX&&n.minY<=a.maxY&&n.maxX>=a.minX&&n.maxY>=a.minY}function er(a){return{children:a,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function gh(a,n,i,s,r){const h=[n,i];for(;h.length;){if(i=h.pop(),n=h.pop(),i-n<=s)continue;const f=n+Math.ceil((i-n)/s/2)*s;Gg(a,f,n,i,r),h.push(n,f,f,i)}}function qa(a){var n;if(a.bbox)n=a.bbox;else if(Array.isArray(a)&&a.length===4)n=a;else if(Array.isArray(a)&&a.length===6)n=[a[0],a[1],a[3],a[4]];else if(a.type==="Feature")n=ji(a);else if(a.type==="FeatureCollection")n=ji(a);else throw new Error("invalid geojson");return{minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]}}var Jg=class{constructor(a=9){this.tree=new qg(a),this.tree.toBBox=qa}insert(a){if(a.type!=="Feature")throw new Error("invalid feature");return a.bbox=a.bbox?a.bbox:ji(a),this.tree.insert(a),this}load(a){var n=[];return Array.isArray(a)?a.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:ji(i),n.push(i)}):Zn(a,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:ji(i),n.push(i)}),this.tree.load(n),this}remove(a,n){if(a.type!=="Feature")throw new Error("invalid feature");return a.bbox=a.bbox?a.bbox:ji(a),this.tree.remove(a,n),this}clear(){return this.tree.clear(),this}search(a){var n=this.tree.search(qa(a));return Re(n)}collides(a){return this.tree.collides(qa(a))}all(){const a=this.tree.all();return Re(a)}toJSON(){return this.tree.toJSON()}fromJSON(a){return this.tree.fromJSON(a),this}};function ph(a){return new Jg(a)}function Wg(a,n){if(n=n!=null?n:{},!va(n))throw new Error("options is invalid");var i=n.precision,s=n.coordinates,r=n.mutate;if(i=i==null||isNaN(i)?6:i,s=s==null||isNaN(s)?3:s,!a)throw new Error("<geojson> is required");if(typeof i!="number")throw new Error("<precision> must be a number");if(typeof s!="number")throw new Error("<coordinates> must be a number");(r===!1||r===void 0)&&(a=JSON.parse(JSON.stringify(a)));var h=Math.pow(10,i);return Vo(a,function(f){jg(f,h,s)}),a}function jg(a,n,i){a.length>i&&a.splice(i,a.length);for(var s=0;s<a.length;s++)a[s]=Math.round(a[s]*n)/n;return a}function Kg(a){if(!a)throw new Error("geojson is required");const n=[];return Yn(a,i=>{Qg(i,n)}),Re(n)}function Qg(a,n){let i=[];const s=a.geometry;if(s!==null){switch(s.type){case"Polygon":i=Je(s);break;case"LineString":i=[Je(s)]}i.forEach(r=>{$g(r,a.properties).forEach(f=>{f.id=n.length,n.push(f)})})}}function $g(a,n){const i=[];return a.reduce((s,r)=>{const h=Pi([s,r],n);return h.bbox=tp(s,r),i.push(h),r}),i}function tp(a,n){const i=a[0],s=a[1],r=n[0],h=n[1],f=i<r?i:r,d=s<h?s:h,m=i>r?i:r,_=s>h?s:h;return[f,d,m,_]}function Za(a,n,i={}){var s=bi(a),r=bi(n),h=qn(r[1]-s[1]),f=qn(r[0]-s[0]),d=qn(s[1]),m=qn(r[1]),_=Math.pow(Math.sin(h/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(d)*Math.cos(m);return cu(2*Math.atan2(Math.sqrt(_),Math.sqrt(1-_)),i.units)}var ep=Object.defineProperty,ip=Object.defineProperties,np=Object.getOwnPropertyDescriptors,mh=Object.getOwnPropertySymbols,rp=Object.prototype.hasOwnProperty,op=Object.prototype.propertyIsEnumerable,yh=(a,n,i)=>n in a?ep(a,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[n]=i,sp=(a,n)=>{for(var i in n||(n={}))rp.call(n,i)&&yh(a,i,n[i]);if(mh)for(var i of mh(n))op.call(n,i)&&yh(a,i,n[i]);return a},ap=(a,n)=>ip(a,np(n));function lp(a,n,i={}){if(!a||!n)throw new Error("lines and inputPoint are required arguments");const s=bi(n);let r=Ue([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),h=0,f=0,d=-1;return Yn(a,function(m,_,x){d!==x&&(d=x,f=0);const b=Je(m);for(let E=0;E<b.length-1;E++){const C=Ue(b[E]),M=bi(C),S=Ue(b[E+1]),z=bi(S),Z=Za(C,S,i);let O,q;z[0]===s[0]&&z[1]===s[1]?[O,q]=[z,!0]:M[0]===s[0]&&M[1]===s[1]?[O,q]=[M,!1]:[O,q]=cp(M,z,s);const j=Za(n,O,i);if(j<r.properties.pointDistance){const X=Za(C,O,i);r=Ue(O,{lineStringIndex:x,segmentIndex:q?E+1:E,totalDistance:h+X,lineDistance:f+X,segmentDistance:X,pointDistance:j,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),r.properties=ap(sp({},r.properties),{multiFeatureIndex:r.properties.lineStringIndex,index:r.properties.segmentIndex,location:r.properties.totalDistance,dist:r.properties.pointDistance})}h+=Z,f+=Z}}),r}function _n(a,n){const[i,s,r]=a,[h,f,d]=n;return i*h+s*f+r*d}function jr(a,n){const[i,s,r]=a,[h,f,d]=n;return[s*d-r*f,r*h-i*d,i*f-s*h]}function up(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2))}function _h(a){const n=up(a);return[a[0]/n,a[1]/n,a[2]/n]}function Ha(a){const n=qn(a[1]),i=qn(a[0]);return[Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)]}function hp(a){const[n,i,s]=a,r=Math.min(Math.max(s,-1),1),h=_a(Math.asin(r));return[_a(Math.atan2(i,n)),h]}function cp(a,n,i){const s=Ha(a),r=Ha(n),h=Ha(i),f=jr(s,r);if(f[0]===0&&f[1]===0&&f[2]===0)return _n(s,r)>0?[[...n],!0]:[[...i],!1];const d=jr(f,h);if(d[0]===0&&d[1]===0&&d[2]===0)return[[...n],!0];const m=jr(d,f),_=_h(m),x=[-_[0],-_[1],-_[2]],b=_n(h,_)>_n(h,x)?_:x,E=_h(f),C=_n(jr(s,b),E),M=_n(jr(b,r),E);return C>=0&&M>=0?[hp(b),!1]:_n(s,h)>_n(r,h)?[[...a],!1]:[[...n],!0]}function fp(a,n){if(!a)throw new Error("line is required");if(!n)throw new Error("splitter is required");const i=Xo(a),s=Xo(n);if(i!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var r=Wg(n,{precision:7});switch(a.type!=="Feature"&&(a=Xe(a)),s){case"Point":return Ya(a,r);case"MultiPoint":return vh(a,r);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return vh(a,Ki(a,r,{ignoreSelfIntersections:!0}))}}function vh(a,n){var i=[],s=ph();return Yn(n,function(r){if(i.forEach(function(d,m){d.id=m}),!i.length)i=Ya(a,r).features,s.load(Re(i));else{var h=s.search(r);if(h.features.length){var f=bh(r,h);i=i.filter(function(d){return d.id!==f.id}),s.remove(f),Zn(Ya(f,r),function(d){i.push(d),s.insert(d)})}}}),Re(i)}function Ya(a,n){var i=[],s=Je(a)[0],r=Je(a)[a.geometry.coordinates.length-1];if(Va(s,bi(n))||Va(r,bi(n)))return Re([a]);var h=ph(),f=Kg(a);h.load(f);var d=h.search(n);if(!d.features.length)return Re([a]);var m=bh(n,d),_=[s],x=ed(f,function(b,E,C){var M=Je(E)[1],S=bi(n);return C===m.id?(b.push(S),i.push(Pi(b)),Va(S,M)?[S]:[S,M]):(b.push(M),b)},_);return x.length>1&&i.push(Pi(x)),Re(i)}function bh(a,n){if(!n.features.length)throw new Error("lines must contain features");if(n.features.length===1)return n.features[0];var i,s=1/0;return Zn(n,function(r){var h=lp(r,a),f=h.properties.pointDistance;f<s&&(i=r,s=f)}),i}function Va(a,n){return a[0]===n[0]&&a[1]===n[1]}function dp(a){if(!a)throw new Error("geojson is required");switch(a.type){case"Feature":return xh(a);case"FeatureCollection":return gp(a);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Xa(a);default:throw new Error("unknown GeoJSON type")}}function xh(a){const n={type:"Feature"};return Object.keys(a).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:n[i]=a[i]}}),n.properties=wh(a.properties),a.geometry==null?n.geometry=null:n.geometry=Xa(a.geometry),n}function wh(a){const n={};return a&&Object.keys(a).forEach(i=>{const s=a[i];typeof s=="object"?s===null?n[i]=null:Array.isArray(s)?n[i]=s.map(r=>r):n[i]=wh(s):n[i]=s}),n}function gp(a){const n={type:"FeatureCollection"};return Object.keys(a).forEach(i=>{switch(i){case"type":case"features":return;default:n[i]=a[i]}}),n.features=a.features.map(i=>xh(i)),n}function Xa(a){const n={type:a.type};return a.bbox&&(n.bbox=a.bbox),a.type==="GeometryCollection"?(n.geometries=a.geometries.map(i=>Xa(i)),n):(n.coordinates=kh(a.coordinates),n)}function kh(a){const n=a;return typeof n[0]!="object"?n.slice():n.map(i=>kh(i))}function pp(a,n){var i=a[0]-n[0],s=a[1]-n[1];return i*i+s*s}function mp(a,n,i){var s=n[0],r=n[1],h=i[0]-s,f=i[1]-r;if(h!==0||f!==0){var d=((a[0]-s)*h+(a[1]-r)*f)/(h*h+f*f);d>1?(s=i[0],r=i[1]):d>0&&(s+=h*d,r+=f*d)}return h=a[0]-s,f=a[1]-r,h*h+f*f}function yp(a,n){for(var i=a[0],s=[i],r,h=1,f=a.length;h<f;h++)r=a[h],pp(r,i)>n&&(s.push(r),i=r);return i!==r&&s.push(r),s}function Ja(a,n,i,s,r){for(var h=s,f,d=n+1;d<i;d++){var m=mp(a[d],a[n],a[i]);m>h&&(f=d,h=m)}h>s&&(f-n>1&&Ja(a,n,f,s,r),r.push(a[f]),i-f>1&&Ja(a,f,i,s,r))}function _p(a,n){var i=a.length-1,s=[a[0]];return Ja(a,0,i,n,s),s.push(a[i]),s}function gs(a,n,i){if(a.length<=2)return a;var s=n!==void 0?n*n:1;return a=i?a:yp(a,s),a=_p(a,s),a}function vp(a,n={}){var i,s,r;if(n=n!=null?n:{},!va(n))throw new Error("options is invalid");const h=(i=n.tolerance)!=null?i:1,f=(s=n.highQuality)!=null?s:!1,d=(r=n.mutate)!=null?r:!1;if(!a)throw new Error("geojson is required");if(h&&h<0)throw new Error("invalid tolerance");return d!==!0&&(a=dp(a)),Hn(a,function(m){bp(m,h,f)}),a}function bp(a,n,i){const s=a.type;if(s==="Point"||s==="MultiPoint")return a;if(Ta(a,{mutate:!0}),s!=="GeometryCollection")switch(s){case"LineString":a.coordinates=gs(a.coordinates,n,i);break;case"MultiLineString":a.coordinates=a.coordinates.map(r=>gs(r,n,i));break;case"Polygon":a.coordinates=Lh(a.coordinates,n,i);break;case"MultiPolygon":a.coordinates=a.coordinates.map(r=>Lh(r,n,i))}return a}function Lh(a,n,i){return a.map(function(s){if(s.length<4)throw new Error("invalid polygon");let r=n,h=gs(s,r,i);for(;!Eh(h)&&r>=Number.EPSILON;)r-=r*.01,h=gs(s,r,i);return Eh(h)?((h[h.length-1][0]!==h[0][0]||h[h.length-1][1]!==h[0][1])&&h.push(h[0]),h):s})}function Eh(a){return a.length<3?!1:!(a.length===3&&a[2][0]===a[0][0]&&a[2][1]===a[0][1])}var xp=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Wa=Math.ceil,je=Math.floor,De="[BigNumber Error] ",Th=De+"Number primitive has more than 15 significant digits: ",fi=1e14,Pt=14,ja=9007199254740991,Ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Qi=1e7,ge=1e9;function Ih(a){var n,i,s,r=O.prototype={constructor:O,toString:null,valueOf:null},h=new O(1),f=20,d=4,m=-7,_=21,x=-1e7,b=1e7,E=!1,C=1,M=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",Z=!0;function O(I,N){var R,F,G,H,W,D,Y,$,J=this;if(!(J instanceof O))return new O(I,N);if(N==null){if(I&&I._isBigNumber===!0){J.s=I.s,!I.c||I.e>b?J.c=J.e=null:I.e<x?J.c=[J.e=0]:(J.e=I.e,J.c=I.c.slice());return}if((D=typeof I=="number")&&I*0==0){if(J.s=1/I<0?(I=-I,-1):1,I===~~I){for(H=0,W=I;W>=10;W/=10,H++);H>b?J.c=J.e=null:(J.e=H,J.c=[I]);return}$=String(I)}else{if(!xp.test($=String(I)))return s(J,$,D);J.s=$.charCodeAt(0)==45?($=$.slice(1),-1):1}(H=$.indexOf("."))>-1&&($=$.replace(".","")),(W=$.search(/e/i))>0?(H<0&&(H=W),H+=+$.slice(W+1),$=$.substring(0,W)):H<0&&(H=$.length)}else{if(ne(N,2,z.length,"Base"),N==10&&Z)return J=new O(I),et(J,f+J.e+1,d);if($=String(I),D=typeof I=="number"){if(I*0!=0)return s(J,$,D,N);if(J.s=1/I<0?($=$.slice(1),-1):1,O.DEBUG&&$.replace(/^0\.0*|\./,"").length>15)throw Error(Th+I)}else J.s=$.charCodeAt(0)===45?($=$.slice(1),-1):1;for(R=z.slice(0,N),H=W=0,Y=$.length;W<Y;W++)if(R.indexOf(F=$.charAt(W))<0){if(F=="."){if(W>H){H=Y;continue}}else if(!G&&($==$.toUpperCase()&&($=$.toLowerCase())||$==$.toLowerCase()&&($=$.toUpperCase()))){G=!0,W=-1,H=0;continue}return s(J,String(I),D,N)}D=!1,$=i($,N,10,J.s),(H=$.indexOf("."))>-1?$=$.replace(".",""):H=$.length}for(W=0;$.charCodeAt(W)===48;W++);for(Y=$.length;$.charCodeAt(--Y)===48;);if($=$.slice(W,++Y)){if(Y-=W,D&&O.DEBUG&&Y>15&&(I>ja||I!==je(I)))throw Error(Th+J.s*I);if((H=H-W-1)>b)J.c=J.e=null;else if(H<x)J.c=[J.e=0];else{if(J.e=H,J.c=[],W=(H+1)%Pt,H<0&&(W+=Pt),W<Y){for(W&&J.c.push(+$.slice(0,W)),Y-=Pt;W<Y;)J.c.push(+$.slice(W,W+=Pt));W=Pt-($=$.slice(W)).length}else W-=Y;for(;W--;$+="0");J.c.push(+$)}}else J.c=[J.e=0]}O.clone=Ih,O.ROUND_UP=0,O.ROUND_DOWN=1,O.ROUND_CEIL=2,O.ROUND_FLOOR=3,O.ROUND_HALF_UP=4,O.ROUND_HALF_DOWN=5,O.ROUND_HALF_EVEN=6,O.ROUND_HALF_CEIL=7,O.ROUND_HALF_FLOOR=8,O.EUCLID=9,O.config=O.set=function(I){var N,R;if(I!=null)if(typeof I=="object"){if(I.hasOwnProperty(N="DECIMAL_PLACES")&&(R=I[N],ne(R,0,ge,N),f=R),I.hasOwnProperty(N="ROUNDING_MODE")&&(R=I[N],ne(R,0,8,N),d=R),I.hasOwnProperty(N="EXPONENTIAL_AT")&&(R=I[N],R&&R.pop?(ne(R[0],-ge,0,N),ne(R[1],0,ge,N),m=R[0],_=R[1]):(ne(R,-ge,ge,N),m=-(_=R<0?-R:R))),I.hasOwnProperty(N="RANGE"))if(R=I[N],R&&R.pop)ne(R[0],-ge,-1,N),ne(R[1],1,ge,N),x=R[0],b=R[1];else if(ne(R,-ge,ge,N),R)x=-(b=R<0?-R:R);else throw Error(De+N+" cannot be zero: "+R);if(I.hasOwnProperty(N="CRYPTO"))if(R=I[N],R===!!R)if(R)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))E=R;else throw E=!R,Error(De+"crypto unavailable");else E=R;else throw Error(De+N+" not true or false: "+R);if(I.hasOwnProperty(N="MODULO_MODE")&&(R=I[N],ne(R,0,9,N),C=R),I.hasOwnProperty(N="POW_PRECISION")&&(R=I[N],ne(R,0,ge,N),M=R),I.hasOwnProperty(N="FORMAT"))if(R=I[N],typeof R=="object")S=R;else throw Error(De+N+" not an object: "+R);if(I.hasOwnProperty(N="ALPHABET"))if(R=I[N],typeof R=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(R))Z=R.slice(0,10)=="0123456789",z=R;else throw Error(De+N+" invalid: "+R)}else throw Error(De+"Object expected: "+I);return{DECIMAL_PLACES:f,ROUNDING_MODE:d,EXPONENTIAL_AT:[m,_],RANGE:[x,b],CRYPTO:E,MODULO_MODE:C,POW_PRECISION:M,FORMAT:S,ALPHABET:z}},O.isBigNumber=function(I){if(!I||I._isBigNumber!==!0)return!1;if(!O.DEBUG)return!0;var N,R,F=I.c,G=I.e,H=I.s;t:if({}.toString.call(F)=="[object Array]"){if((H===1||H===-1)&&G>=-ge&&G<=ge&&G===je(G)){if(F[0]===0){if(G===0&&F.length===1)return!0;break t}if(N=(G+1)%Pt,N<1&&(N+=Pt),String(F[0]).length==N){for(N=0;N<F.length;N++)if(R=F[N],R<0||R>=fi||R!==je(R))break t;if(R!==0)return!0}}}else if(F===null&&G===null&&(H===null||H===1||H===-1))return!0;throw Error(De+"Invalid BigNumber: "+I)},O.maximum=O.max=function(){return j(arguments,-1)},O.minimum=O.min=function(){return j(arguments,1)},O.random=(function(){var I=9007199254740992,N=Math.random()*I&2097151?function(){return je(Math.random()*I)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(R){var F,G,H,W,D,Y=0,$=[],J=new O(h);if(R==null?R=f:ne(R,0,ge),W=Wa(R/Pt),E)if(crypto.getRandomValues){for(F=crypto.getRandomValues(new Uint32Array(W*=2));Y<W;)D=F[Y]*131072+(F[Y+1]>>>11),D>=9e15?(G=crypto.getRandomValues(new Uint32Array(2)),F[Y]=G[0],F[Y+1]=G[1]):($.push(D%1e14),Y+=2);Y=W/2}else if(crypto.randomBytes){for(F=crypto.randomBytes(W*=7);Y<W;)D=(F[Y]&31)*281474976710656+F[Y+1]*1099511627776+F[Y+2]*4294967296+F[Y+3]*16777216+(F[Y+4]<<16)+(F[Y+5]<<8)+F[Y+6],D>=9e15?crypto.randomBytes(7).copy(F,Y):($.push(D%1e14),Y+=7);Y=W/7}else throw E=!1,Error(De+"crypto unavailable");if(!E)for(;Y<W;)D=N(),D<9e15&&($[Y++]=D%1e14);for(W=$[--Y],R%=Pt,W&&R&&(D=Ka[Pt-R],$[Y]=je(W/D)*D);$[Y]===0;$.pop(),Y--);if(Y<0)$=[H=0];else{for(H=-1;$[0]===0;$.splice(0,1),H-=Pt);for(Y=1,D=$[0];D>=10;D/=10,Y++);Y<Pt&&(H-=Pt-Y)}return J.e=H,J.c=$,J}})(),O.sum=function(){for(var I=1,N=arguments,R=new O(N[0]);I<N.length;)R=R.plus(N[I++]);return R},i=(function(){var I="0123456789";function N(R,F,G,H){for(var W,D=[0],Y,$=0,J=R.length;$<J;){for(Y=D.length;Y--;D[Y]*=F);for(D[0]+=H.indexOf(R.charAt($++)),W=0;W<D.length;W++)D[W]>G-1&&(D[W+1]==null&&(D[W+1]=0),D[W+1]+=D[W]/G|0,D[W]%=G)}return D.reverse()}return function(R,F,G,H,W){var D,Y,$,J,at,rt,ht,_t,kt=R.indexOf("."),dt=f,pt=d;for(kt>=0&&(J=M,M=0,R=R.replace(".",""),_t=new O(F),rt=_t.pow(R.length-kt),M=J,_t.c=N(Bi(Qe(rt.c),rt.e,"0"),10,G,I),_t.e=_t.c.length),ht=N(R,F,G,W?(D=z,I):(D=I,z)),$=J=ht.length;ht[--J]==0;ht.pop());if(!ht[0])return D.charAt(0);if(kt<0?--$:(rt.c=ht,rt.e=$,rt.s=H,rt=n(rt,_t,dt,pt,G),ht=rt.c,at=rt.r,$=rt.e),Y=$+dt+1,kt=ht[Y],J=G/2,at=at||Y<0||ht[Y+1]!=null,at=pt<4?(kt!=null||at)&&(pt==0||pt==(rt.s<0?3:2)):kt>J||kt==J&&(pt==4||at||pt==6&&ht[Y-1]&1||pt==(rt.s<0?8:7)),Y<1||!ht[0])R=at?Bi(D.charAt(1),-dt,D.charAt(0)):D.charAt(0);else{if(ht.length=Y,at)for(--G;++ht[--Y]>G;)ht[Y]=0,Y||(++$,ht=[1].concat(ht));for(J=ht.length;!ht[--J];);for(kt=0,R="";kt<=J;R+=D.charAt(ht[kt++]));R=Bi(R,$,D.charAt(0))}return R}})(),n=(function(){function I(F,G,H){var W,D,Y,$,J=0,at=F.length,rt=G%Qi,ht=G/Qi|0;for(F=F.slice();at--;)Y=F[at]%Qi,$=F[at]/Qi|0,W=ht*Y+$*rt,D=rt*Y+W%Qi*Qi+J,J=(D/H|0)+(W/Qi|0)+ht*$,F[at]=D%H;return J&&(F=[J].concat(F)),F}function N(F,G,H,W){var D,Y;if(H!=W)Y=H>W?1:-1;else for(D=Y=0;D<H;D++)if(F[D]!=G[D]){Y=F[D]>G[D]?1:-1;break}return Y}function R(F,G,H,W){for(var D=0;H--;)F[H]-=D,D=F[H]<G[H]?1:0,F[H]=D*W+F[H]-G[H];for(;!F[0]&&F.length>1;F.splice(0,1));}return function(F,G,H,W,D){var Y,$,J,at,rt,ht,_t,kt,dt,pt,vt,Yt,tt,en,qt,mt,U,Wt=F.s==G.s?1:-1,oe=F.c,Ut=G.c;if(!oe||!oe[0]||!Ut||!Ut[0])return new O(!F.s||!G.s||(oe?Ut&&oe[0]==Ut[0]:!Ut)?NaN:oe&&oe[0]==0||!Ut?Wt*0:Wt/0);for(kt=new O(Wt),dt=kt.c=[],$=F.e-G.e,Wt=H+$+1,D||(D=fi,$=Ke(F.e/Pt)-Ke(G.e/Pt),Wt=Wt/Pt|0),J=0;Ut[J]==(oe[J]||0);J++);if(Ut[J]>(oe[J]||0)&&$--,Wt<0)dt.push(1),at=!0;else{for(en=oe.length,mt=Ut.length,J=0,Wt+=2,rt=je(D/(Ut[0]+1)),rt>1&&(Ut=I(Ut,rt,D),oe=I(oe,rt,D),mt=Ut.length,en=oe.length),tt=mt,pt=oe.slice(0,mt),vt=pt.length;vt<mt;pt[vt++]=0);U=Ut.slice(),U=[0].concat(U),qt=Ut[0],Ut[1]>=D/2&&qt++;do{if(rt=0,Y=N(Ut,pt,mt,vt),Y<0){if(Yt=pt[0],mt!=vt&&(Yt=Yt*D+(pt[1]||0)),rt=je(Yt/qt),rt>1)for(rt>=D&&(rt=D-1),ht=I(Ut,rt,D),_t=ht.length,vt=pt.length;N(ht,pt,_t,vt)==1;)rt--,R(ht,mt<_t?U:Ut,_t,D),_t=ht.length,Y=1;else rt==0&&(Y=rt=1),ht=Ut.slice(),_t=ht.length;if(_t<vt&&(ht=[0].concat(ht)),R(pt,ht,vt,D),vt=pt.length,Y==-1)for(;N(Ut,pt,mt,vt)<1;)rt++,R(pt,mt<vt?U:Ut,vt,D),vt=pt.length}else Y===0&&(rt++,pt=[0]);dt[J++]=rt,pt[0]?pt[vt++]=oe[tt]||0:(pt=[oe[tt]],vt=1)}while((tt++<en||pt[0]!=null)&&Wt--);at=pt[0]!=null,dt[0]||dt.splice(0,1)}if(D==fi){for(J=1,Wt=dt[0];Wt>=10;Wt/=10,J++);et(kt,H+(kt.e=J+$*Pt-1)+1,W,at)}else kt.e=$,kt.r=+at;return kt}})();function q(I,N,R,F){var G,H,W,D,Y;if(R==null?R=d:ne(R,0,8),!I.c)return I.toString();if(G=I.c[0],W=I.e,N==null)Y=Qe(I.c),Y=F==1||F==2&&(W<=m||W>=_)?ms(Y,W):Bi(Y,W,"0");else if(I=et(new O(I),N,R),H=I.e,Y=Qe(I.c),D=Y.length,F==1||F==2&&(N<=H||H<=m)){for(;D<N;Y+="0",D++);Y=ms(Y,H)}else if(N-=W+(F===2&&H>W),Y=Bi(Y,H,"0"),H+1>D){if(--N>0)for(Y+=".";N--;Y+="0");}else if(N+=H-D,N>0)for(H+1==D&&(Y+=".");N--;Y+="0");return I.s<0&&G?"-"+Y:Y}function j(I,N){for(var R,F,G=1,H=new O(I[0]);G<I.length;G++)F=new O(I[G]),(!F.s||(R=vn(H,F))===N||R===0&&H.s===N)&&(H=F);return H}function X(I,N,R){for(var F=1,G=N.length;!N[--G];N.pop());for(G=N[0];G>=10;G/=10,F++);return(R=F+R*Pt-1)>b?I.c=I.e=null:R<x?I.c=[I.e=0]:(I.e=R,I.c=N),I}s=(function(){var I=/^(-?)0([xbo])(?=\w[\w.]*$)/i,N=/^([^.]+)\.$/,R=/^\.([^.]+)$/,F=/^-?(Infinity|NaN)$/,G=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(H,W,D,Y){var $,J=D?W:W.replace(G,"");if(F.test(J))H.s=isNaN(J)?null:J<0?-1:1;else{if(!D&&(J=J.replace(I,function(at,rt,ht){return $=(ht=ht.toLowerCase())=="x"?16:ht=="b"?2:8,!Y||Y==$?rt:at}),Y&&($=Y,J=J.replace(N,"$1").replace(R,"0.$1")),W!=J))return new O(J,$);if(O.DEBUG)throw Error(De+"Not a"+(Y?" base "+Y:"")+" number: "+W);H.s=null}H.c=H.e=null}})();function et(I,N,R,F){var G,H,W,D,Y,$,J,at=I.c,rt=Ka;if(at){t:{for(G=1,D=at[0];D>=10;D/=10,G++);if(H=N-G,H<0)H+=Pt,W=N,Y=at[$=0],J=je(Y/rt[G-W-1]%10);else if($=Wa((H+1)/Pt),$>=at.length)if(F){for(;at.length<=$;at.push(0));Y=J=0,G=1,H%=Pt,W=H-Pt+1}else break t;else{for(Y=D=at[$],G=1;D>=10;D/=10,G++);H%=Pt,W=H-Pt+G,J=W<0?0:je(Y/rt[G-W-1]%10)}if(F=F||N<0||at[$+1]!=null||(W<0?Y:Y%rt[G-W-1]),F=R<4?(J||F)&&(R==0||R==(I.s<0?3:2)):J>5||J==5&&(R==4||F||R==6&&(H>0?W>0?Y/rt[G-W]:0:at[$-1])%10&1||R==(I.s<0?8:7)),N<1||!at[0])return at.length=0,F?(N-=I.e+1,at[0]=rt[(Pt-N%Pt)%Pt],I.e=-N||0):at[0]=I.e=0,I;if(H==0?(at.length=$,D=1,$--):(at.length=$+1,D=rt[Pt-H],at[$]=W>0?je(Y/rt[G-W]%rt[W])*D:0),F)for(;;)if($==0){for(H=1,W=at[0];W>=10;W/=10,H++);for(W=at[0]+=D,D=1;W>=10;W/=10,D++);H!=D&&(I.e++,at[0]==fi&&(at[0]=1));break}else{if(at[$]+=D,at[$]!=fi)break;at[$--]=0,D=1}for(H=at.length;at[--H]===0;at.pop());}I.e>b?I.c=I.e=null:I.e<x&&(I.c=[I.e=0])}return I}function ot(I){var N,R=I.e;return R===null?I.toString():(N=Qe(I.c),N=R<=m||R>=_?ms(N,R):Bi(N,R,"0"),I.s<0?"-"+N:N)}return r.absoluteValue=r.abs=function(){var I=new O(this);return I.s<0&&(I.s=1),I},r.comparedTo=function(I,N){return vn(this,new O(I,N))},r.decimalPlaces=r.dp=function(I,N){var R,F,G,H=this;if(I!=null)return ne(I,0,ge),N==null?N=d:ne(N,0,8),et(new O(H),I+H.e+1,N);if(!(R=H.c))return null;if(F=((G=R.length-1)-Ke(this.e/Pt))*Pt,G=R[G])for(;G%10==0;G/=10,F--);return F<0&&(F=0),F},r.dividedBy=r.div=function(I,N){return n(this,new O(I,N),f,d)},r.dividedToIntegerBy=r.idiv=function(I,N){return n(this,new O(I,N),0,1)},r.exponentiatedBy=r.pow=function(I,N){var R,F,G,H,W,D,Y,$,J,at=this;if(I=new O(I),I.c&&!I.isInteger())throw Error(De+"Exponent not an integer: "+ot(I));if(N!=null&&(N=new O(N)),D=I.e>14,!at.c||!at.c[0]||at.c[0]==1&&!at.e&&at.c.length==1||!I.c||!I.c[0])return J=new O(Math.pow(+ot(at),D?I.s*(2-ps(I)):+ot(I))),N?J.mod(N):J;if(Y=I.s<0,N){if(N.c?!N.c[0]:!N.s)return new O(NaN);F=!Y&&at.isInteger()&&N.isInteger(),F&&(at=at.mod(N))}else{if(I.e>9&&(at.e>0||at.e<-1||(at.e==0?at.c[0]>1||D&&at.c[1]>=24e7:at.c[0]<8e13||D&&at.c[0]<=9999975e7)))return H=at.s<0&&ps(I)?-0:0,at.e>-1&&(H=1/H),new O(Y?1/H:H);M&&(H=Wa(M/Pt+2))}for(D?(R=new O(.5),Y&&(I.s=1),$=ps(I)):(G=Math.abs(+ot(I)),$=G%2),J=new O(h);;){if($){if(J=J.times(at),!J.c)break;H?J.c.length>H&&(J.c.length=H):F&&(J=J.mod(N))}if(G){if(G=je(G/2),G===0)break;$=G%2}else if(I=I.times(R),et(I,I.e+1,1),I.e>14)$=ps(I);else{if(G=+ot(I),G===0)break;$=G%2}at=at.times(at),H?at.c&&at.c.length>H&&(at.c.length=H):F&&(at=at.mod(N))}return F?J:(Y&&(J=h.div(J)),N?J.mod(N):H?et(J,M,d,W):J)},r.integerValue=function(I){var N=new O(this);return I==null?I=d:ne(I,0,8),et(N,N.e+1,I)},r.isEqualTo=r.eq=function(I,N){return vn(this,new O(I,N))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(I,N){return vn(this,new O(I,N))>0},r.isGreaterThanOrEqualTo=r.gte=function(I,N){return(N=vn(this,new O(I,N)))===1||N===0},r.isInteger=function(){return!!this.c&&Ke(this.e/Pt)>this.c.length-2},r.isLessThan=r.lt=function(I,N){return vn(this,new O(I,N))<0},r.isLessThanOrEqualTo=r.lte=function(I,N){return(N=vn(this,new O(I,N)))===-1||N===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(I,N){var R,F,G,H,W=this,D=W.s;if(I=new O(I,N),N=I.s,!D||!N)return new O(NaN);if(D!=N)return I.s=-N,W.plus(I);var Y=W.e/Pt,$=I.e/Pt,J=W.c,at=I.c;if(!Y||!$){if(!J||!at)return J?(I.s=-N,I):new O(at?W:NaN);if(!J[0]||!at[0])return at[0]?(I.s=-N,I):new O(J[0]?W:d==3?-0:0)}if(Y=Ke(Y),$=Ke($),J=J.slice(),D=Y-$){for((H=D<0)?(D=-D,G=J):($=Y,G=at),G.reverse(),N=D;N--;G.push(0));G.reverse()}else for(F=(H=(D=J.length)<(N=at.length))?D:N,D=N=0;N<F;N++)if(J[N]!=at[N]){H=J[N]<at[N];break}if(H&&(G=J,J=at,at=G,I.s=-I.s),N=(F=at.length)-(R=J.length),N>0)for(;N--;J[R++]=0);for(N=fi-1;F>D;){if(J[--F]<at[F]){for(R=F;R&&!J[--R];J[R]=N);--J[R],J[F]+=fi}J[F]-=at[F]}for(;J[0]==0;J.splice(0,1),--$);return J[0]?X(I,J,$):(I.s=d==3?-1:1,I.c=[I.e=0],I)},r.modulo=r.mod=function(I,N){var R,F,G=this;return I=new O(I,N),!G.c||!I.s||I.c&&!I.c[0]?new O(NaN):!I.c||G.c&&!G.c[0]?new O(G):(C==9?(F=I.s,I.s=1,R=n(G,I,0,3),I.s=F,R.s*=F):R=n(G,I,0,C),I=G.minus(R.times(I)),!I.c[0]&&C==1&&(I.s=G.s),I)},r.multipliedBy=r.times=function(I,N){var R,F,G,H,W,D,Y,$,J,at,rt,ht,_t,kt,dt,pt=this,vt=pt.c,Yt=(I=new O(I,N)).c;if(!vt||!Yt||!vt[0]||!Yt[0])return!pt.s||!I.s||vt&&!vt[0]&&!Yt||Yt&&!Yt[0]&&!vt?I.c=I.e=I.s=null:(I.s*=pt.s,!vt||!Yt?I.c=I.e=null:(I.c=[0],I.e=0)),I;for(F=Ke(pt.e/Pt)+Ke(I.e/Pt),I.s*=pt.s,Y=vt.length,at=Yt.length,Y<at&&(_t=vt,vt=Yt,Yt=_t,G=Y,Y=at,at=G),G=Y+at,_t=[];G--;_t.push(0));for(kt=fi,dt=Qi,G=at;--G>=0;){for(R=0,rt=Yt[G]%dt,ht=Yt[G]/dt|0,W=Y,H=G+W;H>G;)$=vt[--W]%dt,J=vt[W]/dt|0,D=ht*$+J*rt,$=rt*$+D%dt*dt+_t[H]+R,R=($/kt|0)+(D/dt|0)+ht*J,_t[H--]=$%kt;_t[H]=R}return R?++F:_t.splice(0,1),X(I,_t,F)},r.negated=function(){var I=new O(this);return I.s=-I.s||null,I},r.plus=function(I,N){var R,F=this,G=F.s;if(I=new O(I,N),N=I.s,!G||!N)return new O(NaN);if(G!=N)return I.s=-N,F.minus(I);var H=F.e/Pt,W=I.e/Pt,D=F.c,Y=I.c;if(!H||!W){if(!D||!Y)return new O(G/0);if(!D[0]||!Y[0])return Y[0]?I:new O(D[0]?F:G*0)}if(H=Ke(H),W=Ke(W),D=D.slice(),G=H-W){for(G>0?(W=H,R=Y):(G=-G,R=D),R.reverse();G--;R.push(0));R.reverse()}for(G=D.length,N=Y.length,G-N<0&&(R=Y,Y=D,D=R,N=G),G=0;N;)G=(D[--N]=D[N]+Y[N]+G)/fi|0,D[N]=fi===D[N]?0:D[N]%fi;return G&&(D=[G].concat(D),++W),X(I,D,W)},r.precision=r.sd=function(I,N){var R,F,G,H=this;if(I!=null&&I!==!!I)return ne(I,1,ge),N==null?N=d:ne(N,0,8),et(new O(H),I,N);if(!(R=H.c))return null;if(G=R.length-1,F=G*Pt+1,G=R[G]){for(;G%10==0;G/=10,F--);for(G=R[0];G>=10;G/=10,F++);}return I&&H.e+1>F&&(F=H.e+1),F},r.shiftedBy=function(I){return ne(I,-ja,ja),this.times("1e"+I)},r.squareRoot=r.sqrt=function(){var I,N,R,F,G,H=this,W=H.c,D=H.s,Y=H.e,$=f+4,J=new O("0.5");if(D!==1||!W||!W[0])return new O(!D||D<0&&(!W||W[0])?NaN:W?H:1/0);if(D=Math.sqrt(+ot(H)),D==0||D==1/0?(N=Qe(W),(N.length+Y)%2==0&&(N+="0"),D=Math.sqrt(+N),Y=Ke((Y+1)/2)-(Y<0||Y%2),D==1/0?N="5e"+Y:(N=D.toExponential(),N=N.slice(0,N.indexOf("e")+1)+Y),R=new O(N)):R=new O(D+""),R.c[0]){for(Y=R.e,D=Y+$,D<3&&(D=0);;)if(G=R,R=J.times(G.plus(n(H,G,$,1))),Qe(G.c).slice(0,D)===(N=Qe(R.c)).slice(0,D))if(R.e<Y&&--D,N=N.slice(D-3,D+1),N=="9999"||!F&&N=="4999"){if(!F&&(et(G,G.e+f+2,0),G.times(G).eq(H))){R=G;break}$+=4,D+=4,F=1}else{(!+N||!+N.slice(1)&&N.charAt(0)=="5")&&(et(R,R.e+f+2,1),I=!R.times(R).eq(H));break}}return et(R,R.e+f+1,d,I)},r.toExponential=function(I,N){return I!=null&&(ne(I,0,ge),I++),q(this,I,N,1)},r.toFixed=function(I,N){return I!=null&&(ne(I,0,ge),I=I+this.e+1),q(this,I,N)},r.toFormat=function(I,N,R){var F,G=this;if(R==null)I!=null&&N&&typeof N=="object"?(R=N,N=null):I&&typeof I=="object"?(R=I,I=N=null):R=S;else if(typeof R!="object")throw Error(De+"Argument not an object: "+R);if(F=G.toFixed(I,N),G.c){var H,W=F.split("."),D=+R.groupSize,Y=+R.secondaryGroupSize,$=R.groupSeparator||"",J=W[0],at=W[1],rt=G.s<0,ht=rt?J.slice(1):J,_t=ht.length;if(Y&&(H=D,D=Y,Y=H,_t-=H),D>0&&_t>0){for(H=_t%D||D,J=ht.substr(0,H);H<_t;H+=D)J+=$+ht.substr(H,D);Y>0&&(J+=$+ht.slice(H)),rt&&(J="-"+J)}F=at?J+(R.decimalSeparator||"")+((Y=+R.fractionGroupSize)?at.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(R.fractionGroupSeparator||"")):at):J}return(R.prefix||"")+F+(R.suffix||"")},r.toFraction=function(I){var N,R,F,G,H,W,D,Y,$,J,at,rt,ht=this,_t=ht.c;if(I!=null&&(D=new O(I),!D.isInteger()&&(D.c||D.s!==1)||D.lt(h)))throw Error(De+"Argument "+(D.isInteger()?"out of range: ":"not an integer: ")+ot(D));if(!_t)return new O(ht);for(N=new O(h),$=R=new O(h),F=Y=new O(h),rt=Qe(_t),H=N.e=rt.length-ht.e-1,N.c[0]=Ka[(W=H%Pt)<0?Pt+W:W],I=!I||D.comparedTo(N)>0?H>0?N:$:D,W=b,b=1/0,D=new O(rt),Y.c[0]=0;J=n(D,N,0,1),G=R.plus(J.times(F)),G.comparedTo(I)!=1;)R=F,F=G,$=Y.plus(J.times(G=$)),Y=G,N=D.minus(J.times(G=N)),D=G;return G=n(I.minus(R),F,0,1),Y=Y.plus(G.times($)),R=R.plus(G.times(F)),Y.s=$.s=ht.s,H=H*2,at=n($,F,H,d).minus(ht).abs().comparedTo(n(Y,R,H,d).minus(ht).abs())<1?[$,F]:[Y,R],b=W,at},r.toNumber=function(){return+ot(this)},r.toPrecision=function(I,N){return I!=null&&ne(I,1,ge),q(this,I,N,2)},r.toString=function(I){var N,R=this,F=R.s,G=R.e;return G===null?F?(N="Infinity",F<0&&(N="-"+N)):N="NaN":(I==null?N=G<=m||G>=_?ms(Qe(R.c),G):Bi(Qe(R.c),G,"0"):I===10&&Z?(R=et(new O(R),f+G+1,d),N=Bi(Qe(R.c),R.e,"0")):(ne(I,2,z.length,"Base"),N=i(Bi(Qe(R.c),G,"0"),10,I,F,!0)),F<0&&R.c[0]&&(N="-"+N)),N},r.valueOf=r.toJSON=function(){return ot(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,a!=null&&O.set(a),O}function Ke(a){var n=a|0;return a>0||a===n?n:n-1}function Qe(a){for(var n,i,s=1,r=a.length,h=a[0]+"";s<r;){for(n=a[s++]+"",i=Pt-n.length;i--;n="0"+n);h+=n}for(r=h.length;h.charCodeAt(--r)===48;);return h.slice(0,r+1||1)}function vn(a,n){var i,s,r=a.c,h=n.c,f=a.s,d=n.s,m=a.e,_=n.e;if(!f||!d)return null;if(i=r&&!r[0],s=h&&!h[0],i||s)return i?s?0:-d:f;if(f!=d)return f;if(i=f<0,s=m==_,!r||!h)return s?0:!r^i?1:-1;if(!s)return m>_^i?1:-1;for(d=(m=r.length)<(_=h.length)?m:_,f=0;f<d;f++)if(r[f]!=h[f])return r[f]>h[f]^i?1:-1;return m==_?0:m>_^i?1:-1}function ne(a,n,i,s){if(a<n||a>i||a!==je(a))throw Error(De+(s||"Argument")+(typeof a=="number"?a<n||a>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(a))}function ps(a){var n=a.c.length-1;return Ke(a.e/Pt)==n&&a.c[n]%2!=0}function ms(a,n){return(a.length>1?a.charAt(0)+"."+a.slice(1):a)+(n<0?"e":"e+")+n}function Bi(a,n,i){var s,r;if(n<0){for(r=i+".";++n;r+=i);a=r+a}else if(s=a.length,++n>s){for(r=i,n-=s;--n;r+=i);a+=r}else n<s&&(a=a.slice(0,n)+"."+a.slice(n));return a}var xi=Ih(),wp=class{constructor(a){Q(this,"key");Q(this,"left",null);Q(this,"right",null);this.key=a}},Kr=class extends wp{constructor(a){super(a)}},kp=class{constructor(){Q(this,"size",0);Q(this,"modificationCount",0);Q(this,"splayCount",0)}splay(a){const n=this.root;if(n==null)return this.compare(a,a),-1;let i=null,s=null,r=null,h=null,f=n;const d=this.compare;let m;for(;;)if(m=d(f.key,a),m>0){let _=f.left;if(_==null||(m=d(_.key,a),m>0&&(f.left=_.right,_.right=f,f=_,_=f.left,_==null)))break;i==null?s=f:i.left=f,i=f,f=_}else if(m<0){let _=f.right;if(_==null||(m=d(_.key,a),m<0&&(f.right=_.left,_.left=f,f=_,_=f.right,_==null)))break;r==null?h=f:r.right=f,r=f,f=_}else break;return r!=null&&(r.right=f.left,f.left=h),i!=null&&(i.left=f.right,f.right=s),this.root!==f&&(this.root=f,this.splayCount++),m}splayMin(a){let n=a,i=n.left;for(;i!=null;){const s=i;n.left=s.right,s.right=n,n=s,i=n.left}return n}splayMax(a){let n=a,i=n.right;for(;i!=null;){const s=i;n.right=s.left,s.left=n,n=s,i=n.right}return n}_delete(a){if(this.root==null||this.splay(a)!=0)return null;let i=this.root;const s=i,r=i.left;if(this.size--,r==null)this.root=i.right;else{const h=i.right;i=this.splayMax(r),i.right=h,this.root=i}return this.modificationCount++,s}addNewRoot(a,n){this.size++,this.modificationCount++;const i=this.root;if(i==null){this.root=a;return}n<0?(a.left=i,a.right=i.right,i.right=null):(a.right=i,a.left=i.left,i.left=null),this.root=a}_first(){const a=this.root;return a==null?null:(this.root=this.splayMin(a),this.root)}_last(){const a=this.root;return a==null?null:(this.root=this.splayMax(a),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(a){return this.validKey(a)&&this.splay(a)==0}defaultCompare(){return(a,n)=>a<n?-1:a>n?1:0}wrap(){return{getRoot:()=>this.root,setRoot:a=>{this.root=a},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:a=>{this.splayCount=a},splay:a=>this.splay(a),has:a=>this.has(a)}}},ys=class Oo extends kp{constructor(i,s){super();Q(this,"root",null);Q(this,"compare");Q(this,"validKey");Q(this,Wh,"[object Set]");this.compare=i!=null?i:this.defaultCompare(),this.validKey=s!=null?s:(r=>r!=null&&r!=null)}delete(i){return this.validKey(i)?this._delete(i)!=null:!1}deleteAll(i){for(const s of i)this.delete(s)}forEach(i){const s=this[Symbol.iterator]();let r;for(;r=s.next(),!r.done;)i(r.value,r.value,this)}add(i){const s=this.splay(i);return s!=0&&this.addNewRoot(new Kr(i),s),this}addAndReturn(i){const s=this.splay(i);return s!=0&&this.addNewRoot(new Kr(i),s),this.root.key}addAll(i){for(const s of i)this.add(s)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(i){if(i==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(i)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let h=r.right;for(;h!=null;)r=h,h=r.right;return r.key}firstAfter(i){if(i==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(i)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let h=r.left;for(;h!=null;)r=h,h=r.left;return r.key}retainAll(i){const s=new Oo(this.compare,this.validKey),r=this.modificationCount;for(const h of i){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(h)&&this.splay(h)==0&&s.add(this.root.key)}s.size!=this.size&&(this.root=s.root,this.size=s.size,this.modificationCount++)}lookup(i){return!this.validKey(i)||this.splay(i)!=0?null:this.root.key}intersection(i){const s=new Oo(this.compare,this.validKey);for(const r of this)i.has(r)&&s.add(r);return s}difference(i){const s=new Oo(this.compare,this.validKey);for(const r of this)i.has(r)||s.add(r);return s}union(i){const s=this.clone();return s.addAll(i),s}clone(){const i=new Oo(this.compare,this.validKey);return i.size=this.size,i.root=this.copyNode(this.root),i}copyNode(i){if(i==null)return null;function s(h,f){let d,m;do{if(d=h.left,m=h.right,d!=null){const _=new Kr(d.key);f.left=_,s(d,_)}if(m!=null){const _=new Kr(m.key);f.right=_,h=m,f=_}}while(m!=null)}const r=new Kr(i.key);return s(i,r),r}toSet(){return this.clone()}entries(){return new Ep(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(jh=Symbol.iterator,Wh=Symbol.toStringTag,jh)](){return new Lp(this.wrap())}},Ch=class{constructor(a){Q(this,"tree");Q(this,"path",new Array);Q(this,"modificationCount",null);Q(this,"splayCount");this.tree=a,this.splayCount=a.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const a=this.path[this.path.length-1];return this.getValue(a)}rebuildPath(a){this.path.splice(0,this.path.length),this.tree.splay(a),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(a){for(;a!=null;)this.path.push(a),a=a.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let a=this.path[this.path.length-1],n=a.right;if(n!=null){for(;n!=null;)this.path.push(n),n=n.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===a;)a=this.path.pop();return this.path.length>0}},Lp=class extends Ch{getValue(a){return a.key}},Ep=class extends Ch{getValue(a){return[a.key,a.key]}},Sh=a=>()=>a,Qa=a=>{const n=a?(i,s)=>s.minus(i).abs().isLessThanOrEqualTo(a):Sh(!1);return(i,s)=>n(i,s)?0:i.comparedTo(s)};function Tp(a){const n=a?(i,s,r,h,f)=>i.exponentiatedBy(2).isLessThanOrEqualTo(h.minus(s).exponentiatedBy(2).plus(f.minus(r).exponentiatedBy(2)).times(a)):Sh(!1);return(i,s,r)=>{const h=i.x,f=i.y,d=r.x,m=r.y,_=f.minus(m).times(s.x.minus(d)).minus(h.minus(d).times(s.y.minus(m)));return n(_,h,f,d,m)?0:_.comparedTo(0)}}var Ip=a=>a,Cp=a=>{if(a){const n=new ys(Qa(a)),i=new ys(Qa(a)),s=(h,f)=>f.addAndReturn(h),r=h=>({x:s(h.x,n),y:s(h.y,i)});return r({x:new xi(0),y:new xi(0)}),r}return Ip},$a=a=>({set:n=>{zi=$a(n)},reset:()=>$a(a),compare:Qa(a),snap:Cp(a),orient:Tp(a)}),zi=$a(),Qr=(a,n)=>a.ll.x.isLessThanOrEqualTo(n.x)&&n.x.isLessThanOrEqualTo(a.ur.x)&&a.ll.y.isLessThanOrEqualTo(n.y)&&n.y.isLessThanOrEqualTo(a.ur.y),tl=(a,n)=>{if(n.ur.x.isLessThan(a.ll.x)||a.ur.x.isLessThan(n.ll.x)||n.ur.y.isLessThan(a.ll.y)||a.ur.y.isLessThan(n.ll.y))return null;const i=a.ll.x.isLessThan(n.ll.x)?n.ll.x:a.ll.x,s=a.ur.x.isLessThan(n.ur.x)?a.ur.x:n.ur.x,r=a.ll.y.isLessThan(n.ll.y)?n.ll.y:a.ll.y,h=a.ur.y.isLessThan(n.ur.y)?a.ur.y:n.ur.y;return{ll:{x:i,y:r},ur:{x:s,y:h}}},_s=(a,n)=>a.x.times(n.y).minus(a.y.times(n.x)),Mh=(a,n)=>a.x.times(n.x).plus(a.y.times(n.y)),vs=a=>Mh(a,a).sqrt(),Sp=(a,n,i)=>{const s={x:n.x.minus(a.x),y:n.y.minus(a.y)},r={x:i.x.minus(a.x),y:i.y.minus(a.y)};return _s(r,s).div(vs(r)).div(vs(s))},Mp=(a,n,i)=>{const s={x:n.x.minus(a.x),y:n.y.minus(a.y)},r={x:i.x.minus(a.x),y:i.y.minus(a.y)};return Mh(r,s).div(vs(r)).div(vs(s))},Ah=(a,n,i)=>n.y.isZero()?null:{x:a.x.plus(n.x.div(n.y).times(i.minus(a.y))),y:i},Ph=(a,n,i)=>n.x.isZero()?null:{x:i,y:a.y.plus(n.y.div(n.x).times(i.minus(a.x)))},Ap=(a,n,i,s)=>{if(n.x.isZero())return Ph(i,s,a.x);if(s.x.isZero())return Ph(a,n,i.x);if(n.y.isZero())return Ah(i,s,a.y);if(s.y.isZero())return Ah(a,n,i.y);const r=_s(n,s);if(r.isZero())return null;const h={x:i.x.minus(a.x),y:i.y.minus(a.y)},f=_s(h,n).div(r),d=_s(h,s).div(r),m=a.x.plus(d.times(n.x)),_=i.x.plus(f.times(s.x)),x=a.y.plus(d.times(n.y)),b=i.y.plus(f.times(s.y)),E=m.plus(_).div(2),C=x.plus(b).div(2);return{x:E,y:C}},wi=class lc{constructor(n,i){Q(this,"point");Q(this,"isLeft");Q(this,"segment");Q(this,"otherSE");Q(this,"consumedBy");n.events===void 0?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=i}static compare(n,i){const s=lc.comparePoints(n.point,i.point);return s!==0?s:(n.point!==i.point&&n.link(i),n.isLeft!==i.isLeft?n.isLeft?1:-1:bs.compare(n.segment,i.segment))}static comparePoints(n,i){return n.x.isLessThan(i.x)?-1:n.x.isGreaterThan(i.x)?1:n.y.isLessThan(i.y)?-1:n.y.isGreaterThan(i.y)?1:0}link(n){if(n.point===this.point)throw new Error("Tried to link already linked events");const i=n.point.events;for(let s=0,r=i.length;s<r;s++){const h=i[s];this.point.events.push(h),h.point=this.point}this.checkForConsuming()}checkForConsuming(){const n=this.point.events.length;for(let i=0;i<n;i++){const s=this.point.events[i];if(s.segment.consumedBy===void 0)for(let r=i+1;r<n;r++){const h=this.point.events[r];h.consumedBy===void 0&&s.otherSE.point.events===h.otherSE.point.events&&s.segment.consume(h.segment)}}}getAvailableLinkedEvents(){const n=[];for(let i=0,s=this.point.events.length;i<s;i++){const r=this.point.events[i];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&n.push(r)}return n}getLeftmostComparator(n){const i=new Map,s=r=>{const h=r.otherSE;i.set(r,{sine:Sp(this.point,n.point,h.point),cosine:Mp(this.point,n.point,h.point)})};return(r,h)=>{i.has(r)||s(r),i.has(h)||s(h);const{sine:f,cosine:d}=i.get(r),{sine:m,cosine:_}=i.get(h);return f.isGreaterThanOrEqualTo(0)&&m.isGreaterThanOrEqualTo(0)?d.isLessThan(_)?1:d.isGreaterThan(_)?-1:0:f.isLessThan(0)&&m.isLessThan(0)?d.isLessThan(_)?-1:d.isGreaterThan(_)?1:0:m.isLessThan(f)?-1:m.isGreaterThan(f)?1:0}}},Pp=class El{constructor(n){Q(this,"events");Q(this,"poly");Q(this,"_isExteriorRing");Q(this,"_enclosingRing");this.events=n;for(let i=0,s=n.length;i<s;i++)n[i].segment.ringOut=this;this.poly=null}static factory(n){const i=[];for(let s=0,r=n.length;s<r;s++){const h=n[s];if(!h.isInResult()||h.ringOut)continue;let f=null,d=h.leftSE,m=h.rightSE;const _=[d],x=d.point,b=[];for(;f=d,d=m,_.push(d),d.point!==x;)for(;;){const E=d.getAvailableLinkedEvents();if(E.length===0){const S=_[0].point,z=_[_.length-1].point;throw new Error(`Unable to complete output ring starting at [${S.x}, ${S.y}]. Last matching segment found ends at [${z.x}, ${z.y}].`)}if(E.length===1){m=E[0].otherSE;break}let C=null;for(let S=0,z=b.length;S<z;S++)if(b[S].point===d.point){C=S;break}if(C!==null){const S=b.splice(C)[0],z=_.splice(S.index);z.unshift(z[0].otherSE),i.push(new El(z.reverse()));continue}b.push({index:_.length,point:d.point});const M=d.getLeftmostComparator(f);m=E.sort(M)[0].otherSE;break}i.push(new El(_))}return i}getGeom(){let n=this.events[0].point;const i=[n];for(let _=1,x=this.events.length-1;_<x;_++){const b=this.events[_].point,E=this.events[_+1].point;zi.orient(b,n,E)!==0&&(i.push(b),n=b)}if(i.length===1)return null;const s=i[0],r=i[1];zi.orient(s,n,r)===0&&i.shift(),i.push(i[0]);const h=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:i.length-1,d=this.isExteriorRing()?i.length:-1,m=[];for(let _=f;_!=d;_+=h)m.push([i[_].x.toNumber(),i[_].y.toNumber()]);return m}isExteriorRing(){if(this._isExteriorRing===void 0){const n=this.enclosingRing();this._isExteriorRing=n?!n.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){var r,h;let n=this.events[0];for(let f=1,d=this.events.length;f<d;f++){const m=this.events[f];wi.compare(n,m)>0&&(n=m)}let i=n.segment.prevInResult(),s=i?i.prevInResult():null;for(;;){if(!i)return null;if(!s)return i.ringOut;if(s.ringOut!==i.ringOut)return((r=s.ringOut)==null?void 0:r.enclosingRing())!==i.ringOut?i.ringOut:(h=i.ringOut)==null?void 0:h.enclosingRing();i=s.prevInResult(),s=i?i.prevInResult():null}}},Nh=class{constructor(a){Q(this,"exteriorRing");Q(this,"interiorRings");this.exteriorRing=a,a.poly=this,this.interiorRings=[]}addInterior(a){this.interiorRings.push(a),a.poly=this}getGeom(){const a=this.exteriorRing.getGeom();if(a===null)return null;const n=[a];for(let i=0,s=this.interiorRings.length;i<s;i++){const r=this.interiorRings[i].getGeom();r!==null&&n.push(r)}return n}},Np=class{constructor(a){Q(this,"rings");Q(this,"polys");this.rings=a,this.polys=this._composePolys(a)}getGeom(){const a=[];for(let n=0,i=this.polys.length;n<i;n++){const s=this.polys[n].getGeom();s!==null&&a.push(s)}return a}_composePolys(a){var i;const n=[];for(let s=0,r=a.length;s<r;s++){const h=a[s];if(!h.poly)if(h.isExteriorRing())n.push(new Nh(h));else{const f=h.enclosingRing();f!=null&&f.poly||n.push(new Nh(f)),(i=f==null?void 0:f.poly)==null||i.addInterior(h)}}return n}},Op=class{constructor(a,n=bs.compare){Q(this,"queue");Q(this,"tree");Q(this,"segments");this.queue=a,this.tree=new ys(n),this.segments=[]}process(a){const n=a.segment,i=[];if(a.consumedBy)return a.isLeft?this.queue.delete(a.otherSE):this.tree.delete(n),i;a.isLeft&&this.tree.add(n);let s=n,r=n;do s=this.tree.lastBefore(s);while(s!=null&&s.consumedBy!=null);do r=this.tree.firstAfter(r);while(r!=null&&r.consumedBy!=null);if(a.isLeft){let h=null;if(s){const d=s.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(h=d),!s.isAnEndpoint(d))){const m=this._splitSafely(s,d);for(let _=0,x=m.length;_<x;_++)i.push(m[_])}}let f=null;if(r){const d=r.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(f=d),!r.isAnEndpoint(d))){const m=this._splitSafely(r,d);for(let _=0,x=m.length;_<x;_++)i.push(m[_])}}if(h!==null||f!==null){let d=null;h===null?d=f:f===null?d=h:d=wi.comparePoints(h,f)<=0?h:f,this.queue.delete(n.rightSE),i.push(n.rightSE);const m=n.split(d);for(let _=0,x=m.length;_<x;_++)i.push(m[_])}i.length>0?(this.tree.delete(n),i.push(a)):(this.segments.push(n),n.prev=s)}else{if(s&&r){const h=s.getIntersection(r);if(h!==null){if(!s.isAnEndpoint(h)){const f=this._splitSafely(s,h);for(let d=0,m=f.length;d<m;d++)i.push(f[d])}if(!r.isAnEndpoint(h)){const f=this._splitSafely(r,h);for(let d=0,m=f.length;d<m;d++)i.push(f[d])}}}this.tree.delete(n)}return i}_splitSafely(a,n){this.tree.delete(a);const i=a.rightSE;this.queue.delete(i);const s=a.split(n);return s.push(i),a.consumedBy===void 0&&this.tree.add(a),s}},Rp=class{constructor(){Q(this,"type");Q(this,"numMultiPolys")}run(a,n,i){$r.type=a;const s=[new Rh(n,!0)];for(let _=0,x=i.length;_<x;_++)s.push(new Rh(i[_],!1));if($r.numMultiPolys=s.length,$r.type==="difference"){const _=s[0];let x=1;for(;x<s.length;)tl(s[x].bbox,_.bbox)!==null?x++:s.splice(x,1)}if($r.type==="intersection")for(let _=0,x=s.length;_<x;_++){const b=s[_];for(let E=_+1,C=s.length;E<C;E++)if(tl(b.bbox,s[E].bbox)===null)return[]}const r=new ys(wi.compare);for(let _=0,x=s.length;_<x;_++){const b=s[_].getSweepEvents();for(let E=0,C=b.length;E<C;E++)r.add(b[E])}const h=new Op(r);let f=null;for(r.size!=0&&(f=r.first(),r.delete(f));f;){const _=h.process(f);for(let x=0,b=_.length;x<b;x++){const E=_[x];E.consumedBy===void 0&&r.add(E)}r.size!=0?(f=r.first(),r.delete(f)):f=null}zi.reset();const d=Pp.factory(h.segments);return new Np(d).getGeom()}},$r=new Rp,el=$r,Dp=0,bs=class Vs{constructor(n,i,s,r){Q(this,"id");Q(this,"leftSE");Q(this,"rightSE");Q(this,"rings");Q(this,"windings");Q(this,"ringOut");Q(this,"consumedBy");Q(this,"prev");Q(this,"_prevInResult");Q(this,"_beforeState");Q(this,"_afterState");Q(this,"_isInResult");this.id=++Dp,this.leftSE=n,n.segment=this,n.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=n,this.rings=s,this.windings=r}static compare(n,i){const s=n.leftSE.point.x,r=i.leftSE.point.x,h=n.rightSE.point.x,f=i.rightSE.point.x;if(f.isLessThan(s))return 1;if(h.isLessThan(r))return-1;const d=n.leftSE.point.y,m=i.leftSE.point.y,_=n.rightSE.point.y,x=i.rightSE.point.y;if(s.isLessThan(r)){if(m.isLessThan(d)&&m.isLessThan(_))return 1;if(m.isGreaterThan(d)&&m.isGreaterThan(_))return-1;const b=n.comparePoint(i.leftSE.point);if(b<0)return 1;if(b>0)return-1;const E=i.comparePoint(n.rightSE.point);return E!==0?E:-1}if(s.isGreaterThan(r)){if(d.isLessThan(m)&&d.isLessThan(x))return-1;if(d.isGreaterThan(m)&&d.isGreaterThan(x))return 1;const b=i.comparePoint(n.leftSE.point);if(b!==0)return b;const E=n.comparePoint(i.rightSE.point);return E<0?1:E>0?-1:1}if(d.isLessThan(m))return-1;if(d.isGreaterThan(m))return 1;if(h.isLessThan(f)){const b=i.comparePoint(n.rightSE.point);if(b!==0)return b}if(h.isGreaterThan(f)){const b=n.comparePoint(i.rightSE.point);if(b<0)return 1;if(b>0)return-1}if(!h.eq(f)){const b=_.minus(d),E=h.minus(s),C=x.minus(m),M=f.minus(r);if(b.isGreaterThan(E)&&C.isLessThan(M))return 1;if(b.isLessThan(E)&&C.isGreaterThan(M))return-1}return h.isGreaterThan(f)?1:h.isLessThan(f)||_.isLessThan(x)?-1:_.isGreaterThan(x)?1:n.id<i.id?-1:n.id>i.id?1:0}static fromRing(n,i,s){let r,h,f;const d=wi.comparePoints(n,i);if(d<0)r=n,h=i,f=1;else if(d>0)r=i,h=n,f=-1;else throw new Error(`Tried to create degenerate segment at [${n.x}, ${n.y}]`);const m=new wi(r,!0),_=new wi(h,!1);return new Vs(m,_,[s],[f])}replaceRightSE(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const n=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:n.isLessThan(i)?n:i},ur:{x:this.rightSE.point.x,y:n.isGreaterThan(i)?n:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(n){return n.x.eq(this.leftSE.point.x)&&n.y.eq(this.leftSE.point.y)||n.x.eq(this.rightSE.point.x)&&n.y.eq(this.rightSE.point.y)}comparePoint(n){return zi.orient(this.leftSE.point,n,this.rightSE.point)}getIntersection(n){const i=this.bbox(),s=n.bbox(),r=tl(i,s);if(r===null)return null;const h=this.leftSE.point,f=this.rightSE.point,d=n.leftSE.point,m=n.rightSE.point,_=Qr(i,d)&&this.comparePoint(d)===0,x=Qr(s,h)&&n.comparePoint(h)===0,b=Qr(i,m)&&this.comparePoint(m)===0,E=Qr(s,f)&&n.comparePoint(f)===0;if(x&&_)return E&&!b?f:!E&&b?m:null;if(x)return b&&h.x.eq(m.x)&&h.y.eq(m.y)?null:h;if(_)return E&&f.x.eq(d.x)&&f.y.eq(d.y)?null:d;if(E&&b)return null;if(E)return f;if(b)return m;const C=Ap(h,this.vector(),d,n.vector());return C===null||!Qr(r,C)?null:zi.snap(C)}split(n){const i=[],s=n.events!==void 0,r=new wi(n,!0),h=new wi(n,!1),f=this.rightSE;this.replaceRightSE(h),i.push(h),i.push(r);const d=new Vs(r,f,this.rings.slice(),this.windings.slice());return wi.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),wi.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(r.checkForConsuming(),h.checkForConsuming()),i}swapEvents(){const n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,s=this.windings.length;i<s;i++)this.windings[i]*=-1}consume(n){let i=this,s=n;for(;i.consumedBy;)i=i.consumedBy;for(;s.consumedBy;)s=s.consumedBy;const r=Vs.compare(i,s);if(r!==0){if(r>0){const h=i;i=s,s=h}if(i.prev===s){const h=i;i=s,s=h}for(let h=0,f=s.rings.length;h<f;h++){const d=s.rings[h],m=s.windings[h],_=i.rings.indexOf(d);_===-1?(i.rings.push(d),i.windings.push(m)):i.windings[_]+=m}s.rings=null,s.windings=null,s.consumedBy=i,s.leftSE.consumedBy=i.leftSE,s.rightSE.consumedBy=i.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const n=this.prev.consumedBy||this.prev;this._beforeState=n.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const n=this.beforeState();this._afterState={rings:n.rings.slice(0),windings:n.windings.slice(0),multiPolys:[]};const i=this._afterState.rings,s=this._afterState.windings,r=this._afterState.multiPolys;for(let d=0,m=this.rings.length;d<m;d++){const _=this.rings[d],x=this.windings[d],b=i.indexOf(_);b===-1?(i.push(_),s.push(x)):s[b]+=x}const h=[],f=[];for(let d=0,m=i.length;d<m;d++){if(s[d]===0)continue;const _=i[d],x=_.poly;if(f.indexOf(x)===-1)if(_.isExterior)h.push(x);else{f.indexOf(x)===-1&&f.push(x);const b=h.indexOf(_.poly);b!==-1&&h.splice(b,1)}}for(let d=0,m=h.length;d<m;d++){const _=h[d].multiPoly;r.indexOf(_)===-1&&r.push(_)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const n=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(el.type){case"union":{const s=n.length===0,r=i.length===0;this._isInResult=s!==r;break}case"intersection":{let s,r;n.length<i.length?(s=n.length,r=i.length):(s=i.length,r=n.length),this._isInResult=r===el.numMultiPolys&&s<r;break}case"xor":{const s=Math.abs(n.length-i.length);this._isInResult=s%2===1;break}case"difference":{const s=r=>r.length===1&&r[0].isSubject;this._isInResult=s(n)!==s(i);break}}return this._isInResult}},Oh=class{constructor(a,n,i){Q(this,"poly");Q(this,"isExterior");Q(this,"segments");Q(this,"bbox");if(!Array.isArray(a)||a.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof a[0][0]!="number"||typeof a[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=zi.snap({x:new xi(a[0][0]),y:new xi(a[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let r=s;for(let h=1,f=a.length;h<f;h++){if(typeof a[h][0]!="number"||typeof a[h][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const d=zi.snap({x:new xi(a[h][0]),y:new xi(a[h][1])});d.x.eq(r.x)&&d.y.eq(r.y)||(this.segments.push(bs.fromRing(r,d,this)),d.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=d.x),d.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=d.y),d.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=d.x),d.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=d.y),r=d)}(!s.x.eq(r.x)||!s.y.eq(r.y))&&this.segments.push(bs.fromRing(r,s,this))}getSweepEvents(){const a=[];for(let n=0,i=this.segments.length;n<i;n++){const s=this.segments[n];a.push(s.leftSE),a.push(s.rightSE)}return a}},Bp=class{constructor(a,n){Q(this,"multiPoly");Q(this,"exteriorRing");Q(this,"interiorRings");Q(this,"bbox");if(!Array.isArray(a))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Oh(a[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let i=1,s=a.length;i<s;i++){const r=new Oh(a[i],this,!1);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.interiorRings.push(r)}this.multiPoly=n}getSweepEvents(){const a=this.exteriorRing.getSweepEvents();for(let n=0,i=this.interiorRings.length;n<i;n++){const s=this.interiorRings[n].getSweepEvents();for(let r=0,h=s.length;r<h;r++)a.push(s[r])}return a}},Rh=class{constructor(a,n){Q(this,"isSubject");Q(this,"polys");Q(this,"bbox");if(!Array.isArray(a))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof a[0][0][0]=="number"&&(a=[a])}catch{}this.polys=[],this.bbox={ll:{x:new xi(Number.POSITIVE_INFINITY),y:new xi(Number.POSITIVE_INFINITY)},ur:{x:new xi(Number.NEGATIVE_INFINITY),y:new xi(Number.NEGATIVE_INFINITY)}};for(let i=0,s=a.length;i<s;i++){const r=new Bp(a[i],this);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.polys.push(r)}this.isSubject=n}getSweepEvents(){const a=[];for(let n=0,i=this.polys.length;n<i;n++){const s=this.polys[n].getSweepEvents();for(let r=0,h=s.length;r<h;r++)a.push(s[r])}return a}},zp=(a,...n)=>el.run("union",a,n);zi.set;function Fp(a,n={}){const i=[];if(Hn(a,r=>{i.push(r.coordinates)}),i.length<2)throw new Error("Must have at least 2 geometries");const s=zp(i[0],...i.slice(1));return s.length===0?null:s.length===1?yn(s[0],n.properties):$f(s,n.properties)}const Gp={bedWidthMeters:{compact:.75,standard:1,wide:1.2},rowSpacingMeters:{dense:.15,vegetables:.3,orchard:3},irrigationRadiusMeters:{dripEmitter:.3,microSprinkler:3,sprinkler:12}},Up=3.280839895013123,qp=10.763910416709722,Dh=1609.344,Bh=4046.8564224,zh=1e4,to=a=>({ok:!0,value:a}),Zt=(a,n,i)=>({ok:!1,error:{code:a,message:n,...i?{details:i}:{}}}),Me=a=>JSON.parse(JSON.stringify(a)),Zp=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),Hp=a=>!Zp(a)||typeof a.type!="string"?!1:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection","Feature","FeatureCollection"].includes(a.type);function xs(a,n){if(a.type==="FeatureCollection"){a.features.forEach((i,s)=>xs(i,(r,h)=>n(r,`features[${s}].${h}`)));return}if(a.type==="Feature"){n(a.geometry,"geometry");return}n(a,"geometry")}function il(a,n,i){if(a.type==="GeometryCollection"){a.geometries.forEach((s,r)=>il(s,`${n}.geometries[${r}]`,i));return}i(a,n)}function Yp(a,n){return a[0]===n[0]&&a[1]===n[1]}function Fh(a){const n=a[0];return!n||a.every(i=>Yp(n,i))}function Vp(a){let n=0;for(let i=0;i<a.length-1;i++){const s=a[i],r=a[i+1];n+=s[0]*r[1]-r[0]*s[1]}return n/2}function Xp(a,n){const i=(r,h)=>Math.abs(r[0])>180||Math.abs(r[1])>90?`${h} is outside WGS84 longitude/latitude bounds.`:null,s=(r,h)=>{for(let f=0;f<r.length;f++){const d=i(r[f],`${h}[${f}]`);if(d)return d}return null};switch(a.type){case"Point":return i(a.coordinates,`${n}.coordinates`);case"MultiPoint":case"LineString":return s(a.coordinates,`${n}.coordinates`);case"MultiLineString":case"Polygon":for(let r=0;r<a.coordinates.length;r++){const h=s(a.coordinates[r],`${n}.coordinates[${r}]`);if(h)return h}return null;case"MultiPolygon":for(let r=0;r<a.coordinates.length;r++){const h=a.coordinates[r];for(let f=0;f<h.length;f++){const d=s(h[f],`${n}.coordinates[${r}][${f}]`);if(d)return d}}return null}}function Jp(a,n){const i=Xp(a,n);if(i)return i;if(a.type==="LineString"&&Fh(a.coordinates))return`${n} has no non-zero line segment.`;if(a.type==="MultiLineString"){const s=a.coordinates.findIndex(Fh);if(s>=0)return`${n}.coordinates[${s}] has no non-zero line segment.`}if(a.type==="Polygon"||a.type==="MultiPolygon"){const s=a.type==="Polygon"?[a.coordinates]:a.coordinates;for(let r=0;r<s.length;r++)for(let h=0;h<s[r].length;h++){const f=s[r][h];if(Math.abs(Vp(f))<=Number.EPSILON)return`${n} contains a degenerate zero-area ring.`}}return Du(a)?(a.type==="LineString"||a.type==="MultiLineString"||a.type==="Polygon"||a.type==="MultiPolygon")&&Ag(a).features.length>0?`${n} contains one or more self-intersections.`:null:`${n} is not valid under OGC Simple Feature topology rules.`}function $e(a){const n=Ji(a);if(!n.valid){const r=n.diagnostics.some(h=>h.code==="unsupported-geometry");return Zt(r?"unsupported-geometry":"invalid-input","GeoJSON structural validation failed.",n.diagnostics.filter(h=>h.severity==="error").map(h=>`${h.path}: ${h.code}: ${h.message}`))}if(!Hp(a))return Zt("invalid-input","Expected a supported GeoJSON object.");if(a.type==="FeatureCollection"&&a.features.length===0)return Zt("invalid-input","FeatureCollection must not be empty.");let i=0,s=null;return xs(a,(r,h)=>{if(!s){if(r.type==="GeometryCollection"&&r.geometries.length===0){s=`${h} must not be an empty GeometryCollection.`;return}il(r,h,(f,d)=>{i+=1,s!=null||(s=Jp(f,d))})}}),i===0?Zt("invalid-input","GeoJSON contains no geometry."):s?Zt("topology-error",s):to(a)}function $i(a){const n=$e(a);return n.ok?to(a):Zt(n.error.code==="invalid-input"?"operation-failed":n.error.code,`Generated GeoJSON was rejected: ${n.error.message}`,n.error.details)}function di(a,n){return Zt("operation-failed",`${a} failed safely: ${n instanceof Error?n.message:String(n)}`)}function Wp(a){return Number.isFinite(a)&&a!==0}function jp(a,n,i={}){var h;const s=$e(a);if(!s.ok)return s;if(!Wp(n))return Zt("invalid-options","distanceMeters must be a finite, non-zero number.");const r=(h=i.steps)!=null?h:8;if(!Number.isInteger(r)||r<4||r>256)return Zt("invalid-options","steps must be an integer from 4 through 256.");try{const f=Me(a);let d;if(f.type==="FeatureCollection"){const m=[];for(const _ of f.features){const x=lh(_,n,{units:"meters",steps:r});if(!x)return Zt("empty-result","Buffer removed at least one input feature; no partial result was returned.");m.push(x)}d={type:"FeatureCollection",features:m}}else{const m=lh(f,n,{units:"meters",steps:r});m==null||m.type,d=m}return!d||d.type==="FeatureCollection"&&d.features.length===0?Zt("empty-result","Buffer produced no geometry."):$i(d)}catch(f){return di("Buffer",f)}}function Kp(a,n){const i=$e(a);if(!i.ok)return i;const s=$e(n);if(!s.ok)return s;if(a.geometry.type!=="LineString")return Zt("unsupported-geometry","splitGeoJSON requires a LineString feature.");if(!["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"].includes(n.geometry.type))return Zt("unsupported-geometry","Unsupported splitter geometry.");try{const r=Me(a),h=fp(r,Me(n));return h.features.length<2?Zt("empty-result","Splitter does not cut the LineString."):(h.features=h.features.map((f,d)=>{var _;const m=Me((_=r.properties)!=null?_:{});return m.id!==void 0&&(m.id=`${String(m.id)}:split:${d+1}`),{...f,...r.id!==void 0?{id:`${String(r.id)}:split:${d+1}`}:{},properties:m}}),$i(h))}catch(r){return di("Split",r)}}function Qp(a,n){var s;const i=$e(a);if(!i.ok)return i;if(a.features.length<2)return Zt("invalid-options","mergeGeoJSON requires at least two polygon features.");if(a.features.some(r=>r.geometry.type!=="Polygon"&&r.geometry.type!=="MultiPolygon"))return Zt("unsupported-geometry","mergeGeoJSON supports only Polygon inputs.");try{const r=Me((s=n!=null?n:a.features[0].properties)!=null?s:{}),h=Fp(Me(a),{properties:r});return h?$i(h):Zt("empty-result","Polygon union produced no geometry.")}catch(r){return di("Polygon union",r)}}function $p(a,n){var r;const i=$e(a);if(!i.ok)return i;if(!Number.isFinite(n.toleranceDegrees)||n.toleranceDegrees<=0)return Zt("invalid-options","toleranceDegrees must be a finite number greater than zero.");let s=null;if(xs(a,h=>{il(h,"geometry",f=>{f.type!=="LineString"&&f.type!=="MultiLineString"&&f.type!=="Polygon"&&f.type!=="MultiPolygon"&&(s=f.type)})}),s)return Zt("unsupported-geometry",`simplifyGeoJSON does not simplify ${s} geometry.`);try{const h=vp(Me(a),{tolerance:n.toleranceDegrees,highQuality:(r=n.highQuality)!=null?r:!1,mutate:!1});return $i(h)}catch(h){return di("Simplify",h)}}function tm(a,n={}){const i=$e(a);if(!i.ok)return i;try{const s=Mg(Me(a),{properties:Me(n)});return $i(s)}catch(s){return di("Centroid",s)}}function em(a){const n=$e(a);if(!n.ok)return n;try{const i=ji(Me(a),{recompute:!0});return i.length!==4||i.some(s=>!Number.isFinite(s))?Zt("operation-failed","Bounding box was not a finite 2D extent."):to([i[0],i[1],i[2],i[3]])}catch(i){return di("Bounding box",i)}}function ws(a){let n=0;for(let i=1;i<a.length;i++){const s=a[i-1],r=a[i];n+=jl(s[1],s[0],r[1],r[0]).meters}return n}function Gh(a,n){switch(a.type){case"LineString":n.lengthMeters+=ws(a.coordinates);break;case"MultiLineString":a.coordinates.forEach(i=>{n.lengthMeters+=ws(i)});break;case"Polygon":a.coordinates.forEach(i=>{n.perimeterMeters+=ws(i)});break;case"MultiPolygon":a.coordinates.forEach(i=>i.forEach(s=>{n.perimeterMeters+=ws(s)}));break;case"GeometryCollection":a.geometries.forEach(i=>Gh(i,n));break}}function Uh(a){const n=$e(a);if(!n.ok)return n;try{const i={lengthMeters:0,perimeterMeters:0,areaSquareMeters:nd(Me(a))};return xs(a,s=>Gh(s,i)),Object.values(i).some(s=>!Number.isFinite(s)||s<0)?Zt("operation-failed","Measurement produced a non-finite result."):to(i)}catch(i){return di("Measurement",i)}}function tn(a,n,i){return{value:a,unit:n,text:`${i.format(a)} ${n}`}}function qh(a,n,i={}){var r;if(Object.values(a).some(h=>!Number.isFinite(h)||h<0))return Zt("invalid-input","Measurements must contain finite, non-negative SI values.");const s=(r=i.maximumFractionDigits)!=null?r:2;if(!Number.isInteger(s)||s<0||s>20)return Zt("invalid-options","maximumFractionDigits must be an integer from 0 through 20.");try{const h=new Intl.NumberFormat(i.locale,{maximumFractionDigits:s}),f=m=>n==="metric"?i.autoScale&&m>=1e3?tn(m/1e3,"km",h):tn(m,"m",h):i.autoScale&&m>=Dh?tn(m/Dh,"mi",h):tn(m*Up,"ft",h),d=m=>n==="metric"?i.autoScale&&m>=zh?tn(m/zh,"ha",h):tn(m,"m²",h):i.autoScale&&m>=Bh?tn(m/Bh,"ac",h):tn(m*qp,"ft²",h);return to({length:f(a.lengthMeters),perimeter:f(a.perimeterMeters),area:d(a.areaSquareMeters)})}catch(h){return di("Measurement formatting",h)}}function nl(a,n,i,s){var h;const r=Me((h=a.properties)!=null?h:{});return r.id!==void 0&&(r.id=`${String(r.id)}:${s}`),r["geokit:guide"]={type:n,offsetMeters:i},{...a,...a.id!==void 0?{id:`${String(a.id)}:${s}`}:{},properties:r}}function im(a,n){const i=$e(a);if(!i.ok)return i;if(a.geometry.type!=="LineString"&&a.geometry.type!=="MultiLineString")return Zt("unsupported-geometry","Bed guides require line geometry.");if(!Number.isFinite(n)||n<=0)return Zt("invalid-options","bedWidthMeters must be a finite number greater than zero.");try{const s=Me(a),r=n/2,h=nl(Fa(s,r,{units:"meters"}),"bed-edge",r,"bed-left"),f=nl(Fa(s,-r,{units:"meters"}),"bed-edge",-r,"bed-right");return $i({type:"FeatureCollection",features:[h,f]})}catch(s){return di("Bed-width guide generation",s)}}function nm(a,n,i={}){var h,f;const s=$e(a);if(!s.ok)return s;if(a.geometry.type!=="LineString"&&a.geometry.type!=="MultiLineString")return Zt("unsupported-geometry","Row guides require line geometry.");if(!Number.isFinite(n)||n<=0)return Zt("invalid-options","spacingMeters must be a finite number greater than zero.");const r=(h=i.rowsPerSide)!=null?h:2;if(!Number.isInteger(r)||r<1||r>100)return Zt("invalid-options","rowsPerSide must be an integer from 1 through 100.");try{const d=Me(a),m=[];for(let x=r;x>=1;x--)m.push(-x*n);((f=i.includeBaseline)==null||f)&&m.push(0);for(let x=1;x<=r;x++)m.push(x*n);const _=m.map(x=>{const b=x===0?d:Fa(d,x,{units:"meters"}),E=x===0?"row-center":`row-${x<0?"right":"left"}-${Math.abs(x)}`;return nl(b,"row-spacing",x,E)});return $i({type:"FeatureCollection",features:_})}catch(d){return di("Row-spacing guide generation",d)}}function rm(a,n,i={}){var d,m;const s={type:"Point",coordinates:Me(a)},r=$e(s);if(!r.ok)return r;if(!Number.isFinite(n)||n<=0)return Zt("invalid-options","outerRadiusMeters must be a finite number greater than zero.");const h=(d=i.zoneCount)!=null?d:1,f=(m=i.steps)!=null?m:64;if(!Number.isInteger(h)||h<1||h>32)return Zt("invalid-options","zoneCount must be an integer from 1 through 32.");if(!Number.isInteger(f)||f<8||f>256)return Zt("invalid-options","steps must be an integer from 8 through 256.");try{const[_,x]=a,b=Array.from({length:h},(C,M)=>({getLatLng:()=>({lat:x,lng:_}),getRadius:()=>n*(M+1)/h})),E=Xl({circles:b,steps:f});return $i(E)}catch(_){return di("Irrigation-zone generation",_)}}let Zh=!1;const om={polygon:"tool:polygon:created",polyline:"tool:polyline:created",rectangle:"tool:rectangle:created",circle:"tool:circle:created",marker:"tool:marker:created"};class sm{constructor(n){Q(this,"container");Q(this,"logger");Q(this,"options");Q(this,"L");Q(this,"store");Q(this,"layerRegistry",new Qs);Q(this,"featureLayers",new Map);Q(this,"closeLayerStylePanel",null);Q(this,"map",null);Q(this,"tileLayer",null);Q(this,"adapterAttribution",null);Q(this,"providerDiagnostics",null);Q(this,"drawnItems",null);Q(this,"drawControl",null);Q(this,"rulerControl",null);Q(this,"measurementControl",null);Q(this,"measurementSystem","metric");Q(this,"measurementModalOverlay",null);Q(this,"measurementModalDialog",null);Q(this,"measurementModalRadios",{});Q(this,"measurementModalKeydownHandler",null);Q(this,"detachPolygonFinishPatch",null);Q(this,"vertexMenuEl",null);Q(this,"vertexMenuCleanup",null);Q(this,"vertexEditSurfaceCleanup",null);Q(this,"activeCakeSession",null);Q(this,"cakeSessionCommand",null);Q(this,"moveConfirmationUI",null);Q(this,"activeMoveHandler",null);Q(this,"markerIconConfig",null);Q(this,"markerIcon",null);Q(this,"toolButtonConfig",null);Q(this,"toolbarGroups",null);Q(this,"activeToolCommand",null);Q(this,"pendingToolCommand",null);Q(this,"observedNativeToolbarCommand",null);Q(this,"commandSequence",0);Q(this,"toolErrors",{});Q(this,"toolSelection",[]);Q(this,"toolProvider",{requested:"tile-url",active:"tile-url",state:"enabled",reason:null});Q(this,"capabilityNotificationPending",!1);Q(this,"lastCapabilities","");Q(this,"toolEscapeKeyHandler",null);Q(this,"measurementPreviousFocus",null);Q(this,"snappingOptions",null);Q(this,"measurementOverlayOptions",null);Q(this,"interactionCleanup",null);Q(this,"measurementOverlayElement",null);Q(this,"snapFeedbackMarker",null);Q(this,"lastMeasurementFeature",null);Q(this,"lastMeasurementLatLng",null);var i,s,r,h,f,d;this.options=n,this.container=n.container,this.logger=((i=n.logger)!=null?i:Ro("controller","debug")).child("map"),this.L=this.resolveLeaflet(n),this.store=new zc(this.logger.child("store")),this.layerRegistry.add([],{id:"base",name:"Basemap"},"base"),this.setMarkerIconConfig((s=n.markerIconConfig)!=null?s:null,{reapplyExistingLayers:!1,syncDrawControl:!1}),this.toolButtonConfig=(r=n.toolButtonConfig)!=null?r:null,this.toolbarGroups=(h=n.toolbarGroups)!=null?h:null,this.snappingOptions=n.snapping?{...n.snapping,enabled:(f=n.snapping.enabled)!=null?f:!0}:null,this.measurementOverlayOptions=n.measurementOverlay?{...n.measurementOverlay,enabled:(d=n.measurementOverlay.enabled)!=null?d:!0}:null,this.logger.debug("ctor",{config:n.map,controls:n.controls,readOnly:n.readOnly,useExternalLeaflet:n.useExternalLeaflet}),yf(this.L),_f(this.L),mf(this.L)}emitToolEvent(n,i){var r,h;try{(h=(r=this.options.toolHooks)==null?void 0:r[n])==null||h.call(r,i)}catch(f){this._error(`tool hook failed: ${n}`,f)}const s=this.options.toolEventEmitter;if(s)try{if(typeof s.emit=="function"){s.emit(n,i);return}typeof s.dispatchEvent=="function"&&s.dispatchEvent(new CustomEvent(n,{detail:i}))}catch(f){this._error(`tool emitter failed: ${n}`,f)}}nextCommandId(){return this.commandSequence+=1,`tool-${Date.now().toString(36)}-${this.commandSequence.toString(36)}`}getToolCapabilities(){var i,s,r,h,f,d;const n={};for(const m of Object.keys(Ho))n[m]=m==="ruler"?this.canTriggerRulerTool():typeof((i=this.findLeafletDrawHandler(m))==null?void 0:i.enable)=="function";return nu({ready:!!(this.map&&this.drawnItems),readOnly:!!this.options.readOnly,controls:this.options.controls,available:n,layerCount:(h=(r=(s=this.drawnItems)==null?void 0:s.getLayers)==null?void 0:r.call(s).length)!=null?h:0,selectedFeatureIds:this.toolSelection.filter(m=>this.store.has(m)),activeTool:(d=(f=this.activeToolCommand)==null?void 0:f.tool)!=null?d:null,config:this.toolButtonConfig,groups:this.toolbarGroups,errors:this.toolErrors,provider:this.toolProvider})}setToolSelection(n){this.toolSelection=[...new Set(n)].filter(i=>this.store.has(i)),this.notifyToolCapabilities()}setToolProvider(n){this.toolProvider={...n,reason:n.reason?{...n.reason}:null},this.notifyToolCapabilities()}configure(n,i){this.options.map=n,this.options.controls=i,this.options.readOnly=n.readOnly,this.toolErrors={},this.notifyToolCapabilities()}notifyToolCapabilities(){this.capabilityNotificationPending||(this.capabilityNotificationPending=!0,queueMicrotask(()=>{var s,r;this.capabilityNotificationPending=!1,this.toolSelection=this.toolSelection.filter(h=>this.store.has(h));const n=this.getToolCapabilities();ru(this.container,n);const i=JSON.stringify(n);i!==this.lastCapabilities&&(this.lastCapabilities=i,(r=(s=this.options.callbacks)==null?void 0:s.onToolCapabilitiesChanged)==null||r.call(s,n))}))}toolEventDetail(n,i={}){var s,r;return{tool:n.tool,action:n.action,source:n.source,groupId:n.groupId,commandId:n.commandId,previousTool:n.previousTool,activeTool:(r=(s=this.activeToolCommand)==null?void 0:s.tool)!=null?r:null,featureIds:[],timestamp:Date.now(),...i}}emitToolLifecycle(n,i,s={}){var f,d,m;const r=this.toolEventDetail(i,s),h=n.replace("leaflet-geokit:tool-","");return["started","completed","cancelled","failed"].includes(h)&&ta(this.container,(f=r.reason)!=null?f:`${i.tool}: ${h}`,h==="failed"),(m=(d=this.options.callbacks)==null?void 0:d.onToolEvent)==null||m.call(d,n,r),this.emitToolEvent(n,r),this.notifyToolCapabilities(),r}beginToolCommand(n,i,s,r,h){var m,_,x,b;const f={tool:n,action:i,source:(m=s.source)!=null?m:"api",groupId:s.groupId,commandId:((_=s.commandId)==null?void 0:_.trim())||this.nextCommandId(),previousTool:(b=(x=this.activeToolCommand)==null?void 0:x.tool)!=null?b:null},d=this.toolEventDetail(f);return h&&Object.assign(h,d),r&&this.emitToolLifecycle("leaflet-geokit:tool-command",f),this.emitToolLifecycle("leaflet-geokit:tool-commanded",f),f}startPersistentTool(n){this.activeToolCommand!==n&&(this.activeToolCommand&&(this.cancelActiveTool(`Superseded by command "${n.commandId}"`,!1),n.replacedActive=!0),this.activeToolCommand=n,this.emitToolLifecycle("leaflet-geokit:tool-started",n,{activeTool:n.tool}),n.previousTool!==n.tool&&this.emitToolLifecycle("leaflet-geokit:tool-state-changed",n,{previousTool:n.previousTool,activeTool:n.tool}),Nr(this.container,n.tool))}clearActiveTool(n){this.activeToolCommand===n&&(this.activeToolCommand=null,Nr(this.container,null),this.emitToolLifecycle("leaflet-geokit:tool-state-changed",n,{previousTool:n.tool,activeTool:null}))}cancelActiveTool(n,i=!0){const s=this.activeToolCommand;s&&(this.activeToolCommand=null,this.emitToolLifecycle("leaflet-geokit:tool-cancelled",s,{previousTool:s.tool,activeTool:null,reason:n}),Nr(this.container,null),i&&this.emitToolLifecycle("leaflet-geokit:tool-state-changed",s,{previousTool:s.tool,activeTool:null}))}completeActiveTool(n,i){const s=this.activeToolCommand;s&&(this.emitToolLifecycle("leaflet-geokit:tool-completed",s,n),i&&(s.terminalOutcome="completed"))}failToolCommand(n,i){var s;((s=this.getToolCapabilities().tools[n.tool])==null?void 0:s.state)==="enabled"&&(this.toolErrors[n.tool]=i),n.terminalOutcome="failed",this.emitToolLifecycle("leaflet-geokit:tool-failed",n,{reason:i}),this.activeToolCommand===n?this.clearActiveTool(n):n.replacedActive&&!this.activeToolCommand&&this.emitToolLifecycle("leaflet-geokit:tool-state-changed",n,{previousTool:n.previousTool,activeTool:null})}setToolObservers(n){this.options.toolHooks=n.toolHooks,this.options.toolEventEmitter=n.toolEventEmitter}setMarkerIconConfig(n,i={}){const{reapplyExistingLayers:s=!0,syncDrawControl:r=!0}=i;this.options.markerIconConfig=n,this.markerIconConfig=n,this.markerIcon=this.createMarkerIcon(n),r&&this.syncDrawMarkerOptions(),s&&this.reapplyMarkerIconsToExistingLayers()}setToolButtonConfig(n){this.options.toolButtonConfig=n!=null?n:null,this.toolButtonConfig=n!=null?n:null,this.applyToolButtonCustomizations(),this.notifyToolCapabilities()}setSnappingOptions(n){var i,s,r;if((i=n==null?void 0:n.modes)!=null&&i.includes("grid")&&(!Number.isFinite(n.gridSizeMeters)||((s=n.gridSizeMeters)!=null?s:0)<=0))throw new Error("Grid snapping requires gridSizeMeters greater than zero.");if((n==null?void 0:n.tolerancePx)!==void 0&&(!Number.isFinite(n.tolerancePx)||n.tolerancePx<=0))throw new Error("Snapping tolerancePx must be a finite number greater than zero.");this.snappingOptions=n?{...n,enabled:(r=n.enabled)!=null?r:!0}:null,this.options.snapping=this.snappingOptions,this.installInteractionIntegrations()}getSnappingOptions(){return this.snappingOptions?{...this.snappingOptions,modes:this.snappingOptions.modes?[...this.snappingOptions.modes]:void 0,gridOrigin:this.snappingOptions.gridOrigin?[...this.snappingOptions.gridOrigin]:void 0}:null}setMeasurementOverlayOptions(n){var i;if((n==null?void 0:n.maximumFractionDigits)!==void 0&&(!Number.isInteger(n.maximumFractionDigits)||n.maximumFractionDigits<0||n.maximumFractionDigits>20))throw new Error("Measurement maximumFractionDigits must be an integer from 0 through 20.");this.measurementOverlayOptions=n?{...n,enabled:(i=n.enabled)!=null?i:!0}:null,this.options.measurementOverlay=this.measurementOverlayOptions,this.installInteractionIntegrations()}getMeasurementOverlayOptions(){return this.measurementOverlayOptions?{...this.measurementOverlayOptions}:null}setToolbarGroups(n){this.options.toolbarGroups=n!=null?n:null,this.toolbarGroups=n!=null?n:null,this.applyToolButtonCustomizations(),this.notifyToolCapabilities()}activateTool(n,i={}){const s=n==="select"?"deactivate":"activate";return this.executeToolCommand(n,s,i,!0)}triggerTool(n,i={}){return this.activateTool(n,i)}deactivateTool(n={}){return this.executeToolCommand("select","deactivate",n,!0)}handleToolCommand(n){const i=n.action==="deactivate"||n.tool==="select"?"deactivate":"activate",s=i==="deactivate"?"select":n.tool;return this.executeToolCommand(s,i,n,!1,n)}executeToolCommand(n,i,s,r,h){var _,x,b,E,C,M,S,z,Z,O,q,j,X;const f=this.beginToolCommand(n,i,s,r,h);delete this.toolErrors[n];const d=(x=(_=this.toolButtonConfig)==null?void 0:_[n])==null?void 0:x.requirements,m=this.getToolCapabilities().tools[n];if(i!=="deactivate"&&(((b=m==null?void 0:m.reason)==null?void 0:b.code)==="missing_attribute"||((E=m==null?void 0:m.reason)==null?void 0:E.code)==="no_editable_layers"||this.options.readOnly&&((C=Ho[n])!=null&&C.mutates)||d!=null&&d.selection&&this.getToolCapabilities().selectedFeatureIds.length===0||d!=null&&d.provider&&this.toolProvider.state!=="enabled")){const et=`Tool "${n}" is not available: ${(S=(M=m==null?void 0:m.reason)==null?void 0:M.message)!=null?S:"Tool requirements are not met"}`;return this.failToolCommand(f,et),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:et}),!1}try{if(i==="deactivate"||n==="select"){const ot=(z=this.activeToolCommand)==null?void 0:z.tool;return this.cancelActiveTool("Deactivated by select command"),this.disablePhysicalTool(ot),this.toggleMeasurementModal(!1),this.emitToolLifecycle("leaflet-geokit:tool-completed",f,{activeTool:null}),this.emitToolTrigger({tool:"select",source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}if(n==="save"){const ot=this.store.toFeatureCollection(),I=ot.features.map(N=>Ve(N)).filter(N=>!!N);return(O=(Z=this.options.callbacks)==null?void 0:Z.onSaved)==null||O.call(Z,{geoJSON:ot,featureCount:ot.features.length}),this.emitToolEvent("tool:save",{geoJSON:ot,featureCount:ot.features.length}),this.emitToolLifecycle("leaflet-geokit:tool-completed",f,{featureIds:I,geometry:ot}),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}if(n==="layerStyle"||n==="measurementSettings"){if(n==="measurementSettings")this.toggleMeasurementModal(!0);else{(q=this.closeLayerStylePanel)==null||q.call(this);const ot={layers:this.getLayers()};(X=(j=this.options.callbacks)==null?void 0:j.onLayerStyleRequested)!=null&&X.call(j,ot)||(this.closeLayerStylePanel=Fc(this.container,ot.layers,(I,N)=>{this.setLayerStyle(I,N)}))}return this.emitToolLifecycle("leaflet-geokit:tool-completed",f),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}if(n==="ruler"){if(!this.canTriggerRulerTool()){const I="Ruler control is not available";return this.failToolCommand(f,I),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:I}),!1}if(this.preparePersistentTool(f),!this.triggerRulerTool()){const I="Ruler control is not available";return this.failToolCommand(f,I),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:I}),!1}return this.startPersistentTool(f),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}const et=this.findLeafletDrawHandler(n);if(!et||typeof et.enable!="function"){const ot=`Tool "${n}" is not available on this map`;return this.failToolCommand(f,ot),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:ot}),!1}if(this.preparePersistentTool(f),this.pendingToolCommand=f,et.enable(),this.pendingToolCommand=null,typeof et.enabled=="function"&&et.enabled()===!1){const ot=`Tool "${n}" could not be started`;return this.failToolCommand(f,ot),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:ot}),!1}return this.startPersistentTool(f),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}catch(et){this.pendingToolCommand=null;const ot=i==="deactivate"?"Failed to deactivate active map tools":"Failed to activate tool "+n,I=et instanceof Error?et.message:ot;return this.toolErrors[n]=I,this._error(ot,et),this.failToolCommand(f,I),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:I}),!1}}preparePersistentTool(n){var s;const i=(s=this.activeToolCommand)==null?void 0:s.tool;this.activeToolCommand&&(this.cancelActiveTool(`Superseded by command "${n.commandId}"`,!1),n.replacedActive=!0),this.disablePhysicalTool(i)}disablePhysicalTool(n){var i,s,r,h,f;if(n==="layerCake"||this.activeCakeSession)try{this.activeCakeSession&&this.emitCakeEvent("tool:layer-cake:cancelled"),(i=this.activeCakeSession)==null||i.destroy()}finally{this.activeCakeSession=null,this.cakeSessionCommand=null}n==="move"&&((r=(s=this.activeMoveHandler)==null?void 0:s.hasPendingMove)!=null&&r.call(s))&&((f=(h=this.activeMoveHandler).cancelMove)==null||f.call(h),this.hideMoveConfirmationUI()),n==="ruler"&&this.triggerRulerTool(),n&&this.disableActiveToolHandlers()}resolveLeaflet(n){if(!n.useExternalLeaflet)return Do;if(n.leaflet&&fa(n.leaflet))return this.logger.debug("leaflet-runtime:external-injected"),n.leaflet;const s=globalThis.L;return s&&fa(s)?(this.logger.debug("leaflet-runtime:external-global"),s):(this.logger.warn("leaflet-runtime:external-fallback-bundled",{message:"External Leaflet requested but Draw APIs were missing; falling back to bundled Leaflet/Draw"}),Do)}async init(){var i,s,r,h,f,d;const n=(s=(i=performance.now)==null?void 0:i.call(performance))!=null?s:Date.now();try{await this.destroy();const{latitude:m,longitude:_,zoom:x,minZoom:b,maxZoom:E,tileUrl:C,tileAttribution:M,preferCanvas:S=!0,useExternalLeaflet:z}=this.options.map,Z=[m,_],O=this.L;z&&fa(O,{onError:ot=>this.logger.warn("external-leaflet-missing-draw",{message:ot})}),this.map=O.map(this.container,{zoomControl:!0,minZoom:b,preferCanvas:S}).setView(Z,x),this.setTileLayer({urlTemplate:C,attribution:M!=null?M:"",maxZoom:E},{onTileError:ot=>{var I,N;(N=(I=this.options.callbacks)==null?void 0:I.onTileError)==null||N.call(I,ot)}}),this.drawnItems=O.featureGroup().addTo(this.map),this.drawnItems.on("layeradd layerremove",()=>this.notifyToolCapabilities());const q=this.buildDrawOptions(this.options.controls,!!this.options.readOnly),j=O.Control.Draw;this.drawControl=new j(q),this.map.addControl(this.drawControl),this.applyLayerCakeToolbarIcon(),this.applyMoveToolbarIcon(),this.restoreVisibleLayersFromStore(),this.options.controls.ruler&&(this.logger.debug("init:ruler",{available:typeof O.control.ruler=="function"}),typeof O.control.ruler=="function"?(this.addRulerControl(),this.installMeasurementSettingsControl()):this.logger.warn("init:ruler:missing",{msg:"L.control.ruler is not defined"})),this.applyToolButtonCustomizations(),this.patchLeafletDrawBugs(),this.installPolygonFinishPatch(),this.installVertexEditSurfaceMenu(),this.map.invalidateSize(),setTimeout(()=>{var ot;try{(ot=this.map)==null||ot.invalidateSize()}catch{}},0),this.bindDrawEvents(),this.installInteractionIntegrations();const X=((h=(r=performance.now)==null?void 0:r.call(performance))!=null?h:Date.now())-n;this.logger.debug("init:ready",{elapsedMs:Math.round(X)});const et=this.store.bounds();(d=(f=this.options.callbacks)==null?void 0:f.onReady)==null||d.call(f,et?{bounds:et}:{}),this.toolErrors={},this.notifyToolCapabilities()}catch(m){this._error("Failed to initialize Leaflet map",m,{code:"map_init_failed",recoverable:!1})}}async destroy(){var n,i,s,r,h,f,d,m;this.cancelLayerCakeSession(),(n=this.closeLayerStylePanel)==null||n.call(this),this.closeLayerStylePanel=null,this.featureLayers.clear(),this.providerDiagnostics=null,(i=this.interactionCleanup)==null||i.call(this),this.interactionCleanup=null,this.adapterAttribution=null;try{Gl(this.container,null,{toolbarGroups:null}),this.map&&((r=(s=this.findLeafletDrawHandler("move"))==null?void 0:s.disable)==null||r.call(s),this.map.off(),this.map.remove())}catch(_){this._error("Failed to remove Leaflet map",_)}try{(h=this.detachPolygonFinishPatch)==null||h.call(this)}catch{}this.detachPolygonFinishPatch=null;try{(f=this.vertexMenuCleanup)==null||f.call(this)}catch{}this.vertexMenuEl=null,this.vertexMenuCleanup=null;try{(d=this.vertexEditSurfaceCleanup)==null||d.call(this)}catch{}this.vertexEditSurfaceCleanup=null;try{this.hideMoveConfirmationUI()}catch{}this.toolEscapeKeyHandler&&(this.container.removeEventListener("keydown",this.toolEscapeKeyHandler),this.container.removeEventListener("keyup",this.toolEscapeKeyHandler),this.toolEscapeKeyHandler=null),this.activeToolCommand=null,this.pendingToolCommand=null,this.observedNativeToolbarCommand=null,Nr(this.container,null),this.drawControl=null,this.rulerControl=null,this.measurementControl=null,this.removeMeasurementModal(),this.drawnItems=null,this.notifyToolCapabilities(),this.tileLayer=null;try{(m=this.activeCakeSession)==null||m.destroy()}catch{}this.activeCakeSession=null,this.map=null}getLayers(){return this.layerRegistry.getLayers()}applyLayerRegistry(){var n,i,s,r,h,f,d,m,_,x;if(!(!this.map||!this.drawnItems)){for(const b of this.getLayers()){if(b.kind==="base"){this.tileLayer&&(b.visible?this.tileLayer.addTo(this.map):this.map.removeLayer(this.tileLayer),(s=(i=this.tileLayer).setOpacity)==null||s.call(i,(n=b.style.opacity)!=null?n:1));continue}for(const E of b.featureIds){const C=this.featureLayers.get(E);C&&(b.visible?this.drawnItems.addLayer(C):this.drawnItems.removeLayer(C),(r=C.setStyle)==null||r.call(C,b.style),(f=C.setOpacity)==null||f.call(C,(h=b.style.opacity)!=null?h:1),b.visible&&((d=C.bringToFront)==null||d.call(C)),(m=C.setZIndexOffset)==null||m.call(C,b.order*100))}}(x=(_=this.options.callbacks)==null?void 0:_.onLayerEvent)==null||x.call(_,"leaflet-geokit:layers-changed",{layers:this.getLayers()}),this.notifyToolCapabilities()}}setLayerVisibility(n,i){this.layerRegistry.setLayerVisibility(n,i),this.applyLayerRegistry()}setLayerStyle(n,i){this.layerRegistry.setLayerStyle(n,i),this.applyLayerRegistry()}reorderLayers(n){this.layerRegistry.reorderLayers(n),this.applyLayerRegistry()}async focusLayer(n){var h;const i=this.layerRegistry.get(n),r=this.L.featureGroup(i.featureIds.map(f=>this.featureLayers.get(f)).filter(f=>!!f)).getBounds();r.isValid()&&((h=this.map)==null||h.fitBounds(r,{maxZoom:18}))}async removeLayer(n){if(this.options.readOnly)throw new Error("Map is read-only");const i=this.layerRegistry.get(n);if(i.kind==="base")throw new Error("Hide the basemap with setLayerVisibility instead");for(const s of i.featureIds)await this.removeFeature(s);this.getLayers().some(s=>s.id===n)&&this.layerRegistry.removeLayer(n),this.applyLayerRegistry()}getLayerCakeSession(){var n,i;return(i=(n=this.activeCakeSession)==null?void 0:n.snapshot())!=null?i:null}updateLayerCakeSession(n){if(this.options.readOnly)throw new Error("Map is read-only");if(!this.activeCakeSession)throw new Error("No active layer cake session");this.activeCakeSession.update(n)}saveLayerCakeSession(){if(this.options.readOnly)throw new Error("Map is read-only");if(!this.activeCakeSession)throw new Error("No active layer cake session");this.activeCakeSession.save()}cancelLayerCakeSession(){this.activeCakeSession&&(this.disablePhysicalTool("layerCake"),this.cancelActiveTool("Layer cake cancelled by host"))}emitCakeEvent(n,i={}){var h,f,d;const s=(h=this.cakeSessionCommand)!=null?h:this.activeToolCommand,r={session:this.getLayerCakeSession(),source:s==null?void 0:s.source,commandId:s==null?void 0:s.commandId,groupId:s==null?void 0:s.groupId,...i};this.emitToolEvent(n,r),(d=(f=this.options.callbacks)==null?void 0:f.onLayerEvent)==null||d.call(f,n,r)}async getGeoJSON(){return this.store.toFeatureCollection()}async exportGeoJSON(n={}){const i=Ks(await this.getGeoJSON(),n);return n.preserveLayers?{...i,"geokit:layers":this.layerRegistry.snapshot()}:i}async importGeoJSON(n,i={}){var m,_;if(!this.map||!this.drawnItems)return[];const s=(m=i.behavior)!=null?m:"replace",r=i.validate?qo(n,{expandMulti:!0}):js(n);if(i.preserveLayers&&s!=="replace")throw new Error("preserveLayers requires replace import");const h=i.preserveLayers?Qs.parseSnapshot(n["geokit:layers"],r.features.map(x=>{var b;return(b=Ve(x))!=null?b:""})):null;if(!h&&(new Qs().add([],i.layer),((_=i.layer)==null?void 0:_.id)==="base"||s==="add"&&this.getLayers().some(b=>{var E;return b.id===((E=i.layer)==null?void 0:E.id)})))throw new Error("Duplicate layer id");if(i.validate&&s==="add"&&qo({type:"FeatureCollection",features:[...this.store.toFeatureCollection().features,...r.features]}),s==="replace")await this.clearLayers();else for(const x of r.features){const b=Ve(x);b&&this.store.has(b)&&await this.removeFeature(b)}const f=this.store.add(r),d=this.createGeoJSONLayers(r);return this.addGeoJSONLayersToDrawnItems(d),d.eachLayer(x=>{x._fid&&this.featureLayers.set(x._fid,x)}),h?this.layerRegistry.restore(h):f.length&&this.layerRegistry.add(f,i.layer),this.applyLayerRegistry(),this.notifyToolCapabilities(),this.logger.debug("importGeoJSON",{behavior:s,count:r.features.length,ids:f}),i.fitToData&&await this.fitBoundsToData(),f}async loadGeoJSON(n,i=!1){await this.importGeoJSON(n,{behavior:"replace",fitToData:i})}async clearLayers(){this.cancelLayerCakeSession(),this.drawnItems&&this.drawnItems.clearLayers(),this.store.clear(),this.featureLayers.clear(),this.layerRegistry.clearData(),this.applyLayerRegistry(),this.toolSelection=[],this.notifyToolCapabilities()}async addFeatures(n){return this.importGeoJSON(n,{behavior:"add"})}async updateFeature(n,i){if(!this.store.has(n)){this.logger.warn("updateFeature:missing",{id:n});return}if(this.store.update(n,i),!this.drawnItems)return;this.drawnItems.eachLayer(r=>{r._fid===n&&this.drawnItems.removeLayer(r)});const s=this.createGeoJSONLayers({type:"FeatureCollection",features:[{...i,id:n}]});s.eachLayer(r=>{r._fid=n,this.drawnItems.addLayer(r),this.installVertexContextMenu(r)}),s.eachLayer(r=>this.featureLayers.set(n,r)),this.applyLayerRegistry()}async removeFeature(n){this.drawnItems&&this.drawnItems.eachLayer(i=>{i._fid===n&&this.drawnItems.removeLayer(i)}),this.store.remove(n),this.toolSelection=this.toolSelection.filter(i=>i!==n),this.featureLayers.delete(n),this.layerRegistry.removeFeature(n),this.applyLayerRegistry(),this.notifyToolCapabilities()}async fitBoundsToData(n=.05){if(!this.map)return;const i=this.store.bounds();if(!i)return;const s=i,r=this.L.latLngBounds(s);if(n>0){const h=r.getSouthWest(),f=r.getNorthEast(),d=(f.lat-h.lat)*n,m=(f.lng-h.lng)*n,_=this.L.latLngBounds(this.L.latLng(h.lat-d,h.lng-m),this.L.latLng(f.lat+d,f.lng+m));this.map.fitBounds(_)}else this.map.fitBounds(r)}async fitBounds(n,i=.05){if(!this.map)return;const s=this.L.latLngBounds(n);if(i>0){const r=s.getSouthWest(),h=s.getNorthEast(),f=(h.lat-r.lat)*i,d=(h.lng-r.lng)*i,m=this.L.latLngBounds(this.L.latLng(r.lat-f,r.lng-d),this.L.latLng(h.lat+f,h.lng+d));this.map.fitBounds(m)}else this.map.fitBounds(s)}async setView(n,i,s){this.map&&this.map.setView([n,i],s!=null?s:this.map.getZoom())}getProviderDiagnostics(){return this.providerDiagnostics?{...this.providerDiagnostics}:null}setBasemapAdapter(n){var i,s;if(!this.map)throw new Error("Map is not ready");if(n.provider.capabilities.attributionRequired&&!n.attribution.trim())throw new Error("Basemap attribution is required");if(n.provider.kind==="raster")this.setTileLayer({...n.provider.resolve(),attribution:n.attribution});else{const r=n.provider.createLayer(this.L);if(r===this.tileLayer||this.map.hasLayer(r))throw new Error("Basemap adapter must return a fresh layer");try{r.addTo(this.map)}catch{throw this.map.hasLayer(r)&&this.map.removeLayer(r),new Error("Basemap adapter failed to mount")}this.tileLayer&&this.map.removeLayer(this.tileLayer),this.adapterAttribution&&((i=this.map.attributionControl)==null||i.removeAttribution(this.adapterAttribution)),this.tileLayer=r,this.adapterAttribution=n.attribution,(s=this.map.attributionControl)==null||s.addAttribution(n.attribution)}this.providerDiagnostics=ga(n.provider,n.attribution),this.applyLayerRegistry()}setTileLayer(n,i){var f;if(!this.map){this.logger.warn("setTileLayer called before map initialization");return}this.logger.debug("tile-layer:switch",{maxZoom:n.maxZoom,subdomains:n.subdomains}),this.adapterAttribution&&((f=this.map.attributionControl)==null||f.removeAttribution(this.adapterAttribution)),this.adapterAttribution=null,this.providerDiagnostics=ga(iu(n),n.attribution),this.tileLayer&&(this.map.removeLayer(this.tileLayer),this.tileLayer=null);const s={attribution:n.attribution,minZoom:this.options.map.minZoom,maxZoom:n.maxZoom};n.subdomains!==void 0?s.subdomains=n.subdomains:n.urlTemplate.includes("{s}")&&(s.subdomains=["a","b","c"]);const r=this.L.tileLayer(n.urlTemplate,s);let h=!1;r.on("tileerror",d=>{var m;this.tileLayer===r&&(this.logger.error("tile-layer:error"),h||(h=!0,(m=i==null?void 0:i.onTileError)==null||m.call(i,d)))}),r.addTo(this.map),this.tileLayer=r,this.applyLayerRegistry()}async mergeVisiblePolygons(n){if(!this.map||!this.drawnItems)return null;const s=(await this.getGeoJSON()).features.filter(d=>{const m=d.geometry,_=Ve(d);return!this.getLayers().some(b=>!b.visible&&_&&b.featureIds.includes(_))&&m&&(Nl(m)||Ol(m))});if(s.length<=1){if(s.length===1){const d=s[0].id;return d?String(d):null}return null}const r=Bc(s,n==null?void 0:n.properties);if(!r)return null;const h=[];for(const d of s){const m=d.id;m&&h.push(String(m))}for(const d of h)await this.removeFeature(d);const[f]=await this.addFeatures({type:"FeatureCollection",features:[r]});return f||null}setRulerUnits(n){if(this.measurementSystem===n)return;const i=this.measurementSystem;this.measurementSystem=n,this.logger.debug("ruler:units",{system:n}),this.emitToolEvent("tool:ruler:units-changed",{previous:i,current:n}),this.syncMeasurementModalState(),this.refreshMeasurementOverlay(),this.rebuildRulerControl()}buildDrawOptions(n,i){var h;const s={polygon:n.polygon?{allowIntersection:(h=this.options.map.polygonAllowIntersection)!=null?h:!1,showArea:!0,shapeOptions:{color:"#3388ff"}}:!1,polyline:n.polyline?{shapeOptions:{color:"#3388ff"}}:!1,rectangle:n.rectangle?{shapeOptions:{color:"#3388ff"}}:!1,circle:n.circle?{shapeOptions:{color:"#3388ff"}}:!1,cake:n.cake?{shapeOptions:{color:"#8A2BE2",fillOpacity:.2}}:!1,marker:n.marker?this.buildMarkerDrawOptions():!1,move:n.move?{featureGroup:this.drawnItems}:!1};let r={featureGroup:this.drawnItems};return n.edit?n.delete===!1&&(r.remove=!1):r=!1,i?{draw:!1,edit:!1}:{draw:s,edit:r}}buildMarkerDrawOptions(){return this.markerIcon?{icon:this.markerIcon}:{}}createMarkerIcon(n){return n?this.L.icon({iconUrl:n.iconUrl,iconRetinaUrl:n.iconRetinaUrl,shadowUrl:n.shadowUrl,iconSize:n.iconSize,iconAnchor:n.iconAnchor,popupAnchor:n.popupAnchor}):null}createDefaultMarkerIcon(){var i;const n=(i=this.L.Icon)==null?void 0:i.Default;return n?new n:null}createGeoJSONLayers(n){return this.L.geoJSON(n,{pointToLayer:(i,s)=>this.markerIcon?this.L.marker(s,{icon:this.markerIcon}):this.L.marker(s),onEachFeature:(i,s)=>{const r=Ve(i);r&&(s._fid=r)}})}addGeoJSONLayersToDrawnItems(n){this.drawnItems&&n.eachLayer(i=>{this.drawnItems.addLayer(i),this.installVertexContextMenu(i)})}restoreVisibleLayersFromStore(){if(!this.drawnItems)return;const n=this.store.toFeatureCollection();if(n.features.length===0)return;const i=this.createGeoJSONLayers(n);this.addGeoJSONLayersToDrawnItems(i)}syncDrawMarkerOptions(){var s,r,h,f;const n=this.drawControl;if(!n)return;const i=this.buildMarkerDrawOptions();(s=n.options)!=null||(n.options={}),(h=(r=n.options).draw)!=null||(r.draw={}),n.options.draw.marker=i,(f=n.setDrawingOptions)==null||f.call(n,{marker:i})}reapplyMarkerIconsToExistingLayers(){if(!this.drawnItems)return;const n=this.markerIcon?null:this.createDefaultMarkerIcon();this.drawnItems.eachLayer(i=>{if(!(typeof(i==null?void 0:i.setIcon)!="function"||typeof(i==null?void 0:i.getLatLng)!="function")){if(this.markerIcon){i.setIcon(this.markerIcon);return}n&&i.setIcon(n)}})}applyToolButtonCustomizations(){const n=()=>{Gl(this.container,this.toolButtonConfig,{toolbarGroups:this.toolbarGroups,onTrigger:(i,s)=>this.handleToolbarTrigger(i,s)}),ru(this.container,this.getToolCapabilities())};n(),setTimeout(n,0)}handleToolbarTrigger(n,i){var r,h;if(i.activate){this.activateTool(n,{source:i.source,groupId:i.groupId});return}let s=((r=this.observedNativeToolbarCommand)==null?void 0:r.tool)===n?this.observedNativeToolbarCommand:null;if(s&&(this.observedNativeToolbarCommand=null),n==="measurementSettings")s=this.beginToolCommand(n,"activate",{source:i.source,groupId:i.groupId},!0),this.emitToolLifecycle("leaflet-geokit:tool-completed",s);else if(n==="ruler"){const f=this.isRulerActive();((h=this.activeToolCommand)==null?void 0:h.tool)==="ruler"&&!f?(s=this.beginToolCommand(n,"activate",{source:i.source,groupId:i.groupId},!0),this.cancelActiveTool("Ruler toggled off"),this.emitToolLifecycle("leaflet-geokit:tool-completed",s,{activeTool:null})):s||(s=this.observePersistentToolStart(n,{source:i.source,groupId:i.groupId}))}else s||(s=this.observePersistentToolStart(n,{source:i.source,groupId:i.groupId}));this.emitToolTrigger({tool:n,source:i.source,groupId:i.groupId,commandId:s==null?void 0:s.commandId,handled:!0})}observePersistentToolStart(n,i){const s=this.pendingToolCommand,r=(s==null?void 0:s.tool)!==n,h=r?this.beginToolCommand(n,"activate",i,!0):s;if(this.activeToolCommand&&this.activeToolCommand!==h){const f=this.activeToolCommand.tool;this.cancelActiveTool(`Superseded by command "${h.commandId}"`,!1),h.replacedActive=!0,this.cleanupSupersededNativeTool(f)}return this.startPersistentTool(h),r&&(this.observedNativeToolbarCommand=h,queueMicrotask(()=>{this.observedNativeToolbarCommand===h&&(this.observedNativeToolbarCommand=null)})),h}cleanupSupersededNativeTool(n){var i,s,r,h;if(n==="layerCake"&&this.activeCakeSession)try{this.emitCakeEvent("tool:layer-cake:cancelled"),this.activeCakeSession.destroy()}finally{this.activeCakeSession=null,this.cakeSessionCommand=null}n==="ruler"&&this.isRulerActive()&&this.triggerRulerTool(),n==="move"&&((s=(i=this.activeMoveHandler)==null?void 0:i.hasPendingMove)!=null&&s.call(i))&&((h=(r=this.activeMoveHandler).cancelMove)==null||h.call(r),this.hideMoveConfirmationUI())}handlePersistentToolStop(n,i){const s=this.activeToolCommand;if(!(!s||s.tool!==n)&&!(n==="layerCake"&&this.activeCakeSession)){if(s.terminalOutcome){this.clearActiveTool(s);return}this.cancelActiveTool(i)}}failActiveTool(n){const i=this.activeToolCommand;i&&this.failToolCommand(i,n)}emitToolTrigger(n){var i,s;(s=(i=this.options.callbacks)==null?void 0:i.onToolTrigger)==null||s.call(i,{...n,timestamp:Date.now()})}findLeafletDrawHandler(n){var f,d,m,_,x,b,E,C,M,S;const i={polygon:"polygon",polyline:"polyline",rectangle:"rectangle",circle:"circle",marker:"marker",layerCake:"cake",move:"move"},s={edit:"edit",delete:"remove"},r=i[n];if(r)return(x=(_=(m=(d=(f=this.drawControl)==null?void 0:f._toolbars)==null?void 0:d.draw)==null?void 0:m._modes)==null?void 0:_[r])==null?void 0:x.handler;const h=s[n];return h?(S=(M=(C=(E=(b=this.drawControl)==null?void 0:b._toolbars)==null?void 0:E.edit)==null?void 0:C._modes)==null?void 0:M[h])==null?void 0:S.handler:null}disableActiveToolHandlers(){var i;const n=(i=this.drawControl)==null?void 0:i._toolbars;n&&Object.values(n).forEach(s=>{var r;Object.values((r=s==null?void 0:s._modes)!=null?r:{}).forEach(h=>{const f=h==null?void 0:h.handler;f&&typeof f.disable=="function"&&f.disable()})})}canTriggerRulerTool(){const n=this.rulerControl;return typeof(n==null?void 0:n._toggleMeasure)=="function"||!!this.container.querySelector(".leaflet-ruler")}isRulerActive(){const n=this.rulerControl;return(n==null?void 0:n._choice)===!0||!!this.container.querySelector(".leaflet-ruler-clicked")}triggerRulerTool(){const n=this.rulerControl;if(typeof(n==null?void 0:n._toggleMeasure)=="function")return n._toggleMeasure(),!0;const i=this.container.querySelector(".leaflet-ruler");return i?(i.click(),!0):!1}applyLayerCakeToolbarIcon(){if(!this.container)return;const n=()=>{const i=this.container.querySelector("a.leaflet-draw-draw-cake");if(!i)return;i.style.setProperty("background-image","none","important"),i.style.setProperty("background-color","#fff","important"),i.style.setProperty("position","relative","important");let s=i.querySelector(".leaflet-geokit-cake-icon");s||(s=document.createElement("span"),s.className="leaflet-geokit-cake-icon",s.setAttribute("aria-hidden","true"),i.appendChild(s)),s.style.setProperty("position","absolute","important"),s.style.setProperty("display","block","important"),s.style.setProperty("left","50%","important"),s.style.setProperty("top","50%","important"),s.style.setProperty("width","18px","important"),s.style.setProperty("height","18px","important"),s.style.setProperty("transform","translate(-50%, -50%)","important"),s.style.setProperty("pointer-events","none","important"),s.firstElementChild||(s.innerHTML=If);const r=s.firstElementChild;r&&(r.style.setProperty("width","100%","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("display","block","important"))};n(),setTimeout(n,0)}applyMoveToolbarIcon(){if(!this.container)return;const n=()=>{const i=this.container.querySelector("a.leaflet-draw-draw-move");if(!i)return;i.style.setProperty("background-image","none","important"),i.style.setProperty("background-color","#fff","important"),i.style.setProperty("position","relative","important");let s=i.querySelector(".leaflet-geokit-move-icon");s||(s=document.createElement("span"),s.className="leaflet-geokit-move-icon",s.setAttribute("aria-hidden","true"),i.appendChild(s)),s.style.setProperty("position","absolute","important"),s.style.setProperty("display","block","important"),s.style.setProperty("left","50%","important"),s.style.setProperty("top","50%","important"),s.style.setProperty("width","18px","important"),s.style.setProperty("height","18px","important"),s.style.setProperty("transform","translate(-50%, -50%)","important"),s.style.setProperty("pointer-events","none","important"),s.firstElementChild||(s.innerHTML=Cf);const r=s.firstElementChild;r&&(r.style.setProperty("width","100%","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("display","block","important"))};n(),setTimeout(n,0)}addRulerControl(){if(!this.map)return;this.installRulerPrecisionPatch();const n=Uf(this.measurementSystem);this.rulerControl=this.L.control.ruler(n),this.map.addControl(this.rulerControl)}installRulerPrecisionPatch(){if(Zh)return;const n=this.L.Control.Ruler;if(!n||typeof n!="function")return;const i=n.prototype,s=i._calculateBearingAndDistance;if(typeof s!="function")return;const r=this.logger;i._calculateBearingAndDistance=function(){var f,d,m;s.call(this);try{const _=this._clickedLatLong,x=(f=this._movingLatLong)!=null?f:this._clickedLatLong;if(!_||!x)return;const{meters:b,bearingDegrees:E}=jl(_.lat,_.lng,x.lat,x.lng),C=b/1e3,M=typeof((m=(d=this.options)==null?void 0:d.lengthUnit)==null?void 0:m.factor)=="number"?this.options.lengthUnit.factor:1,S=ca(C*M);this._result=this._result||{},this._result.Distance=S,this._result.Bearing=E,this._result.meters=b}catch(_){r==null||r.warn("ruler:precision-patch",_)}},Zh=!0}rebuildRulerControl(){if(!(!this.map||!this.options.controls.ruler)){if(this.rulerControl){try{this.map.removeControl(this.rulerControl)}catch(n){this.logger.warn("ruler:remove-failed",n)}this.rulerControl=null}this.addRulerControl()}}installMeasurementSettingsControl(){if(!this.map||this.measurementControl)return;const n=this,i=this.L.Control.extend({options:{position:"topleft"},onAdd(){const s=n.L.DomUtil.create("div","leaflet-bar leaflet-ruler-settings-control"),r=n.L.DomUtil.create("button","leaflet-ruler-settings-button",s);return r.type="button",r.title="Measurement settings",r.setAttribute("aria-label","Measurement settings"),r.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),n.toggleMeasurementModal(!0)}),n.L.DomEvent.disableClickPropagation(s),n.L.DomEvent.disableScrollPropagation(s),s}});this.measurementControl=new i,this.map.addControl(this.measurementControl)}ensureMeasurementModal(){if(this.measurementModalOverlay)return this.measurementModalOverlay;if(typeof document=="undefined")throw new Error("Measurement modal requires a browser environment");const n=document.createElement("div");n.className="leaflet-ruler-modal-overlay",n.setAttribute("aria-hidden","true");const i=document.createElement("div");i.className="leaflet-ruler-modal",i.setAttribute("role","dialog"),i.setAttribute("aria-label","Measurement units"),i.setAttribute("aria-modal","true"),i.tabIndex=-1,n.addEventListener("click",m=>{m.target===n&&this.toggleMeasurementModal(!1)});const s=document.createElement("h2");s.className="leaflet-ruler-modal-title",s.textContent="Measurement Units",i.appendChild(s);const r=document.createElement("p");r.className="leaflet-ruler-modal-description",r.textContent="Choose how the measurement tool reports distances.",i.appendChild(r);const h=document.createElement("div");h.className="leaflet-ruler-modal-options",i.appendChild(h),["metric","imperial"].forEach(m=>{const _=document.createElement("label");_.className="leaflet-ruler-modal-option";const x=document.createElement("input");x.type="radio",x.name="leaflet-ruler-units",x.value=m,x.addEventListener("change",()=>{x.checked&&this.setRulerUnits(m)});const b=document.createElement("span");b.textContent=qf[m],_.appendChild(x),_.appendChild(b),h.appendChild(_),this.measurementModalRadios[m]=x});const f=document.createElement("div");f.className="leaflet-ruler-modal-actions";const d=document.createElement("button");return d.type="button",d.className="leaflet-ruler-modal-close",d.textContent="Close",d.addEventListener("click",()=>this.toggleMeasurementModal(!1)),f.appendChild(d),i.appendChild(f),n.appendChild(i),this.container.appendChild(n),this.measurementModalOverlay=n,this.measurementModalDialog=i,this.syncMeasurementModalState(),n}toggleMeasurementModal(n){var h,f;if(!n){this.measurementModalOverlay&&(this.measurementModalOverlay.classList.remove("is-open"),this.measurementModalOverlay.setAttribute("aria-hidden","true")),this.detachMeasurementModalKeydown(),(h=this.measurementPreviousFocus)!=null&&h.isConnected&&this.measurementPreviousFocus.focus(),this.measurementPreviousFocus=null;return}const i=this.ensureMeasurementModal(),s=this.container.getRootNode(),r=s instanceof ShadowRoot?s.activeElement:document.activeElement;i.contains(r)||(this.measurementPreviousFocus=r instanceof HTMLElement?r:null),i.classList.add("is-open"),i.setAttribute("aria-hidden","false"),this.syncMeasurementModalState(),this.attachMeasurementModalKeydown(),(f=this.measurementModalDialog)==null||f.focus()}syncMeasurementModalState(){for(const[n,i]of Object.entries(this.measurementModalRadios))i&&(i.checked=n===this.measurementSystem)}removeMeasurementModal(){this.measurementModalOverlay&&this.measurementModalOverlay.remove(),this.measurementModalOverlay=null,this.measurementModalDialog=null,this.measurementModalRadios={},this.detachMeasurementModalKeydown()}attachMeasurementModalKeydown(){this.measurementModalKeydownHandler||typeof document=="undefined"||(this.measurementModalKeydownHandler=n=>{var s,r;const i=this.measurementModalDialog;if(!(!i||!n.composedPath().includes(i))){if(n.key==="Escape")n.preventDefault(),n.stopPropagation(),this.toggleMeasurementModal(!1);else if(n.key==="Tab"){const h=Array.from(i.querySelectorAll("input:checked, button:not(:disabled)")),f=n.composedPath()[0];n.shiftKey&&(f===h[0]||f===i)?(n.preventDefault(),(s=h.at(-1))==null||s.focus()):!n.shiftKey&&(f===h.at(-1)||f===i)&&(n.preventDefault(),(r=h[0])==null||r.focus())}}},document.addEventListener("keydown",this.measurementModalKeydownHandler))}detachMeasurementModalKeydown(){!this.measurementModalKeydownHandler||typeof document=="undefined"||(document.removeEventListener("keydown",this.measurementModalKeydownHandler),this.measurementModalKeydownHandler=null)}installPolygonFinishPatch(){var f,d,m,_,x;if(!this.map||!this.drawControl)return;try{(f=this.detachPolygonFinishPatch)==null||f.call(this)}catch{}this.detachPolygonFinishPatch=null;const n=this.map,i=(m=(d=this.drawControl)==null?void 0:d._toolbars)==null?void 0:m.draw;if(!i||!!!((x=(_=i._modes)==null?void 0:_.polygon)!=null&&x.handler))return;const r=10,h=b=>{var E,C,M,S,z,Z,O,q;try{const j=(C=(E=i._modes)==null?void 0:E.polygon)==null?void 0:C.handler;if(!j||!j._enabled)return;const X=j._markers;if(!Array.isArray(X)||X.length<3)return;const et=(S=(M=X[0])==null?void 0:M.getLatLng)==null?void 0:S.call(M);if(!et)return;const ot=n.latLngToContainerPoint(et),I=n.latLngToContainerPoint(b.latlng);Math.hypot(ot.x-I.x,ot.y-I.y)<=r&&typeof j._finishShape=="function"&&((Z=(z=b.originalEvent)==null?void 0:z.preventDefault)==null||Z.call(z),(q=(O=b.originalEvent)==null?void 0:O.stopPropagation)==null||q.call(O),j._finishShape())}catch(j){this._error("polygon-finish-patch",j)}};n.on("click",h),this.detachPolygonFinishPatch=()=>{try{n.off("click",h)}catch{}}}patchLeafletDrawBugs(){var n,i,s,r,h;try{const f=this.L,d=f.GeometryUtil;if(!d)return;const m={km:2,ha:2,m:0,mi:2,ac:2,yd:0,ft:0,nm:2},_=(i=(n=d.formattedNumber)==null?void 0:n.bind(d))!=null?i:((x,b)=>Number(x).toFixed(b));d.readableArea=(x,b,E)=>{var S;const C=(S=f.Util)!=null&&S.extend?f.Util.extend({},m,E||{}):{...m,...E||{}};let M;if(b){let z=["ha","m"];const Z=typeof b;Z==="string"?z=[b]:Z!=="boolean"&&(z=Array.isArray(b)?b:z),x>=1e6&&z.indexOf("km")!==-1?M=`${_(1e-6*x,C.km)} km²`:x>=1e4&&z.indexOf("ha")!==-1?M=`${_(1e-4*x,C.ha)} ha`:M=`${_(x,C.m)} m²`}else x=x/.836127,x>=3097600?M=`${_(x/3097600,C.mi)} mi²`:x>=4840?M=`${_(x/4840,C.ac)} acres`:M=`${_(x,C.yd)} yd²`;return M}}catch(f){this.logger.warn("leaflet-draw-patch:readableArea",f)}try{const f=this.L,d=(s=f.Edit)==null?void 0:s.Circle,m=(r=f.Draw)==null?void 0:r.Event,_=f.GeometryUtil;if(!((h=d==null?void 0:d.prototype)!=null&&h._resize)||!m||!_)return;d.prototype._resize=function(b){var M,S,z;const E=this._moveMarker.getLatLng(),C=_.isVersion07x()?E.distanceTo(b):this._map.distance(E,b);this._shape.setRadius(C);try{(M=this._map)!=null&&M.editTooltip&&((z=(S=this._map)==null?void 0:S._editTooltip)!=null&&z.updateContent)&&this._map._editTooltip.updateContent({text:f.drawLocal.edit.handlers.edit.tooltip.subtext+"<br />"+f.drawLocal.edit.handlers.edit.tooltip.text,subtext:f.drawLocal.draw.handlers.circle.radius+": "+_.readableDistance(C,!0,this.options.feet,this.options.nautic)})}catch{}this._map.fire(m.EDITRESIZE,{layer:this._shape})}}catch(f){this.logger.warn("leaflet-draw-patch:circle-resize",f)}}getSnapTargets(){const n=[];for(const i of this.layerRegistry.getLayers())if(!(i.kind==="base"||i.kind==="measurement"))for(const s of i.featureIds){const r=this.featureLayers.get(s);if(!r||typeof r.toGeoJSON!="function")continue;const h=r.toGeoJSON();n.push({featureId:s,layerId:i.id,layerKind:i.kind,visible:i.visible,feature:h})}return n}findSnapResult(n,i){return!this.map||!this.snappingOptions||this.snappingOptions.enabled===!1||!n?null:lu({lat:Number(n.lat),lng:Number(n.lng)},this.getSnapTargets(),s=>{const r=this.map.latLngToContainerPoint([s.lat,s.lng]);return{x:r.x,y:r.y}},s=>{const r=this.map.containerPointToLatLng([s.x,s.y]);return{lat:r.lat,lng:r.lng}},this.snappingOptions,i)}eventLatLng(n){var r,h,f;if(n!=null&&n.latlng)return n.latlng;const i=n==null?void 0:n.originalEvent,s=(f=(r=i==null?void 0:i.touches)==null?void 0:r[0])!=null?f:(h=i==null?void 0:i.changedTouches)==null?void 0:h[0];if(s&&this.map)try{return this.map.mouseEventToLatLng(s)}catch{return null}return null}showSnapFeedback(n){if(!this.map||!this.snappingOptions||this.snappingOptions.enabled===!1)return;if(!n){this.snapFeedbackMarker&&this.map.removeLayer(this.snapFeedbackMarker),this.snapFeedbackMarker=null;const r=this.container.querySelector(".geokit-snap-feedback-label");r==null||r.remove();return}this.snapFeedbackMarker?this.snapFeedbackMarker.setLatLng([n.latlng.lat,n.latlng.lng]):this.snapFeedbackMarker=this.L.circleMarker([n.latlng.lat,n.latlng.lng],{radius:7,color:"#f59e0b",fillColor:"#fff7ed",fillOpacity:.85,weight:3,className:"geokit-snap-feedback",interactive:!1}).addTo(this.map);let i=this.container.querySelector(".geokit-snap-feedback-label");i||(i=document.createElement("div"),i.className="geokit-snap-feedback-label",i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),Object.assign(i.style,{position:"absolute",zIndex:"1000",pointerEvents:"none",padding:"3px 6px",borderRadius:"4px",background:"#fff7ed",color:"#7c2d12",border:"1px solid #f59e0b",font:"12px system-ui"}),this.container.appendChild(i)),i.textContent=`Snapped to ${n.mode}`;const s=this.map.latLngToContainerPoint([n.latlng.lat,n.latlng.lng]);i.style.left=`${s.x+10}px`,i.style.top=`${s.y+10}px`}geometryFeatureForHandler(n,i){var r,h,f,d,m,_,x,b;const s=(r=n==null?void 0:n._poly)!=null?r:n==null?void 0:n._shape;if(!s)return null;if((h=n==null?void 0:n._poly)!=null&&h.getLatLngs){const E=n._poly.getLatLngs(),C=Array.isArray(E==null?void 0:E[0])?E[0]:E,M=(Array.isArray(C)?C:[]).map(z=>[z.lng,z.lat]),S=i!=null?i:n._currentLatLng;if(S&&M.length&&(((f=M.at(-1))==null?void 0:f[0])!==S.lng||((d=M.at(-1))==null?void 0:d[1])!==S.lat)&&M.push([S.lng,S.lat]),n.type==="polygon"||s instanceof this.L.Polygon){if(M.length<3)return null;const z=M[0][0]===((m=M.at(-1))==null?void 0:m[0])&&M[0][1]===((_=M.at(-1))==null?void 0:_[1])?M:[...M,M[0]];return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[z]}}}return M.length<2?null:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:M}}}if((x=n==null?void 0:n._shape)!=null&&x.getLatLng&&((b=n==null?void 0:n._shape)!=null&&b.getRadius)){const E=n._shape.getLatLng(),C=n._shape.getRadius(),M=110574,S=M*Math.max(.1,Math.cos(E.lat*Math.PI/180)),z=Array.from({length:65},(Z,O)=>{const q=O/64*Math.PI*2;return[E.lng+Math.cos(q)*C/S,E.lat+Math.sin(q)*C/M]});return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[z]}}}return typeof s.toGeoJSON=="function"?s.toGeoJSON():null}renderMeasurement(n,i){var _,x,b,E,C;if(!((_=this.measurementOverlayOptions)!=null&&_.enabled)||!n)return;const s=Uh(n);if(!s.ok){this.logger.warn("measurement-overlay:failed",s.error);return}const r=qh(s.value,this.measurementSystem,{maximumFractionDigits:(x=this.measurementOverlayOptions.maximumFractionDigits)!=null?x:2,autoScale:(b=this.measurementOverlayOptions.autoScale)!=null?b:!0});if(!r.ok)return;const h=[],f=this.measurementOverlayOptions;if(f.showLength!==!1&&s.value.lengthMeters>0&&h.push(`Length: ${r.value.length.text}`),f.showPerimeter!==!1&&s.value.perimeterMeters>0&&h.push(`Perimeter: ${r.value.perimeter.text}`),f.showArea!==!1&&s.value.areaSquareMeters>0&&h.push(`Area: ${r.value.area.text}`),!h.length)return;let d=this.measurementOverlayElement;d||(d=document.createElement("div"),d.className="geokit-measurement-overlay",d.setAttribute("role","status"),d.setAttribute("aria-live","polite"),Object.assign(d.style,{position:"absolute",zIndex:"999",pointerEvents:"none",padding:"6px 8px",borderRadius:"5px",background:"rgba(255,255,255,.94)",color:"#1f2937",border:"1px solid #94a3b8",boxShadow:"0 1px 3px rgba(0,0,0,.18)",font:"12px/1.4 system-ui",whiteSpace:"pre-line"}),this.container.appendChild(d),this.measurementOverlayElement=d),d.textContent=h.join(`
|
|
492
|
-
`);const m=(C=i!=null?i:this.lastMeasurementLatLng)!=null?C:(E=this.map)==null?void 0:E.getCenter();if(m&&this.map){const M=this.map.latLngToContainerPoint(m);d.style.left=`${M.x+12}px`,d.style.top=`${M.y+12}px`}this.lastMeasurementFeature=n,this.lastMeasurementLatLng=i?this.L.latLng(i):this.lastMeasurementLatLng}refreshMeasurementOverlay(){var n;(n=this.measurementOverlayOptions)!=null&&n.enabled&&this.renderMeasurement(this.lastMeasurementFeature,this.lastMeasurementLatLng)}hideLiveOverlays(){var n;(n=this.measurementOverlayElement)==null||n.remove(),this.measurementOverlayElement=null,this.lastMeasurementFeature=null,this.lastMeasurementLatLng=null,this.showSnapFeedback(null)}installEditMarkerSnap(n,i,s){var d,m;if(!(n!=null&&n.on)||n._geokitSnapBound)return;n._geokitSnapBound=!0;const r=i._onMarkerDrag,h=i._onTouchMove;r&&((d=n.off)==null||d.call(n,"drag",r,i));const f=_=>{var E,C,M,S,z,Z;const x=(E=i._poly)==null?void 0:E._fid,b=this.findSnapResult((C=n.getLatLng)==null?void 0:C.call(n),x);this.showSnapFeedback(b),b&&n.setLatLng(b.latlng),r==null||r.call(i,{..._,target:n}),this.renderMeasurement((z=(S=(M=i._poly)==null?void 0:M.toGeoJSON)==null?void 0:S.call(M))!=null?z:null,(Z=n.getLatLng)==null?void 0:Z.call(n))};if(n.on("drag",f,i),h){(m=n.off)==null||m.call(n,"touchmove",h,i);const _=x=>{var C,M,S,z,Z,O,q,j;const b=(M=this.eventLatLng(x))!=null?M:(C=n.getLatLng)==null?void 0:C.call(n),E=this.findSnapResult(b,(S=i._poly)==null?void 0:S._fid);this.showSnapFeedback(E),E?(n.setLatLng(E.latlng),r==null||r.call(i,{...x,target:n})):(b&&((z=n.setLatLng)==null||z.call(n,b)),h?h.call(i,{...x,target:n}):r==null||r.call(i,{...x,target:n})),this.renderMeasurement((q=(O=(Z=i._poly)==null?void 0:Z.toGeoJSON)==null?void 0:O.call(Z))!=null?q:null,(j=n.getLatLng)==null?void 0:j.call(n))};n.on("touchmove",_,i),s.push(()=>{var x;return(x=n.off)==null?void 0:x.call(n,"touchmove",_,i)})}s.push(()=>{var _,x,b;(_=n.off)==null||_.call(n,"drag",f,i),n._geokitSnapBound=!1,r&&((x=n.on)==null||x.call(n,"drag",r,i)),h&&((b=n.on)==null||b.call(n,"touchmove",h,i))})}installEditHandlerSnap(n,i){const s=n==null?void 0:n._createMarker;if(typeof s!="function"||n._geokitSnapCreateMarker)return;const r=Object.prototype.hasOwnProperty.call(n,"_createMarker"),h=n._createMarker,f=this,d=function(..._){const x=s.apply(this,_);return f.installEditMarkerSnap(x,this,i),x};n._geokitSnapCreateMarker=!0,n._createMarker=d,i.push(()=>{n._createMarker===d&&(r?n._createMarker=h:delete n._createMarker),delete n._geokitSnapCreateMarker})}installInteractionIntegrations(){var E,C,M,S,z,Z,O;if((E=this.interactionCleanup)==null||E.call(this),this.interactionCleanup=null,this.hideLiveOverlays(),!this.map||!this.drawControl)return;const n=[],i=[],s=!!(((C=this.snappingOptions)==null?void 0:C.enabled)!==!1&&this.snappingOptions);let r=!0;const h=!!((M=this.measurementOverlayOptions)!=null&&M.enabled),f=()=>{var q;for(;i.length;)(q=i.pop())==null||q();this.showSnapFeedback(null)};if(s){const q=Object.values((O=(Z=(z=(S=this.drawControl)==null?void 0:S._toolbars)==null?void 0:z.draw)==null?void 0:Z._modes)!=null?O:{});for(const j of q){const X=j==null?void 0:j.handler;if(X)for(const et of["_onMouseMove","_onMouseDown","_onMouseUp","_onTouch"]){const ot=X[et];if(typeof ot!="function")continue;const I=N=>{var W,D,Y;const R=this.eventLatLng(N),F=this.findSnapResult(R);this.showSnapFeedback(F);const G=F?{...N,latlng:F.latlng}:N,H=ot.call(X,G);return F&&(X._currentLatLng=F.latlng,(W=X._mouseMarker)==null||W.setLatLng(F.latlng),typeof X._updateGuide=="function"&&X._updateGuide(this.map.latLngToLayerPoint(F.latlng)),(D=X._updateTooltip)==null||D.call(X,F.latlng)),this.renderMeasurement(this.geometryFeatureForHandler(X,F==null?void 0:F.latlng),(Y=F==null?void 0:F.latlng)!=null?Y:R),H};X[et]=I,n.push(()=>{X[et]===I&&(X[et]=ot)})}}}const d=q=>{var ot,I,N,R,F,G;const j=Object.values((R=(N=(I=(ot=this.drawControl)==null?void 0:ot._toolbars)==null?void 0:I.draw)==null?void 0:N._modes)!=null?R:{}).map(H=>H==null?void 0:H.handler).find(H=>H==null?void 0:H._enabled);if(!j)return;const X=this.eventLatLng(q),et=s?this.findSnapResult(X):null;s&&this.showSnapFeedback(et),this.renderMeasurement(this.geometryFeatureForHandler(j,(F=et==null?void 0:et.latlng)!=null?F:X),(G=et==null?void 0:et.latlng)!=null?G:X)};this.map.on("mousemove touchmove",d),n.push(()=>{var q;return(q=this.map)==null?void 0:q.off("mousemove touchmove",d)});const m=()=>{var q,j,X,et;if(h)for(const ot of(X=(j=(q=this.drawnItems)==null?void 0:q.getLayers)==null?void 0:j.call(q))!=null?X:[]){const I=ot,N=()=>{var R,F,G;return this.renderMeasurement((F=(R=I.toGeoJSON)==null?void 0:R.call(I))!=null?F:null,(G=I.getLatLng)==null?void 0:G.call(I))};(et=I.on)==null||et.call(I,"editdrag drag",N),i.push(()=>{var R;return(R=I.off)==null?void 0:R.call(I,"editdrag drag",N)})}s&&queueMicrotask(()=>{var ot,I,N,R,F;if(r)for(const G of(N=(I=(ot=this.drawnItems)==null?void 0:ot.getLayers)==null?void 0:I.call(ot))!=null?N:[]){const H=G.editing;for(const W of(R=H==null?void 0:H._verticesHandlers)!=null?R:[]){this.installEditHandlerSnap(W,i);for(const D of(F=W==null?void 0:W._markers)!=null?F:[])this.installEditMarkerSnap(D,W,i)}}})},_=q=>{var X,et,ot,I,N,R,F,G,H,W;const j=(N=(et=(X=q==null?void 0:q.poly)==null?void 0:X.toGeoJSON)==null?void 0:et.call(X))!=null?N:(I=(ot=q==null?void 0:q.layer)==null?void 0:ot.toGeoJSON)==null?void 0:I.call(ot);this.renderMeasurement(j,(W=(F=(R=q==null?void 0:q.marker)==null?void 0:R.getLatLng)==null?void 0:F.call(R))!=null?W:(H=(G=q==null?void 0:q.poly)==null?void 0:G.getCenter)==null?void 0:H.call(G))},x=()=>{f(),this.hideLiveOverlays()},b=()=>{this.hideLiveOverlays()};this.map.on("draw:editstart",m),this.map.on("draw:editvertex",_),this.map.on("draw:editstop",x),this.map.on("draw:drawstop",b),n.push(()=>{var q,j,X,et;r=!1,f(),(q=this.map)==null||q.off("draw:editstart",m),(j=this.map)==null||j.off("draw:editvertex",_),(X=this.map)==null||X.off("draw:editstop",x),(et=this.map)==null||et.off("draw:drawstop",b)}),this.interactionCleanup=()=>{var q;for(;n.length;)(q=n.pop())==null||q();f(),this.hideLiveOverlays()}}bindDrawEvents(){if(!this.map||!this.drawnItems)return;const n=i=>{const s=i==="cake"?"layerCake":i;return["polygon","polyline","rectangle","circle","marker","layerCake","move"].includes(String(s))?s:null};this.map.on("draw:drawstart",i=>{const s=n(i==null?void 0:i.layerType);s&&this.observePersistentToolStart(s,{source:"leaflet-toolbar"})}),this.map.on("draw:editstart",()=>{this.observePersistentToolStart("edit",{source:"leaflet-toolbar"})}),this.map.on("draw:deletestart",()=>{this.observePersistentToolStart("delete",{source:"leaflet-toolbar"})}),this.map.on("draw:canceled",i=>{var r;const s=n(i==null?void 0:i.layerType);s&&((r=this.activeToolCommand)==null?void 0:r.tool)===s&&this.cancelActiveTool("Cancelled with Escape")}),this.map.on("draw:drawstop",i=>{const s=n(i==null?void 0:i.layerType);s&&this.handlePersistentToolStop(s,"Draw interaction stopped")}),this.map.on("draw:editstop",()=>{this.handlePersistentToolStop("edit","Edit interaction stopped")}),this.map.on("draw:deletestop",()=>{this.handlePersistentToolStop("delete","Delete interaction stopped")}),this.toolEscapeKeyHandler||(this.toolEscapeKeyHandler=i=>{var r,h,f,d;if(i.type!=="keydown"||i.defaultPrevented||i.repeat)return;const s=i.target;if(!(s instanceof HTMLElement&&s.closest("input, textarea, select, [contenteditable], [role='dialog']"))){if(i.key==="Escape"&&this.activeToolCommand)i.preventDefault(),this.deactivateTool({source:"api"});else if((i.ctrlKey||i.metaKey)&&i.key==="Enter"){i.preventDefault();const m=(r=this.activeToolCommand)==null?void 0:r.tool;if(m==="edit"||m==="delete"){const _=this.findLeafletDrawHandler(m);(h=_==null?void 0:_.save)==null||h.call(_),(f=_==null?void 0:_.disable)==null||f.call(_)}else m==="move"?((d=this.activeMoveHandler)==null||d.confirmMove(),this.hideMoveConfirmationUI()):this.activateTool("save")}}},this.container.addEventListener("keydown",this.toolEscapeKeyHandler),this.container.addEventListener("keyup",this.toolEscapeKeyHandler)),this.map.on(this.L.Draw.Event.CREATED,i=>{var s,r,h,f,d;try{const{layer:m,layerType:_}=i;if(_===Go.TYPE){try{this.activeCakeSession&&this.emitCakeEvent("tool:layer-cake:cancelled"),(s=this.activeCakeSession)==null||s.destroy()}catch{}this.cakeSessionCommand=this.activeToolCommand,this.activeCakeSession=new Tf(this.map,m,S=>{var et;if(!this.drawnItems)return;const z=this.activeCakeSession.snapshot();S.features.forEach((ot,I)=>{ot.properties={...ot.properties,name:`${z.name} ${I===0?"core":`ring ${I}`}`}});const Z=this.store.add(S),O=this.layerRegistry.add(Z,{name:z.name,kind:"drawn",style:z.style}),q=this.L.geoJSON(S);let j=0;q.eachLayer(ot=>{var N,R,F;const I=(N=Z[j])!=null?N:Z[Z.length-1];ot._fid=I,this.featureLayers.set(I,ot),this.drawnItems.addLayer(ot),this.installVertexContextMenu(ot),(F=(R=this.options.callbacks)==null?void 0:R.onCreated)==null||F.call(R,{id:I,layerType:"polygon",geoJSON:ot.toGeoJSON()}),j++}),this.applyLayerRegistry();const X=((et=this.activeToolCommand)==null?void 0:et.tool)==="layerCake"?this.activeToolCommand:null;this.emitCakeEvent("tool:layer-cake:saved",{layerId:O,featureCollection:S,source:X==null?void 0:X.source,groupId:X==null?void 0:X.groupId,commandId:X==null?void 0:X.commandId}),this.activeCakeSession=null,this.cakeSessionCommand=null,X&&(this.completeActiveTool({featureIds:Z,geometry:S},!0),this.clearActiveTool(X))},this.measurementSystem,()=>this.emitCakeEvent("tool:layer-cake:session-changed"));const M=((r=this.activeToolCommand)==null?void 0:r.tool)==="layerCake"?this.activeToolCommand:null;this.emitCakeEvent("tool:layer-cake:session-started",{center:m.getLatLng(),radius:m.getRadius(),source:M==null?void 0:M.source,groupId:M==null?void 0:M.groupId,commandId:M==null?void 0:M.commandId});return}this.drawnItems.addLayer(m);const x=m.toGeoJSON(),E=this.store.add({type:"FeatureCollection",features:[x]})[0];m._fid=E,this.installVertexContextMenu(m),this.featureLayers.set(E,m),this.layerRegistry.add([E],{name:`${_} layer`,kind:"drawn"}),this.applyLayerRegistry(),(f=(h=this.options.callbacks)==null?void 0:h.onCreated)==null||f.call(h,{id:E,layerType:_,geoJSON:x});const C=om[_];C&&this.emitToolEvent(C,{id:E,geoJSON:x}),((d=this.activeToolCommand)==null?void 0:d.tool)===_&&this.completeActiveTool({featureIds:[E],geometry:x},!0)}catch(m){this.failActiveTool(m instanceof Error?m.message:"Draw completion failed"),this._error("onCreated handler failed",m)}}),this.map.on(this.L.Draw.Event.EDITED,i=>{var s,r,h;try{const f=[];i.layers.eachLayer(_=>{const x=_.toGeoJSON(),b=_._fid;if(b)this.store.update(b,x),f.push(b);else{const E=this.store.add({type:"FeatureCollection",features:[x]})[0];_._fid=E,f.push(E),this.featureLayers.set(E,_),this.layerRegistry.add([E],{kind:"drawn"})}});const m=this.store.toFeatureCollection();(r=(s=this.options.callbacks)==null?void 0:s.onEdited)==null||r.call(s,{ids:f,geoJSON:m}),this.emitToolEvent("tool:edit:applied",{ids:f,geoJSON:m}),((h=this.activeToolCommand)==null?void 0:h.tool)==="edit"&&this.completeActiveTool({featureIds:f,geometry:m},!0)}catch(f){this.failActiveTool(f instanceof Error?f.message:"Edit completion failed"),this._error("onEdited handler failed",f)}}),this.map.on(this.L.Draw.Event.DELETED,i=>{var s,r,h;try{const f=[];i.layers.eachLayer(_=>{const x=_._fid;x&&(f.push(x),this.store.remove(x),this.featureLayers.delete(x),this.layerRegistry.removeFeature(x))});const m=this.store.toFeatureCollection();(r=(s=this.options.callbacks)==null?void 0:s.onDeleted)==null||r.call(s,{ids:f,geoJSON:m}),this.emitToolEvent("tool:delete:applied",{ids:f,geoJSON:m}),this.applyLayerRegistry(),((h=this.activeToolCommand)==null?void 0:h.tool)==="delete"&&this.completeActiveTool({featureIds:f,geometry:m},!0)}catch(f){this.failActiveTool(f instanceof Error?f.message:"Delete completion failed"),this._error("onDeleted handler failed",f)}}),this.map.on("draw:moveend",i=>{var s;try{this.emitToolEvent("tool:move:pending",{layerId:(s=i==null?void 0:i.layer)==null?void 0:s._fid,originalGeoJSON:i==null?void 0:i.originalGeoJSON,newGeoJSON:i==null?void 0:i.newGeoJSON}),this.showMoveConfirmationUI(i.layer)}catch(r){this._error("draw:moveend handler failed",r)}}),this.map.on("draw:moveconfirmed",i=>{var s,r,h,f;try{this.emitToolEvent("tool:move:confirmed",{layerId:(s=i==null?void 0:i.layer)==null?void 0:s._fid,originalGeoJSON:i==null?void 0:i.originalGeoJSON,newGeoJSON:i==null?void 0:i.newGeoJSON});const d=i.layer,m=d._fid;if(m){const _=d.toGeoJSON();this.store.update(m,_),(h=(r=this.options.callbacks)==null?void 0:r.onEdited)==null||h.call(r,{ids:[m],geoJSON:this.store.toFeatureCollection()})}((f=this.activeToolCommand)==null?void 0:f.tool)==="move"&&this.completeActiveTool({featureIds:m?[m]:[],geometry:i==null?void 0:i.newGeoJSON},!1),this.hideMoveConfirmationUI()}catch(d){this.failActiveTool(d instanceof Error?d.message:"Move completion failed"),this._error("draw:moveconfirmed handler failed",d)}})}_error(n,i,s){var h,f,d,m;const r={code:(h=s==null?void 0:s.code)!=null?h:"controller_error",message:n,recoverable:(f=s==null?void 0:s.recoverable)!=null?f:!0,cause:i,timestamp:Date.now()};this.logger.error("error",r),(m=(d=this.options.callbacks)==null?void 0:d.onError)==null||m.call(d,r)}installVertexEditSurfaceMenu(){var r;if(!this.map)return;try{(r=this.vertexEditSurfaceCleanup)==null||r.call(this)}catch{}const n=this.map.getContainer(),i=h=>{this.openNearestEditableVertexMenuFromDomEvent(h)},s=h=>{(h.ctrlKey||h.metaKey)&&this.openNearestEditableVertexMenuFromDomEvent(h)};n.addEventListener("contextmenu",i,{capture:!0}),n.addEventListener("click",s,{capture:!0}),this.vertexEditSurfaceCleanup=()=>{n.removeEventListener("contextmenu",i,{capture:!0}),n.removeEventListener("click",s,{capture:!0})}}openNearestEditableVertexMenuFromDomEvent(n){try{if(!this.map||!this.drawnItems)return;const i=this.map.mouseEventToContainerPoint(n),s=this.map.containerPointToLatLng(i);let r=null;if(this.drawnItems.eachLayer(h=>{if(r)return;const f=h.editing;if(!(f&&typeof f.enabled=="function"&&f.enabled()))return;const m=this.findNearestVertex(h,s,16);m&&(r={layer:h,...m})}),!r)return;n.preventDefault(),n.stopPropagation(),this.showVertexMenu(i,async()=>{await this.deleteVertex(r.layer,r.pathIndex,r.vertexIndex)})}catch(i){this._error("openNearestEditableVertexMenuFromDomEvent",i)}}installVertexContextMenu(n){if(!n||typeof n.on!="function")return;const i=r=>{var h,f,d,m;try{(f=(h=r==null?void 0:r.originalEvent)==null?void 0:h.preventDefault)==null||f.call(h),(m=(d=r==null?void 0:r.originalEvent)==null?void 0:d.stopPropagation)==null||m.call(d)}catch{}this.openVertexMenu(n,r)},s=r=>{const h=r==null?void 0:r.originalEvent;h&&(h.ctrlKey||h.metaKey)&&this.openVertexMenu(n,r)};try{n.on("contextmenu",i),n.on("click",s)}catch{}}openVertexMenu(n,i){try{if(!this.map||!(typeof n.getLatLngs=="function"&&(n instanceof this.L.Polygon||n instanceof this.L.Polyline)))return;const r=n.editing;if(!r||typeof r.enabled!="function"||!r.enabled())return;const h=i==null?void 0:i.latlng,f=this.map.latLngToContainerPoint(h),d=this.findNearestVertex(n,h,12);if(!d)return;this.showVertexMenu(f,async()=>{await this.deleteVertex(n,d.pathIndex,d.vertexIndex)})}catch(s){this._error("openVertexMenu",s)}}showVertexMenu(n,i){var s;try{try{(s=this.vertexMenuCleanup)==null||s.call(this)}catch{}if(this.vertexMenuCleanup=null,!this.container)return;const r=document.createElement("div");r.style.position="absolute",r.style.top=`${n.y}px`,r.style.left=`${n.x}px`,r.style.transform="translate(-50%, -100%)",r.style.background="#fff",r.style.border="1px solid rgba(0,0,0,0.15)",r.style.borderRadius="6px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)",r.style.padding="6px",r.style.zIndex="10000",r.style.fontSize="12px",r.style.userSelect="none";const h=document.createElement("button");h.textContent="Delete vertex",h.style.padding="6px 10px",h.style.border="none",h.style.background="#da1e28",h.style.color="#fff",h.style.borderRadius="4px",h.style.cursor="pointer",h.addEventListener("click",m=>{m.stopPropagation(),m.preventDefault();try{i()}finally{f()}}),r.appendChild(h);const f=()=>{try{window.removeEventListener("pointerdown",d),this.container.removeEventListener("scroll",f,!0),r.remove()}catch{}this.vertexMenuEl=null,this.vertexMenuCleanup=null},d=m=>{!(typeof m.composedPath=="function"?m.composedPath():[]).includes(r)&&!r.contains(m.target)&&f()};window.addEventListener("pointerdown",d,{capture:!0}),this.container.addEventListener("scroll",f,!0),this.container.appendChild(r),this.vertexMenuEl=r,this.vertexMenuCleanup=f}catch(r){this._error("showVertexMenu",r)}}findNearestVertex(n,i,s){if(!this.map)return null;const r=E=>this.map.latLngToContainerPoint(E),h=(E,C)=>Math.hypot(E.x-C.x,E.y-C.y),f=r(i);let d=1/0,m=-1,_=-1;const x=n.getLatLngs();return(Array.isArray(x[0])?x:[x]).forEach((E,C)=>{E.forEach((M,S)=>{const z=r(M),Z=h(z,f);Z<d&&(d=Z,m=C,_=S)})}),m===-1||d>s?null:{pathIndex:m,vertexIndex:_}}async deleteVertex(n,i,s){var r,h,f;try{if(!(typeof n.getLatLngs=="function"&&(n instanceof this.L.Polygon||n instanceof this.L.Polyline)))return;const m=n.getLatLngs(),_=Array.isArray(m[0])?m:[m],x=_[i];if(!x)return;const E=n instanceof this.L.Polygon?3:2;if(x.length<=E)return;if(x.splice(s,1),_.length===1)n.setLatLngs(x);else{const M=_.map((S,z)=>z===i?x:S);n.setLatLngs(M)}(r=n.redraw)==null||r.call(n);const C=n._fid;if(C){const M=n.toGeoJSON();this.store.update(C,M),(f=(h=this.options.callbacks)==null?void 0:h.onEdited)==null||f.call(h,{ids:[C],geoJSON:this.store.toFeatureCollection()})}}catch(d){this._error("deleteVertex",d)}}showMoveConfirmationUI(n){var i,s;try{if(this.hideMoveConfirmationUI(),!this.container||!this.map)return;const r=this.drawControl;if(!r)return;const h=(i=r==null?void 0:r._toolbars)==null?void 0:i.draw;if(!h)return;const f=h._modes||{};let d=null;for(const C in f){const M=f[C];if(((s=M==null?void 0:M.handler)==null?void 0:s.type)==="move"){d=M.handler;break}}this.activeMoveHandler=d;const m=document.createElement("div");m.dataset.geokitMoveConfirmation="",this.L.DomEvent.disableClickPropagation(m),this.L.DomEvent.disableScrollPropagation(m),m.style.position="absolute";const _=this.container.getBoundingClientRect();let x=60;this.container.querySelectorAll("[data-geokit-managed-toolbar]").forEach(C=>{var S;const M=C.getBoundingClientRect();M.width&&M.height&&((S=C.dataset.geokitToolbarPosition)!=null&&S.startsWith("bottom"))&&(x=Math.max(x,_.bottom-M.top+8))}),m.style.bottom=`${x}px`,m.style.maxWidth="calc(100% - 32px)",m.style.boxSizing="border-box",m.style.left="50%",m.style.transform="translateX(-50%)",m.style.display="flex",m.style.gap="8px",m.style.background="#fff",m.style.border="2px solid #3388ff",m.style.borderRadius="8px",m.style.padding="12px 16px",m.style.boxShadow="0 4px 12px rgba(0,0,0,0.2)",m.style.zIndex="10000",m.style.fontSize="14px",m.style.fontFamily="system-ui, sans-serif";const b=document.createElement("button");b.textContent="✓ Save",b.style.minHeight="44px",b.style.minWidth="44px",b.style.whiteSpace="nowrap",b.style.padding="8px 16px",b.style.border="none",b.style.background="#28a745",b.style.color="#fff",b.style.borderRadius="4px",b.style.cursor="pointer",b.style.fontWeight="600",b.style.fontSize="14px",b.addEventListener("click",C=>{C.stopPropagation(),C.preventDefault(),d!=null&&d.confirmMove&&d.confirmMove()});const E=document.createElement("button");E.textContent="✕ Cancel",E.style.minHeight="44px",E.style.minWidth="44px",E.style.whiteSpace="nowrap",E.style.padding="8px 16px",E.style.border="1px solid #ccc",E.style.background="#fff",E.style.color="#333",E.style.borderRadius="4px",E.style.cursor="pointer",E.style.fontWeight="600",E.style.fontSize="14px",E.addEventListener("click",C=>{C.stopPropagation(),C.preventDefault(),this.emitToolEvent("tool:move:cancelled",{layerId:n==null?void 0:n._fid}),d!=null&&d.cancelMove&&d.cancelMove(),this.hideMoveConfirmationUI()}),m.appendChild(b),m.appendChild(E),this.container.appendChild(m),this.moveConfirmationUI=m,this.logger.debug("showMoveConfirmationUI",{layerId:n._fid})}catch(r){this._error("showMoveConfirmationUI",r)}}hideMoveConfirmationUI(){try{this.moveConfirmationUI&&(this.moveConfirmationUI.remove(),this.moveConfirmationUI=null),this.activeMoveHandler=null}catch(n){this._error("hideMoveConfirmationUI",n)}}}const Hh=[25,41],Yh=[12,41],Vh=[1,-34];function ir(a,n){var s,r,h,f;if(a==null)return null;const i=typeof a=="string"?a.trim():"";if(!i)return(s=n.reportError)==null||s.call(n,n.errorMessage,n.cause),null;try{return new URL(i,(r=n.baseUrl)!=null?r:document.baseURI).toString()}catch(d){return(f=n.reportError)==null||f.call(n,n.errorMessage,(h=n.cause)!=null?h:d),null}}function rl(a,n,i){var m,_;if(a==null)return[...n];if(!Array.isArray(a)||a.length!==2)return(m=i.reportError)==null||m.call(i,i.errorMessage,i.cause),[...n];const[s,r]=a,h=Number(s),f=Number(r);return Number.isFinite(h)&&Number.isFinite(f)&&(!i.positiveOnly||h>0&&f>0)?[h,f]:((_=i.reportError)==null||_.call(i,i.errorMessage,i.cause),[...n])}function ol(a,n,i){var m,_,x,b,E;if(a==null)return[...n];const s=typeof a=="string"?a.trim():"";if(!s)return(m=i.reportError)==null||m.call(i,i.errorMessage,i.cause),[...n];const r=s.split(",");if(r.length!==2)return(_=i.reportError)==null||_.call(i,i.errorMessage,i.cause),[...n];const h=Number((x=r[0])==null?void 0:x.trim()),f=Number((b=r[1])==null?void 0:b.trim());return Number.isFinite(h)&&Number.isFinite(f)&&(!i.positiveOnly||h>0&&f>0)?[h,f]:((E=i.reportError)==null||E.call(i,i.errorMessage,i.cause),[...n])}function am(a,n={}){var h,f;if(!a||typeof a!="object")return null;const i=ir(a.iconUrl,{...n,errorMessage:"Invalid marker icon config: iconUrl must be a valid URL",cause:{field:"iconUrl",value:a.iconUrl}});if(!i)return null;const s=(h=ir(a.iconRetinaUrl,{...n,errorMessage:"Invalid marker icon config: iconRetinaUrl must be a valid URL",cause:{field:"iconRetinaUrl",value:a.iconRetinaUrl}}))!=null?h:i,r=(f=ir(a.shadowUrl,{...n,errorMessage:"Invalid marker icon config: shadowUrl must be a valid URL",cause:{field:"shadowUrl",value:a.shadowUrl}}))!=null?f:void 0;return{iconUrl:i,iconRetinaUrl:s,shadowUrl:r,iconSize:rl(a.iconSize,Hh,{...n,positiveOnly:!0,errorMessage:"Invalid marker icon config: iconSize must be a [width, height] tuple of positive finite numbers",cause:{field:"iconSize",value:a.iconSize}}),iconAnchor:rl(a.iconAnchor,Yh,{...n,errorMessage:"Invalid marker icon config: iconAnchor must be a [x, y] tuple of finite numbers",cause:{field:"iconAnchor",value:a.iconAnchor}}),popupAnchor:rl(a.popupAnchor,Vh,{...n,errorMessage:"Invalid marker icon config: popupAnchor must be a [x, y] tuple of finite numbers",cause:{field:"popupAnchor",value:a.popupAnchor}})}}function lm(a,n={}){var h,f;const i=ir(a.iconUrl,{...n,errorMessage:'Invalid "marker-icon-url" attribute; falling back to default markers',cause:{attribute:"marker-icon-url",value:a.iconUrl}});if(!i)return null;const s=(h=ir(a.iconRetinaUrl,{...n,errorMessage:'Invalid "marker-icon-retina-url" attribute; using "marker-icon-url" instead',cause:{attribute:"marker-icon-retina-url",value:a.iconRetinaUrl}}))!=null?h:i,r=(f=ir(a.shadowUrl,{...n,errorMessage:'Invalid "marker-shadow-url" attribute; dropping the custom marker shadow',cause:{attribute:"marker-shadow-url",value:a.shadowUrl}}))!=null?f:void 0;return{iconUrl:i,iconRetinaUrl:s,shadowUrl:r,iconSize:ol(a.iconSize,Hh,{...n,positiveOnly:!0,errorMessage:'Invalid "marker-icon-size" attribute; using the default marker size',cause:{attribute:"marker-icon-size",value:a.iconSize}}),iconAnchor:ol(a.iconAnchor,Yh,{...n,errorMessage:'Invalid "marker-icon-anchor" attribute; using the default marker anchor',cause:{attribute:"marker-icon-anchor",value:a.iconAnchor}}),popupAnchor:ol(a.popupAnchor,Vh,{...n,errorMessage:'Invalid "marker-popup-anchor" attribute; using the default popup anchor',cause:{attribute:"marker-popup-anchor",value:a.popupAnchor}})}}class sl extends HTMLElement{constructor(){super();Q(this,"_root");Q(this,"_container");Q(this,"_logger",Ro("component:leaflet-geokit","debug"));Q(this,"_latitude",0);Q(this,"_longitude",0);Q(this,"_zoom",2);Q(this,"_minZoom");Q(this,"_maxZoom");Q(this,"_tileUrl","https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");Q(this,"_tileAttribution");Q(this,"_tileProvider");Q(this,"_tileStyle");Q(this,"_apiKey");Q(this,"_activeTileProvider","tile-url");Q(this,"_readOnly",!1);Q(this,"_logLevel","debug");Q(this,"_devOverlay",!1);Q(this,"_polygonAllowIntersection",!1);Q(this,"_preferCanvas",!0);Q(this,"_themeUrl");Q(this,"_themeCss","");Q(this,"_themeLinkEl",null);Q(this,"_themeStyleEl",null);Q(this,"_controller",null);Q(this,"_useExternalLeaflet",!1);Q(this,"_skipLeafletStyles",!1);Q(this,"_leafletInstance");Q(this,"_toolHooks");Q(this,"_toolEventEmitter");Q(this,"_markerIconConfig");Q(this,"_toolButtonConfig");Q(this,"_toolbarGroups");Q(this,"_snapping");Q(this,"_measurementOverlay");Q(this,"_internalToolEvents",new WeakSet);Q(this,"_toolCommandSequence",0);Q(this,"_activeTool",null);Q(this,"_providerCapabilityError",null);Q(this,"_lastCapabilities","");Q(this,"_configurationUpdate",Promise.resolve());Q(this,"_status",{state:"uninitialized",ready:!1,busy:!1,featureCount:0,timestamp:Date.now()});Q(this,"_externalToolTriggerListener",i=>{var r,h;const s=i.detail;if((s==null?void 0:s.action)==="deactivate"||(s==null?void 0:s.active)===!1){this.deactivateTool({source:(r=s.source)!=null?r:"event",groupId:s.groupId,commandId:s.commandId});return}s!=null&&s.tool&&this.activateTool(s.tool,{source:(h=s.source)!=null?h:"event",groupId:s.groupId,commandId:s.commandId})});Q(this,"_externalToolDeactivateListener",i=>{var r;const s=i.detail;this.deactivateTool({source:(r=s==null?void 0:s.source)!=null?r:"event",groupId:s==null?void 0:s.groupId,commandId:s==null?void 0:s.commandId})});Q(this,"_externalToolCommandListener",i=>{var d,m;if(this._internalToolEvents.has(i))return;const s=i.detail;if(!(s!=null&&s.tool))return;const r=(d=s.source)!=null?d:"event",h=((m=s.commandId)==null?void 0:m.trim())||this._nextToolCommandId(),f=s.action==="deactivate"||s.tool==="select"?"deactivate":"activate";s.tool=f==="deactivate"?"select":s.tool,Object.assign(s,{tool:s.tool,action:f,source:r,groupId:s.groupId,commandId:h,previousTool:this._activeTool,activeTool:this._activeTool,featureIds:[],timestamp:Date.now()}),queueMicrotask(()=>{this._emitToolTriggerRequested(f==="deactivate"?"select":s.tool,{source:r,groupId:s.groupId,commandId:h});const _=this._controller;if(typeof(_==null?void 0:_.handleToolCommand)=="function"){_.handleToolCommand(s);return}const x=f==="deactivate"?"select":s.tool;this._emitStandaloneToolFailure(x,f,{source:r,groupId:s.groupId,commandId:h},"Map controller is not initialized",!1)})});this._root=this.attachShadow({mode:"open"}),this._root.innerHTML=`
|
|
488
|
+
`)}return u.toString()}},{key:"computeEdgeEndLabels",value:function(u){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(u)}},{key:"computeLabelling",value:function(u){this.computeEdgeEndLabels(u[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],e=this.iterator();e.hasNext();)for(var l=e.next().getLabel(),g=0;g<2;g++)l.isLine(g)&&l.getLocation(g)===Z.BOUNDARY&&(t[g]=!0);for(var y=this.iterator();y.hasNext();)for(var w=y.next(),T=w.getLabel(),M=0;M<2;M++)if(T.isAnyNull(M)){var z=Z.NONE;if(t[M])z=Z.EXTERIOR;else{var K=w.getCoordinate();z=this.getLocation(M,K,u)}T.setAllLocationsIfNull(M,z)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(u,t){this._edgeMap.put(u,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new re,this._edgeList=null,this._ptInAreaLocation=[Z.NONE,Z.NONE]}}])})(),Ye=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var e=null,l=null,g=this._SCANNING_FOR_INCOMING,y=0;y<this._resultAreaEdgeList.size();y++){var w=this._resultAreaEdgeList.get(y),T=w.getSym();if(w.getLabel().isArea())switch(e===null&&w.isInResult()&&(e=w),g){case this._SCANNING_FOR_INCOMING:if(!T.isInResult())continue;l=T,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!w.isInResult())continue;l.setNext(w),g=this._SCANNING_FOR_INCOMING}}if(g===this._LINKING_TO_OUTGOING){if(e===null)throw new ti("no outgoing dirEdge found",this.getCoordinate());dt.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),l.setNext(e)}}},{key:"insert",value:function(e){var l=e;this.insertEdgeEnd(l,l)}},{key:"getRightmostEdge",value:function(){var e=this.getEdges(),l=e.size();if(l<1)return null;var g=e.get(0);if(l===1)return g;var y=e.get(l-1),w=g.getQuadrant(),T=y.getQuadrant();return ye.isNorthern(w)&&ye.isNorthern(T)?g:ye.isNorthern(w)||ye.isNorthern(T)?g.getDy()!==0?g:y.getDy()!==0?y:(dt.shouldNeverReachHere("found two horizontal edges incident on node"),null):y}},{key:"print",value:function(e){Be.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var l=this.iterator();l.hasNext();){var g=l.next();e.print("out "),g.print(e),e.println(),e.print("in "),g.getSym().print(e),e.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Lt;for(var e=this.iterator();e.hasNext();){var l=e.next();(l.isInResult()||l.getSym().isInResult())&&this._resultAreaEdgeList.add(l)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(e){for(var l=this.iterator();l.hasNext();){var g=l.next().getLabel();g.setAllLocationsIfNull(0,e.getLocation(0)),g.setAllLocationsIfNull(1,e.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var e=null,l=null,g=this._edgeList.size()-1;g>=0;g--){var y=this._edgeList.get(g),w=y.getSym();l===null&&(l=w),e!==null&&w.setNext(e),e=y}l.setNext(e)}},{key:"computeDepths",value:function(){if(arguments.length===1){var e=arguments[0],l=this.findIndex(e),g=e.getDepth(ct.LEFT),y=e.getDepth(ct.RIGHT),w=this.computeDepths(l+1,this._edgeList.size(),g);if(this.computeDepths(0,l,w)!==y)throw new ti("depth mismatch at "+e.getCoordinate())}else if(arguments.length===3){for(var T=arguments[1],M=arguments[2],z=arguments[0];z<T;z++){var K=this._edgeList.get(z);K.setEdgeDepths(ct.RIGHT,M),M=K.getDepth(ct.LEFT)}return M}}},{key:"mergeSymLabels",value:function(){for(var e=this.iterator();e.hasNext();){var l=e.next();l.getLabel().merge(l.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(e){for(var l=null,g=null,y=this._SCANNING_FOR_INCOMING,w=this._resultAreaEdgeList.size()-1;w>=0;w--){var T=this._resultAreaEdgeList.get(w),M=T.getSym();switch(l===null&&T.getEdgeRing()===e&&(l=T),y){case this._SCANNING_FOR_INCOMING:if(M.getEdgeRing()!==e)continue;g=M,y=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(T.getEdgeRing()!==e)continue;g.setNextMin(T),y=this._SCANNING_FOR_INCOMING}}y===this._LINKING_TO_OUTGOING&&(dt.isTrue(l!==null,"found null for first outgoing dirEdge"),dt.isTrue(l.getEdgeRing()===e,"unable to link last incoming dirEdge"),g.setNextMin(l))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var e=0,l=this.iterator();l.hasNext();)l.next().isInResult()&&e++;return e}if(arguments.length===1){for(var g=arguments[0],y=0,w=this.iterator();w.hasNext();)w.next().getEdgeRing()===g&&y++;return y}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var e=Z.NONE,l=this.iterator();l.hasNext();){var g=l.next(),y=g.getSym();if(!g.isLineEdge()){if(g.isInResult()){e=Z.INTERIOR;break}if(y.isInResult()){e=Z.EXTERIOR;break}}}if(e===Z.NONE)return null;for(var w=e,T=this.iterator();T.hasNext();){var M=T.next(),z=M.getSym();M.isLineEdge()?M.getEdge().setCovered(w===Z.INTERIOR):(M.isInResult()&&(w=Z.EXTERIOR),z.isInResult()&&(w=Z.INTERIOR))}}},{key:"computeLabelling",value:function(e){S(t,"computeLabelling",this,1).call(this,e),this._label=new Ie(Z.NONE);for(var l=this.iterator();l.hasNext();)for(var g=l.next().getEdge().getLabel(),y=0;y<2;y++){var w=g.getLocation(y);w!==Z.INTERIOR&&w!==Z.BOUNDARY||this._label.setLocation(y,Z.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})(bl),cn=(function(u){function t(){return r(this,t),s(this,t)}return b(t,u),d(t,[{key:"createNode",value:function(e){return new Sn(e,new Ye)}}])})(bo),zs=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"compareTo",value:function(t){var e=t;return u.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=u.orientation(t)}},{key:"orientation",value:function(t){return se.increasingDirection(t)===1}},{key:"compareOriented",value:function(t,e,l,g){for(var y=e?1:-1,w=g?1:-1,T=e?t.length:-1,M=g?l.length:-1,z=e?0:t.length-1,K=g?0:l.length-1;;){var it=t[z].compareTo(l[K]);if(it!==0)return it;var lt=(z+=y)===T,gt=(K+=w)===M;if(lt&&!gt)return-1;if(!lt&>)return 1;if(lt&>)return 0}}}])})(),yi=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var e=this._edges.get(t);t>0&&u.print(","),u.print("(");for(var l=e.getCoordinates(),g=0;g<l.length;g++)g>0&&u.print(","),u.print(l[g].x+" "+l[g].y);u.println(")")}u.print(") ")}},{key:"addAll",value:function(u){for(var t=u.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(u){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(u))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(u){return this._edges.get(u)}},{key:"findEqualEdge",value:function(u){var t=new zs(u.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(u){this._edges.add(u);var t=new zs(u.getCoordinates());this._ocaMap.put(t,u)}}],[{key:"constructor_",value:function(){this._edges=new Lt,this._ocaMap=new re}}])})(),Fs=(function(){return d((function u(){r(this,u)}),[{key:"processIntersections",value:function(u,t,e,l){}},{key:"isDone",value:function(){}}])})(),fn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isTrivialIntersection",value:function(t,e,l,g){if(t===l&&this._li.getIntersectionNum()===1){if(u.isAdjacentSegments(e,g))return!0;if(t.isClosed()){var y=t.size()-1;if(e===0&&g===y||g===0&&e===y)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(t,e,l,g){if(t===l&&e===g)return null;this.numTests++;var y=t.getCoordinates()[e],w=t.getCoordinates()[e+1],T=l.getCoordinates()[g],M=l.getCoordinates()[g+1];this._li.computeIntersection(y,w,T,M),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,l,g)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),l.addIntersections(this._li,g,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[Fs]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t}},{key:"isAdjacentSegments",value:function(t,e){return Math.abs(t-e)===1}}])})(),xl=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(u){u.print(this.coord),u.print(" seg # = "+this.segmentIndex),u.println(" dist = "+this.dist)}},{key:"compareTo",value:function(u){var t=u;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(u){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===u}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(u,t){return this.segmentIndex<u?-1:this.segmentIndex>u?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[ot]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var u=arguments[0],t=arguments[1],e=arguments[2];this.coord=new tt(u),this.segmentIndex=t,this.dist=e}}])})(),On=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"print",value:function(u){u.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(u)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(u){this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var l=t.next(),g=this.createSplitEdge(e,l);u.add(g),e=l}}},{key:"addEndpoints",value:function(){var u=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[u],u,0)}},{key:"createSplitEdge",value:function(u,t){var e=t.segmentIndex-u.segmentIndex+2,l=this.edge.pts[t.segmentIndex],g=t.dist>0||!t.coord.equals2D(l);g||e--;var y=new Array(e).fill(null),w=0;y[w++]=new tt(u.coord);for(var T=u.segmentIndex+1;T<=t.segmentIndex;T++)y[w++]=this.edge.pts[T];return g&&(y[w]=t.coord),new Us(y,new Ie(this.edge._label))}},{key:"add",value:function(u,t,e){var l=new xl(u,t,e),g=this._nodeMap.get(l);return g!==null?g:(this._nodeMap.put(l,l),l)}},{key:"isIntersection",value:function(u){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(u))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new re,this.edge=null;var u=arguments[0];this.edge=u}}])})(),Gs=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])||u.isTrue(this._matrix[Z.INTERIOR][Z.BOUNDARY])||u.isTrue(this._matrix[Z.BOUNDARY][Z.INTERIOR])||u.isTrue(this._matrix[Z.BOUNDARY][Z.BOUNDARY]))&&this._matrix[Z.EXTERIOR][Z.INTERIOR]===ft.FALSE&&this._matrix[Z.EXTERIOR][Z.BOUNDARY]===ft.FALSE}},{key:"isCoveredBy",value:function(){return(u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])||u.isTrue(this._matrix[Z.INTERIOR][Z.BOUNDARY])||u.isTrue(this._matrix[Z.BOUNDARY][Z.INTERIOR])||u.isTrue(this._matrix[Z.BOUNDARY][Z.BOUNDARY]))&&this._matrix[Z.INTERIOR][Z.EXTERIOR]===ft.FALSE&&this._matrix[Z.BOUNDARY][Z.EXTERIOR]===ft.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var l=Math.trunc(e/3),g=e%3;this._matrix[l][g]=ft.toDimensionValue(t.charAt(e))}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this._matrix[y][w]=T}}},{key:"isContains",value:function(){return u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])&&this._matrix[Z.EXTERIOR][Z.INTERIOR]===ft.FALSE&&this._matrix[Z.EXTERIOR][Z.BOUNDARY]===ft.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var l=Math.trunc(e/3),g=e%3;this.setAtLeast(l,g,ft.toDimensionValue(t.charAt(e)))}else if(arguments.length===3){var y=arguments[0],w=arguments[1],T=arguments[2];this._matrix[y][w]<T&&(this._matrix[y][w]=T)}}},{key:"setAtLeastIfValid",value:function(t,e,l){t>=0&&e>=0&&this.setAtLeast(t,e,l)}},{key:"isWithin",value:function(){return u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])&&this._matrix[Z.INTERIOR][Z.EXTERIOR]===ft.FALSE&&this._matrix[Z.BOUNDARY][Z.EXTERIOR]===ft.FALSE}},{key:"isTouches",value:function(t,e){return t>e?this.isTouches(e,t):(t===ft.A&&e===ft.A||t===ft.L&&e===ft.L||t===ft.L&&e===ft.A||t===ft.P&&e===ft.A||t===ft.P&&e===ft.L)&&this._matrix[Z.INTERIOR][Z.INTERIOR]===ft.FALSE&&(u.isTrue(this._matrix[Z.INTERIOR][Z.BOUNDARY])||u.isTrue(this._matrix[Z.BOUNDARY][Z.INTERIOR])||u.isTrue(this._matrix[Z.BOUNDARY][Z.BOUNDARY]))}},{key:"isOverlaps",value:function(t,e){return t===ft.P&&e===ft.P||t===ft.A&&e===ft.A?u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])&&u.isTrue(this._matrix[Z.INTERIOR][Z.EXTERIOR])&&u.isTrue(this._matrix[Z.EXTERIOR][Z.INTERIOR]):t===ft.L&&e===ft.L&&this._matrix[Z.INTERIOR][Z.INTERIOR]===1&&u.isTrue(this._matrix[Z.INTERIOR][Z.EXTERIOR])&&u.isTrue(this._matrix[Z.EXTERIOR][Z.INTERIOR])}},{key:"isEquals",value:function(t,e){return t===e&&u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])&&this._matrix[Z.INTERIOR][Z.EXTERIOR]===ft.FALSE&&this._matrix[Z.BOUNDARY][Z.EXTERIOR]===ft.FALSE&&this._matrix[Z.EXTERIOR][Z.INTERIOR]===ft.FALSE&&this._matrix[Z.EXTERIOR][Z.BOUNDARY]===ft.FALSE}},{key:"toString",value:function(){for(var t=new cr("123456789"),e=0;e<3;e++)for(var l=0;l<3;l++)t.setCharAt(3*e+l,ft.toDimensionSymbol(this._matrix[e][l]));return t.toString()}},{key:"setAll",value:function(t){for(var e=0;e<3;e++)for(var l=0;l<3;l++)this._matrix[e][l]=t}},{key:"get",value:function(t,e){return this._matrix[t][e]}},{key:"transpose",value:function(){var t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}},{key:"matches",value:function(t){if(t.length!==9)throw new X("Should be length 9: "+t);for(var e=0;e<3;e++)for(var l=0;l<3;l++)if(!u.matches(this._matrix[e][l],t.charAt(3*e+l)))return!1;return!0}},{key:"add",value:function(t){for(var e=0;e<3;e++)for(var l=0;l<3;l++)this.setAtLeast(e,l,t.get(e,l))}},{key:"isDisjoint",value:function(){return this._matrix[Z.INTERIOR][Z.INTERIOR]===ft.FALSE&&this._matrix[Z.INTERIOR][Z.BOUNDARY]===ft.FALSE&&this._matrix[Z.BOUNDARY][Z.INTERIOR]===ft.FALSE&&this._matrix[Z.BOUNDARY][Z.BOUNDARY]===ft.FALSE}},{key:"isCrosses",value:function(t,e){return t===ft.P&&e===ft.L||t===ft.P&&e===ft.A||t===ft.L&&e===ft.A?u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])&&u.isTrue(this._matrix[Z.INTERIOR][Z.EXTERIOR]):t===ft.L&&e===ft.P||t===ft.A&&e===ft.P||t===ft.A&&e===ft.L?u.isTrue(this._matrix[Z.INTERIOR][Z.INTERIOR])&&u.isTrue(this._matrix[Z.EXTERIOR][Z.INTERIOR]):t===ft.L&&e===ft.L&&this._matrix[Z.INTERIOR][Z.INTERIOR]===0}},{key:"interfaces_",get:function(){return[I]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(ft.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var t=arguments[0];u.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof u){var e=arguments[0];u.constructor_.call(this),this._matrix[Z.INTERIOR][Z.INTERIOR]=e._matrix[Z.INTERIOR][Z.INTERIOR],this._matrix[Z.INTERIOR][Z.BOUNDARY]=e._matrix[Z.INTERIOR][Z.BOUNDARY],this._matrix[Z.INTERIOR][Z.EXTERIOR]=e._matrix[Z.INTERIOR][Z.EXTERIOR],this._matrix[Z.BOUNDARY][Z.INTERIOR]=e._matrix[Z.BOUNDARY][Z.INTERIOR],this._matrix[Z.BOUNDARY][Z.BOUNDARY]=e._matrix[Z.BOUNDARY][Z.BOUNDARY],this._matrix[Z.BOUNDARY][Z.EXTERIOR]=e._matrix[Z.BOUNDARY][Z.EXTERIOR],this._matrix[Z.EXTERIOR][Z.INTERIOR]=e._matrix[Z.EXTERIOR][Z.INTERIOR],this._matrix[Z.EXTERIOR][Z.BOUNDARY]=e._matrix[Z.EXTERIOR][Z.BOUNDARY],this._matrix[Z.EXTERIOR][Z.EXTERIOR]=e._matrix[Z.EXTERIOR][Z.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var t=arguments[0],e=arguments[1];return e===ft.SYM_DONTCARE||e===ft.SYM_TRUE&&(t>=0||t===ft.TRUE)||e===ft.SYM_FALSE&&t===ft.FALSE||e===ft.SYM_P&&t===ft.P||e===ft.SYM_L&&t===ft.L||e===ft.SYM_A&&t===ft.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var l=arguments[1];return new u(arguments[0]).matches(l)}}},{key:"isTrue",value:function(t){return t>=0||t===ft.TRUE}}])})(),wr=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return t===null||t.length===0?null:(this.ensureCapacity(this._size+t.length),Be.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}},{key:"ensureCapacity",value:function(t){if(t<=this._data.length)return null;var e=Math.max(t,2*this._data.length);this._data=pe.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=new Array(this._size).fill(null);return Be.arraycopy(this._data,0,t,0,this._size),t}},{key:"add",value:function(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)u.constructor_.call(this,10);else if(arguments.length===1){var t=arguments[0];this._data=new Array(t).fill(null)}}}])})(),wl=(function(){function u(){r(this,u)}return d(u,[{key:"getChainStartIndices",value:function(t){var e=0,l=new wr(Math.trunc(t.length/2));l.add(e);do{var g=this.findChainEnd(t,e);l.add(g),e=g}while(e<t.length-1);return l.toArray()}},{key:"findChainEnd",value:function(t,e){for(var l=ye.quadrant(t[e],t[e+1]),g=e+1;g<t.length&&ye.quadrant(t[g-1],t[g])===l;)g++;return g-1}},{key:"OLDgetChainStartIndices",value:function(t){var e=0,l=new Lt;l.add(e);do{var g=this.findChainEnd(t,e);l.add(g),e=g}while(e<t.length-1);return u.toIntArray(l)}}],[{key:"toIntArray",value:function(t){for(var e=new Array(t.size()).fill(null),l=0;l<e.length;l++)e[l]=t.get(l).intValue();return e}}])})(),Si=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(u){var t=this.pts[this.startIndex[u]].x,e=this.pts[this.startIndex[u+1]].x;return t>e?t:e}},{key:"getMinX",value:function(u){var t=this.pts[this.startIndex[u]].x,e=this.pts[this.startIndex[u+1]].x;return t<e?t:e}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var u=arguments[0],t=arguments[1],e=arguments[2],l=arguments[3];this.computeIntersectsForChain(this.startIndex[u],this.startIndex[u+1],t,t.startIndex[e],t.startIndex[e+1],l)}else if(arguments.length===6){var g=arguments[0],y=arguments[1],w=arguments[2],T=arguments[3],M=arguments[4],z=arguments[5];if(y-g==1&&M-T==1)return z.addIntersections(this.e,g,w.e,T),null;if(!this.overlaps(g,y,w,T,M))return null;var K=Math.trunc((g+y)/2),it=Math.trunc((T+M)/2);g<K&&(T<it&&this.computeIntersectsForChain(g,K,w,T,it,z),it<M&&this.computeIntersectsForChain(g,K,w,it,M,z)),K<y&&(T<it&&this.computeIntersectsForChain(K,y,w,T,it,z),it<M&&this.computeIntersectsForChain(K,y,w,it,M,z))}}},{key:"overlaps",value:function(u,t,e,l,g){return qt.intersects(this.pts[u],this.pts[t],e.pts[l],e.pts[g])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(u,t){for(var e=0;e<this.startIndex.length-1;e++)for(var l=0;l<u.startIndex.length-1;l++)this.computeIntersectsForChain(e,u,l,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var u=arguments[0];this.e=u,this.pts=u.getCoordinates();var t=new wl;this.startIndex=t.getChainStartIndices(this.pts)}}])})(),Rn=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"getDepth",value:function(t,e){return this._depth[t][e]}},{key:"setDepth",value:function(t,e,l){this._depth[t][e]=l}},{key:"isNull",value:function(){if(arguments.length===0){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==u.NULL_VALUE)return!1;return!0}if(arguments.length===1){var l=arguments[0];return this._depth[l][1]===u.NULL_VALUE}if(arguments.length===2){var g=arguments[0],y=arguments[1];return this._depth[g][y]===u.NULL_VALUE}}},{key:"normalize",value:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var l=1;l<3;l++){var g=0;this._depth[t][l]>e&&(g=1),this._depth[t][l]=g}}}},{key:"getDelta",value:function(t){return this._depth[t][ct.RIGHT]-this._depth[t][ct.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?Z.EXTERIOR:Z.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<2;e++)for(var l=1;l<3;l++){var g=t.getLocation(e,l);g!==Z.EXTERIOR&&g!==Z.INTERIOR||(this.isNull(e,l)?this._depth[e][l]=u.depthAtLocation(g):this._depth[e][l]+=u.depthAtLocation(g))}else if(arguments.length===3){var y=arguments[0],w=arguments[1];arguments[2]===Z.INTERIOR&&this._depth[y][w]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=u.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===Z.EXTERIOR?0:t===Z.INTERIOR?1:u.NULL_VALUE}}])})();Rn.NULL_VALUE=-1;var Us=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var e=new Array(2).fill(null);return e[0]=this.pts[0],e[1]=this.pts[1],new t(e,Ie.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(e){this._isIsolated=e}},{key:"setName",value:function(e){this._name=e}},{key:"equals",value:function(e){if(!(e instanceof t))return!1;var l=e;if(this.pts.length!==l.pts.length)return!1;for(var g=!0,y=!0,w=this.pts.length,T=0;T<this.pts.length;T++)if(this.pts[T].equals2D(l.pts[T])||(g=!1),this.pts[T].equals2D(l.pts[--w])||(y=!1),!g&&!y)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var e=arguments[0];return this.pts[e]}}},{key:"print",value:function(e){e.print("edge "+this._name+": "),e.print("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&e.print(","),e.print(this.pts[l].x+" "+this.pts[l].y);e.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(e){t.updateIM(this._label,e)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(e){e.print("edge "+this._name+": ");for(var l=this.pts.length-1;l>=0;l--)e.print(this.pts[l]+" ");e.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Si(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new qt;for(var e=0;e<this.pts.length;e++)this._env.expandToInclude(this.pts[e])}return this._env}},{key:"addIntersection",value:function(e,l,g,y){var w=new tt(e.getIntersection(y)),T=l,M=e.getEdgeDistance(g,y),z=T+1;if(z<this.pts.length){var K=this.pts[z];w.equals2D(K)&&(T=z,M=0)}this.eiList.add(w,T,M)}},{key:"toString",value:function(){var e=new cr;e.append("edge "+this._name+": "),e.append("LINESTRING (");for(var l=0;l<this.pts.length;l++)l>0&&e.append(","),e.append(this.pts[l].x+" "+this.pts[l].y);return e.append(") "+this._label+" "+this._depthDelta),e.toString()}},{key:"isPointwiseEqual",value:function(e){if(this.pts.length!==e.pts.length)return!1;for(var l=0;l<this.pts.length;l++)if(!this.pts[l].equals2D(e.pts[l]))return!1;return!0}},{key:"setDepthDelta",value:function(e){this._depthDelta=e}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(e,l,g){for(var y=0;y<e.getIntersectionNum();y++)this.addIntersection(e,l,g,y)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new On(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Rn,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.constructor_.call(this,e,null)}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.pts=l,this._label=g}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Gs&&arguments[0]instanceof Ie))return S(t,"updateIM",this).apply(this,arguments);var e=arguments[0],l=arguments[1];l.setAtLeastIfValid(e.getLocation(0,ct.ON),e.getLocation(1,ct.ON),1),e.isArea()&&(l.setAtLeastIfValid(e.getLocation(0,ct.LEFT),e.getLocation(1,ct.LEFT),2),l.setAtLeastIfValid(e.getLocation(0,ct.RIGHT),e.getLocation(1,ct.RIGHT),2))}}])})(Xt),kr=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"setWorkingPrecisionModel",value:function(t){this._workingPrecisionModel=t}},{key:"insertUniqueEdge",value:function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var l=e.getLabel(),g=t.getLabel();e.isPointwiseEqual(t)||(g=new Ie(t.getLabel())).flip(),l.merge(g);var y=u.depthDelta(g),w=e.getDepthDelta()+y;e.setDepthDelta(w)}else this._edgeList.add(t),t.setDepthDelta(u.depthDelta(t.getLabel()))}},{key:"buildSubgraphs",value:function(t,e){for(var l=new Lt,g=t.iterator();g.hasNext();){var y=g.next(),w=y.getRightmostCoordinate(),T=new Ne(l).getDepth(w);y.computeDepth(T),y.findResultEdges(),l.add(y),e.add(y.getDirectedEdges(),y.getNodes())}}},{key:"createSubgraphs",value:function(t){for(var e=new Lt,l=t.getNodes().iterator();l.hasNext();){var g=l.next();if(!g.isVisited()){var y=new wn;y.create(g),e.add(y)}}return Hi.sort(e,Hi.reverseOrder()),e}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Lo,l=new pi;return l.setPrecisionModel(t),e.setSegmentIntersector(new fn(l)),e}},{key:"buffer",value:function(t,e){var l=this._workingPrecisionModel;l===null&&(l=t.getPrecisionModel()),this._geomFact=t.getFactory();var g=new Nn(l,this._bufParams),y=new Mo(t,e,g).getCurves();if(y.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(y,l),this._graph=new _r(new cn),this._graph.addEdges(this._edgeList.getEdges());var w=this.createSubgraphs(this._graph),T=new fl(this._geomFact);this.buildSubgraphs(w,T);var M=T.getPolygons();return M.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(M)}},{key:"computeNodedEdges",value:function(t,e){var l=this.getNoder(e);l.computeNodes(t);for(var g=l.getNodedSubstrings().iterator();g.hasNext();){var y=g.next(),w=y.getCoordinates();if(w.length!==2||!w[0].equals2D(w[1])){var T=y.getData(),M=new Us(y.getCoordinates(),new Ie(T));this.insertUniqueEdge(M)}}}},{key:"setNoder",value:function(t){this._workingNoder=t}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new yi;var t=arguments[0];this._bufParams=t}},{key:"depthDelta",value:function(t){var e=t.getLocation(0,ct.LEFT),l=t.getLocation(0,ct.RIGHT);return e===Z.INTERIOR&&l===Z.EXTERIOR?1:e===Z.EXTERIOR&&l===Z.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(t){for(var e=new ii,l=new Lt;t.hasNext();){var g=t.next(),y=e.createLineString(g.getCoordinates());l.add(y)}return e.buildGeometry(l)}}])})(),kl=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"rescale",value:function(){if(St(arguments[0],Wt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var l=arguments[0],g=0;g<l.length;g++)l[g].x=l[g].x/this._scaleFactor+this._offsetX,l[g].y=l[g].y/this._scaleFactor+this._offsetY;l.length===2&&l[0].equals2D(l[1])&&Be.out.println(l)}}},{key:"scale",value:function(){if(St(arguments[0],Wt)){for(var t=arguments[0],e=new Lt(t.size()),l=t.iterator();l.hasNext();){var g=l.next();e.add(new mi(this.scale(g.getCoordinates()),g.getData()))}return e}if(arguments[0]instanceof Array){for(var y=arguments[0],w=new Array(y.length).fill(null),T=0;T<y.length;T++)w[T]=new tt(Math.round((y[T].x-this._offsetX)*this._scaleFactor),Math.round((y[T].y-this._offsetY)*this._scaleFactor),y[T].getZ());return se.removeRepeatedPoints(w)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t}},{key:"computeNodes",value:function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)}},{key:"interfaces_",get:function(){return[ko]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];u.constructor_.call(this,t,e,0,0)}else if(arguments.length===4){var l=arguments[0],g=arguments[1];this._noder=l,this._scaleFactor=g,this._isScaled=!this.isIntegerPrecision()}}}])})(),ai=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(arguments.length===2){for(var l=arguments[0],g=arguments[1].iterator();g.hasNext();)for(var y=g.next().getCoordinates(),w=1;w<y.length-1;w++)if(y[w].equals(l))throw new _t("found endpt/interior pt intersection at index "+w+" :pt "+l)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),l=this._segStrings.iterator();l.hasNext();){var g=l.next();this.checkInteriorIntersections(e,g)}else if(arguments.length===2)for(var y=arguments[0],w=arguments[1],T=y.getCoordinates(),M=w.getCoordinates(),z=0;z<T.length-1;z++)for(var K=0;K<M.length-1;K++)this.checkInteriorIntersections(y,z,w,K);else if(arguments.length===4){var it=arguments[0],lt=arguments[1],gt=arguments[2],bt=arguments[3];if(it===gt&<===bt)return null;var wt=it.getCoordinates()[lt],zt=it.getCoordinates()[lt+1],Ot=gt.getCoordinates()[bt],Jt=gt.getCoordinates()[bt+1];if(this._li.computeIntersection(wt,zt,Ot,Jt),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,wt,zt)||this.hasInteriorIntersection(this._li,Ot,Jt)))throw new _t("found non-noded intersection at "+wt+"-"+zt+" and "+Ot+"-"+Jt)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(arguments.length===1)for(var l=arguments[0].getCoordinates(),g=0;g<l.length-2;g++)this.checkCollapse(l[g],l[g+1],l[g+2])}},{key:"hasInteriorIntersection",value:function(t,e,l){for(var g=0;g<t.getIntersectionNum();g++){var y=t.getIntersection(g);if(!y.equals(e)&&!y.equals(l))return!0}return!1}},{key:"checkCollapse",value:function(t,e,l){if(t.equals(l))throw new _t("found non-noded collapse at "+u.fact.createLineString([t,e,l]))}}],[{key:"constructor_",value:function(){this._li=new pi,this._segStrings=null;var t=arguments[0];this._segStrings=t}}])})();ai.fact=new ii;var Ao=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"intersectsScaled",value:function(t,e){var l=Math.min(t.x,e.x),g=Math.max(t.x,e.x),y=Math.min(t.y,e.y),w=Math.max(t.y,e.y),T=this._maxx<l||this._minx>g||this._maxy<y||this._miny>w;if(T)return!1;var M=this.intersectsToleranceSquare(t,e);return dt.isTrue(!(T&&M),"Found bad envelope test"),M}},{key:"initCorners",value:function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new tt(this._maxx,this._maxy),this._corner[1]=new tt(this._minx,this._maxy),this._corner[2]=new tt(this._minx,this._miny),this._corner[3]=new tt(this._maxx,this._miny)}},{key:"intersects",value:function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(t){return Math.round(t*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var t=u.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new qt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(t,e){var l=!1,g=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(g=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!l||!g)||!!t.equals(this._pt)||!!e.equals(this._pt))))}},{key:"addSnappedNode",value:function(t,e){var l=t.getCoordinate(e),g=t.getCoordinate(e+1);return!!this.intersects(l,g)&&(t.addIntersection(this.getCoordinate(),e),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],l=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=l,e<=0)throw new X("Scale factor must be non-zero");e!==1&&(this._pt=new tt(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new tt,this._p1Scaled=new tt),this.initCorners(this._pt)}}])})();Ao.SAFE_ENV_EXPANSION_FACTOR=.75;var dn=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var u=arguments[1];arguments[0].getLineSegment(u,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Pe}}])})(),qs=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var u=arguments[0];return this.snap(u,null,-1)}if(arguments.length===3){var t=arguments[0],e=arguments[1],l=arguments[2],g=t.getSafeEnvelope(),y=new li(t,e,l);return this._index.query(g,new((function(){return d((function w(){r(this,w)}),[{key:"interfaces_",get:function(){return[Ps]}},{key:"visitItem",value:function(w){w.select(g,y)}}])})())),y.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var u=arguments[0];this._index=u}}])})(),li=(function(u){function t(){var e;return r(this,t),e=s(this,t),t.constructor_.apply(e,arguments),e}return b(t,u),d(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof wo))return S(t,"select",this,1).apply(this,arguments);var e=arguments[1],l=arguments[0].getContext();if(this._parentEdge===l&&(e===this._hotPixelVertexIndex||e+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(l,e)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],l=arguments[1],g=arguments[2];this._hotPixel=e,this._parentEdge=l,this._hotPixelVertexIndex=g}}])})(dn);qs.HotPixelSnapAction=li;var Lr=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(u,t,e,l){if(u===e&&t===l)return null;var g=u.getCoordinates()[t],y=u.getCoordinates()[t+1],w=e.getCoordinates()[l],T=e.getCoordinates()[l+1];if(this._li.computeIntersection(g,y,w,T),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var M=0;M<this._li.getIntersectionNum();M++)this._interiorIntersections.add(this._li.getIntersection(M));u.addIntersections(this._li,t,0),e.addIntersections(this._li,l,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[Fs]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var u=arguments[0];this._li=u,this._interiorIntersections=new Lt}}])})(),Zs=(function(){return d((function u(){r(this,u),u.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(u){var t=mi.getNodedSubstrings(u),e=new ai(t);try{e.checkValid()}catch(l){if(!(l instanceof W))throw l;l.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return mi.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(u,t){var e=this.findInteriorIntersections(u,t);this.computeIntersectionSnaps(e),this.computeVertexSnaps(u)}},{key:"findInteriorIntersections",value:function(u,t){var e=new Lr(t);return this._noder.setSegmentIntersector(e),this._noder.computeNodes(u),e.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(St(arguments[0],Wt))for(var u=arguments[0].iterator();u.hasNext();){var t=u.next();this.computeVertexSnaps(t)}else if(arguments[0]instanceof mi)for(var e=arguments[0],l=e.getCoordinates(),g=0;g<l.length;g++){var y=new Ao(l[g],this._scaleFactor,this._li);this._pointSnapper.snap(y,e,g)&&e.addIntersection(l[g],g)}}},{key:"computeNodes",value:function(u){this._nodedSegStrings=u,this._noder=new Lo,this._pointSnapper=new qs(this._noder.getIndex()),this.snapRound(u,this._li)}},{key:"computeIntersectionSnaps",value:function(u){for(var t=u.iterator();t.hasNext();){var e=t.next(),l=new Ao(e,this._scaleFactor,this._li);this._pointSnapper.snap(l)}}},{key:"interfaces_",get:function(){return[ko]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var u=arguments[0];this._pm=u,this._li=new pi,this._li.setPrecisionModel(u),this._scaleFactor=u.getScale()}}])})(),Mi=(function(){function u(){r(this,u),u.constructor_.apply(this,arguments)}return d(u,[{key:"bufferFixedPrecision",value:function(t){var e=new kl(new Zs(new we(1)),t.getScale()),l=new kr(this._bufParams);l.setWorkingPrecisionModel(t),l.setNoder(e),this._resultGeometry=l.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var t=u.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(y){if(!(y instanceof ti))throw y;this._saveException=y}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var e=arguments[0],l=u.precisionScaleFactor(this._argGeom,this._distance,e),g=new we(l);this.bufferFixedPrecision(g)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===we.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new kr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof _t))throw e;this._saveException=e}}},{key:"getResultGeometry",value:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(t){this._bufParams.setEndCapStyle(t)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new U,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],l=arguments[1];this._argGeom=e,this._bufParams=l}}},{key:"bufferOp",value:function(){if(arguments.length===2){var t=arguments[1];return new u(arguments[0]).getResultGeometry(t)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof mt&&typeof arguments[1]=="number"){var e=arguments[1],l=arguments[2],g=new u(arguments[0]);return g.setQuadrantSegments(l),g.getResultGeometry(e)}if(arguments[2]instanceof U&&arguments[0]instanceof mt&&typeof arguments[1]=="number"){var y=arguments[1];return new u(arguments[0],arguments[2]).getResultGeometry(y)}}else if(arguments.length===4){var w=arguments[1],T=arguments[2],M=arguments[3],z=new u(arguments[0]);return z.setQuadrantSegments(T),z.setEndCapStyle(M),z.getResultGeometry(w)}}},{key:"precisionScaleFactor",value:function(t,e,l){var g=t.getEnvelopeInternal(),y=rn.max(Math.abs(g.getMaxX()),Math.abs(g.getMaxY()),Math.abs(g.getMinX()),Math.abs(g.getMinY()))+2*(e>0?e:0),w=l-Math.trunc(Math.log(y)/Math.log(10)+1);return Math.pow(10,w)}}])})();Mi.CAP_ROUND=U.CAP_ROUND,Mi.CAP_BUTT=U.CAP_FLAT,Mi.CAP_FLAT=U.CAP_FLAT,Mi.CAP_SQUARE=U.CAP_SQUARE,Mi.MAX_PRECISION_DIGITS=12;var Er=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Tr=(function(){return d((function u(t){r(this,u),this.geometryFactory=t||new ii}),[{key:"read",value:function(u){var t,e=(t=typeof u=="string"?JSON.parse(u):u).type;if(!ke[e])throw new Error("Unknown GeoJSON type: "+t.type);return Er.indexOf(e)!==-1?ke[e].call(this,t.coordinates):e==="GeometryCollection"?ke[e].call(this,t.geometries):ke[e].call(this,t)}},{key:"write",value:function(u){var t=u.getGeometryType();if(!Le[t])throw new Error("Geometry is not supported");return Le[t].call(this,u)}}])})(),ke={Feature:function(u){var t={};for(var e in u)t[e]=u[e];if(u.geometry){var l=u.geometry.type;if(!ke[l])throw new Error("Unknown GeoJSON type: "+u.type);t.geometry=this.read(u.geometry)}return u.bbox&&(t.bbox=ke.bbox.call(this,u.bbox)),t},FeatureCollection:function(u){var t={};if(u.features){t.features=[];for(var e=0;e<u.features.length;++e)t.features.push(this.read(u.features[e]))}return u.bbox&&(t.bbox=this.parse.bbox.call(this,u.bbox)),t},coordinates:function(u){for(var t=[],e=0;e<u.length;++e){var l=u[e];t.push(h(tt,O(l)))}return t},bbox:function(u){return this.geometryFactory.createLinearRing([new tt(u[0],u[1]),new tt(u[2],u[1]),new tt(u[2],u[3]),new tt(u[0],u[3]),new tt(u[0],u[1])])},Point:function(u){var t=h(tt,O(u));return this.geometryFactory.createPoint(t)},MultiPoint:function(u){for(var t=[],e=0;e<u.length;++e)t.push(ke.Point.call(this,u[e]));return this.geometryFactory.createMultiPoint(t)},LineString:function(u){var t=ke.coordinates.call(this,u);return this.geometryFactory.createLineString(t)},MultiLineString:function(u){for(var t=[],e=0;e<u.length;++e)t.push(ke.LineString.call(this,u[e]));return this.geometryFactory.createMultiLineString(t)},Polygon:function(u){for(var t=ke.coordinates.call(this,u[0]),e=this.geometryFactory.createLinearRing(t),l=[],g=1;g<u.length;++g){var y=u[g],w=ke.coordinates.call(this,y),T=this.geometryFactory.createLinearRing(w);l.push(T)}return this.geometryFactory.createPolygon(e,l)},MultiPolygon:function(u){for(var t=[],e=0;e<u.length;++e){var l=u[e];t.push(ke.Polygon.call(this,l))}return this.geometryFactory.createMultiPolygon(t)},GeometryCollection:function(u){for(var t=[],e=0;e<u.length;++e){var l=u[e];t.push(this.read(l))}return this.geometryFactory.createGeometryCollection(t)}},Le={coordinate:function(u){var t=[u.x,u.y];return u.z&&t.push(u.z),u.m&&t.push(u.m),t},Point:function(u){return{type:"Point",coordinates:Le.coordinate.call(this,u.getCoordinate())}},MultiPoint:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=Le.Point.call(this,l);t.push(g.coordinates)}return{type:"MultiPoint",coordinates:t}},LineString:function(u){for(var t=[],e=u.getCoordinates(),l=0;l<e.length;++l){var g=e[l];t.push(Le.coordinate.call(this,g))}return{type:"LineString",coordinates:t}},MultiLineString:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=Le.LineString.call(this,l);t.push(g.coordinates)}return{type:"MultiLineString",coordinates:t}},Polygon:function(u){var t=[],e=Le.LineString.call(this,u._shell);t.push(e.coordinates);for(var l=0;l<u._holes.length;++l){var g=u._holes[l],y=Le.LineString.call(this,g);t.push(y.coordinates)}return{type:"Polygon",coordinates:t}},MultiPolygon:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=Le.Polygon.call(this,l);t.push(g.coordinates)}return{type:"MultiPolygon",coordinates:t}},GeometryCollection:function(u){for(var t=[],e=0;e<u._geometries.length;++e){var l=u._geometries[e],g=l.getGeometryType();t.push(Le[g].call(this,l))}return{type:"GeometryCollection",geometries:t}}};return{BufferOp:Mi,GeoJSONReader:(function(){return d((function u(t){r(this,u),this.parser=new Tr(t||new ii)}),[{key:"read",value:function(u){return this.parser.read(u)}}])})(),GeoJSONWriter:(function(){return d((function u(){r(this,u),this.parser=new Tr(this.geometryFactory)}),[{key:"write",value:function(u){return this.parser.write(u)}}])})()}}))})(ts)),ts.exports}var Xd=Vd();const Jd=Il(Xd);class Wd{constructor(){this._partials=new Float64Array(32),this._n=0}add(n){const i=this._partials;let s=0;for(let r=0;r<this._n&&r<32;r++){const h=i[r],f=n+h,d=Math.abs(n)<Math.abs(h)?n-(f-h):h-(f-n);d&&(i[s++]=d),n=f}return i[s]=n,this._n=s+1,this}valueOf(){const n=this._partials;let i=this._n,s,r,h,f=0;if(i>0){for(f=n[--i];i>0&&(s=f,r=n[--i],f=s+r,h=r-(f-s),!h););i>0&&(h<0&&n[i-1]<0||h>0&&n[i-1]>0)&&(r=h*2,s=f+r,r==s-f&&(f=s))}return f}}function*jd(a){for(const n of a)yield*n}function Gu(a){return Array.from(jd(a))}var jt=1e-6,Gt=Math.PI,We=Gt/2,Uu=Gt/4,ci=Gt*2,Di=180/Gt,qe=Gt/180,ue=Math.abs,Kd=Math.atan,jn=Math.atan2,te=Math.cos,Qt=Math.sin,Qd=Math.sign||function(a){return a>0?1:a<0?-1:0},Zr=Math.sqrt;function qu(a){return a>1?0:a<-1?Gt:Math.acos(a)}function Kn(a){return a>1?We:a<-1?-We:Math.asin(a)}function Hr(){}function es(a,n){a&&Hu.hasOwnProperty(a.type)&&Hu[a.type](a,n)}var Zu={Feature:function(a,n){es(a.geometry,n)},FeatureCollection:function(a,n){for(var i=a.features,s=-1,r=i.length;++s<r;)es(i[s].geometry,n)}},Hu={Sphere:function(a,n){n.sphere()},Point:function(a,n){a=a.coordinates,n.point(a[0],a[1],a[2])},MultiPoint:function(a,n){for(var i=a.coordinates,s=-1,r=i.length;++s<r;)a=i[s],n.point(a[0],a[1],a[2])},LineString:function(a,n){Ca(a.coordinates,n,0)},MultiLineString:function(a,n){for(var i=a.coordinates,s=-1,r=i.length;++s<r;)Ca(i[s],n,0)},Polygon:function(a,n){Yu(a.coordinates,n)},MultiPolygon:function(a,n){for(var i=a.coordinates,s=-1,r=i.length;++s<r;)Yu(i[s],n)},GeometryCollection:function(a,n){for(var i=a.geometries,s=-1,r=i.length;++s<r;)es(i[s],n)}};function Ca(a,n,i){var s=-1,r=a.length-i,h;for(n.lineStart();++s<r;)h=a[s],n.point(h[0],h[1],h[2]);n.lineEnd()}function Yu(a,n){var i=-1,s=a.length;for(n.polygonStart();++i<s;)Ca(a[i],n,1);n.polygonEnd()}function $d(a,n){a&&Zu.hasOwnProperty(a.type)?Zu[a.type](a,n):es(a,n)}function Sa(a){return[jn(a[1],a[0]),Kn(a[2])]}function Qn(a){var n=a[0],i=a[1],s=te(i);return[s*te(n),s*Qt(n),Qt(i)]}function is(a,n){return a[0]*n[0]+a[1]*n[1]+a[2]*n[2]}function ns(a,n){return[a[1]*n[2]-a[2]*n[1],a[2]*n[0]-a[0]*n[2],a[0]*n[1]-a[1]*n[0]]}function Ma(a,n){a[0]+=n[0],a[1]+=n[1],a[2]+=n[2]}function rs(a,n){return[a[0]*n,a[1]*n,a[2]*n]}function Aa(a){var n=Zr(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);a[0]/=n,a[1]/=n,a[2]/=n}function Pa(a,n){function i(s,r){return s=a(s,r),n(s[0],s[1])}return a.invert&&n.invert&&(i.invert=function(s,r){return s=n.invert(s,r),s&&a.invert(s[0],s[1])}),i}function Na(a,n){return[ue(a)>Gt?a+Math.round(-a/ci)*ci:a,n]}Na.invert=Na;function tg(a,n,i){return(a%=ci)?n||i?Pa(Xu(a),Ju(n,i)):Xu(a):n||i?Ju(n,i):Na}function Vu(a){return function(n,i){return n+=a,[n>Gt?n-ci:n<-Gt?n+ci:n,i]}}function Xu(a){var n=Vu(a);return n.invert=Vu(-a),n}function Ju(a,n){var i=te(a),s=Qt(a),r=te(n),h=Qt(n);function f(d,m){var _=te(m),x=te(d)*_,b=Qt(d)*_,E=Qt(m),C=E*i+x*s;return[jn(b*r-C*h,x*i-E*s),Kn(C*r+b*h)]}return f.invert=function(d,m){var _=te(m),x=te(d)*_,b=Qt(d)*_,E=Qt(m),C=E*r-b*h;return[jn(b*r+E*h,x*i+C*s),Kn(C*i-x*s)]},f}function eg(a,n,i,s,r,h){if(i){var f=te(n),d=Qt(n),m=s*i;r==null?(r=n+s*ci,h=n-m/2):(r=Wu(f,r),h=Wu(f,h),(s>0?r<h:r>h)&&(r+=s*ci));for(var _,x=r;s>0?x>h:x<h;x-=m)_=Sa([f,-d*te(x),-d*Qt(x)]),a.point(_[0],_[1])}}function Wu(a,n){n=Qn(n),n[0]-=a,Aa(n);var i=qu(-n[1]);return((-n[2]<0?-i:i)+ci-jt)%ci}function ju(){var a=[],n;return{point:function(i,s,r){n.push([i,s,r])},lineStart:function(){a.push(n=[])},lineEnd:Hr,rejoin:function(){a.length>1&&a.push(a.pop().concat(a.shift()))},result:function(){var i=a;return a=[],n=null,i}}}function os(a,n){return ue(a[0]-n[0])<jt&&ue(a[1]-n[1])<jt}function ss(a,n,i,s){this.x=a,this.z=n,this.o=i,this.e=s,this.v=!1,this.n=this.p=null}function Ku(a,n,i,s,r){var h=[],f=[],d,m;if(a.forEach(function(S){if(!((O=S.length-1)<=0)){var O,N=S[0],G=S[O],D;if(os(N,G)){if(!N[2]&&!G[2]){for(r.lineStart(),d=0;d<O;++d)r.point((N=S[d])[0],N[1]);r.lineEnd();return}G[0]+=2*jt}h.push(D=new ss(N,S,null,!0)),f.push(D.o=new ss(N,null,D,!1)),h.push(D=new ss(G,S,null,!1)),f.push(D.o=new ss(G,null,D,!0))}}),!!h.length){for(f.sort(n),Qu(h),Qu(f),d=0,m=f.length;d<m;++d)f[d].e=i=!i;for(var _=h[0],x,b;;){for(var E=_,C=!0;E.v;)if((E=E.n)===_)return;x=E.z,r.lineStart();do{if(E.v=E.o.v=!0,E.e){if(C)for(d=0,m=x.length;d<m;++d)r.point((b=x[d])[0],b[1]);else s(E.x,E.n.x,1,r);E=E.n}else{if(C)for(x=E.p.z,d=x.length-1;d>=0;--d)r.point((b=x[d])[0],b[1]);else s(E.x,E.p.x,-1,r);E=E.p}E=E.o,x=E.z,C=!C}while(!E.v);r.lineEnd()}}}function Qu(a){if(n=a.length){for(var n,i=0,s=a[0],r;++i<n;)s.n=r=a[i],r.p=s,s=r;s.n=r=a[0],r.p=s}}function Oa(a){return ue(a[0])<=Gt?a[0]:Qd(a[0])*((ue(a[0])+Gt)%ci-Gt)}function ig(a,n){var i=Oa(n),s=n[1],r=Qt(s),h=[Qt(i),-te(i),0],f=0,d=0,m=new Wd;r===1?s=We+jt:r===-1&&(s=-We-jt);for(var _=0,x=a.length;_<x;++_)if(E=(b=a[_]).length)for(var b,E,C=b[E-1],S=Oa(C),O=C[1]/2+Uu,N=Qt(O),G=te(O),D=0;D<E;++D,S=W,N=et,G=ot,C=U){var U=b[D],W=Oa(U),X=U[1]/2+Uu,et=Qt(X),ot=te(X),I=W-S,P=I>=0?1:-1,R=P*I,F=R>Gt,q=N*et;if(m.add(jn(q*P*Qt(R),G*ot+q*te(R))),f+=F?I+P*ci:I,F^S>=i^W>=i){var H=ns(Qn(C),Qn(U));Aa(H);var j=ns(h,H);Aa(j);var B=(F^I>=0?-1:1)*Kn(j[2]);(s>B||s===B&&(H[0]||H[1]))&&(d+=F^I>=0?1:-1)}}return(f<-jt||f<jt&&m<-1e-12)^d&1}function $u(a,n,i,s){return function(r){var h=n(r),f=ju(),d=n(f),m=!1,_,x,b,E={point:C,lineStart:O,lineEnd:N,polygonStart:function(){E.point=G,E.lineStart=D,E.lineEnd=U,x=[],_=[]},polygonEnd:function(){E.point=C,E.lineStart=O,E.lineEnd=N,x=Gu(x);var W=ig(_,s);x.length?(m||(r.polygonStart(),m=!0),Ku(x,rg,W,i,r)):W&&(m||(r.polygonStart(),m=!0),r.lineStart(),i(null,null,1,r),r.lineEnd()),m&&(r.polygonEnd(),m=!1),x=_=null},sphere:function(){r.polygonStart(),r.lineStart(),i(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function C(W,X){a(W,X)&&r.point(W,X)}function S(W,X){h.point(W,X)}function O(){E.point=S,h.lineStart()}function N(){E.point=C,h.lineEnd()}function G(W,X){b.push([W,X]),d.point(W,X)}function D(){d.lineStart(),b=[]}function U(){G(b[0][0],b[0][1]),d.lineEnd();var W=d.clean(),X=f.result(),et,ot=X.length,I,P,R;if(b.pop(),_.push(b),b=null,!!ot){if(W&1){if(P=X[0],(I=P.length-1)>0){for(m||(r.polygonStart(),m=!0),r.lineStart(),et=0;et<I;++et)r.point((R=P[et])[0],R[1]);r.lineEnd()}return}ot>1&&W&2&&X.push(X.pop().concat(X.shift())),x.push(X.filter(ng))}}return E}}function ng(a){return a.length>1}function rg(a,n){return((a=a.x)[0]<0?a[1]-We-jt:We-a[1])-((n=n.x)[0]<0?n[1]-We-jt:We-n[1])}const th=$u(function(){return!0},og,ag,[-Gt,-We]);function og(a){var n=NaN,i=NaN,s=NaN,r;return{lineStart:function(){a.lineStart(),r=1},point:function(h,f){var d=h>0?Gt:-Gt,m=ue(h-n);ue(m-Gt)<jt?(a.point(n,i=(i+f)/2>0?We:-We),a.point(s,i),a.lineEnd(),a.lineStart(),a.point(d,i),a.point(h,i),r=0):s!==d&&m>=Gt&&(ue(n-s)<jt&&(n-=s*jt),ue(h-d)<jt&&(h-=d*jt),i=sg(n,i,h,f),a.point(s,i),a.lineEnd(),a.lineStart(),a.point(d,i),r=0),a.point(n=h,i=f),s=d},lineEnd:function(){a.lineEnd(),n=i=NaN},clean:function(){return 2-r}}}function sg(a,n,i,s){var r,h,f=Qt(a-i);return ue(f)>jt?Kd((Qt(n)*(h=te(s))*Qt(i)-Qt(s)*(r=te(n))*Qt(a))/(r*h*f)):(n+s)/2}function ag(a,n,i,s){var r;if(a==null)r=i*We,s.point(-Gt,r),s.point(0,r),s.point(Gt,r),s.point(Gt,0),s.point(Gt,-r),s.point(0,-r),s.point(-Gt,-r),s.point(-Gt,0),s.point(-Gt,r);else if(ue(a[0]-n[0])>jt){var h=a[0]<n[0]?Gt:-Gt;r=i*h/2,s.point(-h,r),s.point(0,r),s.point(h,r)}else s.point(n[0],n[1])}function lg(a){var n=te(a),i=6*qe,s=n>0,r=ue(n)>jt;function h(x,b,E,C){eg(C,a,i,E,x,b)}function f(x,b){return te(x)*te(b)>n}function d(x){var b,E,C,S,O;return{lineStart:function(){S=C=!1,O=1},point:function(N,G){var D=[N,G],U,W=f(N,G),X=s?W?0:_(N,G):W?_(N+(N<0?Gt:-Gt),G):0;if(!b&&(S=C=W)&&x.lineStart(),W!==C&&(U=m(b,D),(!U||os(b,U)||os(D,U))&&(D[2]=1)),W!==C)O=0,W?(x.lineStart(),U=m(D,b),x.point(U[0],U[1])):(U=m(b,D),x.point(U[0],U[1],2),x.lineEnd()),b=U;else if(r&&b&&s^W){var et;!(X&E)&&(et=m(D,b,!0))&&(O=0,s?(x.lineStart(),x.point(et[0][0],et[0][1]),x.point(et[1][0],et[1][1]),x.lineEnd()):(x.point(et[1][0],et[1][1]),x.lineEnd(),x.lineStart(),x.point(et[0][0],et[0][1],3)))}W&&(!b||!os(b,D))&&x.point(D[0],D[1]),b=D,C=W,E=X},lineEnd:function(){C&&x.lineEnd(),b=null},clean:function(){return O|(S&&C)<<1}}}function m(x,b,E){var C=Qn(x),S=Qn(b),O=[1,0,0],N=ns(C,S),G=is(N,N),D=N[0],U=G-D*D;if(!U)return!E&&x;var W=n*G/U,X=-n*D/U,et=ns(O,N),ot=rs(O,W),I=rs(N,X);Ma(ot,I);var P=et,R=is(ot,P),F=is(P,P),q=R*R-F*(is(ot,ot)-1);if(!(q<0)){var H=Zr(q),j=rs(P,(-R-H)/F);if(Ma(j,ot),j=Sa(j),!E)return j;var B=x[0],Y=b[0],$=x[1],J=b[1],at;Y<B&&(at=B,B=Y,Y=at);var rt=Y-B,ht=ue(rt-Gt)<jt,_t=ht||rt<jt;if(!ht&&J<$&&(at=$,$=J,J=at),_t?ht?$+J>0^j[1]<(ue(j[0]-B)<jt?$:J):$<=j[1]&&j[1]<=J:rt>Gt^(B<=j[0]&&j[0]<=Y)){var kt=rs(P,(-R+H)/F);return Ma(kt,ot),[j,Sa(kt)]}}}function _(x,b){var E=s?a:Gt-a,C=0;return x<-E?C|=1:x>E&&(C|=2),b<-E?C|=4:b>E&&(C|=8),C}return $u(f,d,h,s?[0,-a]:[-Gt,a-Gt])}function ug(a,n,i,s,r,h){var f=a[0],d=a[1],m=n[0],_=n[1],x=0,b=1,E=m-f,C=_-d,S;if(S=i-f,!(!E&&S>0)){if(S/=E,E<0){if(S<x)return;S<b&&(b=S)}else if(E>0){if(S>b)return;S>x&&(x=S)}if(S=r-f,!(!E&&S<0)){if(S/=E,E<0){if(S>b)return;S>x&&(x=S)}else if(E>0){if(S<x)return;S<b&&(b=S)}if(S=s-d,!(!C&&S>0)){if(S/=C,C<0){if(S<x)return;S<b&&(b=S)}else if(C>0){if(S>b)return;S>x&&(x=S)}if(S=h-d,!(!C&&S<0)){if(S/=C,C<0){if(S>b)return;S>x&&(x=S)}else if(C>0){if(S<x)return;S<b&&(b=S)}return x>0&&(a[0]=f+x*E,a[1]=d+x*C),b<1&&(n[0]=f+b*E,n[1]=d+b*C),!0}}}}}var Yr=1e9,as=-Yr;function hg(a,n,i,s){function r(_,x){return a<=_&&_<=i&&n<=x&&x<=s}function h(_,x,b,E){var C=0,S=0;if(_==null||(C=f(_,b))!==(S=f(x,b))||m(_,x)<0^b>0)do E.point(C===0||C===3?a:i,C>1?s:n);while((C=(C+b+4)%4)!==S);else E.point(x[0],x[1])}function f(_,x){return ue(_[0]-a)<jt?x>0?0:3:ue(_[0]-i)<jt?x>0?2:1:ue(_[1]-n)<jt?x>0?1:0:x>0?3:2}function d(_,x){return m(_.x,x.x)}function m(_,x){var b=f(_,1),E=f(x,1);return b!==E?b-E:b===0?x[1]-_[1]:b===1?_[0]-x[0]:b===2?_[1]-x[1]:x[0]-_[0]}return function(_){var x=_,b=ju(),E,C,S,O,N,G,D,U,W,X,et,ot={point:I,lineStart:q,lineEnd:H,polygonStart:R,polygonEnd:F};function I(B,Y){r(B,Y)&&x.point(B,Y)}function P(){for(var B=0,Y=0,$=C.length;Y<$;++Y)for(var J=C[Y],at=1,rt=J.length,ht=J[0],_t,kt,dt=ht[0],pt=ht[1];at<rt;++at)_t=dt,kt=pt,ht=J[at],dt=ht[0],pt=ht[1],kt<=s?pt>s&&(dt-_t)*(s-kt)>(pt-kt)*(a-_t)&&++B:pt<=s&&(dt-_t)*(s-kt)<(pt-kt)*(a-_t)&&--B;return B}function R(){x=b,E=[],C=[],et=!0}function F(){var B=P(),Y=et&&B,$=(E=Gu(E)).length;(Y||$)&&(_.polygonStart(),Y&&(_.lineStart(),h(null,null,1,_),_.lineEnd()),$&&Ku(E,d,B,h,_),_.polygonEnd()),x=_,E=C=S=null}function q(){ot.point=j,C&&C.push(S=[]),X=!0,W=!1,D=U=NaN}function H(){E&&(j(O,N),G&&W&&b.rejoin(),E.push(b.result())),ot.point=I,W&&x.lineEnd()}function j(B,Y){var $=r(B,Y);if(C&&S.push([B,Y]),X)O=B,N=Y,G=$,X=!1,$&&(x.lineStart(),x.point(B,Y));else if($&&W)x.point(B,Y);else{var J=[D=Math.max(as,Math.min(Yr,D)),U=Math.max(as,Math.min(Yr,U))],at=[B=Math.max(as,Math.min(Yr,B)),Y=Math.max(as,Math.min(Yr,Y))];ug(J,at,a,n,i,s)?(W||(x.lineStart(),x.point(J[0],J[1])),x.point(at[0],at[1]),$||x.lineEnd(),et=!1):$&&(x.lineStart(),x.point(B,Y),et=!1)}D=B,U=Y,W=$}return ot}}const eh=a=>a;var $n=1/0,ls=$n,Vr=-$n,us=Vr,ih={point:cg,lineStart:Hr,lineEnd:Hr,polygonStart:Hr,polygonEnd:Hr,result:function(){var a=[[$n,ls],[Vr,us]];return Vr=us=-(ls=$n=1/0),a}};function cg(a,n){a<$n&&($n=a),a>Vr&&(Vr=a),n<ls&&(ls=n),n>us&&(us=n)}function Ra(a){return function(n){var i=new Da;for(var s in a)i[s]=a[s];return i.stream=n,i}}function Da(){}Da.prototype={constructor:Da,point:function(a,n){this.stream.point(a,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Ba(a,n,i){var s=a.clipExtent&&a.clipExtent();return a.scale(150).translate([0,0]),s!=null&&a.clipExtent(null),$d(i,a.stream(ih)),n(ih.result()),s!=null&&a.clipExtent(s),a}function nh(a,n,i){return Ba(a,function(s){var r=n[1][0]-n[0][0],h=n[1][1]-n[0][1],f=Math.min(r/(s[1][0]-s[0][0]),h/(s[1][1]-s[0][1])),d=+n[0][0]+(r-f*(s[1][0]+s[0][0]))/2,m=+n[0][1]+(h-f*(s[1][1]+s[0][1]))/2;a.scale(150*f).translate([d,m])},i)}function fg(a,n,i){return nh(a,[[0,0],n],i)}function dg(a,n,i){return Ba(a,function(s){var r=+n,h=r/(s[1][0]-s[0][0]),f=(r-h*(s[1][0]+s[0][0]))/2,d=-h*s[0][1];a.scale(150*h).translate([f,d])},i)}function gg(a,n,i){return Ba(a,function(s){var r=+n,h=r/(s[1][1]-s[0][1]),f=-h*s[0][0],d=(r-h*(s[1][1]+s[0][1]))/2;a.scale(150*h).translate([f,d])},i)}var rh=16,pg=te(30*qe);function oh(a,n){return+n?yg(a,n):mg(a)}function mg(a){return Ra({point:function(n,i){n=a(n,i),this.stream.point(n[0],n[1])}})}function yg(a,n){function i(s,r,h,f,d,m,_,x,b,E,C,S,O,N){var G=_-s,D=x-r,U=G*G+D*D;if(U>4*n&&O--){var W=f+E,X=d+C,et=m+S,ot=Zr(W*W+X*X+et*et),I=Kn(et/=ot),P=ue(ue(et)-1)<jt||ue(h-b)<jt?(h+b)/2:jn(X,W),R=a(P,I),F=R[0],q=R[1],H=F-s,j=q-r,B=D*H-G*j;(B*B/U>n||ue((G*H+D*j)/U-.5)>.3||f*E+d*C+m*S<pg)&&(i(s,r,h,f,d,m,F,q,P,W/=ot,X/=ot,et,O,N),N.point(F,q),i(F,q,P,W,X,et,_,x,b,E,C,S,O,N))}}return function(s){var r,h,f,d,m,_,x,b,E,C,S,O,N={point:G,lineStart:D,lineEnd:W,polygonStart:function(){s.polygonStart(),N.lineStart=X},polygonEnd:function(){s.polygonEnd(),N.lineStart=D}};function G(I,P){I=a(I,P),s.point(I[0],I[1])}function D(){b=NaN,N.point=U,s.lineStart()}function U(I,P){var R=Qn([I,P]),F=a(I,P);i(b,E,x,C,S,O,b=F[0],E=F[1],x=I,C=R[0],S=R[1],O=R[2],rh,s),s.point(b,E)}function W(){N.point=G,s.lineEnd()}function X(){D(),N.point=et,N.lineEnd=ot}function et(I,P){U(r=I,P),h=b,f=E,d=C,m=S,_=O,N.point=U}function ot(){i(b,E,x,C,S,O,h,f,r,d,m,_,rh,s),N.lineEnd=W,W()}return N}}var _g=Ra({point:function(a,n){this.stream.point(a*qe,n*qe)}});function vg(a){return Ra({point:function(n,i){var s=a(n,i);return this.stream.point(s[0],s[1])}})}function bg(a,n,i,s,r){function h(f,d){return f*=s,d*=r,[n+a*f,i-a*d]}return h.invert=function(f,d){return[(f-n)/a*s,(i-d)/a*r]},h}function sh(a,n,i,s,r,h){if(!h)return bg(a,n,i,s,r);var f=te(h),d=Qt(h),m=f*a,_=d*a,x=f/a,b=d/a,E=(d*i-f*n)/a,C=(d*n+f*i)/a;function S(O,N){return O*=s,N*=r,[m*O-_*N+n,i-_*O-m*N]}return S.invert=function(O,N){return[s*(x*O-b*N+E),r*(C-b*O-x*N)]},S}function xg(a){return wg(function(){return a})()}function wg(a){var n,i=150,s=480,r=250,h=0,f=0,d=0,m=0,_=0,x,b=0,E=1,C=1,S=null,O=th,N=null,G,D,U,W=eh,X=.5,et,ot,I,P,R;function F(B){return I(B[0]*qe,B[1]*qe)}function q(B){return B=I.invert(B[0],B[1]),B&&[B[0]*Di,B[1]*Di]}F.stream=function(B){return P&&R===B?P:P=_g(vg(x)(O(et(W(R=B)))))},F.preclip=function(B){return arguments.length?(O=B,S=void 0,j()):O},F.postclip=function(B){return arguments.length?(W=B,N=G=D=U=null,j()):W},F.clipAngle=function(B){return arguments.length?(O=+B?lg(S=B*qe):(S=null,th),j()):S*Di},F.clipExtent=function(B){return arguments.length?(W=B==null?(N=G=D=U=null,eh):hg(N=+B[0][0],G=+B[0][1],D=+B[1][0],U=+B[1][1]),j()):N==null?null:[[N,G],[D,U]]},F.scale=function(B){return arguments.length?(i=+B,H()):i},F.translate=function(B){return arguments.length?(s=+B[0],r=+B[1],H()):[s,r]},F.center=function(B){return arguments.length?(h=B[0]%360*qe,f=B[1]%360*qe,H()):[h*Di,f*Di]},F.rotate=function(B){return arguments.length?(d=B[0]%360*qe,m=B[1]%360*qe,_=B.length>2?B[2]%360*qe:0,H()):[d*Di,m*Di,_*Di]},F.angle=function(B){return arguments.length?(b=B%360*qe,H()):b*Di},F.reflectX=function(B){return arguments.length?(E=B?-1:1,H()):E<0},F.reflectY=function(B){return arguments.length?(C=B?-1:1,H()):C<0},F.precision=function(B){return arguments.length?(et=oh(ot,X=B*B),j()):Zr(X)},F.fitExtent=function(B,Y){return nh(F,B,Y)},F.fitSize=function(B,Y){return fg(F,B,Y)},F.fitWidth=function(B,Y){return dg(F,B,Y)},F.fitHeight=function(B,Y){return gg(F,B,Y)};function H(){var B=sh(i,0,0,E,C,b).apply(null,n(h,f)),Y=sh(i,s-B[0],r-B[1],E,C,b);return x=tg(d,m,_),ot=Pa(n,Y),I=Pa(x,ot),et=oh(ot,X),j()}function j(){return P=R=null,F}return function(){return n=a.apply(this,arguments),F.invert=n.invert&&q,H()}}function kg(a){return function(n,i){var s=te(n),r=te(i),h=a(s*r);return h===1/0?[2,0]:[h*r*Qt(n),h*Qt(i)]}}function Lg(a){return function(n,i){var s=Zr(n*n+i*i),r=a(s),h=Qt(r),f=te(r);return[jn(n*h,s*f),Kn(s&&i*h/s)]}}var ah=kg(function(a){return(a=qu(a))&&a/Qt(a)});ah.invert=Lg(function(a){return a});function Eg(){return xg(ah).scale(79.4188).clipAngle(180-.001)}var{BufferOp:Tg,GeoJSONReader:Ig,GeoJSONWriter:Cg}=Jd;function lh(a,n,i){i=i||{};var s=i.units||"kilometers",r=i.steps||8;if(!a)throw new Error("geojson is required");if(typeof i!="object")throw new Error("options must be an object");if(typeof r!="number")throw new Error("steps must be an number");if(n===void 0)throw new Error("radius is required");if(r<=0)throw new Error("steps must be greater than 0");var h=[];switch(a.type){case"GeometryCollection":return Hn(a,function(f){var d=hs(f,n,s,r);d&&h.push(d)}),Re(h);case"FeatureCollection":return Zn(a,function(f){var d=hs(f,n,s,r);d&&Zn(d,function(m){m&&h.push(m)})}),Re(h)}return hs(a,n,s,r)}function hs(a,n,i,s){var r=a.properties||{},h=a.type==="Feature"?a.geometry:a;if(h.type==="GeometryCollection"){var f=[];return Hn(a,function(O){var N=hs(O,n,i,s);N&&f.push(N)}),Re(f)}var d=Sg(h),m={type:h.type,coordinates:hh(h.coordinates,d)},_=new Ig,x=_.read(m),b=cu(fu(n,i),"meters"),E=Tg.bufferOp(x,b,s),C=new Cg;if(E=C.write(E),!uh(E.coordinates)){var S={type:E.type,coordinates:ch(E.coordinates,d)};return Xe(S,r)}}function uh(a){return Array.isArray(a[0])?uh(a[0]):isNaN(a[0])}function hh(a,n){return typeof a[0]!="object"?n(a):a.map(function(i){return hh(i,n)})}function ch(a,n){return typeof a[0]!="object"?n.invert(a):a.map(function(i){return ch(i,n)})}function Sg(a){var n=Hd(a).geometry.coordinates,i=[-n[0],-n[1]];return Eg().rotate(i).scale(Kt)}function Mg(a,n={}){let i=0,s=0,r=0;return Vo(a,function(h){i+=h[0],s+=h[1],r++},!0),Ue([i/r,s/r],n.properties)}function Ag(a){let n,i;const s={type:"FeatureCollection",features:[]};if(a.type==="Feature"?i=a.geometry:i=a,i.type==="LineString")n=[i.coordinates];else if(i.type==="MultiLineString")n=i.coordinates;else if(i.type==="MultiPolygon")n=[].concat(...i.coordinates);else if(i.type==="Polygon")n=i.coordinates;else throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");return n.forEach(r=>{n.forEach(h=>{for(let f=0;f<r.length-1;f++)for(let d=f;d<h.length-1;d++){if(r===h&&(Math.abs(f-d)===1||f===0&&d===r.length-2&&r[f][0]===r[r.length-1][0]&&r[f][1]===r[r.length-1][1]))continue;const m=Pg(r[f][0],r[f][1],r[f+1][0],r[f+1][1],h[d][0],h[d][1],h[d+1][0],h[d+1][1]);m&&s.features.push(Ue([m[0],m[1]]))}})}),s}function Pg(a,n,i,s,r,h,f,d){let m,_,x,b,E;const C={x:null,y:null,onLine1:!1,onLine2:!1};return m=(d-h)*(i-a)-(f-r)*(s-n),m===0?C.x!==null&&C.y!==null?C:!1:(_=n-h,x=a-r,b=(f-r)*_-(d-h)*x,E=(i-a)*_-(s-n)*x,_=b/m,x=E/m,C.x=a+_*(i-a),C.y=n+_*(s-n),_>=0&&_<=1&&(C.onLine1=!0),x>=0&&x<=1&&(C.onLine2=!0),C.onLine1&&C.onLine2?[C.x,C.y]:!1)}function cs(a){var n=a[0],i=a[1];return[i[0]-n[0],i[1]-n[1]]}function za(a,n){return a[0]*n[1]-n[0]*a[1]}function Ng(a,n){return[a[0]+n[0],a[1]+n[1]]}function Og(a,n){return[a[0]-n[0],a[1]-n[1]]}function Rg(a,n){return[a*n[0],a*n[1]]}function Dg(a,n){var i=a[0],s=cs(a),r=n[0],h=cs(n),f=za(s,h),d=Og(r,i),m=za(d,h),_=m/f,x=Ng(i,Rg(_,s));return x}function Bg(a,n){var i=cs(a),s=cs(n);return za(i,s)===0}function zg(a,n){return Bg(a,n)?!1:Dg(a,n)}function Fa(a,n,i={}){if(i=i||{},!va(i))throw new Error("options is invalid");const{units:s="kilometers"}=i;if(!a)throw new Error("geojson is required");if(n==null||isNaN(n))throw new Error("distance is required");var r=Xo(a),h=a.type==="Feature"?a.properties:{};switch(r){case"LineString":return fh(a,n,s);case"MultiLineString":var f=[];return Yn(a,function(d){f.push(fh(d,n,s).geometry.coordinates)}),hu(f,h);default:throw new Error("geometry "+r+" is not supported")}}function fh(a,n,i){var s=[],r=td(n,i),h=Je(a),f=[];return h.forEach(function(d,m){if(m!==h.length-1){var _=Fg(d,h[m+1],r);if(s.push(_),m>0){var x=s[m-1],b=zg(_,x);b!==!1&&(x[1]=b,_[0]=b),f.push(x[0]),m===h.length-2&&(f.push(_[0]),f.push(_[1]))}h.length===2&&(f.push(_[0]),f.push(_[1]))}}),Pi(f,a.type==="Feature"?a.properties:{})}function Fg(a,n,i){var s=Math.sqrt((a[0]-n[0])*(a[0]-n[0])+(a[1]-n[1])*(a[1]-n[1])),r=a[0]+i*(n[1]-a[1])/s,h=n[0]+i*(n[1]-a[1])/s,f=a[1]+i*(a[0]-n[0])/s,d=n[1]+i*(a[0]-n[0])/s;return[[r,f],[h,d]]}function Gg(a,n,i,s,r){dh(a,n,i||0,s||a.length-1,r||Ug)}function dh(a,n,i,s,r){for(;s>i;){if(s-i>600){var h=s-i+1,f=n-i+1,d=Math.log(h),m=.5*Math.exp(2*d/3),_=.5*Math.sqrt(d*m*(h-m)/h)*(f-h/2<0?-1:1),x=Math.max(i,Math.floor(n-f*m/h+_)),b=Math.min(s,Math.floor(n+(h-f)*m/h+_));dh(a,n,x,b,r)}var E=a[n],C=i,S=s;for(Xr(a,i,n),r(a[s],E)>0&&Xr(a,i,s);C<S;){for(Xr(a,C,S),C++,S--;r(a[C],E)<0;)C++;for(;r(a[S],E)>0;)S--}r(a[i],E)===0?Xr(a,i,S):(S++,Xr(a,S,s)),S<=n&&(i=S+1),n<=S&&(s=S-1)}}function Xr(a,n,i){var s=a[n];a[n]=a[i],a[i]=s}function Ug(a,n){return a<n?-1:a>n?1:0}let qg=class{constructor(n=9){this._maxEntries=Math.max(4,n),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(n){let i=this.data;const s=[];if(!ds(n,i))return s;const r=this.toBBox,h=[];for(;i;){for(let f=0;f<i.children.length;f++){const d=i.children[f],m=i.leaf?r(d):d;ds(n,m)&&(i.leaf?s.push(d):Ua(n,m)?this._all(d,s):h.push(d))}i=h.pop()}return s}collides(n){let i=this.data;if(!ds(n,i))return!1;const s=[];for(;i;){for(let r=0;r<i.children.length;r++){const h=i.children[r],f=i.leaf?this.toBBox(h):h;if(ds(n,f)){if(i.leaf||Ua(n,f))return!0;s.push(h)}}i=s.pop()}return!1}load(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(let s=0;s<n.length;s++)this.insert(n[s]);return this}let i=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=i;else if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){const s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}return this}insert(n){return n&&this._insert(n,this.data.height-1),this}clear(){return this.data=er([]),this}remove(n,i){if(!n)return this;let s=this.data;const r=this.toBBox(n),h=[],f=[];let d,m,_;for(;s||h.length;){if(s||(s=h.pop(),m=h[h.length-1],d=f.pop(),_=!0),s.leaf){const x=Zg(n,s.children,i);if(x!==-1)return s.children.splice(x,1),h.push(s),this._condense(h),this}!_&&!s.leaf&&Ua(s,r)?(h.push(s),f.push(d),d=0,m=s,s=s.children[0]):m?(d++,s=m.children[d],_=!1):s=null}return this}toBBox(n){return n}compareMinX(n,i){return n.minX-i.minX}compareMinY(n,i){return n.minY-i.minY}toJSON(){return this.data}fromJSON(n){return this.data=n,this}_all(n,i){const s=[];for(;n;)n.leaf?i.push(...n.children):s.push(...n.children),n=s.pop();return i}_build(n,i,s,r){const h=s-i+1;let f=this._maxEntries,d;if(h<=f)return d=er(n.slice(i,s+1)),tr(d,this.toBBox),d;r||(r=Math.ceil(Math.log(h)/Math.log(f)),f=Math.ceil(h/Math.pow(f,r-1))),d=er([]),d.leaf=!1,d.height=r;const m=Math.ceil(h/f),_=m*Math.ceil(Math.sqrt(f));gh(n,i,s,_,this.compareMinX);for(let x=i;x<=s;x+=_){const b=Math.min(x+_-1,s);gh(n,x,b,m,this.compareMinY);for(let E=x;E<=b;E+=m){const C=Math.min(E+m-1,b);d.children.push(this._build(n,E,C,r-1))}}return tr(d,this.toBBox),d}_chooseSubtree(n,i,s,r){for(;r.push(i),!(i.leaf||r.length-1===s);){let h=1/0,f=1/0,d;for(let m=0;m<i.children.length;m++){const _=i.children[m],x=Ga(_),b=Vg(n,_)-x;b<f?(f=b,h=x<h?x:h,d=_):b===f&&x<h&&(h=x,d=_)}i=d||i.children[0]}return i}_insert(n,i,s){const r=s?n:this.toBBox(n),h=[],f=this._chooseSubtree(r,this.data,i,h);for(f.children.push(n),Wr(f,r);i>=0&&h[i].children.length>this._maxEntries;)this._split(h,i),i--;this._adjustParentBBoxes(r,h,i)}_split(n,i){const s=n[i],r=s.children.length,h=this._minEntries;this._chooseSplitAxis(s,h,r);const f=this._chooseSplitIndex(s,h,r),d=er(s.children.splice(f,s.children.length-f));d.height=s.height,d.leaf=s.leaf,tr(s,this.toBBox),tr(d,this.toBBox),i?n[i-1].children.push(d):this._splitRoot(s,d)}_splitRoot(n,i){this.data=er([n,i]),this.data.height=n.height+1,this.data.leaf=!1,tr(this.data,this.toBBox)}_chooseSplitIndex(n,i,s){let r,h=1/0,f=1/0;for(let d=i;d<=s-i;d++){const m=Jr(n,0,d,this.toBBox),_=Jr(n,d,s,this.toBBox),x=Xg(m,_),b=Ga(m)+Ga(_);x<h?(h=x,r=d,f=b<f?b:f):x===h&&b<f&&(f=b,r=d)}return r||s-i}_chooseSplitAxis(n,i,s){const r=n.leaf?this.compareMinX:Hg,h=n.leaf?this.compareMinY:Yg,f=this._allDistMargin(n,i,s,r),d=this._allDistMargin(n,i,s,h);f<d&&n.children.sort(r)}_allDistMargin(n,i,s,r){n.children.sort(r);const h=this.toBBox,f=Jr(n,0,i,h),d=Jr(n,s-i,s,h);let m=fs(f)+fs(d);for(let _=i;_<s-i;_++){const x=n.children[_];Wr(f,n.leaf?h(x):x),m+=fs(f)}for(let _=s-i-1;_>=i;_--){const x=n.children[_];Wr(d,n.leaf?h(x):x),m+=fs(d)}return m}_adjustParentBBoxes(n,i,s){for(let r=s;r>=0;r--)Wr(i[r],n)}_condense(n){for(let i=n.length-1,s;i>=0;i--)n[i].children.length===0?i>0?(s=n[i-1].children,s.splice(s.indexOf(n[i]),1)):this.clear():tr(n[i],this.toBBox)}};function Zg(a,n,i){if(!i)return n.indexOf(a);for(let s=0;s<n.length;s++)if(i(a,n[s]))return s;return-1}function tr(a,n){Jr(a,0,a.children.length,n,a)}function Jr(a,n,i,s,r){r||(r=er(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let h=n;h<i;h++){const f=a.children[h];Wr(r,a.leaf?s(f):f)}return r}function Wr(a,n){return a.minX=Math.min(a.minX,n.minX),a.minY=Math.min(a.minY,n.minY),a.maxX=Math.max(a.maxX,n.maxX),a.maxY=Math.max(a.maxY,n.maxY),a}function Hg(a,n){return a.minX-n.minX}function Yg(a,n){return a.minY-n.minY}function Ga(a){return(a.maxX-a.minX)*(a.maxY-a.minY)}function fs(a){return a.maxX-a.minX+(a.maxY-a.minY)}function Vg(a,n){return(Math.max(n.maxX,a.maxX)-Math.min(n.minX,a.minX))*(Math.max(n.maxY,a.maxY)-Math.min(n.minY,a.minY))}function Xg(a,n){const i=Math.max(a.minX,n.minX),s=Math.max(a.minY,n.minY),r=Math.min(a.maxX,n.maxX),h=Math.min(a.maxY,n.maxY);return Math.max(0,r-i)*Math.max(0,h-s)}function Ua(a,n){return a.minX<=n.minX&&a.minY<=n.minY&&n.maxX<=a.maxX&&n.maxY<=a.maxY}function ds(a,n){return n.minX<=a.maxX&&n.minY<=a.maxY&&n.maxX>=a.minX&&n.maxY>=a.minY}function er(a){return{children:a,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function gh(a,n,i,s,r){const h=[n,i];for(;h.length;){if(i=h.pop(),n=h.pop(),i-n<=s)continue;const f=n+Math.ceil((i-n)/s/2)*s;Gg(a,f,n,i,r),h.push(n,f,f,i)}}function qa(a){var n;if(a.bbox)n=a.bbox;else if(Array.isArray(a)&&a.length===4)n=a;else if(Array.isArray(a)&&a.length===6)n=[a[0],a[1],a[3],a[4]];else if(a.type==="Feature")n=ji(a);else if(a.type==="FeatureCollection")n=ji(a);else throw new Error("invalid geojson");return{minX:n[0],minY:n[1],maxX:n[2],maxY:n[3]}}var Jg=class{constructor(a=9){this.tree=new qg(a),this.tree.toBBox=qa}insert(a){if(a.type!=="Feature")throw new Error("invalid feature");return a.bbox=a.bbox?a.bbox:ji(a),this.tree.insert(a),this}load(a){var n=[];return Array.isArray(a)?a.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:ji(i),n.push(i)}):Zn(a,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:ji(i),n.push(i)}),this.tree.load(n),this}remove(a,n){if(a.type!=="Feature")throw new Error("invalid feature");return a.bbox=a.bbox?a.bbox:ji(a),this.tree.remove(a,n),this}clear(){return this.tree.clear(),this}search(a){var n=this.tree.search(qa(a));return Re(n)}collides(a){return this.tree.collides(qa(a))}all(){const a=this.tree.all();return Re(a)}toJSON(){return this.tree.toJSON()}fromJSON(a){return this.tree.fromJSON(a),this}};function ph(a){return new Jg(a)}function Wg(a,n){if(n=n!=null?n:{},!va(n))throw new Error("options is invalid");var i=n.precision,s=n.coordinates,r=n.mutate;if(i=i==null||isNaN(i)?6:i,s=s==null||isNaN(s)?3:s,!a)throw new Error("<geojson> is required");if(typeof i!="number")throw new Error("<precision> must be a number");if(typeof s!="number")throw new Error("<coordinates> must be a number");(r===!1||r===void 0)&&(a=JSON.parse(JSON.stringify(a)));var h=Math.pow(10,i);return Vo(a,function(f){jg(f,h,s)}),a}function jg(a,n,i){a.length>i&&a.splice(i,a.length);for(var s=0;s<a.length;s++)a[s]=Math.round(a[s]*n)/n;return a}function Kg(a){if(!a)throw new Error("geojson is required");const n=[];return Yn(a,i=>{Qg(i,n)}),Re(n)}function Qg(a,n){let i=[];const s=a.geometry;if(s!==null){switch(s.type){case"Polygon":i=Je(s);break;case"LineString":i=[Je(s)]}i.forEach(r=>{$g(r,a.properties).forEach(f=>{f.id=n.length,n.push(f)})})}}function $g(a,n){const i=[];return a.reduce((s,r)=>{const h=Pi([s,r],n);return h.bbox=tp(s,r),i.push(h),r}),i}function tp(a,n){const i=a[0],s=a[1],r=n[0],h=n[1],f=i<r?i:r,d=s<h?s:h,m=i>r?i:r,_=s>h?s:h;return[f,d,m,_]}function Za(a,n,i={}){var s=bi(a),r=bi(n),h=qn(r[1]-s[1]),f=qn(r[0]-s[0]),d=qn(s[1]),m=qn(r[1]),_=Math.pow(Math.sin(h/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(d)*Math.cos(m);return cu(2*Math.atan2(Math.sqrt(_),Math.sqrt(1-_)),i.units)}var ep=Object.defineProperty,ip=Object.defineProperties,np=Object.getOwnPropertyDescriptors,mh=Object.getOwnPropertySymbols,rp=Object.prototype.hasOwnProperty,op=Object.prototype.propertyIsEnumerable,yh=(a,n,i)=>n in a?ep(a,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[n]=i,sp=(a,n)=>{for(var i in n||(n={}))rp.call(n,i)&&yh(a,i,n[i]);if(mh)for(var i of mh(n))op.call(n,i)&&yh(a,i,n[i]);return a},ap=(a,n)=>ip(a,np(n));function lp(a,n,i={}){if(!a||!n)throw new Error("lines and inputPoint are required arguments");const s=bi(n);let r=Ue([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),h=0,f=0,d=-1;return Yn(a,function(m,_,x){d!==x&&(d=x,f=0);const b=Je(m);for(let E=0;E<b.length-1;E++){const C=Ue(b[E]),S=bi(C),O=Ue(b[E+1]),N=bi(O),G=Za(C,O,i);let D,U;N[0]===s[0]&&N[1]===s[1]?[D,U]=[N,!0]:S[0]===s[0]&&S[1]===s[1]?[D,U]=[S,!1]:[D,U]=cp(S,N,s);const W=Za(n,D,i);if(W<r.properties.pointDistance){const X=Za(C,D,i);r=Ue(D,{lineStringIndex:x,segmentIndex:U?E+1:E,totalDistance:h+X,lineDistance:f+X,segmentDistance:X,pointDistance:W,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),r.properties=ap(sp({},r.properties),{multiFeatureIndex:r.properties.lineStringIndex,index:r.properties.segmentIndex,location:r.properties.totalDistance,dist:r.properties.pointDistance})}h+=G,f+=G}}),r}function _n(a,n){const[i,s,r]=a,[h,f,d]=n;return i*h+s*f+r*d}function jr(a,n){const[i,s,r]=a,[h,f,d]=n;return[s*d-r*f,r*h-i*d,i*f-s*h]}function up(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2))}function _h(a){const n=up(a);return[a[0]/n,a[1]/n,a[2]/n]}function Ha(a){const n=qn(a[1]),i=qn(a[0]);return[Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)]}function hp(a){const[n,i,s]=a,r=Math.min(Math.max(s,-1),1),h=_a(Math.asin(r));return[_a(Math.atan2(i,n)),h]}function cp(a,n,i){const s=Ha(a),r=Ha(n),h=Ha(i),f=jr(s,r);if(f[0]===0&&f[1]===0&&f[2]===0)return _n(s,r)>0?[[...n],!0]:[[...i],!1];const d=jr(f,h);if(d[0]===0&&d[1]===0&&d[2]===0)return[[...n],!0];const m=jr(d,f),_=_h(m),x=[-_[0],-_[1],-_[2]],b=_n(h,_)>_n(h,x)?_:x,E=_h(f),C=_n(jr(s,b),E),S=_n(jr(b,r),E);return C>=0&&S>=0?[hp(b),!1]:_n(s,h)>_n(r,h)?[[...a],!1]:[[...n],!0]}function fp(a,n){if(!a)throw new Error("line is required");if(!n)throw new Error("splitter is required");const i=Xo(a),s=Xo(n);if(i!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var r=Wg(n,{precision:7});switch(a.type!=="Feature"&&(a=Xe(a)),s){case"Point":return Ya(a,r);case"MultiPoint":return vh(a,r);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return vh(a,Ki(a,r,{ignoreSelfIntersections:!0}))}}function vh(a,n){var i=[],s=ph();return Yn(n,function(r){if(i.forEach(function(d,m){d.id=m}),!i.length)i=Ya(a,r).features,s.load(Re(i));else{var h=s.search(r);if(h.features.length){var f=bh(r,h);i=i.filter(function(d){return d.id!==f.id}),s.remove(f),Zn(Ya(f,r),function(d){i.push(d),s.insert(d)})}}}),Re(i)}function Ya(a,n){var i=[],s=Je(a)[0],r=Je(a)[a.geometry.coordinates.length-1];if(Va(s,bi(n))||Va(r,bi(n)))return Re([a]);var h=ph(),f=Kg(a);h.load(f);var d=h.search(n);if(!d.features.length)return Re([a]);var m=bh(n,d),_=[s],x=ed(f,function(b,E,C){var S=Je(E)[1],O=bi(n);return C===m.id?(b.push(O),i.push(Pi(b)),Va(O,S)?[O]:[O,S]):(b.push(S),b)},_);return x.length>1&&i.push(Pi(x)),Re(i)}function bh(a,n){if(!n.features.length)throw new Error("lines must contain features");if(n.features.length===1)return n.features[0];var i,s=1/0;return Zn(n,function(r){var h=lp(r,a),f=h.properties.pointDistance;f<s&&(i=r,s=f)}),i}function Va(a,n){return a[0]===n[0]&&a[1]===n[1]}function dp(a){if(!a)throw new Error("geojson is required");switch(a.type){case"Feature":return xh(a);case"FeatureCollection":return gp(a);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Xa(a);default:throw new Error("unknown GeoJSON type")}}function xh(a){const n={type:"Feature"};return Object.keys(a).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:n[i]=a[i]}}),n.properties=wh(a.properties),a.geometry==null?n.geometry=null:n.geometry=Xa(a.geometry),n}function wh(a){const n={};return a&&Object.keys(a).forEach(i=>{const s=a[i];typeof s=="object"?s===null?n[i]=null:Array.isArray(s)?n[i]=s.map(r=>r):n[i]=wh(s):n[i]=s}),n}function gp(a){const n={type:"FeatureCollection"};return Object.keys(a).forEach(i=>{switch(i){case"type":case"features":return;default:n[i]=a[i]}}),n.features=a.features.map(i=>xh(i)),n}function Xa(a){const n={type:a.type};return a.bbox&&(n.bbox=a.bbox),a.type==="GeometryCollection"?(n.geometries=a.geometries.map(i=>Xa(i)),n):(n.coordinates=kh(a.coordinates),n)}function kh(a){const n=a;return typeof n[0]!="object"?n.slice():n.map(i=>kh(i))}function pp(a,n){var i=a[0]-n[0],s=a[1]-n[1];return i*i+s*s}function mp(a,n,i){var s=n[0],r=n[1],h=i[0]-s,f=i[1]-r;if(h!==0||f!==0){var d=((a[0]-s)*h+(a[1]-r)*f)/(h*h+f*f);d>1?(s=i[0],r=i[1]):d>0&&(s+=h*d,r+=f*d)}return h=a[0]-s,f=a[1]-r,h*h+f*f}function yp(a,n){for(var i=a[0],s=[i],r,h=1,f=a.length;h<f;h++)r=a[h],pp(r,i)>n&&(s.push(r),i=r);return i!==r&&s.push(r),s}function Ja(a,n,i,s,r){for(var h=s,f,d=n+1;d<i;d++){var m=mp(a[d],a[n],a[i]);m>h&&(f=d,h=m)}h>s&&(f-n>1&&Ja(a,n,f,s,r),r.push(a[f]),i-f>1&&Ja(a,f,i,s,r))}function _p(a,n){var i=a.length-1,s=[a[0]];return Ja(a,0,i,n,s),s.push(a[i]),s}function gs(a,n,i){if(a.length<=2)return a;var s=n!==void 0?n*n:1;return a=i?a:yp(a,s),a=_p(a,s),a}function vp(a,n={}){var i,s,r;if(n=n!=null?n:{},!va(n))throw new Error("options is invalid");const h=(i=n.tolerance)!=null?i:1,f=(s=n.highQuality)!=null?s:!1,d=(r=n.mutate)!=null?r:!1;if(!a)throw new Error("geojson is required");if(h&&h<0)throw new Error("invalid tolerance");return d!==!0&&(a=dp(a)),Hn(a,function(m){bp(m,h,f)}),a}function bp(a,n,i){const s=a.type;if(s==="Point"||s==="MultiPoint")return a;if(Ta(a,{mutate:!0}),s!=="GeometryCollection")switch(s){case"LineString":a.coordinates=gs(a.coordinates,n,i);break;case"MultiLineString":a.coordinates=a.coordinates.map(r=>gs(r,n,i));break;case"Polygon":a.coordinates=Lh(a.coordinates,n,i);break;case"MultiPolygon":a.coordinates=a.coordinates.map(r=>Lh(r,n,i))}return a}function Lh(a,n,i){return a.map(function(s){if(s.length<4)throw new Error("invalid polygon");let r=n,h=gs(s,r,i);for(;!Eh(h)&&r>=Number.EPSILON;)r-=r*.01,h=gs(s,r,i);return Eh(h)?((h[h.length-1][0]!==h[0][0]||h[h.length-1][1]!==h[0][1])&&h.push(h[0]),h):s})}function Eh(a){return a.length<3?!1:!(a.length===3&&a[2][0]===a[0][0]&&a[2][1]===a[0][1])}var xp=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Wa=Math.ceil,je=Math.floor,De="[BigNumber Error] ",Th=De+"Number primitive has more than 15 significant digits: ",fi=1e14,Pt=14,ja=9007199254740991,Ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Qi=1e7,ge=1e9;function Ih(a){var n,i,s,r=D.prototype={constructor:D,toString:null,valueOf:null},h=new D(1),f=20,d=4,m=-7,_=21,x=-1e7,b=1e7,E=!1,C=1,S=0,O={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},N="0123456789abcdefghijklmnopqrstuvwxyz",G=!0;function D(I,P){var R,F,q,H,j,B,Y,$,J=this;if(!(J instanceof D))return new D(I,P);if(P==null){if(I&&I._isBigNumber===!0){J.s=I.s,!I.c||I.e>b?J.c=J.e=null:I.e<x?J.c=[J.e=0]:(J.e=I.e,J.c=I.c.slice());return}if((B=typeof I=="number")&&I*0==0){if(J.s=1/I<0?(I=-I,-1):1,I===~~I){for(H=0,j=I;j>=10;j/=10,H++);H>b?J.c=J.e=null:(J.e=H,J.c=[I]);return}$=String(I)}else{if(!xp.test($=String(I)))return s(J,$,B);J.s=$.charCodeAt(0)==45?($=$.slice(1),-1):1}(H=$.indexOf("."))>-1&&($=$.replace(".","")),(j=$.search(/e/i))>0?(H<0&&(H=j),H+=+$.slice(j+1),$=$.substring(0,j)):H<0&&(H=$.length)}else{if(ne(P,2,N.length,"Base"),P==10&&G)return J=new D(I),et(J,f+J.e+1,d);if($=String(I),B=typeof I=="number"){if(I*0!=0)return s(J,$,B,P);if(J.s=1/I<0?($=$.slice(1),-1):1,D.DEBUG&&$.replace(/^0\.0*|\./,"").length>15)throw Error(Th+I)}else J.s=$.charCodeAt(0)===45?($=$.slice(1),-1):1;for(R=N.slice(0,P),H=j=0,Y=$.length;j<Y;j++)if(R.indexOf(F=$.charAt(j))<0){if(F=="."){if(j>H){H=Y;continue}}else if(!q&&($==$.toUpperCase()&&($=$.toLowerCase())||$==$.toLowerCase()&&($=$.toUpperCase()))){q=!0,j=-1,H=0;continue}return s(J,String(I),B,P)}B=!1,$=i($,P,10,J.s),(H=$.indexOf("."))>-1?$=$.replace(".",""):H=$.length}for(j=0;$.charCodeAt(j)===48;j++);for(Y=$.length;$.charCodeAt(--Y)===48;);if($=$.slice(j,++Y)){if(Y-=j,B&&D.DEBUG&&Y>15&&(I>ja||I!==je(I)))throw Error(Th+J.s*I);if((H=H-j-1)>b)J.c=J.e=null;else if(H<x)J.c=[J.e=0];else{if(J.e=H,J.c=[],j=(H+1)%Pt,H<0&&(j+=Pt),j<Y){for(j&&J.c.push(+$.slice(0,j)),Y-=Pt;j<Y;)J.c.push(+$.slice(j,j+=Pt));j=Pt-($=$.slice(j)).length}else j-=Y;for(;j--;$+="0");J.c.push(+$)}}else J.c=[J.e=0]}D.clone=Ih,D.ROUND_UP=0,D.ROUND_DOWN=1,D.ROUND_CEIL=2,D.ROUND_FLOOR=3,D.ROUND_HALF_UP=4,D.ROUND_HALF_DOWN=5,D.ROUND_HALF_EVEN=6,D.ROUND_HALF_CEIL=7,D.ROUND_HALF_FLOOR=8,D.EUCLID=9,D.config=D.set=function(I){var P,R;if(I!=null)if(typeof I=="object"){if(I.hasOwnProperty(P="DECIMAL_PLACES")&&(R=I[P],ne(R,0,ge,P),f=R),I.hasOwnProperty(P="ROUNDING_MODE")&&(R=I[P],ne(R,0,8,P),d=R),I.hasOwnProperty(P="EXPONENTIAL_AT")&&(R=I[P],R&&R.pop?(ne(R[0],-ge,0,P),ne(R[1],0,ge,P),m=R[0],_=R[1]):(ne(R,-ge,ge,P),m=-(_=R<0?-R:R))),I.hasOwnProperty(P="RANGE"))if(R=I[P],R&&R.pop)ne(R[0],-ge,-1,P),ne(R[1],1,ge,P),x=R[0],b=R[1];else if(ne(R,-ge,ge,P),R)x=-(b=R<0?-R:R);else throw Error(De+P+" cannot be zero: "+R);if(I.hasOwnProperty(P="CRYPTO"))if(R=I[P],R===!!R)if(R)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))E=R;else throw E=!R,Error(De+"crypto unavailable");else E=R;else throw Error(De+P+" not true or false: "+R);if(I.hasOwnProperty(P="MODULO_MODE")&&(R=I[P],ne(R,0,9,P),C=R),I.hasOwnProperty(P="POW_PRECISION")&&(R=I[P],ne(R,0,ge,P),S=R),I.hasOwnProperty(P="FORMAT"))if(R=I[P],typeof R=="object")O=R;else throw Error(De+P+" not an object: "+R);if(I.hasOwnProperty(P="ALPHABET"))if(R=I[P],typeof R=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(R))G=R.slice(0,10)=="0123456789",N=R;else throw Error(De+P+" invalid: "+R)}else throw Error(De+"Object expected: "+I);return{DECIMAL_PLACES:f,ROUNDING_MODE:d,EXPONENTIAL_AT:[m,_],RANGE:[x,b],CRYPTO:E,MODULO_MODE:C,POW_PRECISION:S,FORMAT:O,ALPHABET:N}},D.isBigNumber=function(I){if(!I||I._isBigNumber!==!0)return!1;if(!D.DEBUG)return!0;var P,R,F=I.c,q=I.e,H=I.s;t:if({}.toString.call(F)=="[object Array]"){if((H===1||H===-1)&&q>=-ge&&q<=ge&&q===je(q)){if(F[0]===0){if(q===0&&F.length===1)return!0;break t}if(P=(q+1)%Pt,P<1&&(P+=Pt),String(F[0]).length==P){for(P=0;P<F.length;P++)if(R=F[P],R<0||R>=fi||R!==je(R))break t;if(R!==0)return!0}}}else if(F===null&&q===null&&(H===null||H===1||H===-1))return!0;throw Error(De+"Invalid BigNumber: "+I)},D.maximum=D.max=function(){return W(arguments,-1)},D.minimum=D.min=function(){return W(arguments,1)},D.random=(function(){var I=9007199254740992,P=Math.random()*I&2097151?function(){return je(Math.random()*I)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(R){var F,q,H,j,B,Y=0,$=[],J=new D(h);if(R==null?R=f:ne(R,0,ge),j=Wa(R/Pt),E)if(crypto.getRandomValues){for(F=crypto.getRandomValues(new Uint32Array(j*=2));Y<j;)B=F[Y]*131072+(F[Y+1]>>>11),B>=9e15?(q=crypto.getRandomValues(new Uint32Array(2)),F[Y]=q[0],F[Y+1]=q[1]):($.push(B%1e14),Y+=2);Y=j/2}else if(crypto.randomBytes){for(F=crypto.randomBytes(j*=7);Y<j;)B=(F[Y]&31)*281474976710656+F[Y+1]*1099511627776+F[Y+2]*4294967296+F[Y+3]*16777216+(F[Y+4]<<16)+(F[Y+5]<<8)+F[Y+6],B>=9e15?crypto.randomBytes(7).copy(F,Y):($.push(B%1e14),Y+=7);Y=j/7}else throw E=!1,Error(De+"crypto unavailable");if(!E)for(;Y<j;)B=P(),B<9e15&&($[Y++]=B%1e14);for(j=$[--Y],R%=Pt,j&&R&&(B=Ka[Pt-R],$[Y]=je(j/B)*B);$[Y]===0;$.pop(),Y--);if(Y<0)$=[H=0];else{for(H=-1;$[0]===0;$.splice(0,1),H-=Pt);for(Y=1,B=$[0];B>=10;B/=10,Y++);Y<Pt&&(H-=Pt-Y)}return J.e=H,J.c=$,J}})(),D.sum=function(){for(var I=1,P=arguments,R=new D(P[0]);I<P.length;)R=R.plus(P[I++]);return R},i=(function(){var I="0123456789";function P(R,F,q,H){for(var j,B=[0],Y,$=0,J=R.length;$<J;){for(Y=B.length;Y--;B[Y]*=F);for(B[0]+=H.indexOf(R.charAt($++)),j=0;j<B.length;j++)B[j]>q-1&&(B[j+1]==null&&(B[j+1]=0),B[j+1]+=B[j]/q|0,B[j]%=q)}return B.reverse()}return function(R,F,q,H,j){var B,Y,$,J,at,rt,ht,_t,kt=R.indexOf("."),dt=f,pt=d;for(kt>=0&&(J=S,S=0,R=R.replace(".",""),_t=new D(F),rt=_t.pow(R.length-kt),S=J,_t.c=P(Bi(Qe(rt.c),rt.e,"0"),10,q,I),_t.e=_t.c.length),ht=P(R,F,q,j?(B=N,I):(B=I,N)),$=J=ht.length;ht[--J]==0;ht.pop());if(!ht[0])return B.charAt(0);if(kt<0?--$:(rt.c=ht,rt.e=$,rt.s=H,rt=n(rt,_t,dt,pt,q),ht=rt.c,at=rt.r,$=rt.e),Y=$+dt+1,kt=ht[Y],J=q/2,at=at||Y<0||ht[Y+1]!=null,at=pt<4?(kt!=null||at)&&(pt==0||pt==(rt.s<0?3:2)):kt>J||kt==J&&(pt==4||at||pt==6&&ht[Y-1]&1||pt==(rt.s<0?8:7)),Y<1||!ht[0])R=at?Bi(B.charAt(1),-dt,B.charAt(0)):B.charAt(0);else{if(ht.length=Y,at)for(--q;++ht[--Y]>q;)ht[Y]=0,Y||(++$,ht=[1].concat(ht));for(J=ht.length;!ht[--J];);for(kt=0,R="";kt<=J;R+=B.charAt(ht[kt++]));R=Bi(R,$,B.charAt(0))}return R}})(),n=(function(){function I(F,q,H){var j,B,Y,$,J=0,at=F.length,rt=q%Qi,ht=q/Qi|0;for(F=F.slice();at--;)Y=F[at]%Qi,$=F[at]/Qi|0,j=ht*Y+$*rt,B=rt*Y+j%Qi*Qi+J,J=(B/H|0)+(j/Qi|0)+ht*$,F[at]=B%H;return J&&(F=[J].concat(F)),F}function P(F,q,H,j){var B,Y;if(H!=j)Y=H>j?1:-1;else for(B=Y=0;B<H;B++)if(F[B]!=q[B]){Y=F[B]>q[B]?1:-1;break}return Y}function R(F,q,H,j){for(var B=0;H--;)F[H]-=B,B=F[H]<q[H]?1:0,F[H]=B*j+F[H]-q[H];for(;!F[0]&&F.length>1;F.splice(0,1));}return function(F,q,H,j,B){var Y,$,J,at,rt,ht,_t,kt,dt,pt,vt,Yt,tt,en,qt,mt,Z,Wt=F.s==q.s?1:-1,oe=F.c,Ut=q.c;if(!oe||!oe[0]||!Ut||!Ut[0])return new D(!F.s||!q.s||(oe?Ut&&oe[0]==Ut[0]:!Ut)?NaN:oe&&oe[0]==0||!Ut?Wt*0:Wt/0);for(kt=new D(Wt),dt=kt.c=[],$=F.e-q.e,Wt=H+$+1,B||(B=fi,$=Ke(F.e/Pt)-Ke(q.e/Pt),Wt=Wt/Pt|0),J=0;Ut[J]==(oe[J]||0);J++);if(Ut[J]>(oe[J]||0)&&$--,Wt<0)dt.push(1),at=!0;else{for(en=oe.length,mt=Ut.length,J=0,Wt+=2,rt=je(B/(Ut[0]+1)),rt>1&&(Ut=I(Ut,rt,B),oe=I(oe,rt,B),mt=Ut.length,en=oe.length),tt=mt,pt=oe.slice(0,mt),vt=pt.length;vt<mt;pt[vt++]=0);Z=Ut.slice(),Z=[0].concat(Z),qt=Ut[0],Ut[1]>=B/2&&qt++;do{if(rt=0,Y=P(Ut,pt,mt,vt),Y<0){if(Yt=pt[0],mt!=vt&&(Yt=Yt*B+(pt[1]||0)),rt=je(Yt/qt),rt>1)for(rt>=B&&(rt=B-1),ht=I(Ut,rt,B),_t=ht.length,vt=pt.length;P(ht,pt,_t,vt)==1;)rt--,R(ht,mt<_t?Z:Ut,_t,B),_t=ht.length,Y=1;else rt==0&&(Y=rt=1),ht=Ut.slice(),_t=ht.length;if(_t<vt&&(ht=[0].concat(ht)),R(pt,ht,vt,B),vt=pt.length,Y==-1)for(;P(Ut,pt,mt,vt)<1;)rt++,R(pt,mt<vt?Z:Ut,vt,B),vt=pt.length}else Y===0&&(rt++,pt=[0]);dt[J++]=rt,pt[0]?pt[vt++]=oe[tt]||0:(pt=[oe[tt]],vt=1)}while((tt++<en||pt[0]!=null)&&Wt--);at=pt[0]!=null,dt[0]||dt.splice(0,1)}if(B==fi){for(J=1,Wt=dt[0];Wt>=10;Wt/=10,J++);et(kt,H+(kt.e=J+$*Pt-1)+1,j,at)}else kt.e=$,kt.r=+at;return kt}})();function U(I,P,R,F){var q,H,j,B,Y;if(R==null?R=d:ne(R,0,8),!I.c)return I.toString();if(q=I.c[0],j=I.e,P==null)Y=Qe(I.c),Y=F==1||F==2&&(j<=m||j>=_)?ms(Y,j):Bi(Y,j,"0");else if(I=et(new D(I),P,R),H=I.e,Y=Qe(I.c),B=Y.length,F==1||F==2&&(P<=H||H<=m)){for(;B<P;Y+="0",B++);Y=ms(Y,H)}else if(P-=j+(F===2&&H>j),Y=Bi(Y,H,"0"),H+1>B){if(--P>0)for(Y+=".";P--;Y+="0");}else if(P+=H-B,P>0)for(H+1==B&&(Y+=".");P--;Y+="0");return I.s<0&&q?"-"+Y:Y}function W(I,P){for(var R,F,q=1,H=new D(I[0]);q<I.length;q++)F=new D(I[q]),(!F.s||(R=vn(H,F))===P||R===0&&H.s===P)&&(H=F);return H}function X(I,P,R){for(var F=1,q=P.length;!P[--q];P.pop());for(q=P[0];q>=10;q/=10,F++);return(R=F+R*Pt-1)>b?I.c=I.e=null:R<x?I.c=[I.e=0]:(I.e=R,I.c=P),I}s=(function(){var I=/^(-?)0([xbo])(?=\w[\w.]*$)/i,P=/^([^.]+)\.$/,R=/^\.([^.]+)$/,F=/^-?(Infinity|NaN)$/,q=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(H,j,B,Y){var $,J=B?j:j.replace(q,"");if(F.test(J))H.s=isNaN(J)?null:J<0?-1:1;else{if(!B&&(J=J.replace(I,function(at,rt,ht){return $=(ht=ht.toLowerCase())=="x"?16:ht=="b"?2:8,!Y||Y==$?rt:at}),Y&&($=Y,J=J.replace(P,"$1").replace(R,"0.$1")),j!=J))return new D(J,$);if(D.DEBUG)throw Error(De+"Not a"+(Y?" base "+Y:"")+" number: "+j);H.s=null}H.c=H.e=null}})();function et(I,P,R,F){var q,H,j,B,Y,$,J,at=I.c,rt=Ka;if(at){t:{for(q=1,B=at[0];B>=10;B/=10,q++);if(H=P-q,H<0)H+=Pt,j=P,Y=at[$=0],J=je(Y/rt[q-j-1]%10);else if($=Wa((H+1)/Pt),$>=at.length)if(F){for(;at.length<=$;at.push(0));Y=J=0,q=1,H%=Pt,j=H-Pt+1}else break t;else{for(Y=B=at[$],q=1;B>=10;B/=10,q++);H%=Pt,j=H-Pt+q,J=j<0?0:je(Y/rt[q-j-1]%10)}if(F=F||P<0||at[$+1]!=null||(j<0?Y:Y%rt[q-j-1]),F=R<4?(J||F)&&(R==0||R==(I.s<0?3:2)):J>5||J==5&&(R==4||F||R==6&&(H>0?j>0?Y/rt[q-j]:0:at[$-1])%10&1||R==(I.s<0?8:7)),P<1||!at[0])return at.length=0,F?(P-=I.e+1,at[0]=rt[(Pt-P%Pt)%Pt],I.e=-P||0):at[0]=I.e=0,I;if(H==0?(at.length=$,B=1,$--):(at.length=$+1,B=rt[Pt-H],at[$]=j>0?je(Y/rt[q-j]%rt[j])*B:0),F)for(;;)if($==0){for(H=1,j=at[0];j>=10;j/=10,H++);for(j=at[0]+=B,B=1;j>=10;j/=10,B++);H!=B&&(I.e++,at[0]==fi&&(at[0]=1));break}else{if(at[$]+=B,at[$]!=fi)break;at[$--]=0,B=1}for(H=at.length;at[--H]===0;at.pop());}I.e>b?I.c=I.e=null:I.e<x&&(I.c=[I.e=0])}return I}function ot(I){var P,R=I.e;return R===null?I.toString():(P=Qe(I.c),P=R<=m||R>=_?ms(P,R):Bi(P,R,"0"),I.s<0?"-"+P:P)}return r.absoluteValue=r.abs=function(){var I=new D(this);return I.s<0&&(I.s=1),I},r.comparedTo=function(I,P){return vn(this,new D(I,P))},r.decimalPlaces=r.dp=function(I,P){var R,F,q,H=this;if(I!=null)return ne(I,0,ge),P==null?P=d:ne(P,0,8),et(new D(H),I+H.e+1,P);if(!(R=H.c))return null;if(F=((q=R.length-1)-Ke(this.e/Pt))*Pt,q=R[q])for(;q%10==0;q/=10,F--);return F<0&&(F=0),F},r.dividedBy=r.div=function(I,P){return n(this,new D(I,P),f,d)},r.dividedToIntegerBy=r.idiv=function(I,P){return n(this,new D(I,P),0,1)},r.exponentiatedBy=r.pow=function(I,P){var R,F,q,H,j,B,Y,$,J,at=this;if(I=new D(I),I.c&&!I.isInteger())throw Error(De+"Exponent not an integer: "+ot(I));if(P!=null&&(P=new D(P)),B=I.e>14,!at.c||!at.c[0]||at.c[0]==1&&!at.e&&at.c.length==1||!I.c||!I.c[0])return J=new D(Math.pow(+ot(at),B?I.s*(2-ps(I)):+ot(I))),P?J.mod(P):J;if(Y=I.s<0,P){if(P.c?!P.c[0]:!P.s)return new D(NaN);F=!Y&&at.isInteger()&&P.isInteger(),F&&(at=at.mod(P))}else{if(I.e>9&&(at.e>0||at.e<-1||(at.e==0?at.c[0]>1||B&&at.c[1]>=24e7:at.c[0]<8e13||B&&at.c[0]<=9999975e7)))return H=at.s<0&&ps(I)?-0:0,at.e>-1&&(H=1/H),new D(Y?1/H:H);S&&(H=Wa(S/Pt+2))}for(B?(R=new D(.5),Y&&(I.s=1),$=ps(I)):(q=Math.abs(+ot(I)),$=q%2),J=new D(h);;){if($){if(J=J.times(at),!J.c)break;H?J.c.length>H&&(J.c.length=H):F&&(J=J.mod(P))}if(q){if(q=je(q/2),q===0)break;$=q%2}else if(I=I.times(R),et(I,I.e+1,1),I.e>14)$=ps(I);else{if(q=+ot(I),q===0)break;$=q%2}at=at.times(at),H?at.c&&at.c.length>H&&(at.c.length=H):F&&(at=at.mod(P))}return F?J:(Y&&(J=h.div(J)),P?J.mod(P):H?et(J,S,d,j):J)},r.integerValue=function(I){var P=new D(this);return I==null?I=d:ne(I,0,8),et(P,P.e+1,I)},r.isEqualTo=r.eq=function(I,P){return vn(this,new D(I,P))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(I,P){return vn(this,new D(I,P))>0},r.isGreaterThanOrEqualTo=r.gte=function(I,P){return(P=vn(this,new D(I,P)))===1||P===0},r.isInteger=function(){return!!this.c&&Ke(this.e/Pt)>this.c.length-2},r.isLessThan=r.lt=function(I,P){return vn(this,new D(I,P))<0},r.isLessThanOrEqualTo=r.lte=function(I,P){return(P=vn(this,new D(I,P)))===-1||P===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(I,P){var R,F,q,H,j=this,B=j.s;if(I=new D(I,P),P=I.s,!B||!P)return new D(NaN);if(B!=P)return I.s=-P,j.plus(I);var Y=j.e/Pt,$=I.e/Pt,J=j.c,at=I.c;if(!Y||!$){if(!J||!at)return J?(I.s=-P,I):new D(at?j:NaN);if(!J[0]||!at[0])return at[0]?(I.s=-P,I):new D(J[0]?j:d==3?-0:0)}if(Y=Ke(Y),$=Ke($),J=J.slice(),B=Y-$){for((H=B<0)?(B=-B,q=J):($=Y,q=at),q.reverse(),P=B;P--;q.push(0));q.reverse()}else for(F=(H=(B=J.length)<(P=at.length))?B:P,B=P=0;P<F;P++)if(J[P]!=at[P]){H=J[P]<at[P];break}if(H&&(q=J,J=at,at=q,I.s=-I.s),P=(F=at.length)-(R=J.length),P>0)for(;P--;J[R++]=0);for(P=fi-1;F>B;){if(J[--F]<at[F]){for(R=F;R&&!J[--R];J[R]=P);--J[R],J[F]+=fi}J[F]-=at[F]}for(;J[0]==0;J.splice(0,1),--$);return J[0]?X(I,J,$):(I.s=d==3?-1:1,I.c=[I.e=0],I)},r.modulo=r.mod=function(I,P){var R,F,q=this;return I=new D(I,P),!q.c||!I.s||I.c&&!I.c[0]?new D(NaN):!I.c||q.c&&!q.c[0]?new D(q):(C==9?(F=I.s,I.s=1,R=n(q,I,0,3),I.s=F,R.s*=F):R=n(q,I,0,C),I=q.minus(R.times(I)),!I.c[0]&&C==1&&(I.s=q.s),I)},r.multipliedBy=r.times=function(I,P){var R,F,q,H,j,B,Y,$,J,at,rt,ht,_t,kt,dt,pt=this,vt=pt.c,Yt=(I=new D(I,P)).c;if(!vt||!Yt||!vt[0]||!Yt[0])return!pt.s||!I.s||vt&&!vt[0]&&!Yt||Yt&&!Yt[0]&&!vt?I.c=I.e=I.s=null:(I.s*=pt.s,!vt||!Yt?I.c=I.e=null:(I.c=[0],I.e=0)),I;for(F=Ke(pt.e/Pt)+Ke(I.e/Pt),I.s*=pt.s,Y=vt.length,at=Yt.length,Y<at&&(_t=vt,vt=Yt,Yt=_t,q=Y,Y=at,at=q),q=Y+at,_t=[];q--;_t.push(0));for(kt=fi,dt=Qi,q=at;--q>=0;){for(R=0,rt=Yt[q]%dt,ht=Yt[q]/dt|0,j=Y,H=q+j;H>q;)$=vt[--j]%dt,J=vt[j]/dt|0,B=ht*$+J*rt,$=rt*$+B%dt*dt+_t[H]+R,R=($/kt|0)+(B/dt|0)+ht*J,_t[H--]=$%kt;_t[H]=R}return R?++F:_t.splice(0,1),X(I,_t,F)},r.negated=function(){var I=new D(this);return I.s=-I.s||null,I},r.plus=function(I,P){var R,F=this,q=F.s;if(I=new D(I,P),P=I.s,!q||!P)return new D(NaN);if(q!=P)return I.s=-P,F.minus(I);var H=F.e/Pt,j=I.e/Pt,B=F.c,Y=I.c;if(!H||!j){if(!B||!Y)return new D(q/0);if(!B[0]||!Y[0])return Y[0]?I:new D(B[0]?F:q*0)}if(H=Ke(H),j=Ke(j),B=B.slice(),q=H-j){for(q>0?(j=H,R=Y):(q=-q,R=B),R.reverse();q--;R.push(0));R.reverse()}for(q=B.length,P=Y.length,q-P<0&&(R=Y,Y=B,B=R,P=q),q=0;P;)q=(B[--P]=B[P]+Y[P]+q)/fi|0,B[P]=fi===B[P]?0:B[P]%fi;return q&&(B=[q].concat(B),++j),X(I,B,j)},r.precision=r.sd=function(I,P){var R,F,q,H=this;if(I!=null&&I!==!!I)return ne(I,1,ge),P==null?P=d:ne(P,0,8),et(new D(H),I,P);if(!(R=H.c))return null;if(q=R.length-1,F=q*Pt+1,q=R[q]){for(;q%10==0;q/=10,F--);for(q=R[0];q>=10;q/=10,F++);}return I&&H.e+1>F&&(F=H.e+1),F},r.shiftedBy=function(I){return ne(I,-ja,ja),this.times("1e"+I)},r.squareRoot=r.sqrt=function(){var I,P,R,F,q,H=this,j=H.c,B=H.s,Y=H.e,$=f+4,J=new D("0.5");if(B!==1||!j||!j[0])return new D(!B||B<0&&(!j||j[0])?NaN:j?H:1/0);if(B=Math.sqrt(+ot(H)),B==0||B==1/0?(P=Qe(j),(P.length+Y)%2==0&&(P+="0"),B=Math.sqrt(+P),Y=Ke((Y+1)/2)-(Y<0||Y%2),B==1/0?P="5e"+Y:(P=B.toExponential(),P=P.slice(0,P.indexOf("e")+1)+Y),R=new D(P)):R=new D(B+""),R.c[0]){for(Y=R.e,B=Y+$,B<3&&(B=0);;)if(q=R,R=J.times(q.plus(n(H,q,$,1))),Qe(q.c).slice(0,B)===(P=Qe(R.c)).slice(0,B))if(R.e<Y&&--B,P=P.slice(B-3,B+1),P=="9999"||!F&&P=="4999"){if(!F&&(et(q,q.e+f+2,0),q.times(q).eq(H))){R=q;break}$+=4,B+=4,F=1}else{(!+P||!+P.slice(1)&&P.charAt(0)=="5")&&(et(R,R.e+f+2,1),I=!R.times(R).eq(H));break}}return et(R,R.e+f+1,d,I)},r.toExponential=function(I,P){return I!=null&&(ne(I,0,ge),I++),U(this,I,P,1)},r.toFixed=function(I,P){return I!=null&&(ne(I,0,ge),I=I+this.e+1),U(this,I,P)},r.toFormat=function(I,P,R){var F,q=this;if(R==null)I!=null&&P&&typeof P=="object"?(R=P,P=null):I&&typeof I=="object"?(R=I,I=P=null):R=O;else if(typeof R!="object")throw Error(De+"Argument not an object: "+R);if(F=q.toFixed(I,P),q.c){var H,j=F.split("."),B=+R.groupSize,Y=+R.secondaryGroupSize,$=R.groupSeparator||"",J=j[0],at=j[1],rt=q.s<0,ht=rt?J.slice(1):J,_t=ht.length;if(Y&&(H=B,B=Y,Y=H,_t-=H),B>0&&_t>0){for(H=_t%B||B,J=ht.substr(0,H);H<_t;H+=B)J+=$+ht.substr(H,B);Y>0&&(J+=$+ht.slice(H)),rt&&(J="-"+J)}F=at?J+(R.decimalSeparator||"")+((Y=+R.fractionGroupSize)?at.replace(new RegExp("\\d{"+Y+"}\\B","g"),"$&"+(R.fractionGroupSeparator||"")):at):J}return(R.prefix||"")+F+(R.suffix||"")},r.toFraction=function(I){var P,R,F,q,H,j,B,Y,$,J,at,rt,ht=this,_t=ht.c;if(I!=null&&(B=new D(I),!B.isInteger()&&(B.c||B.s!==1)||B.lt(h)))throw Error(De+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+ot(B));if(!_t)return new D(ht);for(P=new D(h),$=R=new D(h),F=Y=new D(h),rt=Qe(_t),H=P.e=rt.length-ht.e-1,P.c[0]=Ka[(j=H%Pt)<0?Pt+j:j],I=!I||B.comparedTo(P)>0?H>0?P:$:B,j=b,b=1/0,B=new D(rt),Y.c[0]=0;J=n(B,P,0,1),q=R.plus(J.times(F)),q.comparedTo(I)!=1;)R=F,F=q,$=Y.plus(J.times(q=$)),Y=q,P=B.minus(J.times(q=P)),B=q;return q=n(I.minus(R),F,0,1),Y=Y.plus(q.times($)),R=R.plus(q.times(F)),Y.s=$.s=ht.s,H=H*2,at=n($,F,H,d).minus(ht).abs().comparedTo(n(Y,R,H,d).minus(ht).abs())<1?[$,F]:[Y,R],b=j,at},r.toNumber=function(){return+ot(this)},r.toPrecision=function(I,P){return I!=null&&ne(I,1,ge),U(this,I,P,2)},r.toString=function(I){var P,R=this,F=R.s,q=R.e;return q===null?F?(P="Infinity",F<0&&(P="-"+P)):P="NaN":(I==null?P=q<=m||q>=_?ms(Qe(R.c),q):Bi(Qe(R.c),q,"0"):I===10&&G?(R=et(new D(R),f+q+1,d),P=Bi(Qe(R.c),R.e,"0")):(ne(I,2,N.length,"Base"),P=i(Bi(Qe(R.c),q,"0"),10,I,F,!0)),F<0&&R.c[0]&&(P="-"+P)),P},r.valueOf=r.toJSON=function(){return ot(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,a!=null&&D.set(a),D}function Ke(a){var n=a|0;return a>0||a===n?n:n-1}function Qe(a){for(var n,i,s=1,r=a.length,h=a[0]+"";s<r;){for(n=a[s++]+"",i=Pt-n.length;i--;n="0"+n);h+=n}for(r=h.length;h.charCodeAt(--r)===48;);return h.slice(0,r+1||1)}function vn(a,n){var i,s,r=a.c,h=n.c,f=a.s,d=n.s,m=a.e,_=n.e;if(!f||!d)return null;if(i=r&&!r[0],s=h&&!h[0],i||s)return i?s?0:-d:f;if(f!=d)return f;if(i=f<0,s=m==_,!r||!h)return s?0:!r^i?1:-1;if(!s)return m>_^i?1:-1;for(d=(m=r.length)<(_=h.length)?m:_,f=0;f<d;f++)if(r[f]!=h[f])return r[f]>h[f]^i?1:-1;return m==_?0:m>_^i?1:-1}function ne(a,n,i,s){if(a<n||a>i||a!==je(a))throw Error(De+(s||"Argument")+(typeof a=="number"?a<n||a>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(a))}function ps(a){var n=a.c.length-1;return Ke(a.e/Pt)==n&&a.c[n]%2!=0}function ms(a,n){return(a.length>1?a.charAt(0)+"."+a.slice(1):a)+(n<0?"e":"e+")+n}function Bi(a,n,i){var s,r;if(n<0){for(r=i+".";++n;r+=i);a=r+a}else if(s=a.length,++n>s){for(r=i,n-=s;--n;r+=i);a+=r}else n<s&&(a=a.slice(0,n)+"."+a.slice(n));return a}var xi=Ih(),wp=class{constructor(a){Q(this,"key");Q(this,"left",null);Q(this,"right",null);this.key=a}},Kr=class extends wp{constructor(a){super(a)}},kp=class{constructor(){Q(this,"size",0);Q(this,"modificationCount",0);Q(this,"splayCount",0)}splay(a){const n=this.root;if(n==null)return this.compare(a,a),-1;let i=null,s=null,r=null,h=null,f=n;const d=this.compare;let m;for(;;)if(m=d(f.key,a),m>0){let _=f.left;if(_==null||(m=d(_.key,a),m>0&&(f.left=_.right,_.right=f,f=_,_=f.left,_==null)))break;i==null?s=f:i.left=f,i=f,f=_}else if(m<0){let _=f.right;if(_==null||(m=d(_.key,a),m<0&&(f.right=_.left,_.left=f,f=_,_=f.right,_==null)))break;r==null?h=f:r.right=f,r=f,f=_}else break;return r!=null&&(r.right=f.left,f.left=h),i!=null&&(i.left=f.right,f.right=s),this.root!==f&&(this.root=f,this.splayCount++),m}splayMin(a){let n=a,i=n.left;for(;i!=null;){const s=i;n.left=s.right,s.right=n,n=s,i=n.left}return n}splayMax(a){let n=a,i=n.right;for(;i!=null;){const s=i;n.right=s.left,s.left=n,n=s,i=n.right}return n}_delete(a){if(this.root==null||this.splay(a)!=0)return null;let i=this.root;const s=i,r=i.left;if(this.size--,r==null)this.root=i.right;else{const h=i.right;i=this.splayMax(r),i.right=h,this.root=i}return this.modificationCount++,s}addNewRoot(a,n){this.size++,this.modificationCount++;const i=this.root;if(i==null){this.root=a;return}n<0?(a.left=i,a.right=i.right,i.right=null):(a.right=i,a.left=i.left,i.left=null),this.root=a}_first(){const a=this.root;return a==null?null:(this.root=this.splayMin(a),this.root)}_last(){const a=this.root;return a==null?null:(this.root=this.splayMax(a),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(a){return this.validKey(a)&&this.splay(a)==0}defaultCompare(){return(a,n)=>a<n?-1:a>n?1:0}wrap(){return{getRoot:()=>this.root,setRoot:a=>{this.root=a},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:a=>{this.splayCount=a},splay:a=>this.splay(a),has:a=>this.has(a)}}},ys=class Oo extends kp{constructor(i,s){super();Q(this,"root",null);Q(this,"compare");Q(this,"validKey");Q(this,Wh,"[object Set]");this.compare=i!=null?i:this.defaultCompare(),this.validKey=s!=null?s:(r=>r!=null&&r!=null)}delete(i){return this.validKey(i)?this._delete(i)!=null:!1}deleteAll(i){for(const s of i)this.delete(s)}forEach(i){const s=this[Symbol.iterator]();let r;for(;r=s.next(),!r.done;)i(r.value,r.value,this)}add(i){const s=this.splay(i);return s!=0&&this.addNewRoot(new Kr(i),s),this}addAndReturn(i){const s=this.splay(i);return s!=0&&this.addNewRoot(new Kr(i),s),this.root.key}addAll(i){for(const s of i)this.add(s)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(i){if(i==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(i)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let h=r.right;for(;h!=null;)r=h,h=r.right;return r.key}firstAfter(i){if(i==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(i)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let h=r.left;for(;h!=null;)r=h,h=r.left;return r.key}retainAll(i){const s=new Oo(this.compare,this.validKey),r=this.modificationCount;for(const h of i){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(h)&&this.splay(h)==0&&s.add(this.root.key)}s.size!=this.size&&(this.root=s.root,this.size=s.size,this.modificationCount++)}lookup(i){return!this.validKey(i)||this.splay(i)!=0?null:this.root.key}intersection(i){const s=new Oo(this.compare,this.validKey);for(const r of this)i.has(r)&&s.add(r);return s}difference(i){const s=new Oo(this.compare,this.validKey);for(const r of this)i.has(r)||s.add(r);return s}union(i){const s=this.clone();return s.addAll(i),s}clone(){const i=new Oo(this.compare,this.validKey);return i.size=this.size,i.root=this.copyNode(this.root),i}copyNode(i){if(i==null)return null;function s(h,f){let d,m;do{if(d=h.left,m=h.right,d!=null){const _=new Kr(d.key);f.left=_,s(d,_)}if(m!=null){const _=new Kr(m.key);f.right=_,h=m,f=_}}while(m!=null)}const r=new Kr(i.key);return s(i,r),r}toSet(){return this.clone()}entries(){return new Ep(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(jh=Symbol.iterator,Wh=Symbol.toStringTag,jh)](){return new Lp(this.wrap())}},Ch=class{constructor(a){Q(this,"tree");Q(this,"path",new Array);Q(this,"modificationCount",null);Q(this,"splayCount");this.tree=a,this.splayCount=a.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const a=this.path[this.path.length-1];return this.getValue(a)}rebuildPath(a){this.path.splice(0,this.path.length),this.tree.splay(a),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(a){for(;a!=null;)this.path.push(a),a=a.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let a=this.path[this.path.length-1],n=a.right;if(n!=null){for(;n!=null;)this.path.push(n),n=n.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===a;)a=this.path.pop();return this.path.length>0}},Lp=class extends Ch{getValue(a){return a.key}},Ep=class extends Ch{getValue(a){return[a.key,a.key]}},Sh=a=>()=>a,Qa=a=>{const n=a?(i,s)=>s.minus(i).abs().isLessThanOrEqualTo(a):Sh(!1);return(i,s)=>n(i,s)?0:i.comparedTo(s)};function Tp(a){const n=a?(i,s,r,h,f)=>i.exponentiatedBy(2).isLessThanOrEqualTo(h.minus(s).exponentiatedBy(2).plus(f.minus(r).exponentiatedBy(2)).times(a)):Sh(!1);return(i,s,r)=>{const h=i.x,f=i.y,d=r.x,m=r.y,_=f.minus(m).times(s.x.minus(d)).minus(h.minus(d).times(s.y.minus(m)));return n(_,h,f,d,m)?0:_.comparedTo(0)}}var Ip=a=>a,Cp=a=>{if(a){const n=new ys(Qa(a)),i=new ys(Qa(a)),s=(h,f)=>f.addAndReturn(h),r=h=>({x:s(h.x,n),y:s(h.y,i)});return r({x:new xi(0),y:new xi(0)}),r}return Ip},$a=a=>({set:n=>{zi=$a(n)},reset:()=>$a(a),compare:Qa(a),snap:Cp(a),orient:Tp(a)}),zi=$a(),Qr=(a,n)=>a.ll.x.isLessThanOrEqualTo(n.x)&&n.x.isLessThanOrEqualTo(a.ur.x)&&a.ll.y.isLessThanOrEqualTo(n.y)&&n.y.isLessThanOrEqualTo(a.ur.y),tl=(a,n)=>{if(n.ur.x.isLessThan(a.ll.x)||a.ur.x.isLessThan(n.ll.x)||n.ur.y.isLessThan(a.ll.y)||a.ur.y.isLessThan(n.ll.y))return null;const i=a.ll.x.isLessThan(n.ll.x)?n.ll.x:a.ll.x,s=a.ur.x.isLessThan(n.ur.x)?a.ur.x:n.ur.x,r=a.ll.y.isLessThan(n.ll.y)?n.ll.y:a.ll.y,h=a.ur.y.isLessThan(n.ur.y)?a.ur.y:n.ur.y;return{ll:{x:i,y:r},ur:{x:s,y:h}}},_s=(a,n)=>a.x.times(n.y).minus(a.y.times(n.x)),Mh=(a,n)=>a.x.times(n.x).plus(a.y.times(n.y)),vs=a=>Mh(a,a).sqrt(),Sp=(a,n,i)=>{const s={x:n.x.minus(a.x),y:n.y.minus(a.y)},r={x:i.x.minus(a.x),y:i.y.minus(a.y)};return _s(r,s).div(vs(r)).div(vs(s))},Mp=(a,n,i)=>{const s={x:n.x.minus(a.x),y:n.y.minus(a.y)},r={x:i.x.minus(a.x),y:i.y.minus(a.y)};return Mh(r,s).div(vs(r)).div(vs(s))},Ah=(a,n,i)=>n.y.isZero()?null:{x:a.x.plus(n.x.div(n.y).times(i.minus(a.y))),y:i},Ph=(a,n,i)=>n.x.isZero()?null:{x:i,y:a.y.plus(n.y.div(n.x).times(i.minus(a.x)))},Ap=(a,n,i,s)=>{if(n.x.isZero())return Ph(i,s,a.x);if(s.x.isZero())return Ph(a,n,i.x);if(n.y.isZero())return Ah(i,s,a.y);if(s.y.isZero())return Ah(a,n,i.y);const r=_s(n,s);if(r.isZero())return null;const h={x:i.x.minus(a.x),y:i.y.minus(a.y)},f=_s(h,n).div(r),d=_s(h,s).div(r),m=a.x.plus(d.times(n.x)),_=i.x.plus(f.times(s.x)),x=a.y.plus(d.times(n.y)),b=i.y.plus(f.times(s.y)),E=m.plus(_).div(2),C=x.plus(b).div(2);return{x:E,y:C}},wi=class lc{constructor(n,i){Q(this,"point");Q(this,"isLeft");Q(this,"segment");Q(this,"otherSE");Q(this,"consumedBy");n.events===void 0?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=i}static compare(n,i){const s=lc.comparePoints(n.point,i.point);return s!==0?s:(n.point!==i.point&&n.link(i),n.isLeft!==i.isLeft?n.isLeft?1:-1:bs.compare(n.segment,i.segment))}static comparePoints(n,i){return n.x.isLessThan(i.x)?-1:n.x.isGreaterThan(i.x)?1:n.y.isLessThan(i.y)?-1:n.y.isGreaterThan(i.y)?1:0}link(n){if(n.point===this.point)throw new Error("Tried to link already linked events");const i=n.point.events;for(let s=0,r=i.length;s<r;s++){const h=i[s];this.point.events.push(h),h.point=this.point}this.checkForConsuming()}checkForConsuming(){const n=this.point.events.length;for(let i=0;i<n;i++){const s=this.point.events[i];if(s.segment.consumedBy===void 0)for(let r=i+1;r<n;r++){const h=this.point.events[r];h.consumedBy===void 0&&s.otherSE.point.events===h.otherSE.point.events&&s.segment.consume(h.segment)}}}getAvailableLinkedEvents(){const n=[];for(let i=0,s=this.point.events.length;i<s;i++){const r=this.point.events[i];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&n.push(r)}return n}getLeftmostComparator(n){const i=new Map,s=r=>{const h=r.otherSE;i.set(r,{sine:Sp(this.point,n.point,h.point),cosine:Mp(this.point,n.point,h.point)})};return(r,h)=>{i.has(r)||s(r),i.has(h)||s(h);const{sine:f,cosine:d}=i.get(r),{sine:m,cosine:_}=i.get(h);return f.isGreaterThanOrEqualTo(0)&&m.isGreaterThanOrEqualTo(0)?d.isLessThan(_)?1:d.isGreaterThan(_)?-1:0:f.isLessThan(0)&&m.isLessThan(0)?d.isLessThan(_)?-1:d.isGreaterThan(_)?1:0:m.isLessThan(f)?-1:m.isGreaterThan(f)?1:0}}},Pp=class El{constructor(n){Q(this,"events");Q(this,"poly");Q(this,"_isExteriorRing");Q(this,"_enclosingRing");this.events=n;for(let i=0,s=n.length;i<s;i++)n[i].segment.ringOut=this;this.poly=null}static factory(n){const i=[];for(let s=0,r=n.length;s<r;s++){const h=n[s];if(!h.isInResult()||h.ringOut)continue;let f=null,d=h.leftSE,m=h.rightSE;const _=[d],x=d.point,b=[];for(;f=d,d=m,_.push(d),d.point!==x;)for(;;){const E=d.getAvailableLinkedEvents();if(E.length===0){const O=_[0].point,N=_[_.length-1].point;throw new Error(`Unable to complete output ring starting at [${O.x}, ${O.y}]. Last matching segment found ends at [${N.x}, ${N.y}].`)}if(E.length===1){m=E[0].otherSE;break}let C=null;for(let O=0,N=b.length;O<N;O++)if(b[O].point===d.point){C=O;break}if(C!==null){const O=b.splice(C)[0],N=_.splice(O.index);N.unshift(N[0].otherSE),i.push(new El(N.reverse()));continue}b.push({index:_.length,point:d.point});const S=d.getLeftmostComparator(f);m=E.sort(S)[0].otherSE;break}i.push(new El(_))}return i}getGeom(){let n=this.events[0].point;const i=[n];for(let _=1,x=this.events.length-1;_<x;_++){const b=this.events[_].point,E=this.events[_+1].point;zi.orient(b,n,E)!==0&&(i.push(b),n=b)}if(i.length===1)return null;const s=i[0],r=i[1];zi.orient(s,n,r)===0&&i.shift(),i.push(i[0]);const h=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:i.length-1,d=this.isExteriorRing()?i.length:-1,m=[];for(let _=f;_!=d;_+=h)m.push([i[_].x.toNumber(),i[_].y.toNumber()]);return m}isExteriorRing(){if(this._isExteriorRing===void 0){const n=this.enclosingRing();this._isExteriorRing=n?!n.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){var r,h;let n=this.events[0];for(let f=1,d=this.events.length;f<d;f++){const m=this.events[f];wi.compare(n,m)>0&&(n=m)}let i=n.segment.prevInResult(),s=i?i.prevInResult():null;for(;;){if(!i)return null;if(!s)return i.ringOut;if(s.ringOut!==i.ringOut)return((r=s.ringOut)==null?void 0:r.enclosingRing())!==i.ringOut?i.ringOut:(h=i.ringOut)==null?void 0:h.enclosingRing();i=s.prevInResult(),s=i?i.prevInResult():null}}},Nh=class{constructor(a){Q(this,"exteriorRing");Q(this,"interiorRings");this.exteriorRing=a,a.poly=this,this.interiorRings=[]}addInterior(a){this.interiorRings.push(a),a.poly=this}getGeom(){const a=this.exteriorRing.getGeom();if(a===null)return null;const n=[a];for(let i=0,s=this.interiorRings.length;i<s;i++){const r=this.interiorRings[i].getGeom();r!==null&&n.push(r)}return n}},Np=class{constructor(a){Q(this,"rings");Q(this,"polys");this.rings=a,this.polys=this._composePolys(a)}getGeom(){const a=[];for(let n=0,i=this.polys.length;n<i;n++){const s=this.polys[n].getGeom();s!==null&&a.push(s)}return a}_composePolys(a){var i;const n=[];for(let s=0,r=a.length;s<r;s++){const h=a[s];if(!h.poly)if(h.isExteriorRing())n.push(new Nh(h));else{const f=h.enclosingRing();f!=null&&f.poly||n.push(new Nh(f)),(i=f==null?void 0:f.poly)==null||i.addInterior(h)}}return n}},Op=class{constructor(a,n=bs.compare){Q(this,"queue");Q(this,"tree");Q(this,"segments");this.queue=a,this.tree=new ys(n),this.segments=[]}process(a){const n=a.segment,i=[];if(a.consumedBy)return a.isLeft?this.queue.delete(a.otherSE):this.tree.delete(n),i;a.isLeft&&this.tree.add(n);let s=n,r=n;do s=this.tree.lastBefore(s);while(s!=null&&s.consumedBy!=null);do r=this.tree.firstAfter(r);while(r!=null&&r.consumedBy!=null);if(a.isLeft){let h=null;if(s){const d=s.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(h=d),!s.isAnEndpoint(d))){const m=this._splitSafely(s,d);for(let _=0,x=m.length;_<x;_++)i.push(m[_])}}let f=null;if(r){const d=r.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(f=d),!r.isAnEndpoint(d))){const m=this._splitSafely(r,d);for(let _=0,x=m.length;_<x;_++)i.push(m[_])}}if(h!==null||f!==null){let d=null;h===null?d=f:f===null?d=h:d=wi.comparePoints(h,f)<=0?h:f,this.queue.delete(n.rightSE),i.push(n.rightSE);const m=n.split(d);for(let _=0,x=m.length;_<x;_++)i.push(m[_])}i.length>0?(this.tree.delete(n),i.push(a)):(this.segments.push(n),n.prev=s)}else{if(s&&r){const h=s.getIntersection(r);if(h!==null){if(!s.isAnEndpoint(h)){const f=this._splitSafely(s,h);for(let d=0,m=f.length;d<m;d++)i.push(f[d])}if(!r.isAnEndpoint(h)){const f=this._splitSafely(r,h);for(let d=0,m=f.length;d<m;d++)i.push(f[d])}}}this.tree.delete(n)}return i}_splitSafely(a,n){this.tree.delete(a);const i=a.rightSE;this.queue.delete(i);const s=a.split(n);return s.push(i),a.consumedBy===void 0&&this.tree.add(a),s}},Rp=class{constructor(){Q(this,"type");Q(this,"numMultiPolys")}run(a,n,i){$r.type=a;const s=[new Rh(n,!0)];for(let _=0,x=i.length;_<x;_++)s.push(new Rh(i[_],!1));if($r.numMultiPolys=s.length,$r.type==="difference"){const _=s[0];let x=1;for(;x<s.length;)tl(s[x].bbox,_.bbox)!==null?x++:s.splice(x,1)}if($r.type==="intersection")for(let _=0,x=s.length;_<x;_++){const b=s[_];for(let E=_+1,C=s.length;E<C;E++)if(tl(b.bbox,s[E].bbox)===null)return[]}const r=new ys(wi.compare);for(let _=0,x=s.length;_<x;_++){const b=s[_].getSweepEvents();for(let E=0,C=b.length;E<C;E++)r.add(b[E])}const h=new Op(r);let f=null;for(r.size!=0&&(f=r.first(),r.delete(f));f;){const _=h.process(f);for(let x=0,b=_.length;x<b;x++){const E=_[x];E.consumedBy===void 0&&r.add(E)}r.size!=0?(f=r.first(),r.delete(f)):f=null}zi.reset();const d=Pp.factory(h.segments);return new Np(d).getGeom()}},$r=new Rp,el=$r,Dp=0,bs=class Vs{constructor(n,i,s,r){Q(this,"id");Q(this,"leftSE");Q(this,"rightSE");Q(this,"rings");Q(this,"windings");Q(this,"ringOut");Q(this,"consumedBy");Q(this,"prev");Q(this,"_prevInResult");Q(this,"_beforeState");Q(this,"_afterState");Q(this,"_isInResult");this.id=++Dp,this.leftSE=n,n.segment=this,n.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=n,this.rings=s,this.windings=r}static compare(n,i){const s=n.leftSE.point.x,r=i.leftSE.point.x,h=n.rightSE.point.x,f=i.rightSE.point.x;if(f.isLessThan(s))return 1;if(h.isLessThan(r))return-1;const d=n.leftSE.point.y,m=i.leftSE.point.y,_=n.rightSE.point.y,x=i.rightSE.point.y;if(s.isLessThan(r)){if(m.isLessThan(d)&&m.isLessThan(_))return 1;if(m.isGreaterThan(d)&&m.isGreaterThan(_))return-1;const b=n.comparePoint(i.leftSE.point);if(b<0)return 1;if(b>0)return-1;const E=i.comparePoint(n.rightSE.point);return E!==0?E:-1}if(s.isGreaterThan(r)){if(d.isLessThan(m)&&d.isLessThan(x))return-1;if(d.isGreaterThan(m)&&d.isGreaterThan(x))return 1;const b=i.comparePoint(n.leftSE.point);if(b!==0)return b;const E=n.comparePoint(i.rightSE.point);return E<0?1:E>0?-1:1}if(d.isLessThan(m))return-1;if(d.isGreaterThan(m))return 1;if(h.isLessThan(f)){const b=i.comparePoint(n.rightSE.point);if(b!==0)return b}if(h.isGreaterThan(f)){const b=n.comparePoint(i.rightSE.point);if(b<0)return 1;if(b>0)return-1}if(!h.eq(f)){const b=_.minus(d),E=h.minus(s),C=x.minus(m),S=f.minus(r);if(b.isGreaterThan(E)&&C.isLessThan(S))return 1;if(b.isLessThan(E)&&C.isGreaterThan(S))return-1}return h.isGreaterThan(f)?1:h.isLessThan(f)||_.isLessThan(x)?-1:_.isGreaterThan(x)?1:n.id<i.id?-1:n.id>i.id?1:0}static fromRing(n,i,s){let r,h,f;const d=wi.comparePoints(n,i);if(d<0)r=n,h=i,f=1;else if(d>0)r=i,h=n,f=-1;else throw new Error(`Tried to create degenerate segment at [${n.x}, ${n.y}]`);const m=new wi(r,!0),_=new wi(h,!1);return new Vs(m,_,[s],[f])}replaceRightSE(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const n=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:n.isLessThan(i)?n:i},ur:{x:this.rightSE.point.x,y:n.isGreaterThan(i)?n:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(n){return n.x.eq(this.leftSE.point.x)&&n.y.eq(this.leftSE.point.y)||n.x.eq(this.rightSE.point.x)&&n.y.eq(this.rightSE.point.y)}comparePoint(n){return zi.orient(this.leftSE.point,n,this.rightSE.point)}getIntersection(n){const i=this.bbox(),s=n.bbox(),r=tl(i,s);if(r===null)return null;const h=this.leftSE.point,f=this.rightSE.point,d=n.leftSE.point,m=n.rightSE.point,_=Qr(i,d)&&this.comparePoint(d)===0,x=Qr(s,h)&&n.comparePoint(h)===0,b=Qr(i,m)&&this.comparePoint(m)===0,E=Qr(s,f)&&n.comparePoint(f)===0;if(x&&_)return E&&!b?f:!E&&b?m:null;if(x)return b&&h.x.eq(m.x)&&h.y.eq(m.y)?null:h;if(_)return E&&f.x.eq(d.x)&&f.y.eq(d.y)?null:d;if(E&&b)return null;if(E)return f;if(b)return m;const C=Ap(h,this.vector(),d,n.vector());return C===null||!Qr(r,C)?null:zi.snap(C)}split(n){const i=[],s=n.events!==void 0,r=new wi(n,!0),h=new wi(n,!1),f=this.rightSE;this.replaceRightSE(h),i.push(h),i.push(r);const d=new Vs(r,f,this.rings.slice(),this.windings.slice());return wi.comparePoints(d.leftSE.point,d.rightSE.point)>0&&d.swapEvents(),wi.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(r.checkForConsuming(),h.checkForConsuming()),i}swapEvents(){const n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,s=this.windings.length;i<s;i++)this.windings[i]*=-1}consume(n){let i=this,s=n;for(;i.consumedBy;)i=i.consumedBy;for(;s.consumedBy;)s=s.consumedBy;const r=Vs.compare(i,s);if(r!==0){if(r>0){const h=i;i=s,s=h}if(i.prev===s){const h=i;i=s,s=h}for(let h=0,f=s.rings.length;h<f;h++){const d=s.rings[h],m=s.windings[h],_=i.rings.indexOf(d);_===-1?(i.rings.push(d),i.windings.push(m)):i.windings[_]+=m}s.rings=null,s.windings=null,s.consumedBy=i,s.leftSE.consumedBy=i.leftSE,s.rightSE.consumedBy=i.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const n=this.prev.consumedBy||this.prev;this._beforeState=n.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const n=this.beforeState();this._afterState={rings:n.rings.slice(0),windings:n.windings.slice(0),multiPolys:[]};const i=this._afterState.rings,s=this._afterState.windings,r=this._afterState.multiPolys;for(let d=0,m=this.rings.length;d<m;d++){const _=this.rings[d],x=this.windings[d],b=i.indexOf(_);b===-1?(i.push(_),s.push(x)):s[b]+=x}const h=[],f=[];for(let d=0,m=i.length;d<m;d++){if(s[d]===0)continue;const _=i[d],x=_.poly;if(f.indexOf(x)===-1)if(_.isExterior)h.push(x);else{f.indexOf(x)===-1&&f.push(x);const b=h.indexOf(_.poly);b!==-1&&h.splice(b,1)}}for(let d=0,m=h.length;d<m;d++){const _=h[d].multiPoly;r.indexOf(_)===-1&&r.push(_)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const n=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(el.type){case"union":{const s=n.length===0,r=i.length===0;this._isInResult=s!==r;break}case"intersection":{let s,r;n.length<i.length?(s=n.length,r=i.length):(s=i.length,r=n.length),this._isInResult=r===el.numMultiPolys&&s<r;break}case"xor":{const s=Math.abs(n.length-i.length);this._isInResult=s%2===1;break}case"difference":{const s=r=>r.length===1&&r[0].isSubject;this._isInResult=s(n)!==s(i);break}}return this._isInResult}},Oh=class{constructor(a,n,i){Q(this,"poly");Q(this,"isExterior");Q(this,"segments");Q(this,"bbox");if(!Array.isArray(a)||a.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],typeof a[0][0]!="number"||typeof a[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=zi.snap({x:new xi(a[0][0]),y:new xi(a[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let r=s;for(let h=1,f=a.length;h<f;h++){if(typeof a[h][0]!="number"||typeof a[h][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const d=zi.snap({x:new xi(a[h][0]),y:new xi(a[h][1])});d.x.eq(r.x)&&d.y.eq(r.y)||(this.segments.push(bs.fromRing(r,d,this)),d.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=d.x),d.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=d.y),d.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=d.x),d.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=d.y),r=d)}(!s.x.eq(r.x)||!s.y.eq(r.y))&&this.segments.push(bs.fromRing(r,s,this))}getSweepEvents(){const a=[];for(let n=0,i=this.segments.length;n<i;n++){const s=this.segments[n];a.push(s.leftSE),a.push(s.rightSE)}return a}},Bp=class{constructor(a,n){Q(this,"multiPoly");Q(this,"exteriorRing");Q(this,"interiorRings");Q(this,"bbox");if(!Array.isArray(a))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Oh(a[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let i=1,s=a.length;i<s;i++){const r=new Oh(a[i],this,!1);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.interiorRings.push(r)}this.multiPoly=n}getSweepEvents(){const a=this.exteriorRing.getSweepEvents();for(let n=0,i=this.interiorRings.length;n<i;n++){const s=this.interiorRings[n].getSweepEvents();for(let r=0,h=s.length;r<h;r++)a.push(s[r])}return a}},Rh=class{constructor(a,n){Q(this,"isSubject");Q(this,"polys");Q(this,"bbox");if(!Array.isArray(a))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof a[0][0][0]=="number"&&(a=[a])}catch{}this.polys=[],this.bbox={ll:{x:new xi(Number.POSITIVE_INFINITY),y:new xi(Number.POSITIVE_INFINITY)},ur:{x:new xi(Number.NEGATIVE_INFINITY),y:new xi(Number.NEGATIVE_INFINITY)}};for(let i=0,s=a.length;i<s;i++){const r=new Bp(a[i],this);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.polys.push(r)}this.isSubject=n}getSweepEvents(){const a=[];for(let n=0,i=this.polys.length;n<i;n++){const s=this.polys[n].getSweepEvents();for(let r=0,h=s.length;r<h;r++)a.push(s[r])}return a}},zp=(a,...n)=>el.run("union",a,n);zi.set;function Fp(a,n={}){const i=[];if(Hn(a,r=>{i.push(r.coordinates)}),i.length<2)throw new Error("Must have at least 2 geometries");const s=zp(i[0],...i.slice(1));return s.length===0?null:s.length===1?yn(s[0],n.properties):$f(s,n.properties)}const Gp={bedWidthMeters:{compact:.75,standard:1,wide:1.2},rowSpacingMeters:{dense:.15,vegetables:.3,orchard:3},irrigationRadiusMeters:{dripEmitter:.3,microSprinkler:3,sprinkler:12}},Up=3.280839895013123,qp=10.763910416709722,Dh=1609.344,Bh=4046.8564224,zh=1e4,to=a=>({ok:!0,value:a}),Zt=(a,n,i)=>({ok:!1,error:{code:a,message:n,...i?{details:i}:{}}}),Me=a=>JSON.parse(JSON.stringify(a)),Zp=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),Hp=a=>!Zp(a)||typeof a.type!="string"?!1:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection","Feature","FeatureCollection"].includes(a.type);function xs(a,n){if(a.type==="FeatureCollection"){a.features.forEach((i,s)=>xs(i,(r,h)=>n(r,`features[${s}].${h}`)));return}if(a.type==="Feature"){n(a.geometry,"geometry");return}n(a,"geometry")}function il(a,n,i){if(a.type==="GeometryCollection"){a.geometries.forEach((s,r)=>il(s,`${n}.geometries[${r}]`,i));return}i(a,n)}function Yp(a,n){return a[0]===n[0]&&a[1]===n[1]}function Fh(a){const n=a[0];return!n||a.every(i=>Yp(n,i))}function Vp(a){let n=0;for(let i=0;i<a.length-1;i++){const s=a[i],r=a[i+1];n+=s[0]*r[1]-r[0]*s[1]}return n/2}function Xp(a,n){const i=(r,h)=>Math.abs(r[0])>180||Math.abs(r[1])>90?`${h} is outside WGS84 longitude/latitude bounds.`:null,s=(r,h)=>{for(let f=0;f<r.length;f++){const d=i(r[f],`${h}[${f}]`);if(d)return d}return null};switch(a.type){case"Point":return i(a.coordinates,`${n}.coordinates`);case"MultiPoint":case"LineString":return s(a.coordinates,`${n}.coordinates`);case"MultiLineString":case"Polygon":for(let r=0;r<a.coordinates.length;r++){const h=s(a.coordinates[r],`${n}.coordinates[${r}]`);if(h)return h}return null;case"MultiPolygon":for(let r=0;r<a.coordinates.length;r++){const h=a.coordinates[r];for(let f=0;f<h.length;f++){const d=s(h[f],`${n}.coordinates[${r}][${f}]`);if(d)return d}}return null}}function Jp(a,n){const i=Xp(a,n);if(i)return i;if(a.type==="LineString"&&Fh(a.coordinates))return`${n} has no non-zero line segment.`;if(a.type==="MultiLineString"){const s=a.coordinates.findIndex(Fh);if(s>=0)return`${n}.coordinates[${s}] has no non-zero line segment.`}if(a.type==="Polygon"||a.type==="MultiPolygon"){const s=a.type==="Polygon"?[a.coordinates]:a.coordinates;for(let r=0;r<s.length;r++)for(let h=0;h<s[r].length;h++){const f=s[r][h];if(Math.abs(Vp(f))<=Number.EPSILON)return`${n} contains a degenerate zero-area ring.`}}return Du(a)?(a.type==="LineString"||a.type==="MultiLineString"||a.type==="Polygon"||a.type==="MultiPolygon")&&Ag(a).features.length>0?`${n} contains one or more self-intersections.`:null:`${n} is not valid under OGC Simple Feature topology rules.`}function $e(a){const n=Ji(a);if(!n.valid){const r=n.diagnostics.some(h=>h.code==="unsupported-geometry");return Zt(r?"unsupported-geometry":"invalid-input","GeoJSON structural validation failed.",n.diagnostics.filter(h=>h.severity==="error").map(h=>`${h.path}: ${h.code}: ${h.message}`))}if(!Hp(a))return Zt("invalid-input","Expected a supported GeoJSON object.");if(a.type==="FeatureCollection"&&a.features.length===0)return Zt("invalid-input","FeatureCollection must not be empty.");let i=0,s=null;return xs(a,(r,h)=>{if(!s){if(r.type==="GeometryCollection"&&r.geometries.length===0){s=`${h} must not be an empty GeometryCollection.`;return}il(r,h,(f,d)=>{i+=1,s!=null||(s=Jp(f,d))})}}),i===0?Zt("invalid-input","GeoJSON contains no geometry."):s?Zt("topology-error",s):to(a)}function $i(a){const n=$e(a);return n.ok?to(a):Zt(n.error.code==="invalid-input"?"operation-failed":n.error.code,`Generated GeoJSON was rejected: ${n.error.message}`,n.error.details)}function di(a,n){return Zt("operation-failed",`${a} failed safely: ${n instanceof Error?n.message:String(n)}`)}function Wp(a){return Number.isFinite(a)&&a!==0}function jp(a,n,i={}){var h;const s=$e(a);if(!s.ok)return s;if(!Wp(n))return Zt("invalid-options","distanceMeters must be a finite, non-zero number.");const r=(h=i.steps)!=null?h:8;if(!Number.isInteger(r)||r<4||r>256)return Zt("invalid-options","steps must be an integer from 4 through 256.");try{const f=Me(a);let d;if(f.type==="FeatureCollection"){const m=[];for(const _ of f.features){const x=lh(_,n,{units:"meters",steps:r});if(!x)return Zt("empty-result","Buffer removed at least one input feature; no partial result was returned.");m.push(x)}d={type:"FeatureCollection",features:m}}else{const m=lh(f,n,{units:"meters",steps:r});m==null||m.type,d=m}return!d||d.type==="FeatureCollection"&&d.features.length===0?Zt("empty-result","Buffer produced no geometry."):$i(d)}catch(f){return di("Buffer",f)}}function Kp(a,n){const i=$e(a);if(!i.ok)return i;const s=$e(n);if(!s.ok)return s;if(a.geometry.type!=="LineString")return Zt("unsupported-geometry","splitGeoJSON requires a LineString feature.");if(!["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"].includes(n.geometry.type))return Zt("unsupported-geometry","Unsupported splitter geometry.");try{const r=Me(a),h=fp(r,Me(n));return h.features.length<2?Zt("empty-result","Splitter does not cut the LineString."):(h.features=h.features.map((f,d)=>{var _;const m=Me((_=r.properties)!=null?_:{});return m.id!==void 0&&(m.id=`${String(m.id)}:split:${d+1}`),{...f,...r.id!==void 0?{id:`${String(r.id)}:split:${d+1}`}:{},properties:m}}),$i(h))}catch(r){return di("Split",r)}}function Qp(a,n){var s;const i=$e(a);if(!i.ok)return i;if(a.features.length<2)return Zt("invalid-options","mergeGeoJSON requires at least two polygon features.");if(a.features.some(r=>r.geometry.type!=="Polygon"&&r.geometry.type!=="MultiPolygon"))return Zt("unsupported-geometry","mergeGeoJSON supports only Polygon inputs.");try{const r=Me((s=n!=null?n:a.features[0].properties)!=null?s:{}),h=Fp(Me(a),{properties:r});return h?$i(h):Zt("empty-result","Polygon union produced no geometry.")}catch(r){return di("Polygon union",r)}}function $p(a,n){var r;const i=$e(a);if(!i.ok)return i;if(!Number.isFinite(n.toleranceDegrees)||n.toleranceDegrees<=0)return Zt("invalid-options","toleranceDegrees must be a finite number greater than zero.");let s=null;if(xs(a,h=>{il(h,"geometry",f=>{f.type!=="LineString"&&f.type!=="MultiLineString"&&f.type!=="Polygon"&&f.type!=="MultiPolygon"&&(s=f.type)})}),s)return Zt("unsupported-geometry",`simplifyGeoJSON does not simplify ${s} geometry.`);try{const h=vp(Me(a),{tolerance:n.toleranceDegrees,highQuality:(r=n.highQuality)!=null?r:!1,mutate:!1});return $i(h)}catch(h){return di("Simplify",h)}}function tm(a,n={}){const i=$e(a);if(!i.ok)return i;try{const s=Mg(Me(a),{properties:Me(n)});return $i(s)}catch(s){return di("Centroid",s)}}function em(a){const n=$e(a);if(!n.ok)return n;try{const i=ji(Me(a),{recompute:!0});return i.length!==4||i.some(s=>!Number.isFinite(s))?Zt("operation-failed","Bounding box was not a finite 2D extent."):to([i[0],i[1],i[2],i[3]])}catch(i){return di("Bounding box",i)}}function ws(a){let n=0;for(let i=1;i<a.length;i++){const s=a[i-1],r=a[i];n+=jl(s[1],s[0],r[1],r[0]).meters}return n}function Gh(a,n){switch(a.type){case"LineString":n.lengthMeters+=ws(a.coordinates);break;case"MultiLineString":a.coordinates.forEach(i=>{n.lengthMeters+=ws(i)});break;case"Polygon":a.coordinates.forEach(i=>{n.perimeterMeters+=ws(i)});break;case"MultiPolygon":a.coordinates.forEach(i=>i.forEach(s=>{n.perimeterMeters+=ws(s)}));break;case"GeometryCollection":a.geometries.forEach(i=>Gh(i,n));break}}function Uh(a){const n=$e(a);if(!n.ok)return n;try{const i={lengthMeters:0,perimeterMeters:0,areaSquareMeters:nd(Me(a))};return xs(a,s=>Gh(s,i)),Object.values(i).some(s=>!Number.isFinite(s)||s<0)?Zt("operation-failed","Measurement produced a non-finite result."):to(i)}catch(i){return di("Measurement",i)}}function tn(a,n,i){return{value:a,unit:n,text:`${i.format(a)} ${n}`}}function qh(a,n,i={}){var r;if(Object.values(a).some(h=>!Number.isFinite(h)||h<0))return Zt("invalid-input","Measurements must contain finite, non-negative SI values.");const s=(r=i.maximumFractionDigits)!=null?r:2;if(!Number.isInteger(s)||s<0||s>20)return Zt("invalid-options","maximumFractionDigits must be an integer from 0 through 20.");try{const h=new Intl.NumberFormat(i.locale,{maximumFractionDigits:s}),f=m=>n==="metric"?i.autoScale&&m>=1e3?tn(m/1e3,"km",h):tn(m,"m",h):i.autoScale&&m>=Dh?tn(m/Dh,"mi",h):tn(m*Up,"ft",h),d=m=>n==="metric"?i.autoScale&&m>=zh?tn(m/zh,"ha",h):tn(m,"m²",h):i.autoScale&&m>=Bh?tn(m/Bh,"ac",h):tn(m*qp,"ft²",h);return to({length:f(a.lengthMeters),perimeter:f(a.perimeterMeters),area:d(a.areaSquareMeters)})}catch(h){return di("Measurement formatting",h)}}function nl(a,n,i,s){var h;const r=Me((h=a.properties)!=null?h:{});return r.id!==void 0&&(r.id=`${String(r.id)}:${s}`),r["geokit:guide"]={type:n,offsetMeters:i},{...a,...a.id!==void 0?{id:`${String(a.id)}:${s}`}:{},properties:r}}function im(a,n){const i=$e(a);if(!i.ok)return i;if(a.geometry.type!=="LineString"&&a.geometry.type!=="MultiLineString")return Zt("unsupported-geometry","Bed guides require line geometry.");if(!Number.isFinite(n)||n<=0)return Zt("invalid-options","bedWidthMeters must be a finite number greater than zero.");try{const s=Me(a),r=n/2,h=nl(Fa(s,r,{units:"meters"}),"bed-edge",r,"bed-left"),f=nl(Fa(s,-r,{units:"meters"}),"bed-edge",-r,"bed-right");return $i({type:"FeatureCollection",features:[h,f]})}catch(s){return di("Bed-width guide generation",s)}}function nm(a,n,i={}){var h,f;const s=$e(a);if(!s.ok)return s;if(a.geometry.type!=="LineString"&&a.geometry.type!=="MultiLineString")return Zt("unsupported-geometry","Row guides require line geometry.");if(!Number.isFinite(n)||n<=0)return Zt("invalid-options","spacingMeters must be a finite number greater than zero.");const r=(h=i.rowsPerSide)!=null?h:2;if(!Number.isInteger(r)||r<1||r>100)return Zt("invalid-options","rowsPerSide must be an integer from 1 through 100.");try{const d=Me(a),m=[];for(let x=r;x>=1;x--)m.push(-x*n);((f=i.includeBaseline)==null||f)&&m.push(0);for(let x=1;x<=r;x++)m.push(x*n);const _=m.map(x=>{const b=x===0?d:Fa(d,x,{units:"meters"}),E=x===0?"row-center":`row-${x<0?"right":"left"}-${Math.abs(x)}`;return nl(b,"row-spacing",x,E)});return $i({type:"FeatureCollection",features:_})}catch(d){return di("Row-spacing guide generation",d)}}function rm(a,n,i={}){var d,m;const s={type:"Point",coordinates:Me(a)},r=$e(s);if(!r.ok)return r;if(!Number.isFinite(n)||n<=0)return Zt("invalid-options","outerRadiusMeters must be a finite number greater than zero.");const h=(d=i.zoneCount)!=null?d:1,f=(m=i.steps)!=null?m:64;if(!Number.isInteger(h)||h<1||h>32)return Zt("invalid-options","zoneCount must be an integer from 1 through 32.");if(!Number.isInteger(f)||f<8||f>256)return Zt("invalid-options","steps must be an integer from 8 through 256.");try{const[_,x]=a,b=Array.from({length:h},(C,S)=>({getLatLng:()=>({lat:x,lng:_}),getRadius:()=>n*(S+1)/h})),E=Xl({circles:b,steps:f});return $i(E)}catch(_){return di("Irrigation-zone generation",_)}}let Zh=!1;const om={polygon:"tool:polygon:created",polyline:"tool:polyline:created",rectangle:"tool:rectangle:created",circle:"tool:circle:created",marker:"tool:marker:created"};class sm{constructor(n){Q(this,"container");Q(this,"logger");Q(this,"options");Q(this,"L");Q(this,"store");Q(this,"layerRegistry",new Qs);Q(this,"featureLayers",new Map);Q(this,"closeLayerStylePanel",null);Q(this,"map",null);Q(this,"tileLayer",null);Q(this,"adapterAttribution",null);Q(this,"providerDiagnostics",null);Q(this,"drawnItems",null);Q(this,"drawControl",null);Q(this,"rulerControl",null);Q(this,"measurementControl",null);Q(this,"measurementSystem","metric");Q(this,"measurementModalOverlay",null);Q(this,"measurementModalDialog",null);Q(this,"measurementModalRadios",{});Q(this,"measurementModalKeydownHandler",null);Q(this,"detachPolygonFinishPatch",null);Q(this,"vertexMenuEl",null);Q(this,"vertexMenuCleanup",null);Q(this,"vertexEditSurfaceCleanup",null);Q(this,"activeCakeSession",null);Q(this,"cakeSessionCommand",null);Q(this,"moveConfirmationUI",null);Q(this,"activeMoveHandler",null);Q(this,"markerIconConfig",null);Q(this,"markerIcon",null);Q(this,"toolButtonConfig",null);Q(this,"toolbarGroups",null);Q(this,"activeToolCommand",null);Q(this,"pendingToolCommand",null);Q(this,"observedNativeToolbarCommand",null);Q(this,"commandSequence",0);Q(this,"toolErrors",{});Q(this,"toolSelection",[]);Q(this,"toolProvider",{requested:"tile-url",active:"tile-url",state:"enabled",reason:null});Q(this,"capabilityNotificationPending",!1);Q(this,"lastCapabilities","");Q(this,"toolEscapeKeyHandler",null);Q(this,"measurementPreviousFocus",null);Q(this,"snappingOptions",null);Q(this,"measurementOverlayOptions",null);Q(this,"interactionCleanup",null);Q(this,"measurementOverlayElement",null);Q(this,"snapFeedbackMarker",null);Q(this,"lastMeasurementFeature",null);Q(this,"lastMeasurementLatLng",null);var i,s,r,h,f,d;this.options=n,this.container=n.container,this.logger=((i=n.logger)!=null?i:Ro("controller","debug")).child("map"),this.L=this.resolveLeaflet(n),this.store=new zc(this.logger.child("store")),this.layerRegistry.add([],{id:"base",name:"Basemap"},"base"),this.setMarkerIconConfig((s=n.markerIconConfig)!=null?s:null,{reapplyExistingLayers:!1,syncDrawControl:!1}),this.toolButtonConfig=(r=n.toolButtonConfig)!=null?r:null,this.toolbarGroups=(h=n.toolbarGroups)!=null?h:null,this.snappingOptions=n.snapping?{...n.snapping,enabled:(f=n.snapping.enabled)!=null?f:!0}:null,this.measurementOverlayOptions=n.measurementOverlay?{...n.measurementOverlay,enabled:(d=n.measurementOverlay.enabled)!=null?d:!0}:null,this.logger.debug("ctor",{config:n.map,controls:n.controls,readOnly:n.readOnly,useExternalLeaflet:n.useExternalLeaflet}),yf(this.L),_f(this.L),mf(this.L)}emitToolEvent(n,i){var r,h;try{(h=(r=this.options.toolHooks)==null?void 0:r[n])==null||h.call(r,i)}catch(f){this._error(`tool hook failed: ${n}`,f)}const s=this.options.toolEventEmitter;if(s)try{if(typeof s.emit=="function"){s.emit(n,i);return}typeof s.dispatchEvent=="function"&&s.dispatchEvent(new CustomEvent(n,{detail:i}))}catch(f){this._error(`tool emitter failed: ${n}`,f)}}nextCommandId(){return this.commandSequence+=1,`tool-${Date.now().toString(36)}-${this.commandSequence.toString(36)}`}getToolCapabilities(){var i,s,r,h,f,d;const n={};for(const m of Object.keys(Ho))n[m]=m==="ruler"?this.canTriggerRulerTool():typeof((i=this.findLeafletDrawHandler(m))==null?void 0:i.enable)=="function";return nu({ready:!!(this.map&&this.drawnItems),readOnly:!!this.options.readOnly,controls:this.options.controls,available:n,layerCount:(h=(r=(s=this.drawnItems)==null?void 0:s.getLayers)==null?void 0:r.call(s).length)!=null?h:0,selectedFeatureIds:this.toolSelection.filter(m=>this.store.has(m)),activeTool:(d=(f=this.activeToolCommand)==null?void 0:f.tool)!=null?d:null,config:this.toolButtonConfig,groups:this.toolbarGroups,errors:this.toolErrors,provider:this.toolProvider})}setToolSelection(n){this.toolSelection=[...new Set(n)].filter(i=>this.store.has(i)),this.notifyToolCapabilities()}setToolProvider(n){this.toolProvider={...n,reason:n.reason?{...n.reason}:null},this.notifyToolCapabilities()}configure(n,i){this.options.map=n,this.options.controls=i,this.options.readOnly=n.readOnly,this.toolErrors={},this.notifyToolCapabilities()}notifyToolCapabilities(){this.capabilityNotificationPending||(this.capabilityNotificationPending=!0,queueMicrotask(()=>{var s,r;this.capabilityNotificationPending=!1,this.toolSelection=this.toolSelection.filter(h=>this.store.has(h));const n=this.getToolCapabilities();ru(this.container,n);const i=JSON.stringify(n);i!==this.lastCapabilities&&(this.lastCapabilities=i,(r=(s=this.options.callbacks)==null?void 0:s.onToolCapabilitiesChanged)==null||r.call(s,n))}))}toolEventDetail(n,i={}){var s,r;return{tool:n.tool,action:n.action,source:n.source,groupId:n.groupId,commandId:n.commandId,previousTool:n.previousTool,activeTool:(r=(s=this.activeToolCommand)==null?void 0:s.tool)!=null?r:null,featureIds:[],timestamp:Date.now(),...i}}emitToolLifecycle(n,i,s={}){var f,d,m;const r=this.toolEventDetail(i,s),h=n.replace("leaflet-geokit:tool-","");return["started","completed","cancelled","failed"].includes(h)&&ta(this.container,(f=r.reason)!=null?f:`${i.tool}: ${h}`,h==="failed"),(m=(d=this.options.callbacks)==null?void 0:d.onToolEvent)==null||m.call(d,n,r),this.emitToolEvent(n,r),this.notifyToolCapabilities(),r}beginToolCommand(n,i,s,r,h){var m,_,x,b;const f={tool:n,action:i,source:(m=s.source)!=null?m:"api",groupId:s.groupId,commandId:((_=s.commandId)==null?void 0:_.trim())||this.nextCommandId(),previousTool:(b=(x=this.activeToolCommand)==null?void 0:x.tool)!=null?b:null},d=this.toolEventDetail(f);return h&&Object.assign(h,d),r&&this.emitToolLifecycle("leaflet-geokit:tool-command",f),this.emitToolLifecycle("leaflet-geokit:tool-commanded",f),f}startPersistentTool(n){this.activeToolCommand!==n&&(this.activeToolCommand&&(this.cancelActiveTool(`Superseded by command "${n.commandId}"`,!1),n.replacedActive=!0),this.activeToolCommand=n,this.emitToolLifecycle("leaflet-geokit:tool-started",n,{activeTool:n.tool}),n.previousTool!==n.tool&&this.emitToolLifecycle("leaflet-geokit:tool-state-changed",n,{previousTool:n.previousTool,activeTool:n.tool}),Nr(this.container,n.tool))}clearActiveTool(n){this.activeToolCommand===n&&(this.activeToolCommand=null,Nr(this.container,null),this.emitToolLifecycle("leaflet-geokit:tool-state-changed",n,{previousTool:n.tool,activeTool:null}))}cancelActiveTool(n,i=!0){const s=this.activeToolCommand;s&&(this.activeToolCommand=null,this.emitToolLifecycle("leaflet-geokit:tool-cancelled",s,{previousTool:s.tool,activeTool:null,reason:n}),Nr(this.container,null),i&&this.emitToolLifecycle("leaflet-geokit:tool-state-changed",s,{previousTool:s.tool,activeTool:null}))}completeActiveTool(n,i){const s=this.activeToolCommand;s&&(this.emitToolLifecycle("leaflet-geokit:tool-completed",s,n),i&&(s.terminalOutcome="completed"))}failToolCommand(n,i){var s;((s=this.getToolCapabilities().tools[n.tool])==null?void 0:s.state)==="enabled"&&(this.toolErrors[n.tool]=i),n.terminalOutcome="failed",this.emitToolLifecycle("leaflet-geokit:tool-failed",n,{reason:i}),this.activeToolCommand===n?this.clearActiveTool(n):n.replacedActive&&!this.activeToolCommand&&this.emitToolLifecycle("leaflet-geokit:tool-state-changed",n,{previousTool:n.previousTool,activeTool:null})}setToolObservers(n){this.options.toolHooks=n.toolHooks,this.options.toolEventEmitter=n.toolEventEmitter}setMarkerIconConfig(n,i={}){const{reapplyExistingLayers:s=!0,syncDrawControl:r=!0}=i;this.options.markerIconConfig=n,this.markerIconConfig=n,this.markerIcon=this.createMarkerIcon(n),r&&this.syncDrawMarkerOptions(),s&&this.reapplyMarkerIconsToExistingLayers()}setToolButtonConfig(n){this.options.toolButtonConfig=n!=null?n:null,this.toolButtonConfig=n!=null?n:null,this.applyToolButtonCustomizations(),this.notifyToolCapabilities()}setSnappingOptions(n){var i,s,r;if((i=n==null?void 0:n.modes)!=null&&i.includes("grid")&&(!Number.isFinite(n.gridSizeMeters)||((s=n.gridSizeMeters)!=null?s:0)<=0))throw new Error("Grid snapping requires gridSizeMeters greater than zero.");if((n==null?void 0:n.tolerancePx)!==void 0&&(!Number.isFinite(n.tolerancePx)||n.tolerancePx<=0))throw new Error("Snapping tolerancePx must be a finite number greater than zero.");this.snappingOptions=n?{...n,enabled:(r=n.enabled)!=null?r:!0}:null,this.options.snapping=this.snappingOptions,this.installInteractionIntegrations()}getSnappingOptions(){return this.snappingOptions?{...this.snappingOptions,modes:this.snappingOptions.modes?[...this.snappingOptions.modes]:void 0,gridOrigin:this.snappingOptions.gridOrigin?[...this.snappingOptions.gridOrigin]:void 0}:null}setMeasurementOverlayOptions(n){var i;if((n==null?void 0:n.maximumFractionDigits)!==void 0&&(!Number.isInteger(n.maximumFractionDigits)||n.maximumFractionDigits<0||n.maximumFractionDigits>20))throw new Error("Measurement maximumFractionDigits must be an integer from 0 through 20.");this.measurementOverlayOptions=n?{...n,enabled:(i=n.enabled)!=null?i:!0}:null,this.options.measurementOverlay=this.measurementOverlayOptions,this.installInteractionIntegrations()}getMeasurementOverlayOptions(){return this.measurementOverlayOptions?{...this.measurementOverlayOptions}:null}setToolbarGroups(n){this.options.toolbarGroups=n!=null?n:null,this.toolbarGroups=n!=null?n:null,this.applyToolButtonCustomizations(),this.notifyToolCapabilities()}activateTool(n,i={}){const s=n==="select"?"deactivate":"activate";return this.executeToolCommand(n,s,i,!0)}triggerTool(n,i={}){return this.activateTool(n,i)}deactivateTool(n={}){return this.executeToolCommand("select","deactivate",n,!0)}handleToolCommand(n){const i=n.action==="deactivate"||n.tool==="select"?"deactivate":"activate",s=i==="deactivate"?"select":n.tool;return this.executeToolCommand(s,i,n,!1,n)}executeToolCommand(n,i,s,r,h){var _,x,b,E,C,S,O,N,G,D,U,W,X;const f=this.beginToolCommand(n,i,s,r,h);delete this.toolErrors[n];const d=(x=(_=this.toolButtonConfig)==null?void 0:_[n])==null?void 0:x.requirements,m=this.getToolCapabilities().tools[n];if(i!=="deactivate"&&(((b=m==null?void 0:m.reason)==null?void 0:b.code)==="missing_attribute"||((E=m==null?void 0:m.reason)==null?void 0:E.code)==="no_editable_layers"||this.options.readOnly&&((C=Ho[n])!=null&&C.mutates)||d!=null&&d.selection&&this.getToolCapabilities().selectedFeatureIds.length===0||d!=null&&d.provider&&this.toolProvider.state!=="enabled")){const et=`Tool "${n}" is not available: ${(O=(S=m==null?void 0:m.reason)==null?void 0:S.message)!=null?O:"Tool requirements are not met"}`;return this.failToolCommand(f,et),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:et}),!1}try{if(i==="deactivate"||n==="select"){const ot=(N=this.activeToolCommand)==null?void 0:N.tool;return this.cancelActiveTool("Deactivated by select command"),this.disablePhysicalTool(ot),this.toggleMeasurementModal(!1),this.emitToolLifecycle("leaflet-geokit:tool-completed",f,{activeTool:null}),this.emitToolTrigger({tool:"select",source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}if(n==="save"){const ot=this.store.toFeatureCollection(),I=ot.features.map(P=>Ve(P)).filter(P=>!!P);return(D=(G=this.options.callbacks)==null?void 0:G.onSaved)==null||D.call(G,{geoJSON:ot,featureCount:ot.features.length}),this.emitToolEvent("tool:save",{geoJSON:ot,featureCount:ot.features.length}),this.emitToolLifecycle("leaflet-geokit:tool-completed",f,{featureIds:I,geometry:ot}),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}if(n==="layerStyle"||n==="measurementSettings"){if(n==="measurementSettings")this.toggleMeasurementModal(!0);else{(U=this.closeLayerStylePanel)==null||U.call(this);const ot={layers:this.getLayers()};(X=(W=this.options.callbacks)==null?void 0:W.onLayerStyleRequested)!=null&&X.call(W,ot)||(this.closeLayerStylePanel=Fc(this.container,ot.layers,(I,P)=>{this.setLayerStyle(I,P)}))}return this.emitToolLifecycle("leaflet-geokit:tool-completed",f),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}if(n==="ruler"){if(!this.canTriggerRulerTool()){const I="Ruler control is not available";return this.failToolCommand(f,I),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:I}),!1}if(this.preparePersistentTool(f),!this.triggerRulerTool()){const I="Ruler control is not available";return this.failToolCommand(f,I),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:I}),!1}return this.startPersistentTool(f),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}const et=this.findLeafletDrawHandler(n);if(!et||typeof et.enable!="function"){const ot=`Tool "${n}" is not available on this map`;return this.failToolCommand(f,ot),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:ot}),!1}if(this.preparePersistentTool(f),this.pendingToolCommand=f,et.enable(),this.pendingToolCommand=null,typeof et.enabled=="function"&&et.enabled()===!1){const ot=`Tool "${n}" could not be started`;return this.failToolCommand(f,ot),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:ot}),!1}return this.startPersistentTool(f),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!0}),!0}catch(et){this.pendingToolCommand=null;const ot=i==="deactivate"?"Failed to deactivate active map tools":"Failed to activate tool "+n,I=et instanceof Error?et.message:ot;return this.toolErrors[n]=I,this._error(ot,et),this.failToolCommand(f,I),this.emitToolTrigger({tool:n,source:f.source,groupId:f.groupId,commandId:f.commandId,handled:!1,error:I}),!1}}preparePersistentTool(n){var s;const i=(s=this.activeToolCommand)==null?void 0:s.tool;this.activeToolCommand&&(this.cancelActiveTool(`Superseded by command "${n.commandId}"`,!1),n.replacedActive=!0),this.disablePhysicalTool(i)}disablePhysicalTool(n){var i,s,r,h,f;if(n==="layerCake"||this.activeCakeSession)try{this.activeCakeSession&&this.emitCakeEvent("tool:layer-cake:cancelled"),(i=this.activeCakeSession)==null||i.destroy()}finally{this.activeCakeSession=null,this.cakeSessionCommand=null}n==="move"&&((r=(s=this.activeMoveHandler)==null?void 0:s.hasPendingMove)!=null&&r.call(s))&&((f=(h=this.activeMoveHandler).cancelMove)==null||f.call(h),this.hideMoveConfirmationUI()),n==="ruler"&&this.triggerRulerTool(),n&&this.disableActiveToolHandlers()}resolveLeaflet(n){if(!n.useExternalLeaflet)return Do;if(n.leaflet&&fa(n.leaflet))return this.logger.debug("leaflet-runtime:external-injected"),n.leaflet;const s=globalThis.L;return s&&fa(s)?(this.logger.debug("leaflet-runtime:external-global"),s):(this.logger.warn("leaflet-runtime:external-fallback-bundled",{message:"External Leaflet requested but Draw APIs were missing; falling back to bundled Leaflet/Draw"}),Do)}async init(){var i,s,r,h,f,d;const n=(s=(i=performance.now)==null?void 0:i.call(performance))!=null?s:Date.now();try{await this.destroy();const{latitude:m,longitude:_,zoom:x,minZoom:b,maxZoom:E,tileUrl:C,tileAttribution:S,preferCanvas:O=!0,useExternalLeaflet:N}=this.options.map,G=[m,_],D=this.L;N&&fa(D,{onError:ot=>this.logger.warn("external-leaflet-missing-draw",{message:ot})}),this.map=D.map(this.container,{zoomControl:!0,minZoom:b,preferCanvas:O}).setView(G,x),this.setTileLayer({urlTemplate:C,attribution:S!=null?S:"",maxZoom:E},{onTileError:ot=>{var I,P;(P=(I=this.options.callbacks)==null?void 0:I.onTileError)==null||P.call(I,ot)}}),this.drawnItems=D.featureGroup().addTo(this.map),this.drawnItems.on("layeradd layerremove",()=>this.notifyToolCapabilities());const U=this.buildDrawOptions(this.options.controls,!!this.options.readOnly),W=D.Control.Draw;this.drawControl=new W(U),this.map.addControl(this.drawControl),this.applyLayerCakeToolbarIcon(),this.applyMoveToolbarIcon(),this.restoreVisibleLayersFromStore(),this.options.controls.ruler&&(this.logger.debug("init:ruler",{available:typeof D.control.ruler=="function"}),typeof D.control.ruler=="function"?(this.addRulerControl(),this.installMeasurementSettingsControl()):this.logger.warn("init:ruler:missing",{msg:"L.control.ruler is not defined"})),this.applyToolButtonCustomizations(),this.patchLeafletDrawBugs(),this.installPolygonFinishPatch(),this.installVertexEditSurfaceMenu(),this.map.invalidateSize(),setTimeout(()=>{var ot;try{(ot=this.map)==null||ot.invalidateSize()}catch{}},0),this.bindDrawEvents(),this.installInteractionIntegrations();const X=((h=(r=performance.now)==null?void 0:r.call(performance))!=null?h:Date.now())-n;this.logger.debug("init:ready",{elapsedMs:Math.round(X)});const et=this.store.bounds();(d=(f=this.options.callbacks)==null?void 0:f.onReady)==null||d.call(f,et?{bounds:et}:{}),this.toolErrors={},this.notifyToolCapabilities()}catch(m){this._error("Failed to initialize Leaflet map",m,{code:"map_init_failed",recoverable:!1})}}async destroy(){var n,i,s,r,h,f,d,m;this.cancelLayerCakeSession(),(n=this.closeLayerStylePanel)==null||n.call(this),this.closeLayerStylePanel=null,this.featureLayers.clear(),this.providerDiagnostics=null,(i=this.interactionCleanup)==null||i.call(this),this.interactionCleanup=null,this.adapterAttribution=null;try{Gl(this.container,null,{toolbarGroups:null}),this.map&&((r=(s=this.findLeafletDrawHandler("move"))==null?void 0:s.disable)==null||r.call(s),this.map.off(),this.map.remove())}catch(_){this._error("Failed to remove Leaflet map",_)}try{(h=this.detachPolygonFinishPatch)==null||h.call(this)}catch{}this.detachPolygonFinishPatch=null;try{(f=this.vertexMenuCleanup)==null||f.call(this)}catch{}this.vertexMenuEl=null,this.vertexMenuCleanup=null;try{(d=this.vertexEditSurfaceCleanup)==null||d.call(this)}catch{}this.vertexEditSurfaceCleanup=null;try{this.hideMoveConfirmationUI()}catch{}this.toolEscapeKeyHandler&&(this.container.removeEventListener("keydown",this.toolEscapeKeyHandler),this.container.removeEventListener("keyup",this.toolEscapeKeyHandler),this.toolEscapeKeyHandler=null),this.activeToolCommand=null,this.pendingToolCommand=null,this.observedNativeToolbarCommand=null,Nr(this.container,null),this.drawControl=null,this.rulerControl=null,this.measurementControl=null,this.removeMeasurementModal(),this.drawnItems=null,this.notifyToolCapabilities(),this.tileLayer=null;try{(m=this.activeCakeSession)==null||m.destroy()}catch{}this.activeCakeSession=null,this.map=null}getLayers(){return this.layerRegistry.getLayers()}applyLayerRegistry(){var n,i,s,r,h,f,d,m,_,x;if(!(!this.map||!this.drawnItems)){for(const b of this.getLayers()){if(b.kind==="base"){this.tileLayer&&(b.visible?this.tileLayer.addTo(this.map):this.map.removeLayer(this.tileLayer),(s=(i=this.tileLayer).setOpacity)==null||s.call(i,(n=b.style.opacity)!=null?n:1));continue}for(const E of b.featureIds){const C=this.featureLayers.get(E);C&&(b.visible?this.drawnItems.addLayer(C):this.drawnItems.removeLayer(C),(r=C.setStyle)==null||r.call(C,b.style),(f=C.setOpacity)==null||f.call(C,(h=b.style.opacity)!=null?h:1),b.visible&&((d=C.bringToFront)==null||d.call(C)),(m=C.setZIndexOffset)==null||m.call(C,b.order*100))}}(x=(_=this.options.callbacks)==null?void 0:_.onLayerEvent)==null||x.call(_,"leaflet-geokit:layers-changed",{layers:this.getLayers()}),this.notifyToolCapabilities()}}setLayerVisibility(n,i){this.layerRegistry.setLayerVisibility(n,i),this.applyLayerRegistry()}setLayerStyle(n,i){this.layerRegistry.setLayerStyle(n,i),this.applyLayerRegistry()}reorderLayers(n){this.layerRegistry.reorderLayers(n),this.applyLayerRegistry()}async focusLayer(n){var h;const i=this.layerRegistry.get(n),r=this.L.featureGroup(i.featureIds.map(f=>this.featureLayers.get(f)).filter(f=>!!f)).getBounds();r.isValid()&&((h=this.map)==null||h.fitBounds(r,{maxZoom:18}))}async removeLayer(n){if(this.options.readOnly)throw new Error("Map is read-only");const i=this.layerRegistry.get(n);if(i.kind==="base")throw new Error("Hide the basemap with setLayerVisibility instead");for(const s of i.featureIds)await this.removeFeature(s);this.getLayers().some(s=>s.id===n)&&this.layerRegistry.removeLayer(n),this.applyLayerRegistry()}getLayerCakeSession(){var n,i;return(i=(n=this.activeCakeSession)==null?void 0:n.snapshot())!=null?i:null}updateLayerCakeSession(n){if(this.options.readOnly)throw new Error("Map is read-only");if(!this.activeCakeSession)throw new Error("No active layer cake session");this.activeCakeSession.update(n)}saveLayerCakeSession(){if(this.options.readOnly)throw new Error("Map is read-only");if(!this.activeCakeSession)throw new Error("No active layer cake session");this.activeCakeSession.save()}cancelLayerCakeSession(){this.activeCakeSession&&(this.disablePhysicalTool("layerCake"),this.cancelActiveTool("Layer cake cancelled by host"))}emitCakeEvent(n,i={}){var h,f,d;const s=(h=this.cakeSessionCommand)!=null?h:this.activeToolCommand,r={session:this.getLayerCakeSession(),source:s==null?void 0:s.source,commandId:s==null?void 0:s.commandId,groupId:s==null?void 0:s.groupId,...i};this.emitToolEvent(n,r),(d=(f=this.options.callbacks)==null?void 0:f.onLayerEvent)==null||d.call(f,n,r)}async getGeoJSON(){return this.store.toFeatureCollection()}async exportGeoJSON(n={}){const i=Ks(await this.getGeoJSON(),n);return n.preserveLayers?{...i,"geokit:layers":this.layerRegistry.snapshot()}:i}async importGeoJSON(n,i={}){var m,_;if(!this.map||!this.drawnItems)return[];const s=(m=i.behavior)!=null?m:"replace",r=i.validate?qo(n,{expandMulti:!0}):js(n);if(i.preserveLayers&&s!=="replace")throw new Error("preserveLayers requires replace import");const h=i.preserveLayers?Qs.parseSnapshot(n["geokit:layers"],r.features.map(x=>{var b;return(b=Ve(x))!=null?b:""})):null;if(!h&&(new Qs().add([],i.layer),((_=i.layer)==null?void 0:_.id)==="base"||s==="add"&&this.getLayers().some(b=>{var E;return b.id===((E=i.layer)==null?void 0:E.id)})))throw new Error("Duplicate layer id");if(i.validate&&s==="add"&&qo({type:"FeatureCollection",features:[...this.store.toFeatureCollection().features,...r.features]}),s==="replace")await this.clearLayers();else for(const x of r.features){const b=Ve(x);b&&this.store.has(b)&&await this.removeFeature(b)}const f=this.store.add(r),d=this.createGeoJSONLayers(r);return this.addGeoJSONLayersToDrawnItems(d),d.eachLayer(x=>{x._fid&&this.featureLayers.set(x._fid,x)}),h?this.layerRegistry.restore(h):f.length&&this.layerRegistry.add(f,i.layer),this.applyLayerRegistry(),this.notifyToolCapabilities(),this.logger.debug("importGeoJSON",{behavior:s,count:r.features.length,ids:f}),i.fitToData&&await this.fitBoundsToData(),f}async loadGeoJSON(n,i=!1){await this.importGeoJSON(n,{behavior:"replace",fitToData:i})}async clearLayers(){this.cancelLayerCakeSession(),this.drawnItems&&this.drawnItems.clearLayers(),this.store.clear(),this.featureLayers.clear(),this.layerRegistry.clearData(),this.applyLayerRegistry(),this.toolSelection=[],this.notifyToolCapabilities()}async addFeatures(n){return this.importGeoJSON(n,{behavior:"add"})}async updateFeature(n,i){if(!this.store.has(n)){this.logger.warn("updateFeature:missing",{id:n});return}if(this.store.update(n,i),!this.drawnItems)return;this.drawnItems.eachLayer(r=>{r._fid===n&&this.drawnItems.removeLayer(r)});const s=this.createGeoJSONLayers({type:"FeatureCollection",features:[{...i,id:n}]});s.eachLayer(r=>{r._fid=n,this.drawnItems.addLayer(r),this.installVertexContextMenu(r)}),s.eachLayer(r=>this.featureLayers.set(n,r)),this.applyLayerRegistry()}async removeFeature(n){this.drawnItems&&this.drawnItems.eachLayer(i=>{i._fid===n&&this.drawnItems.removeLayer(i)}),this.store.remove(n),this.toolSelection=this.toolSelection.filter(i=>i!==n),this.featureLayers.delete(n),this.layerRegistry.removeFeature(n),this.applyLayerRegistry(),this.notifyToolCapabilities()}async fitBoundsToData(n=.05){if(!this.map)return;const i=this.store.bounds();if(!i)return;const s=i,r=this.L.latLngBounds(s);if(n>0){const h=r.getSouthWest(),f=r.getNorthEast(),d=(f.lat-h.lat)*n,m=(f.lng-h.lng)*n,_=this.L.latLngBounds(this.L.latLng(h.lat-d,h.lng-m),this.L.latLng(f.lat+d,f.lng+m));this.map.fitBounds(_)}else this.map.fitBounds(r)}async fitBounds(n,i=.05){if(!this.map)return;const s=this.L.latLngBounds(n);if(i>0){const r=s.getSouthWest(),h=s.getNorthEast(),f=(h.lat-r.lat)*i,d=(h.lng-r.lng)*i,m=this.L.latLngBounds(this.L.latLng(r.lat-f,r.lng-d),this.L.latLng(h.lat+f,h.lng+d));this.map.fitBounds(m)}else this.map.fitBounds(s)}async setView(n,i,s){this.map&&this.map.setView([n,i],s!=null?s:this.map.getZoom())}getProviderDiagnostics(){return this.providerDiagnostics?{...this.providerDiagnostics}:null}setBasemapAdapter(n){var i,s;if(!this.map)throw new Error("Map is not ready");if(n.provider.capabilities.attributionRequired&&!n.attribution.trim())throw new Error("Basemap attribution is required");if(n.provider.kind==="raster")this.setTileLayer({...n.provider.resolve(),attribution:n.attribution});else{const r=n.provider.createLayer(this.L);if(r===this.tileLayer||this.map.hasLayer(r))throw new Error("Basemap adapter must return a fresh layer");try{r.addTo(this.map)}catch{throw this.map.hasLayer(r)&&this.map.removeLayer(r),new Error("Basemap adapter failed to mount")}this.tileLayer&&this.map.removeLayer(this.tileLayer),this.adapterAttribution&&((i=this.map.attributionControl)==null||i.removeAttribution(this.adapterAttribution)),this.tileLayer=r,this.adapterAttribution=n.attribution,(s=this.map.attributionControl)==null||s.addAttribution(n.attribution)}this.providerDiagnostics=ga(n.provider,n.attribution),this.applyLayerRegistry()}setTileLayer(n,i){var f;if(!this.map){this.logger.warn("setTileLayer called before map initialization");return}this.logger.debug("tile-layer:switch",{maxZoom:n.maxZoom,subdomains:n.subdomains}),this.adapterAttribution&&((f=this.map.attributionControl)==null||f.removeAttribution(this.adapterAttribution)),this.adapterAttribution=null,this.providerDiagnostics=ga(iu(n),n.attribution),this.tileLayer&&(this.map.removeLayer(this.tileLayer),this.tileLayer=null);const s={attribution:n.attribution,minZoom:this.options.map.minZoom,maxZoom:n.maxZoom};n.subdomains!==void 0?s.subdomains=n.subdomains:n.urlTemplate.includes("{s}")&&(s.subdomains=["a","b","c"]);const r=this.L.tileLayer(n.urlTemplate,s);let h=!1;r.on("tileerror",d=>{var m;this.tileLayer===r&&(this.logger.error("tile-layer:error"),h||(h=!0,(m=i==null?void 0:i.onTileError)==null||m.call(i,d)))}),r.addTo(this.map),this.tileLayer=r,this.applyLayerRegistry()}async mergeVisiblePolygons(n){if(!this.map||!this.drawnItems)return null;const s=(await this.getGeoJSON()).features.filter(d=>{const m=d.geometry,_=Ve(d);return!this.getLayers().some(b=>!b.visible&&_&&b.featureIds.includes(_))&&m&&(Nl(m)||Ol(m))});if(s.length<=1){if(s.length===1){const d=s[0].id;return d?String(d):null}return null}const r=Bc(s,n==null?void 0:n.properties);if(!r)return null;const h=[];for(const d of s){const m=d.id;m&&h.push(String(m))}for(const d of h)await this.removeFeature(d);const[f]=await this.addFeatures({type:"FeatureCollection",features:[r]});return f||null}setRulerUnits(n){if(this.measurementSystem===n)return;const i=this.measurementSystem;this.measurementSystem=n,this.logger.debug("ruler:units",{system:n}),this.emitToolEvent("tool:ruler:units-changed",{previous:i,current:n}),this.syncMeasurementModalState(),this.refreshMeasurementOverlay(),this.rebuildRulerControl()}buildDrawOptions(n,i){var h;const s={polygon:n.polygon?{allowIntersection:(h=this.options.map.polygonAllowIntersection)!=null?h:!1,showArea:!0,shapeOptions:{color:"#3388ff"}}:!1,polyline:n.polyline?{shapeOptions:{color:"#3388ff"}}:!1,rectangle:n.rectangle?{shapeOptions:{color:"#3388ff"}}:!1,circle:n.circle?{shapeOptions:{color:"#3388ff"}}:!1,cake:n.cake?{shapeOptions:{color:"#8A2BE2",fillOpacity:.2}}:!1,marker:n.marker?this.buildMarkerDrawOptions():!1,move:n.move?{featureGroup:this.drawnItems}:!1};let r={featureGroup:this.drawnItems};return n.edit?n.delete===!1&&(r.remove=!1):r=!1,i?{draw:!1,edit:!1}:{draw:s,edit:r}}buildMarkerDrawOptions(){return this.markerIcon?{icon:this.markerIcon}:{}}createMarkerIcon(n){return n?this.L.icon({iconUrl:n.iconUrl,iconRetinaUrl:n.iconRetinaUrl,shadowUrl:n.shadowUrl,iconSize:n.iconSize,iconAnchor:n.iconAnchor,popupAnchor:n.popupAnchor}):null}createDefaultMarkerIcon(){var i;const n=(i=this.L.Icon)==null?void 0:i.Default;return n?new n:null}createGeoJSONLayers(n){return this.L.geoJSON(n,{pointToLayer:(i,s)=>this.markerIcon?this.L.marker(s,{icon:this.markerIcon}):this.L.marker(s),onEachFeature:(i,s)=>{const r=Ve(i);r&&(s._fid=r)}})}addGeoJSONLayersToDrawnItems(n){this.drawnItems&&n.eachLayer(i=>{this.drawnItems.addLayer(i),this.installVertexContextMenu(i)})}restoreVisibleLayersFromStore(){if(!this.drawnItems)return;const n=this.store.toFeatureCollection();if(n.features.length===0)return;const i=this.createGeoJSONLayers(n);this.addGeoJSONLayersToDrawnItems(i)}syncDrawMarkerOptions(){var s,r,h,f;const n=this.drawControl;if(!n)return;const i=this.buildMarkerDrawOptions();(s=n.options)!=null||(n.options={}),(h=(r=n.options).draw)!=null||(r.draw={}),n.options.draw.marker=i,(f=n.setDrawingOptions)==null||f.call(n,{marker:i})}reapplyMarkerIconsToExistingLayers(){if(!this.drawnItems)return;const n=this.markerIcon?null:this.createDefaultMarkerIcon();this.drawnItems.eachLayer(i=>{if(!(typeof(i==null?void 0:i.setIcon)!="function"||typeof(i==null?void 0:i.getLatLng)!="function")){if(this.markerIcon){i.setIcon(this.markerIcon);return}n&&i.setIcon(n)}})}applyToolButtonCustomizations(){const n=()=>{Gl(this.container,this.toolButtonConfig,{toolbarGroups:this.toolbarGroups,onTrigger:(i,s)=>this.handleToolbarTrigger(i,s)}),ru(this.container,this.getToolCapabilities())};n(),setTimeout(n,0)}handleToolbarTrigger(n,i){var r,h;if(i.activate){this.activateTool(n,{source:i.source,groupId:i.groupId});return}let s=((r=this.observedNativeToolbarCommand)==null?void 0:r.tool)===n?this.observedNativeToolbarCommand:null;if(s&&(this.observedNativeToolbarCommand=null),n==="measurementSettings")s=this.beginToolCommand(n,"activate",{source:i.source,groupId:i.groupId},!0),this.emitToolLifecycle("leaflet-geokit:tool-completed",s);else if(n==="ruler"){const f=this.isRulerActive();((h=this.activeToolCommand)==null?void 0:h.tool)==="ruler"&&!f?(s=this.beginToolCommand(n,"activate",{source:i.source,groupId:i.groupId},!0),this.cancelActiveTool("Ruler toggled off"),this.emitToolLifecycle("leaflet-geokit:tool-completed",s,{activeTool:null})):s||(s=this.observePersistentToolStart(n,{source:i.source,groupId:i.groupId}))}else s||(s=this.observePersistentToolStart(n,{source:i.source,groupId:i.groupId}));this.emitToolTrigger({tool:n,source:i.source,groupId:i.groupId,commandId:s==null?void 0:s.commandId,handled:!0})}observePersistentToolStart(n,i){const s=this.pendingToolCommand,r=(s==null?void 0:s.tool)!==n,h=r?this.beginToolCommand(n,"activate",i,!0):s;if(this.activeToolCommand&&this.activeToolCommand!==h){const f=this.activeToolCommand.tool;this.cancelActiveTool(`Superseded by command "${h.commandId}"`,!1),h.replacedActive=!0,this.cleanupSupersededNativeTool(f)}return this.startPersistentTool(h),r&&(this.observedNativeToolbarCommand=h,queueMicrotask(()=>{this.observedNativeToolbarCommand===h&&(this.observedNativeToolbarCommand=null)})),h}cleanupSupersededNativeTool(n){var i,s,r,h;if(n==="layerCake"&&this.activeCakeSession)try{this.emitCakeEvent("tool:layer-cake:cancelled"),this.activeCakeSession.destroy()}finally{this.activeCakeSession=null,this.cakeSessionCommand=null}n==="ruler"&&this.isRulerActive()&&this.triggerRulerTool(),n==="move"&&((s=(i=this.activeMoveHandler)==null?void 0:i.hasPendingMove)!=null&&s.call(i))&&((h=(r=this.activeMoveHandler).cancelMove)==null||h.call(r),this.hideMoveConfirmationUI())}handlePersistentToolStop(n,i){const s=this.activeToolCommand;if(!(!s||s.tool!==n)&&!(n==="layerCake"&&this.activeCakeSession)){if(s.terminalOutcome){this.clearActiveTool(s);return}this.cancelActiveTool(i)}}failActiveTool(n){const i=this.activeToolCommand;i&&this.failToolCommand(i,n)}emitToolTrigger(n){var i,s;(s=(i=this.options.callbacks)==null?void 0:i.onToolTrigger)==null||s.call(i,{...n,timestamp:Date.now()})}findLeafletDrawHandler(n){var f,d,m,_,x,b,E,C,S,O;const i={polygon:"polygon",polyline:"polyline",rectangle:"rectangle",circle:"circle",marker:"marker",layerCake:"cake",move:"move"},s={edit:"edit",delete:"remove"},r=i[n];if(r)return(x=(_=(m=(d=(f=this.drawControl)==null?void 0:f._toolbars)==null?void 0:d.draw)==null?void 0:m._modes)==null?void 0:_[r])==null?void 0:x.handler;const h=s[n];return h?(O=(S=(C=(E=(b=this.drawControl)==null?void 0:b._toolbars)==null?void 0:E.edit)==null?void 0:C._modes)==null?void 0:S[h])==null?void 0:O.handler:null}disableActiveToolHandlers(){var i;const n=(i=this.drawControl)==null?void 0:i._toolbars;n&&Object.values(n).forEach(s=>{var r;Object.values((r=s==null?void 0:s._modes)!=null?r:{}).forEach(h=>{const f=h==null?void 0:h.handler;f&&typeof f.disable=="function"&&f.disable()})})}canTriggerRulerTool(){const n=this.rulerControl;return typeof(n==null?void 0:n._toggleMeasure)=="function"||!!this.container.querySelector(".leaflet-ruler")}isRulerActive(){const n=this.rulerControl;return(n==null?void 0:n._choice)===!0||!!this.container.querySelector(".leaflet-ruler-clicked")}triggerRulerTool(){const n=this.rulerControl;if(typeof(n==null?void 0:n._toggleMeasure)=="function")return n._toggleMeasure(),!0;const i=this.container.querySelector(".leaflet-ruler");return i?(i.click(),!0):!1}applyLayerCakeToolbarIcon(){if(!this.container)return;const n=()=>{const i=this.container.querySelector("a.leaflet-draw-draw-cake");if(!i)return;i.style.setProperty("background-image","none","important"),i.style.setProperty("background-color","#fff","important"),i.style.setProperty("position","relative","important");let s=i.querySelector(".leaflet-geokit-cake-icon");s||(s=document.createElement("span"),s.className="leaflet-geokit-cake-icon",s.setAttribute("aria-hidden","true"),i.appendChild(s)),s.style.setProperty("position","absolute","important"),s.style.setProperty("display","block","important"),s.style.setProperty("left","50%","important"),s.style.setProperty("top","50%","important"),s.style.setProperty("width","18px","important"),s.style.setProperty("height","18px","important"),s.style.setProperty("transform","translate(-50%, -50%)","important"),s.style.setProperty("pointer-events","none","important"),s.firstElementChild||(s.innerHTML=If);const r=s.firstElementChild;r&&(r.style.setProperty("width","100%","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("display","block","important"))};n(),setTimeout(n,0)}applyMoveToolbarIcon(){if(!this.container)return;const n=()=>{const i=this.container.querySelector("a.leaflet-draw-draw-move");if(!i)return;i.style.setProperty("background-image","none","important"),i.style.setProperty("background-color","#fff","important"),i.style.setProperty("position","relative","important");let s=i.querySelector(".leaflet-geokit-move-icon");s||(s=document.createElement("span"),s.className="leaflet-geokit-move-icon",s.setAttribute("aria-hidden","true"),i.appendChild(s)),s.style.setProperty("position","absolute","important"),s.style.setProperty("display","block","important"),s.style.setProperty("left","50%","important"),s.style.setProperty("top","50%","important"),s.style.setProperty("width","18px","important"),s.style.setProperty("height","18px","important"),s.style.setProperty("transform","translate(-50%, -50%)","important"),s.style.setProperty("pointer-events","none","important"),s.firstElementChild||(s.innerHTML=Cf);const r=s.firstElementChild;r&&(r.style.setProperty("width","100%","important"),r.style.setProperty("height","100%","important"),r.style.setProperty("display","block","important"))};n(),setTimeout(n,0)}addRulerControl(){if(!this.map)return;this.installRulerPrecisionPatch();const n=Uf(this.measurementSystem);this.rulerControl=this.L.control.ruler(n),this.map.addControl(this.rulerControl)}installRulerPrecisionPatch(){if(Zh)return;const n=this.L.Control.Ruler;if(!n||typeof n!="function")return;const i=n.prototype,s=i._calculateBearingAndDistance;if(typeof s!="function")return;const r=this.logger;i._calculateBearingAndDistance=function(){var f,d,m;s.call(this);try{const _=this._clickedLatLong,x=(f=this._movingLatLong)!=null?f:this._clickedLatLong;if(!_||!x)return;const{meters:b,bearingDegrees:E}=jl(_.lat,_.lng,x.lat,x.lng),C=b/1e3,S=typeof((m=(d=this.options)==null?void 0:d.lengthUnit)==null?void 0:m.factor)=="number"?this.options.lengthUnit.factor:1,O=ca(C*S);this._result=this._result||{},this._result.Distance=O,this._result.Bearing=E,this._result.meters=b}catch(_){r==null||r.warn("ruler:precision-patch",_)}},Zh=!0}rebuildRulerControl(){if(!(!this.map||!this.options.controls.ruler)){if(this.rulerControl){try{this.map.removeControl(this.rulerControl)}catch(n){this.logger.warn("ruler:remove-failed",n)}this.rulerControl=null}this.addRulerControl()}}installMeasurementSettingsControl(){if(!this.map||this.measurementControl)return;const n=this,i=this.L.Control.extend({options:{position:"topleft"},onAdd(){const s=n.L.DomUtil.create("div","leaflet-bar leaflet-ruler-settings-control"),r=n.L.DomUtil.create("button","leaflet-ruler-settings-button",s);return r.type="button",r.title="Measurement settings",r.setAttribute("aria-label","Measurement settings"),r.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),n.toggleMeasurementModal(!0)}),n.L.DomEvent.disableClickPropagation(s),n.L.DomEvent.disableScrollPropagation(s),s}});this.measurementControl=new i,this.map.addControl(this.measurementControl)}ensureMeasurementModal(){if(this.measurementModalOverlay)return this.measurementModalOverlay;if(typeof document=="undefined")throw new Error("Measurement modal requires a browser environment");const n=document.createElement("div");n.className="leaflet-ruler-modal-overlay",n.setAttribute("aria-hidden","true");const i=document.createElement("div");i.className="leaflet-ruler-modal",i.setAttribute("role","dialog"),i.setAttribute("aria-label","Measurement units"),i.setAttribute("aria-modal","true"),i.tabIndex=-1,n.addEventListener("click",m=>{m.target===n&&this.toggleMeasurementModal(!1)});const s=document.createElement("h2");s.className="leaflet-ruler-modal-title",s.textContent="Measurement Units",i.appendChild(s);const r=document.createElement("p");r.className="leaflet-ruler-modal-description",r.textContent="Choose how the measurement tool reports distances.",i.appendChild(r);const h=document.createElement("div");h.className="leaflet-ruler-modal-options",i.appendChild(h),["metric","imperial"].forEach(m=>{const _=document.createElement("label");_.className="leaflet-ruler-modal-option";const x=document.createElement("input");x.type="radio",x.name="leaflet-ruler-units",x.value=m,x.addEventListener("change",()=>{x.checked&&this.setRulerUnits(m)});const b=document.createElement("span");b.textContent=qf[m],_.appendChild(x),_.appendChild(b),h.appendChild(_),this.measurementModalRadios[m]=x});const f=document.createElement("div");f.className="leaflet-ruler-modal-actions";const d=document.createElement("button");return d.type="button",d.className="leaflet-ruler-modal-close",d.textContent="Close",d.addEventListener("click",()=>this.toggleMeasurementModal(!1)),f.appendChild(d),i.appendChild(f),n.appendChild(i),this.container.appendChild(n),this.measurementModalOverlay=n,this.measurementModalDialog=i,this.syncMeasurementModalState(),n}toggleMeasurementModal(n){var h,f;if(!n){this.measurementModalOverlay&&(this.measurementModalOverlay.classList.remove("is-open"),this.measurementModalOverlay.setAttribute("aria-hidden","true")),this.detachMeasurementModalKeydown(),(h=this.measurementPreviousFocus)!=null&&h.isConnected&&this.measurementPreviousFocus.focus(),this.measurementPreviousFocus=null;return}const i=this.ensureMeasurementModal(),s=this.container.getRootNode(),r=s instanceof ShadowRoot?s.activeElement:document.activeElement;i.contains(r)||(this.measurementPreviousFocus=r instanceof HTMLElement?r:null),i.classList.add("is-open"),i.setAttribute("aria-hidden","false"),this.syncMeasurementModalState(),this.attachMeasurementModalKeydown(),(f=this.measurementModalDialog)==null||f.focus()}syncMeasurementModalState(){for(const[n,i]of Object.entries(this.measurementModalRadios))i&&(i.checked=n===this.measurementSystem)}removeMeasurementModal(){this.measurementModalOverlay&&this.measurementModalOverlay.remove(),this.measurementModalOverlay=null,this.measurementModalDialog=null,this.measurementModalRadios={},this.detachMeasurementModalKeydown()}attachMeasurementModalKeydown(){this.measurementModalKeydownHandler||typeof document=="undefined"||(this.measurementModalKeydownHandler=n=>{var s,r;const i=this.measurementModalDialog;if(!(!i||!n.composedPath().includes(i))){if(n.key==="Escape")n.preventDefault(),n.stopPropagation(),this.toggleMeasurementModal(!1);else if(n.key==="Tab"){const h=Array.from(i.querySelectorAll("input:checked, button:not(:disabled)")),f=n.composedPath()[0];n.shiftKey&&(f===h[0]||f===i)?(n.preventDefault(),(s=h.at(-1))==null||s.focus()):!n.shiftKey&&(f===h.at(-1)||f===i)&&(n.preventDefault(),(r=h[0])==null||r.focus())}}},document.addEventListener("keydown",this.measurementModalKeydownHandler))}detachMeasurementModalKeydown(){!this.measurementModalKeydownHandler||typeof document=="undefined"||(document.removeEventListener("keydown",this.measurementModalKeydownHandler),this.measurementModalKeydownHandler=null)}installPolygonFinishPatch(){var f,d,m,_,x;if(!this.map||!this.drawControl)return;try{(f=this.detachPolygonFinishPatch)==null||f.call(this)}catch{}this.detachPolygonFinishPatch=null;const n=this.map,i=(m=(d=this.drawControl)==null?void 0:d._toolbars)==null?void 0:m.draw;if(!i||!!!((x=(_=i._modes)==null?void 0:_.polygon)!=null&&x.handler))return;const r=10,h=b=>{var E,C,S,O,N,G,D,U;try{const W=(C=(E=i._modes)==null?void 0:E.polygon)==null?void 0:C.handler;if(!W||!W._enabled)return;const X=W._markers;if(!Array.isArray(X)||X.length<3)return;const et=(O=(S=X[0])==null?void 0:S.getLatLng)==null?void 0:O.call(S);if(!et)return;const ot=n.latLngToContainerPoint(et),I=n.latLngToContainerPoint(b.latlng);Math.hypot(ot.x-I.x,ot.y-I.y)<=r&&typeof W._finishShape=="function"&&((G=(N=b.originalEvent)==null?void 0:N.preventDefault)==null||G.call(N),(U=(D=b.originalEvent)==null?void 0:D.stopPropagation)==null||U.call(D),W._finishShape())}catch(W){this._error("polygon-finish-patch",W)}};n.on("click",h),this.detachPolygonFinishPatch=()=>{try{n.off("click",h)}catch{}}}patchLeafletDrawBugs(){var n,i,s,r,h;try{const f=this.L,d=f.GeometryUtil;if(!d)return;const m={km:2,ha:2,m:0,mi:2,ac:2,yd:0,ft:0,nm:2},_=(i=(n=d.formattedNumber)==null?void 0:n.bind(d))!=null?i:((x,b)=>Number(x).toFixed(b));d.readableArea=(x,b,E)=>{var O;const C=(O=f.Util)!=null&&O.extend?f.Util.extend({},m,E||{}):{...m,...E||{}};let S;if(b){let N=["ha","m"];const G=typeof b;G==="string"?N=[b]:G!=="boolean"&&(N=Array.isArray(b)?b:N),x>=1e6&&N.indexOf("km")!==-1?S=`${_(1e-6*x,C.km)} km²`:x>=1e4&&N.indexOf("ha")!==-1?S=`${_(1e-4*x,C.ha)} ha`:S=`${_(x,C.m)} m²`}else x=x/.836127,x>=3097600?S=`${_(x/3097600,C.mi)} mi²`:x>=4840?S=`${_(x/4840,C.ac)} acres`:S=`${_(x,C.yd)} yd²`;return S}}catch(f){this.logger.warn("leaflet-draw-patch:readableArea",f)}try{const f=this.L,d=(s=f.Edit)==null?void 0:s.Circle,m=(r=f.Draw)==null?void 0:r.Event,_=f.GeometryUtil;if(!((h=d==null?void 0:d.prototype)!=null&&h._resize)||!m||!_)return;d.prototype._resize=function(b){var S,O,N;const E=this._moveMarker.getLatLng(),C=_.isVersion07x()?E.distanceTo(b):this._map.distance(E,b);this._shape.setRadius(C);try{(S=this._map)!=null&&S.editTooltip&&((N=(O=this._map)==null?void 0:O._editTooltip)!=null&&N.updateContent)&&this._map._editTooltip.updateContent({text:f.drawLocal.edit.handlers.edit.tooltip.subtext+"<br />"+f.drawLocal.edit.handlers.edit.tooltip.text,subtext:f.drawLocal.draw.handlers.circle.radius+": "+_.readableDistance(C,!0,this.options.feet,this.options.nautic)})}catch{}this._map.fire(m.EDITRESIZE,{layer:this._shape})}}catch(f){this.logger.warn("leaflet-draw-patch:circle-resize",f)}}getSnapTargets(){const n=[];for(const i of this.layerRegistry.getLayers())if(!(i.kind==="base"||i.kind==="measurement"))for(const s of i.featureIds){const r=this.featureLayers.get(s);if(!r||typeof r.toGeoJSON!="function")continue;const h=r.toGeoJSON();n.push({featureId:s,layerId:i.id,layerKind:i.kind,visible:i.visible,feature:h})}return n}findSnapResult(n,i){return!this.map||!this.snappingOptions||this.snappingOptions.enabled===!1||!n?null:lu({lat:Number(n.lat),lng:Number(n.lng)},this.getSnapTargets(),s=>{const r=this.map.latLngToContainerPoint([s.lat,s.lng]);return{x:r.x,y:r.y}},s=>{const r=this.map.containerPointToLatLng([s.x,s.y]);return{lat:r.lat,lng:r.lng}},this.snappingOptions,i)}eventLatLng(n){var r,h,f;if(n!=null&&n.latlng)return n.latlng;const i=n==null?void 0:n.originalEvent,s=(f=(r=i==null?void 0:i.touches)==null?void 0:r[0])!=null?f:(h=i==null?void 0:i.changedTouches)==null?void 0:h[0];if(s&&this.map)try{return this.map.mouseEventToLatLng(s)}catch{return null}return null}showSnapFeedback(n){if(!this.map||!this.snappingOptions||this.snappingOptions.enabled===!1)return;if(!n){this.snapFeedbackMarker&&this.map.removeLayer(this.snapFeedbackMarker),this.snapFeedbackMarker=null;const r=this.container.querySelector(".geokit-snap-feedback-label");r==null||r.remove();return}this.snapFeedbackMarker?this.snapFeedbackMarker.setLatLng([n.latlng.lat,n.latlng.lng]):this.snapFeedbackMarker=this.L.circleMarker([n.latlng.lat,n.latlng.lng],{radius:7,color:"#f59e0b",fillColor:"#fff7ed",fillOpacity:.85,weight:3,className:"geokit-snap-feedback",interactive:!1}).addTo(this.map);let i=this.container.querySelector(".geokit-snap-feedback-label");i||(i=document.createElement("div"),i.className="geokit-snap-feedback-label",i.setAttribute("role","status"),i.setAttribute("aria-live","polite"),Object.assign(i.style,{position:"absolute",zIndex:"1000",pointerEvents:"none",padding:"3px 6px",borderRadius:"4px",background:"#fff7ed",color:"#7c2d12",border:"1px solid #f59e0b",font:"12px system-ui"}),this.container.appendChild(i)),i.textContent=`Snapped to ${n.mode}`;const s=this.map.latLngToContainerPoint([n.latlng.lat,n.latlng.lng]);i.style.left=`${s.x+10}px`,i.style.top=`${s.y+10}px`}geometryFeatureForHandler(n,i){var r,h,f,d,m,_,x,b;const s=(r=n==null?void 0:n._poly)!=null?r:n==null?void 0:n._shape;if(!s)return null;if((h=n==null?void 0:n._poly)!=null&&h.getLatLngs){const E=n._poly.getLatLngs(),C=Array.isArray(E==null?void 0:E[0])?E[0]:E,S=(Array.isArray(C)?C:[]).map(N=>[N.lng,N.lat]),O=i!=null?i:n._currentLatLng;if(O&&S.length&&(((f=S.at(-1))==null?void 0:f[0])!==O.lng||((d=S.at(-1))==null?void 0:d[1])!==O.lat)&&S.push([O.lng,O.lat]),n.type==="polygon"||s instanceof this.L.Polygon){if(S.length<3)return null;const N=S[0][0]===((m=S.at(-1))==null?void 0:m[0])&&S[0][1]===((_=S.at(-1))==null?void 0:_[1])?S:[...S,S[0]];return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[N]}}}return S.length<2?null:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:S}}}if((x=n==null?void 0:n._shape)!=null&&x.getLatLng&&((b=n==null?void 0:n._shape)!=null&&b.getRadius)){const E=n._shape.getLatLng(),C=n._shape.getRadius(),S=110574,O=S*Math.max(.1,Math.cos(E.lat*Math.PI/180)),N=Array.from({length:65},(G,D)=>{const U=D/64*Math.PI*2;return[E.lng+Math.cos(U)*C/O,E.lat+Math.sin(U)*C/S]});return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[N]}}}return typeof s.toGeoJSON=="function"?s.toGeoJSON():null}renderMeasurement(n,i){var _,x,b,E,C;if(!((_=this.measurementOverlayOptions)!=null&&_.enabled)||!n)return;const s=Uh(n);if(!s.ok){this.logger.warn("measurement-overlay:failed",s.error);return}const r=qh(s.value,this.measurementSystem,{maximumFractionDigits:(x=this.measurementOverlayOptions.maximumFractionDigits)!=null?x:2,autoScale:(b=this.measurementOverlayOptions.autoScale)!=null?b:!0});if(!r.ok)return;const h=[],f=this.measurementOverlayOptions;if(f.showLength!==!1&&s.value.lengthMeters>0&&h.push(`Length: ${r.value.length.text}`),f.showPerimeter!==!1&&s.value.perimeterMeters>0&&h.push(`Perimeter: ${r.value.perimeter.text}`),f.showArea!==!1&&s.value.areaSquareMeters>0&&h.push(`Area: ${r.value.area.text}`),!h.length)return;let d=this.measurementOverlayElement;d||(d=document.createElement("div"),d.className="geokit-measurement-overlay",d.setAttribute("role","status"),d.setAttribute("aria-live","polite"),Object.assign(d.style,{position:"absolute",zIndex:"999",pointerEvents:"none",padding:"6px 8px",borderRadius:"5px",background:"rgba(255,255,255,.94)",color:"#1f2937",border:"1px solid #94a3b8",boxShadow:"0 1px 3px rgba(0,0,0,.18)",font:"12px/1.4 system-ui",whiteSpace:"pre-line"}),this.container.appendChild(d),this.measurementOverlayElement=d),d.textContent=h.join(`
|
|
489
|
+
`);const m=(C=i!=null?i:this.lastMeasurementLatLng)!=null?C:(E=this.map)==null?void 0:E.getCenter();if(m&&this.map){const S=this.map.latLngToContainerPoint(m);d.style.left=`${S.x+12}px`,d.style.top=`${S.y+12}px`}this.lastMeasurementFeature=n,this.lastMeasurementLatLng=i?this.L.latLng(i):this.lastMeasurementLatLng}refreshMeasurementOverlay(){var n;(n=this.measurementOverlayOptions)!=null&&n.enabled&&this.renderMeasurement(this.lastMeasurementFeature,this.lastMeasurementLatLng)}hideLiveOverlays(){var n;(n=this.measurementOverlayElement)==null||n.remove(),this.measurementOverlayElement=null,this.lastMeasurementFeature=null,this.lastMeasurementLatLng=null,this.showSnapFeedback(null)}installEditMarkerSnap(n,i,s){var d,m;if(!(n!=null&&n.on)||n._geokitSnapBound)return;n._geokitSnapBound=!0;const r=i._onMarkerDrag,h=i._onTouchMove;r&&((d=n.off)==null||d.call(n,"drag",r,i));const f=_=>{var E,C,S,O,N,G;const x=(E=i._poly)==null?void 0:E._fid,b=this.findSnapResult((C=n.getLatLng)==null?void 0:C.call(n),x);this.showSnapFeedback(b),b&&n.setLatLng(b.latlng),r==null||r.call(i,{..._,target:n}),this.renderMeasurement((N=(O=(S=i._poly)==null?void 0:S.toGeoJSON)==null?void 0:O.call(S))!=null?N:null,(G=n.getLatLng)==null?void 0:G.call(n))};if(n.on("drag",f,i),h){(m=n.off)==null||m.call(n,"touchmove",h,i);const _=x=>{var C,S,O,N,G,D,U,W;const b=(S=this.eventLatLng(x))!=null?S:(C=n.getLatLng)==null?void 0:C.call(n),E=this.findSnapResult(b,(O=i._poly)==null?void 0:O._fid);this.showSnapFeedback(E),E?(n.setLatLng(E.latlng),r==null||r.call(i,{...x,target:n})):(b&&((N=n.setLatLng)==null||N.call(n,b)),h?h.call(i,{...x,target:n}):r==null||r.call(i,{...x,target:n})),this.renderMeasurement((U=(D=(G=i._poly)==null?void 0:G.toGeoJSON)==null?void 0:D.call(G))!=null?U:null,(W=n.getLatLng)==null?void 0:W.call(n))};n.on("touchmove",_,i),s.push(()=>{var x;return(x=n.off)==null?void 0:x.call(n,"touchmove",_,i)})}s.push(()=>{var _,x,b;(_=n.off)==null||_.call(n,"drag",f,i),n._geokitSnapBound=!1,r&&((x=n.on)==null||x.call(n,"drag",r,i)),h&&((b=n.on)==null||b.call(n,"touchmove",h,i))})}installEditHandlerSnap(n,i){const s=n==null?void 0:n._createMarker;if(typeof s!="function"||n._geokitSnapCreateMarker)return;const r=Object.prototype.hasOwnProperty.call(n,"_createMarker"),h=n._createMarker,f=this,d=function(..._){const x=s.apply(this,_);return f.installEditMarkerSnap(x,this,i),x};n._geokitSnapCreateMarker=!0,n._createMarker=d,i.push(()=>{n._createMarker===d&&(r?n._createMarker=h:delete n._createMarker),delete n._geokitSnapCreateMarker})}installInteractionIntegrations(){var E,C,S,O,N,G,D;if((E=this.interactionCleanup)==null||E.call(this),this.interactionCleanup=null,this.hideLiveOverlays(),!this.map||!this.drawControl)return;const n=[],i=[],s=!!(((C=this.snappingOptions)==null?void 0:C.enabled)!==!1&&this.snappingOptions);let r=!0;const h=!!((S=this.measurementOverlayOptions)!=null&&S.enabled),f=()=>{var U;for(;i.length;)(U=i.pop())==null||U();this.showSnapFeedback(null)};if(s){const U=Object.values((D=(G=(N=(O=this.drawControl)==null?void 0:O._toolbars)==null?void 0:N.draw)==null?void 0:G._modes)!=null?D:{});for(const W of U){const X=W==null?void 0:W.handler;if(X)for(const et of["_onMouseMove","_onMouseDown","_onMouseUp","_onTouch"]){const ot=X[et];if(typeof ot!="function")continue;const I=P=>{var j,B,Y;const R=this.eventLatLng(P),F=this.findSnapResult(R);this.showSnapFeedback(F);const q=F?{...P,latlng:F.latlng}:P,H=ot.call(X,q);return F&&(X._currentLatLng=F.latlng,(j=X._mouseMarker)==null||j.setLatLng(F.latlng),typeof X._updateGuide=="function"&&X._updateGuide(this.map.latLngToLayerPoint(F.latlng)),(B=X._updateTooltip)==null||B.call(X,F.latlng)),this.renderMeasurement(this.geometryFeatureForHandler(X,F==null?void 0:F.latlng),(Y=F==null?void 0:F.latlng)!=null?Y:R),H};X[et]=I,n.push(()=>{X[et]===I&&(X[et]=ot)})}}}const d=U=>{var ot,I,P,R,F,q;const W=Object.values((R=(P=(I=(ot=this.drawControl)==null?void 0:ot._toolbars)==null?void 0:I.draw)==null?void 0:P._modes)!=null?R:{}).map(H=>H==null?void 0:H.handler).find(H=>H==null?void 0:H._enabled);if(!W)return;const X=this.eventLatLng(U),et=s?this.findSnapResult(X):null;s&&this.showSnapFeedback(et),this.renderMeasurement(this.geometryFeatureForHandler(W,(F=et==null?void 0:et.latlng)!=null?F:X),(q=et==null?void 0:et.latlng)!=null?q:X)};this.map.on("mousemove touchmove",d),n.push(()=>{var U;return(U=this.map)==null?void 0:U.off("mousemove touchmove",d)});const m=()=>{var U,W,X,et;if(h)for(const ot of(X=(W=(U=this.drawnItems)==null?void 0:U.getLayers)==null?void 0:W.call(U))!=null?X:[]){const I=ot,P=()=>{var R,F,q;return this.renderMeasurement((F=(R=I.toGeoJSON)==null?void 0:R.call(I))!=null?F:null,(q=I.getLatLng)==null?void 0:q.call(I))};(et=I.on)==null||et.call(I,"editdrag drag",P),i.push(()=>{var R;return(R=I.off)==null?void 0:R.call(I,"editdrag drag",P)})}s&&queueMicrotask(()=>{var ot,I,P,R,F;if(r)for(const q of(P=(I=(ot=this.drawnItems)==null?void 0:ot.getLayers)==null?void 0:I.call(ot))!=null?P:[]){const H=q.editing;for(const j of(R=H==null?void 0:H._verticesHandlers)!=null?R:[]){this.installEditHandlerSnap(j,i);for(const B of(F=j==null?void 0:j._markers)!=null?F:[])this.installEditMarkerSnap(B,j,i)}}})},_=U=>{var X,et,ot,I,P,R,F,q,H,j;const W=(P=(et=(X=U==null?void 0:U.poly)==null?void 0:X.toGeoJSON)==null?void 0:et.call(X))!=null?P:(I=(ot=U==null?void 0:U.layer)==null?void 0:ot.toGeoJSON)==null?void 0:I.call(ot);this.renderMeasurement(W,(j=(F=(R=U==null?void 0:U.marker)==null?void 0:R.getLatLng)==null?void 0:F.call(R))!=null?j:(H=(q=U==null?void 0:U.poly)==null?void 0:q.getCenter)==null?void 0:H.call(q))},x=()=>{f(),this.hideLiveOverlays()},b=()=>{this.hideLiveOverlays()};this.map.on("draw:editstart",m),this.map.on("draw:editvertex",_),this.map.on("draw:editstop",x),this.map.on("draw:drawstop",b),n.push(()=>{var U,W,X,et;r=!1,f(),(U=this.map)==null||U.off("draw:editstart",m),(W=this.map)==null||W.off("draw:editvertex",_),(X=this.map)==null||X.off("draw:editstop",x),(et=this.map)==null||et.off("draw:drawstop",b)}),this.interactionCleanup=()=>{var U;for(;n.length;)(U=n.pop())==null||U();f(),this.hideLiveOverlays()}}bindDrawEvents(){if(!this.map||!this.drawnItems)return;const n=i=>{const s=i==="cake"?"layerCake":i;return["polygon","polyline","rectangle","circle","marker","layerCake","move"].includes(String(s))?s:null};this.map.on("draw:drawstart",i=>{const s=n(i==null?void 0:i.layerType);s&&this.observePersistentToolStart(s,{source:"leaflet-toolbar"})}),this.map.on("draw:editstart",()=>{this.observePersistentToolStart("edit",{source:"leaflet-toolbar"})}),this.map.on("draw:deletestart",()=>{this.observePersistentToolStart("delete",{source:"leaflet-toolbar"})}),this.map.on("draw:canceled",i=>{var r;const s=n(i==null?void 0:i.layerType);s&&((r=this.activeToolCommand)==null?void 0:r.tool)===s&&this.cancelActiveTool("Cancelled with Escape")}),this.map.on("draw:drawstop",i=>{const s=n(i==null?void 0:i.layerType);s&&this.handlePersistentToolStop(s,"Draw interaction stopped")}),this.map.on("draw:editstop",()=>{this.handlePersistentToolStop("edit","Edit interaction stopped")}),this.map.on("draw:deletestop",()=>{this.handlePersistentToolStop("delete","Delete interaction stopped")}),this.toolEscapeKeyHandler||(this.toolEscapeKeyHandler=i=>{var r,h,f,d;if(i.type!=="keydown"||i.defaultPrevented||i.repeat)return;const s=i.target;if(!(s instanceof HTMLElement&&s.closest("input, textarea, select, [contenteditable], [role='dialog']"))){if(i.key==="Escape"&&this.activeToolCommand)i.preventDefault(),this.deactivateTool({source:"api"});else if((i.ctrlKey||i.metaKey)&&i.key==="Enter"){i.preventDefault();const m=(r=this.activeToolCommand)==null?void 0:r.tool;if(m==="edit"||m==="delete"){const _=this.findLeafletDrawHandler(m);(h=_==null?void 0:_.save)==null||h.call(_),(f=_==null?void 0:_.disable)==null||f.call(_)}else m==="move"?((d=this.activeMoveHandler)==null||d.confirmMove(),this.hideMoveConfirmationUI()):this.activateTool("save")}}},this.container.addEventListener("keydown",this.toolEscapeKeyHandler),this.container.addEventListener("keyup",this.toolEscapeKeyHandler)),this.map.on(this.L.Draw.Event.CREATED,i=>{var s,r,h,f,d;try{const{layer:m,layerType:_}=i;if(_===Go.TYPE){try{this.activeCakeSession&&this.emitCakeEvent("tool:layer-cake:cancelled"),(s=this.activeCakeSession)==null||s.destroy()}catch{}this.cakeSessionCommand=this.activeToolCommand,this.activeCakeSession=new Tf(this.map,m,O=>{var et;if(!this.drawnItems)return;const N=this.activeCakeSession.snapshot();O.features.forEach((ot,I)=>{ot.properties={...ot.properties,name:`${N.name} ${I===0?"core":`ring ${I}`}`}});const G=this.store.add(O),D=this.layerRegistry.add(G,{name:N.name,kind:"drawn",style:N.style}),U=this.L.geoJSON(O);let W=0;U.eachLayer(ot=>{var P,R,F;const I=(P=G[W])!=null?P:G[G.length-1];ot._fid=I,this.featureLayers.set(I,ot),this.drawnItems.addLayer(ot),this.installVertexContextMenu(ot),(F=(R=this.options.callbacks)==null?void 0:R.onCreated)==null||F.call(R,{id:I,layerType:"polygon",geoJSON:ot.toGeoJSON()}),W++}),this.applyLayerRegistry();const X=((et=this.activeToolCommand)==null?void 0:et.tool)==="layerCake"?this.activeToolCommand:null;this.emitCakeEvent("tool:layer-cake:saved",{layerId:D,featureCollection:O,source:X==null?void 0:X.source,groupId:X==null?void 0:X.groupId,commandId:X==null?void 0:X.commandId}),this.activeCakeSession=null,this.cakeSessionCommand=null,X&&(this.completeActiveTool({featureIds:G,geometry:O},!0),this.clearActiveTool(X))},this.measurementSystem,()=>this.emitCakeEvent("tool:layer-cake:session-changed"));const S=((r=this.activeToolCommand)==null?void 0:r.tool)==="layerCake"?this.activeToolCommand:null;this.emitCakeEvent("tool:layer-cake:session-started",{center:m.getLatLng(),radius:m.getRadius(),source:S==null?void 0:S.source,groupId:S==null?void 0:S.groupId,commandId:S==null?void 0:S.commandId});return}this.drawnItems.addLayer(m);const x=m.toGeoJSON(),E=this.store.add({type:"FeatureCollection",features:[x]})[0];m._fid=E,this.installVertexContextMenu(m),this.featureLayers.set(E,m),this.layerRegistry.add([E],{name:`${_} layer`,kind:"drawn"}),this.applyLayerRegistry(),(f=(h=this.options.callbacks)==null?void 0:h.onCreated)==null||f.call(h,{id:E,layerType:_,geoJSON:x});const C=om[_];C&&this.emitToolEvent(C,{id:E,geoJSON:x}),((d=this.activeToolCommand)==null?void 0:d.tool)===_&&this.completeActiveTool({featureIds:[E],geometry:x},!0)}catch(m){this.failActiveTool(m instanceof Error?m.message:"Draw completion failed"),this._error("onCreated handler failed",m)}}),this.map.on(this.L.Draw.Event.EDITED,i=>{var s,r,h;try{const f=[];i.layers.eachLayer(_=>{const x=_.toGeoJSON(),b=_._fid;if(b)this.store.update(b,x),f.push(b);else{const E=this.store.add({type:"FeatureCollection",features:[x]})[0];_._fid=E,f.push(E),this.featureLayers.set(E,_),this.layerRegistry.add([E],{kind:"drawn"})}});const m=this.store.toFeatureCollection();(r=(s=this.options.callbacks)==null?void 0:s.onEdited)==null||r.call(s,{ids:f,geoJSON:m}),this.emitToolEvent("tool:edit:applied",{ids:f,geoJSON:m}),((h=this.activeToolCommand)==null?void 0:h.tool)==="edit"&&this.completeActiveTool({featureIds:f,geometry:m},!0)}catch(f){this.failActiveTool(f instanceof Error?f.message:"Edit completion failed"),this._error("onEdited handler failed",f)}}),this.map.on(this.L.Draw.Event.DELETED,i=>{var s,r,h;try{const f=[];i.layers.eachLayer(_=>{const x=_._fid;x&&(f.push(x),this.store.remove(x),this.featureLayers.delete(x),this.layerRegistry.removeFeature(x))});const m=this.store.toFeatureCollection();(r=(s=this.options.callbacks)==null?void 0:s.onDeleted)==null||r.call(s,{ids:f,geoJSON:m}),this.emitToolEvent("tool:delete:applied",{ids:f,geoJSON:m}),this.applyLayerRegistry(),((h=this.activeToolCommand)==null?void 0:h.tool)==="delete"&&this.completeActiveTool({featureIds:f,geometry:m},!0)}catch(f){this.failActiveTool(f instanceof Error?f.message:"Delete completion failed"),this._error("onDeleted handler failed",f)}}),this.map.on("draw:moveend",i=>{var s;try{this.emitToolEvent("tool:move:pending",{layerId:(s=i==null?void 0:i.layer)==null?void 0:s._fid,originalGeoJSON:i==null?void 0:i.originalGeoJSON,newGeoJSON:i==null?void 0:i.newGeoJSON}),this.showMoveConfirmationUI(i.layer)}catch(r){this._error("draw:moveend handler failed",r)}}),this.map.on("draw:moveconfirmed",i=>{var s,r,h,f;try{this.emitToolEvent("tool:move:confirmed",{layerId:(s=i==null?void 0:i.layer)==null?void 0:s._fid,originalGeoJSON:i==null?void 0:i.originalGeoJSON,newGeoJSON:i==null?void 0:i.newGeoJSON});const d=i.layer,m=d._fid;if(m){const _=d.toGeoJSON();this.store.update(m,_),(h=(r=this.options.callbacks)==null?void 0:r.onEdited)==null||h.call(r,{ids:[m],geoJSON:this.store.toFeatureCollection()})}((f=this.activeToolCommand)==null?void 0:f.tool)==="move"&&this.completeActiveTool({featureIds:m?[m]:[],geometry:i==null?void 0:i.newGeoJSON},!1),this.hideMoveConfirmationUI()}catch(d){this.failActiveTool(d instanceof Error?d.message:"Move completion failed"),this._error("draw:moveconfirmed handler failed",d)}})}_error(n,i,s){var h,f,d,m;const r={code:(h=s==null?void 0:s.code)!=null?h:"controller_error",message:n,recoverable:(f=s==null?void 0:s.recoverable)!=null?f:!0,cause:i,timestamp:Date.now()};this.logger.error("error",r),(m=(d=this.options.callbacks)==null?void 0:d.onError)==null||m.call(d,r)}installVertexEditSurfaceMenu(){var r;if(!this.map)return;try{(r=this.vertexEditSurfaceCleanup)==null||r.call(this)}catch{}const n=this.map.getContainer(),i=h=>{this.openNearestEditableVertexMenuFromDomEvent(h)},s=h=>{(h.ctrlKey||h.metaKey)&&this.openNearestEditableVertexMenuFromDomEvent(h)};n.addEventListener("contextmenu",i,{capture:!0}),n.addEventListener("click",s,{capture:!0}),this.vertexEditSurfaceCleanup=()=>{n.removeEventListener("contextmenu",i,{capture:!0}),n.removeEventListener("click",s,{capture:!0})}}openNearestEditableVertexMenuFromDomEvent(n){try{if(!this.map||!this.drawnItems)return;const i=this.map.mouseEventToContainerPoint(n),s=this.map.containerPointToLatLng(i);let r=null;if(this.drawnItems.eachLayer(h=>{if(r)return;const f=h.editing;if(!(f&&typeof f.enabled=="function"&&f.enabled()))return;const m=this.findNearestVertex(h,s,16);m&&(r={layer:h,...m})}),!r)return;n.preventDefault(),n.stopPropagation(),this.showVertexMenu(i,async()=>{await this.deleteVertex(r.layer,r.pathIndex,r.vertexIndex)})}catch(i){this._error("openNearestEditableVertexMenuFromDomEvent",i)}}installVertexContextMenu(n){if(!n||typeof n.on!="function")return;const i=r=>{var h,f,d,m;try{(f=(h=r==null?void 0:r.originalEvent)==null?void 0:h.preventDefault)==null||f.call(h),(m=(d=r==null?void 0:r.originalEvent)==null?void 0:d.stopPropagation)==null||m.call(d)}catch{}this.openVertexMenu(n,r)},s=r=>{const h=r==null?void 0:r.originalEvent;h&&(h.ctrlKey||h.metaKey)&&this.openVertexMenu(n,r)};try{n.on("contextmenu",i),n.on("click",s)}catch{}}openVertexMenu(n,i){try{if(!this.map||!(typeof n.getLatLngs=="function"&&(n instanceof this.L.Polygon||n instanceof this.L.Polyline)))return;const r=n.editing;if(!r||typeof r.enabled!="function"||!r.enabled())return;const h=i==null?void 0:i.latlng,f=this.map.latLngToContainerPoint(h),d=this.findNearestVertex(n,h,12);if(!d)return;this.showVertexMenu(f,async()=>{await this.deleteVertex(n,d.pathIndex,d.vertexIndex)})}catch(s){this._error("openVertexMenu",s)}}showVertexMenu(n,i){var s;try{try{(s=this.vertexMenuCleanup)==null||s.call(this)}catch{}if(this.vertexMenuCleanup=null,!this.container)return;const r=document.createElement("div");r.style.position="absolute",r.style.top=`${n.y}px`,r.style.left=`${n.x}px`,r.style.transform="translate(-50%, -100%)",r.style.background="#fff",r.style.border="1px solid rgba(0,0,0,0.15)",r.style.borderRadius="6px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)",r.style.padding="6px",r.style.zIndex="10000",r.style.fontSize="12px",r.style.userSelect="none";const h=document.createElement("button");h.textContent="Delete vertex",h.style.padding="6px 10px",h.style.border="none",h.style.background="#da1e28",h.style.color="#fff",h.style.borderRadius="4px",h.style.cursor="pointer",h.addEventListener("click",m=>{m.stopPropagation(),m.preventDefault();try{i()}finally{f()}}),r.appendChild(h);const f=()=>{try{window.removeEventListener("pointerdown",d),this.container.removeEventListener("scroll",f,!0),r.remove()}catch{}this.vertexMenuEl=null,this.vertexMenuCleanup=null},d=m=>{!(typeof m.composedPath=="function"?m.composedPath():[]).includes(r)&&!r.contains(m.target)&&f()};window.addEventListener("pointerdown",d,{capture:!0}),this.container.addEventListener("scroll",f,!0),this.container.appendChild(r),this.vertexMenuEl=r,this.vertexMenuCleanup=f}catch(r){this._error("showVertexMenu",r)}}findNearestVertex(n,i,s){if(!this.map)return null;const r=E=>this.map.latLngToContainerPoint(E),h=(E,C)=>Math.hypot(E.x-C.x,E.y-C.y),f=r(i);let d=1/0,m=-1,_=-1;const x=n.getLatLngs();return(Array.isArray(x[0])?x:[x]).forEach((E,C)=>{E.forEach((S,O)=>{const N=r(S),G=h(N,f);G<d&&(d=G,m=C,_=O)})}),m===-1||d>s?null:{pathIndex:m,vertexIndex:_}}async deleteVertex(n,i,s){var r,h,f;try{if(!(typeof n.getLatLngs=="function"&&(n instanceof this.L.Polygon||n instanceof this.L.Polyline)))return;const m=n.getLatLngs(),_=Array.isArray(m[0])?m:[m],x=_[i];if(!x)return;const E=n instanceof this.L.Polygon?3:2;if(x.length<=E)return;if(x.splice(s,1),_.length===1)n.setLatLngs(x);else{const S=_.map((O,N)=>N===i?x:O);n.setLatLngs(S)}(r=n.redraw)==null||r.call(n);const C=n._fid;if(C){const S=n.toGeoJSON();this.store.update(C,S),(f=(h=this.options.callbacks)==null?void 0:h.onEdited)==null||f.call(h,{ids:[C],geoJSON:this.store.toFeatureCollection()})}}catch(d){this._error("deleteVertex",d)}}showMoveConfirmationUI(n){var i,s;try{if(this.hideMoveConfirmationUI(),!this.container||!this.map)return;const r=this.drawControl;if(!r)return;const h=(i=r==null?void 0:r._toolbars)==null?void 0:i.draw;if(!h)return;const f=h._modes||{};let d=null;for(const C in f){const S=f[C];if(((s=S==null?void 0:S.handler)==null?void 0:s.type)==="move"){d=S.handler;break}}this.activeMoveHandler=d;const m=document.createElement("div");m.dataset.geokitMoveConfirmation="",this.L.DomEvent.disableClickPropagation(m),this.L.DomEvent.disableScrollPropagation(m),m.style.position="absolute";const _=this.container.getBoundingClientRect();let x=60;this.container.querySelectorAll("[data-geokit-managed-toolbar]").forEach(C=>{var O;const S=C.getBoundingClientRect();S.width&&S.height&&((O=C.dataset.geokitToolbarPosition)!=null&&O.startsWith("bottom"))&&(x=Math.max(x,_.bottom-S.top+8))}),m.style.bottom=`${x}px`,m.style.maxWidth="calc(100% - 32px)",m.style.boxSizing="border-box",m.style.left="50%",m.style.transform="translateX(-50%)",m.style.display="flex",m.style.gap="8px",m.style.background="#fff",m.style.border="2px solid #3388ff",m.style.borderRadius="8px",m.style.padding="12px 16px",m.style.boxShadow="0 4px 12px rgba(0,0,0,0.2)",m.style.zIndex="10000",m.style.fontSize="14px",m.style.fontFamily="system-ui, sans-serif";const b=document.createElement("button");b.textContent="✓ Save",b.style.minHeight="44px",b.style.minWidth="44px",b.style.whiteSpace="nowrap",b.style.padding="8px 16px",b.style.border="none",b.style.background="#28a745",b.style.color="#fff",b.style.borderRadius="4px",b.style.cursor="pointer",b.style.fontWeight="600",b.style.fontSize="14px",b.addEventListener("click",C=>{C.stopPropagation(),C.preventDefault(),d!=null&&d.confirmMove&&d.confirmMove()});const E=document.createElement("button");E.textContent="✕ Cancel",E.style.minHeight="44px",E.style.minWidth="44px",E.style.whiteSpace="nowrap",E.style.padding="8px 16px",E.style.border="1px solid #ccc",E.style.background="#fff",E.style.color="#333",E.style.borderRadius="4px",E.style.cursor="pointer",E.style.fontWeight="600",E.style.fontSize="14px",E.addEventListener("click",C=>{C.stopPropagation(),C.preventDefault(),this.emitToolEvent("tool:move:cancelled",{layerId:n==null?void 0:n._fid}),d!=null&&d.cancelMove&&d.cancelMove(),this.hideMoveConfirmationUI()}),m.appendChild(b),m.appendChild(E),this.container.appendChild(m),this.moveConfirmationUI=m,this.logger.debug("showMoveConfirmationUI",{layerId:n._fid})}catch(r){this._error("showMoveConfirmationUI",r)}}hideMoveConfirmationUI(){try{this.moveConfirmationUI&&(this.moveConfirmationUI.remove(),this.moveConfirmationUI=null),this.activeMoveHandler=null}catch(n){this._error("hideMoveConfirmationUI",n)}}}const Hh=[25,41],Yh=[12,41],Vh=[1,-34];function ir(a,n){var s,r,h,f;if(a==null)return null;const i=typeof a=="string"?a.trim():"";if(!i)return(s=n.reportError)==null||s.call(n,n.errorMessage,n.cause),null;try{return new URL(i,(r=n.baseUrl)!=null?r:document.baseURI).toString()}catch(d){return(f=n.reportError)==null||f.call(n,n.errorMessage,(h=n.cause)!=null?h:d),null}}function rl(a,n,i){var m,_;if(a==null)return[...n];if(!Array.isArray(a)||a.length!==2)return(m=i.reportError)==null||m.call(i,i.errorMessage,i.cause),[...n];const[s,r]=a,h=Number(s),f=Number(r);return Number.isFinite(h)&&Number.isFinite(f)&&(!i.positiveOnly||h>0&&f>0)?[h,f]:((_=i.reportError)==null||_.call(i,i.errorMessage,i.cause),[...n])}function ol(a,n,i){var m,_,x,b,E;if(a==null)return[...n];const s=typeof a=="string"?a.trim():"";if(!s)return(m=i.reportError)==null||m.call(i,i.errorMessage,i.cause),[...n];const r=s.split(",");if(r.length!==2)return(_=i.reportError)==null||_.call(i,i.errorMessage,i.cause),[...n];const h=Number((x=r[0])==null?void 0:x.trim()),f=Number((b=r[1])==null?void 0:b.trim());return Number.isFinite(h)&&Number.isFinite(f)&&(!i.positiveOnly||h>0&&f>0)?[h,f]:((E=i.reportError)==null||E.call(i,i.errorMessage,i.cause),[...n])}function am(a,n={}){var h,f;if(!a||typeof a!="object")return null;const i=ir(a.iconUrl,{...n,errorMessage:"Invalid marker icon config: iconUrl must be a valid URL",cause:{field:"iconUrl",value:a.iconUrl}});if(!i)return null;const s=(h=ir(a.iconRetinaUrl,{...n,errorMessage:"Invalid marker icon config: iconRetinaUrl must be a valid URL",cause:{field:"iconRetinaUrl",value:a.iconRetinaUrl}}))!=null?h:i,r=(f=ir(a.shadowUrl,{...n,errorMessage:"Invalid marker icon config: shadowUrl must be a valid URL",cause:{field:"shadowUrl",value:a.shadowUrl}}))!=null?f:void 0;return{iconUrl:i,iconRetinaUrl:s,shadowUrl:r,iconSize:rl(a.iconSize,Hh,{...n,positiveOnly:!0,errorMessage:"Invalid marker icon config: iconSize must be a [width, height] tuple of positive finite numbers",cause:{field:"iconSize",value:a.iconSize}}),iconAnchor:rl(a.iconAnchor,Yh,{...n,errorMessage:"Invalid marker icon config: iconAnchor must be a [x, y] tuple of finite numbers",cause:{field:"iconAnchor",value:a.iconAnchor}}),popupAnchor:rl(a.popupAnchor,Vh,{...n,errorMessage:"Invalid marker icon config: popupAnchor must be a [x, y] tuple of finite numbers",cause:{field:"popupAnchor",value:a.popupAnchor}})}}function lm(a,n={}){var h,f;const i=ir(a.iconUrl,{...n,errorMessage:'Invalid "marker-icon-url" attribute; falling back to default markers',cause:{attribute:"marker-icon-url",value:a.iconUrl}});if(!i)return null;const s=(h=ir(a.iconRetinaUrl,{...n,errorMessage:'Invalid "marker-icon-retina-url" attribute; using "marker-icon-url" instead',cause:{attribute:"marker-icon-retina-url",value:a.iconRetinaUrl}}))!=null?h:i,r=(f=ir(a.shadowUrl,{...n,errorMessage:'Invalid "marker-shadow-url" attribute; dropping the custom marker shadow',cause:{attribute:"marker-shadow-url",value:a.shadowUrl}}))!=null?f:void 0;return{iconUrl:i,iconRetinaUrl:s,shadowUrl:r,iconSize:ol(a.iconSize,Hh,{...n,positiveOnly:!0,errorMessage:'Invalid "marker-icon-size" attribute; using the default marker size',cause:{attribute:"marker-icon-size",value:a.iconSize}}),iconAnchor:ol(a.iconAnchor,Yh,{...n,errorMessage:'Invalid "marker-icon-anchor" attribute; using the default marker anchor',cause:{attribute:"marker-icon-anchor",value:a.iconAnchor}}),popupAnchor:ol(a.popupAnchor,Vh,{...n,errorMessage:'Invalid "marker-popup-anchor" attribute; using the default popup anchor',cause:{attribute:"marker-popup-anchor",value:a.popupAnchor}})}}class sl extends HTMLElement{constructor(){super();Q(this,"_root");Q(this,"_container");Q(this,"_logger",Ro("component:leaflet-geokit","debug"));Q(this,"_latitude",0);Q(this,"_longitude",0);Q(this,"_zoom",2);Q(this,"_minZoom");Q(this,"_maxZoom");Q(this,"_tileUrl","https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");Q(this,"_tileAttribution");Q(this,"_tileProvider");Q(this,"_tileStyle");Q(this,"_apiKey");Q(this,"_activeTileProvider","tile-url");Q(this,"_readOnly",!1);Q(this,"_logLevel","debug");Q(this,"_devOverlay",!1);Q(this,"_polygonAllowIntersection",!1);Q(this,"_preferCanvas",!0);Q(this,"_themeUrl");Q(this,"_themeCss","");Q(this,"_themeLinkEl",null);Q(this,"_themeStyleEl",null);Q(this,"_controller",null);Q(this,"_useExternalLeaflet",!1);Q(this,"_skipLeafletStyles",!1);Q(this,"_leafletInstance");Q(this,"_toolHooks");Q(this,"_toolEventEmitter");Q(this,"_markerIconConfig");Q(this,"_toolButtonConfig");Q(this,"_toolbarGroups");Q(this,"_snapping");Q(this,"_measurementOverlay");Q(this,"_internalToolEvents",new WeakSet);Q(this,"_toolCommandSequence",0);Q(this,"_activeTool",null);Q(this,"_providerCapabilityError",null);Q(this,"_lastCapabilities","");Q(this,"_configurationUpdate",Promise.resolve());Q(this,"_status",{state:"uninitialized",ready:!1,busy:!1,featureCount:0,timestamp:Date.now()});Q(this,"_externalToolTriggerListener",i=>{var r,h;const s=i.detail;if((s==null?void 0:s.action)==="deactivate"||(s==null?void 0:s.active)===!1){this.deactivateTool({source:(r=s.source)!=null?r:"event",groupId:s.groupId,commandId:s.commandId});return}s!=null&&s.tool&&this.activateTool(s.tool,{source:(h=s.source)!=null?h:"event",groupId:s.groupId,commandId:s.commandId})});Q(this,"_externalToolDeactivateListener",i=>{var r;const s=i.detail;this.deactivateTool({source:(r=s==null?void 0:s.source)!=null?r:"event",groupId:s==null?void 0:s.groupId,commandId:s==null?void 0:s.commandId})});Q(this,"_externalToolCommandListener",i=>{var d,m;if(this._internalToolEvents.has(i))return;const s=i.detail;if(!(s!=null&&s.tool))return;const r=(d=s.source)!=null?d:"event",h=((m=s.commandId)==null?void 0:m.trim())||this._nextToolCommandId(),f=s.action==="deactivate"||s.tool==="select"?"deactivate":"activate";s.tool=f==="deactivate"?"select":s.tool,Object.assign(s,{tool:s.tool,action:f,source:r,groupId:s.groupId,commandId:h,previousTool:this._activeTool,activeTool:this._activeTool,featureIds:[],timestamp:Date.now()}),queueMicrotask(()=>{this._emitToolTriggerRequested(f==="deactivate"?"select":s.tool,{source:r,groupId:s.groupId,commandId:h});const _=this._controller;if(typeof(_==null?void 0:_.handleToolCommand)=="function"){_.handleToolCommand(s);return}const x=f==="deactivate"?"select":s.tool;this._emitStandaloneToolFailure(x,f,{source:r,groupId:s.groupId,commandId:h},"Map controller is not initialized",!1)})});this._root=this.attachShadow({mode:"open"}),this._root.innerHTML=`
|
|
493
490
|
<style>
|
|
494
491
|
:host {
|
|
495
492
|
display: block;
|
|
@@ -502,5 +499,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
502
499
|
}
|
|
503
500
|
</style>
|
|
504
501
|
<div class="map-container" part="host map"></div>
|
|
505
|
-
`;const i=this._root.querySelector(".map-container");if(!(i instanceof HTMLDivElement))throw new Error("Failed to initialize map container");this._container=i;const s=this.getAttribute("log-level");s&&(this._logLevel=s,this._logger.setLevel(s))}_controlsFromAttributes(){return{polygon:this.hasAttribute("draw-polygon"),polyline:this.hasAttribute("draw-polyline"),rectangle:this.hasAttribute("draw-rectangle"),circle:this.hasAttribute("draw-circle"),cake:this.hasAttribute("draw-layer-cake"),marker:this.hasAttribute("draw-marker"),move:this.hasAttribute("draw-move"),edit:this.hasAttribute("edit-features"),delete:this.hasAttribute("delete-features"),ruler:this.hasAttribute("draw-ruler")}}_mapConfig(){return{latitude:this._latitude,longitude:this._longitude,zoom:this._zoom,minZoom:this._minZoom,maxZoom:this._maxZoom,tileUrl:this._tileUrl,tileAttribution:this._tileAttribution,readOnly:this._readOnly,fitToDataOnLoad:!1,logLevel:this._logLevel,devOverlay:this._devOverlay,polygonAllowIntersection:this._polygonAllowIntersection,preferCanvas:this._preferCanvas,useExternalLeaflet:this._useExternalLeaflet,skipLeafletStyles:this._skipLeafletStyles}}async connectedCallback(){var i,s,r;this._logger.debug("connectedCallback",this._currentConfig()),this._setStatus({state:"initializing",ready:!1,busy:!0,featureCount:0,lastEvent:"connected",lastError:null}),Lc({root:this._root,skipStyles:this._skipLeafletStyles}),this._applyThemeStyles(),this._controller=new sm({container:this._container,map:this._mapConfig(),controls:this._controlsFromAttributes(),readOnly:this._readOnly,logger:this._logger.child("controller"),callbacks:{onToolCapabilitiesChanged:()=>this._emitToolCapabilities(),onReady:h=>{this.dispatchEvent(new CustomEvent(ie.Ready,{detail:h})),this._syncStatusFromController({state:"ready",ready:!0,busy:!1,lastEvent:ie.Ready,clearLastError:!0})},onCreated:h=>{this.dispatchEvent(new CustomEvent(ie.Created,{detail:h})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:this._status.featureCount+1,lastEvent:ie.Created,lastError:null})},onEdited:h=>{this.dispatchEvent(new CustomEvent(ie.Edited,{detail:h})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:h.geoJSON.features.length,lastEvent:ie.Edited,lastError:null})},onDeleted:h=>{this.dispatchEvent(new CustomEvent(ie.Deleted,{detail:h})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:h.geoJSON.features.length,lastEvent:ie.Deleted,lastError:null})},onError:h=>{this._emitError(h,{state:h.recoverable?this._status.ready?"ready":this._status.state:"error",lastEvent:ie.Error})},onTileError:h=>{if(this._tileProvider)return;const f=this._describeTileLayerError(h,"tile-url");this._handleTileProviderError("tile_load_failed",f,"tile-url")},onToolTrigger:h=>{this._emitToolTriggerResult(h)},onToolEvent:(h,f)=>{this._emitToolLifecycleEvent(h,f)},onLayerEvent:(h,f)=>{this.dispatchEvent(new CustomEvent(h,{detail:f,bubbles:!0,composed:!0}))},onLayerStyleRequested:h=>!this.dispatchEvent(new CustomEvent("leaflet-geokit:layer-style-request",{detail:h,cancelable:!0,bubbles:!0,composed:!0})),onSaved:h=>{this.dispatchEvent(new CustomEvent(ie.Export,{detail:{geoJSON:h.geoJSON,featureCount:h.featureCount,adapter:"editing"}})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:h.featureCount,lastEvent:ie.Export,lastError:null})}},leaflet:(i=this._leafletInstance)!=null?i:void 0,useExternalLeaflet:this._useExternalLeaflet,toolHooks:this._toolHooks,toolEventEmitter:this._toolEventEmitter,markerIconConfig:this._effectiveMarkerIconConfig(),toolButtonConfig:this._effectiveToolButtonConfig(),toolbarGroups:this._effectiveToolbarGroups(),snapping:(s=this._snapping)!=null?s:null,measurementOverlay:(r=this._measurementOverlay)!=null?r:null}),this.addEventListener(_i.ToolCommand,this._externalToolCommandListener),this.addEventListener("leaflet-geokit:trigger-tool",this._externalToolTriggerListener),this.addEventListener("leaflet-geokit:activate-tool",this._externalToolTriggerListener),this.addEventListener("leaflet-geokit:deactivate-tool",this._externalToolDeactivateListener),await this._controller.init(),this._status.state!=="error"&&this._tileProvider&&this._updateTileLayer()}async disconnectedCallback(){this._logger.debug("disconnectedCallback"),this._activeTileProvider="tile-url",this._providerCapabilityError=null,this._controller&&(await this._controller.destroy(),this._controller=null),this._activeTool=null,this.removeEventListener(_i.ToolCommand,this._externalToolCommandListener),this.removeEventListener("leaflet-geokit:trigger-tool",this._externalToolTriggerListener),this.removeEventListener("leaflet-geokit:activate-tool",this._externalToolTriggerListener),this.removeEventListener("leaflet-geokit:deactivate-tool",this._externalToolDeactivateListener),this._setStatus({state:"uninitialized",ready:!1,busy:!1,featureCount:0,lastEvent:"disconnected",lastError:null})}static get observedAttributes(){return["latitude","longitude","zoom","min-zoom","max-zoom","tile-url","tile-attribution","tile-provider","tile-style","api-key","here-api-key","read-only","log-level","dev-overlay","prefer-canvas","use-external-leaflet","skip-leaflet-styles","marker-icon-url","marker-icon-retina-url","marker-shadow-url","marker-icon-size","marker-icon-anchor","marker-popup-anchor","tool-button-config","toolbar-groups","theme-url","draw-polygon","draw-polyline","draw-rectangle","draw-circle","draw-layer-cake","draw-marker","draw-move","draw-ruler","edit-features","delete-features","polygon-allow-intersection"]}attributeChangedCallback(i,s,r){var h;switch(this._logger.debug("attributeChanged",{name:i,value:r}),i){case"latitude":this._latitude=this._coerceNumber(r,0);break;case"longitude":this._longitude=this._coerceNumber(r,0);break;case"zoom":this._zoom=this._coerceNumber(r,2);break;case"min-zoom":this._minZoom=r!=null?this._coerceNumber(r):void 0;break;case"max-zoom":this._maxZoom=r!=null?this._coerceNumber(r):void 0;break;case"tile-url":this._tileUrl=r!=null?r:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",this._controller&&this._updateTileLayer();break;case"tile-attribution":this._tileAttribution=r!=null?r:void 0,this._controller&&this._updateTileLayer();break;case"tile-provider":this._tileProvider=this._normalizeText(r,{lowercase:!0}),this._controller&&this._updateTileLayer();break;case"tile-style":this._tileStyle=this._normalizeText(r),this._controller&&this._updateTileLayer();break;case"api-key":case"here-api-key":this._syncApiKeyFromAttributes(),this._controller&&this._updateTileLayer();break;case"theme-url":this._themeUrl=r!=null?r:void 0,this.isConnected&&this._applyThemeStyles();break;case"read-only":this._readOnly=r!==null;break;case"log-level":this._logLevel=r!=null?r:this._logLevel,this._logger.setLevel(this._logLevel);break;case"dev-overlay":this._devOverlay=r!==null;break;case"polygon-allow-intersection":this._polygonAllowIntersection=r!==null;break;case"prefer-canvas":this._preferCanvas=r!==null;break;case"use-external-leaflet":this._useExternalLeaflet=r!==null;break;case"skip-leaflet-styles":this._skipLeafletStyles=r!==null;break}if(this._controller){if(i==="latitude"||i==="longitude"||i==="zoom")this._controller.setView(this._latitude,this._longitude,this._zoom);else if(this._isMarkerIconAttribute(i))this._syncMarkerIconConfig();else if(i==="tool-button-config")this._syncToolButtonConfig();else if(i==="toolbar-groups")this._syncToolbarGroups();else if(i==="min-zoom"||i==="max-zoom"||i==="read-only"||i==="dev-overlay"||i==="log-level"||i==="prefer-canvas"||i==="use-external-leaflet"||i==="skip-leaflet-styles"||i.startsWith("draw-")||i==="edit-features"||i==="delete-features"){const f=this._controller;(h=f.configure)==null||h.call(f,this._mapConfig(),this._controlsFromAttributes()),this._configurationUpdate=this._configurationUpdate.then(async()=>{var d;this._controller!==f||!this.isConnected||((d=f.configure)==null||d.call(f,this._mapConfig(),this._controlsFromAttributes()),await f.init(),this._tileProvider&&this._updateTileLayer())})}}}_updateTileLayer(){var s,r,h,f,d,m;if(!this._controller)return;const i=this._controller;if(typeof i.setTileLayer!="function"){this._logger.warn("setTileLayer is not available on MapController yet");return}this._providerCapabilityError=null;try{if(this._tileProvider){const _=this._tileProvider,x={provider:_,style:this._tileStyle,apiKey:this._apiKey,attribution:this._tileAttribution},b=Zf(x);if(!b.valid){const M=(s=b.error)!=null&&s.toLowerCase().includes("api key")?"missing_api_key":"tile_load_failed";this._handleTileProviderError(M,(r=b.error)!=null?r:"Invalid tile provider configuration",_);return}const E=da(x),C=this._activeTileProvider;i.setTileLayer(E,{onTileError:M=>{if(this._tileProvider!==_)return;const S=this._describeTileLayerError(M,_),z=_==="here"?this._resolveHereTileLayerErrorCode(S):"tile_load_failed";this._handleTileProviderError(z,S,_)}}),this._activeTileProvider=_,this._emitTileProviderChanged(_,this._tileStyle,C);return}i.setTileLayer({urlTemplate:this._tileUrl,attribution:(h=this._tileAttribution)!=null?h:"",maxZoom:this._maxZoom,subdomains:["a","b","c"]},{onTileError:_=>{const x=this._describeTileLayerError(_,"tile-url");this._handleTileProviderError("tile_load_failed",x,"tile-url")}}),this._activeTileProvider="tile-url"}catch(_){const x=this._resolveTileProviderErrorCode(_);this._logger.error("Failed to update tile layer",{error:_,code:x}),this._handleTileProviderError(x,_ instanceof Error?_.message:"Unknown tile layer error",(f=this._tileProvider)!=null?f:"unknown")}finally{(m=(d=this._controller)==null?void 0:d.setToolProvider)==null||m.call(d,this._toolProviderCapability()),this._emitToolCapabilities()}}_handleTileProviderError(i,s,r){var d,m;this._logger.error(`Tile provider error (${i}): ${s}`);const h=Date.now();this._providerCapabilityError={code:i==="missing_api_key"?"missing_api_key":i==="unknown_provider"?"missing_provider":"runtime_error",message:i==="missing_api_key"?"Requested provider requires an API key":i==="unknown_provider"?"Requested provider is unavailable":"Requested provider failed; using fallback tiles"},this.dispatchEvent(new CustomEvent("tile-provider-error",{bubbles:!0,detail:{code:i,message:s,provider:r,timestamp:h}})),this._emitDiagnostic({code:i,message:s,recoverable:!0,severity:"warn",timestamp:h},{state:this._status.ready?"ready":this._status.state,lastEvent:"tile-provider-error"});const f=this._controller;typeof f.setTileLayer=="function"&&(f.setTileLayer({urlTemplate:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19,subdomains:["a","b","c"]}),this._activeTileProvider="osm"),(m=(d=this._controller)==null?void 0:d.setToolProvider)==null||m.call(d,this._toolProviderCapability()),this._emitToolCapabilities()}_emitTileProviderChanged(i,s,r){this.dispatchEvent(new CustomEvent("tile-provider-changed",{bubbles:!0,detail:{provider:i,style:s,previousProvider:r,timestamp:Date.now()}}))}_toolProviderCapability(){var r,h;const i=this._activeTileProvider==="adapter"?"adapter":(r=this._tileProvider)!=null?r:"tile-url";let s=this._providerCapabilityError;return i!=="adapter"&&i!=="tile-url"&&i!=="osm"&&i!=="here"?s={code:"missing_provider",message:"Requested provider is unavailable"}:i==="here"&&!((h=this._apiKey)!=null&&h.trim())&&(s={code:"missing_api_key",message:"Requested provider requires an API key"}),{requested:i,active:this._activeTileProvider,state:s?"unavailable":"enabled",reason:s?{...s}:null}}setBasemapAdapter(i){var r,h;if(!this._status.ready||!this._controller)throw new Error("Map is not ready");if(!i){this._updateTileLayer();return}this._controller.setBasemapAdapter(i);const s=this._activeTileProvider;this._activeTileProvider="adapter",this._providerCapabilityError=null,this._emitTileProviderChanged("adapter",void 0,s),(h=(r=this._controller).setToolProvider)==null||h.call(r,this._toolProviderCapability()),this._emitToolCapabilities()}getProviderDiagnostics(){var r,h,f;const i=(f=(h=(r=this._controller)==null?void 0:r.getProviderDiagnostics)==null?void 0:h.call(r))!=null?f:null;if(!i||this._activeTileProvider==="adapter")return i;const s=this._activeTileProvider==="tile-url"&&this._tileUrl===da({provider:"osm"}).urlTemplate?"osm":this._activeTileProvider;if(s==="osm"||s==="here"){const d=eu({provider:s});return{...i,...d.capabilities}}return i}getToolCapabilities(){var s,r,h;return{...(h=(r=(s=this._controller)==null?void 0:s.getToolCapabilities)==null?void 0:r.call(s))!=null?h:nu({ready:!1,readOnly:this._readOnly,controls:this._controlsFromAttributes(),available:{},layerCount:0,selectedFeatureIds:[],activeTool:null,config:this._effectiveToolButtonConfig(),groups:this._effectiveToolbarGroups(),provider:this._toolProviderCapability()}),provider:this._toolProviderCapability()}}setToolSelection(i){var s;(s=this._controller)==null||s.setToolSelection(i)}_emitToolCapabilities(){const i=this.getToolCapabilities(),s=JSON.stringify(i);s!==this._lastCapabilities&&(this._lastCapabilities=s,this.dispatchEvent(new CustomEvent(_i.ToolCapabilitiesChanged,{detail:i,bubbles:!0,composed:!0})))}_isMarkerIconAttribute(i){return i==="marker-icon-url"||i==="marker-icon-retina-url"||i==="marker-shadow-url"||i==="marker-icon-size"||i==="marker-icon-anchor"||i==="marker-popup-anchor"}_effectiveMarkerIconConfig(){const i=(r,h)=>{this._emitError({code:"invalid_marker_icon_config",message:r,recoverable:!0,cause:h},{state:this._status.ready?"ready":this._status.state})};if(this._markerIconConfig===null)return null;if(this._markerIconConfig!==void 0)return am(this._markerIconConfig,{reportError:i});const s=this.getAttribute("marker-icon-url");return s==null?null:lm({iconUrl:s,iconRetinaUrl:this.getAttribute("marker-icon-retina-url"),shadowUrl:this.getAttribute("marker-shadow-url"),iconSize:this.getAttribute("marker-icon-size"),iconAnchor:this.getAttribute("marker-icon-anchor"),popupAnchor:this.getAttribute("marker-popup-anchor")},{reportError:i})}_syncMarkerIconConfig(){const i=this._controller;typeof(i==null?void 0:i.setMarkerIconConfig)=="function"&&i.setMarkerIconConfig(this._effectiveMarkerIconConfig())}_effectiveToolButtonConfig(){if(this._toolButtonConfig!==void 0)return this._toolButtonConfig;const i=this.getAttribute("tool-button-config");if(i==null||i.trim()==="")return null;try{const s=JSON.parse(i);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("tool-button-config must be a JSON object");return s}catch(s){return this._emitError({code:"invalid_tool_button_config",message:"Failed to parse tool-button-config",recoverable:!0,cause:s},{state:this._status.ready?"ready":this._status.state}),null}}_syncToolButtonConfig(){const i=this._controller;typeof(i==null?void 0:i.setToolButtonConfig)=="function"&&i.setToolButtonConfig(this._effectiveToolButtonConfig())}_effectiveToolbarGroups(){if(this._toolbarGroups!==void 0)return this._toolbarGroups;const i=this.getAttribute("toolbar-groups");if(i==null||i.trim()==="")return null;try{const s=JSON.parse(i);if(!Array.isArray(s))throw new Error("toolbar-groups must be a JSON array");return s}catch(s){return this._emitError({code:"invalid_toolbar_groups",message:"Failed to parse toolbar-groups",recoverable:!0,cause:s},{state:this._status.ready?"ready":this._status.state}),null}}_syncToolbarGroups(){const i=this._controller;typeof(i==null?void 0:i.setToolbarGroups)=="function"&&i.setToolbarGroups(this._effectiveToolbarGroups())}get latitude(){return this._latitude}set latitude(i){this._latitude=Number(i),this._reflect("latitude",String(this._latitude))}get longitude(){return this._longitude}set longitude(i){this._longitude=Number(i),this._reflect("longitude",String(this._longitude))}get zoom(){return this._zoom}set zoom(i){this._zoom=Number(i),this._reflect("zoom",String(this._zoom))}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom=i,this._reflect("min-zoom",i!=null?String(i):null)}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom=i,this._reflect("max-zoom",i!=null?String(i):null)}get tileUrl(){return this._tileUrl}set tileUrl(i){this._tileUrl=i,this._reflect("tile-url",i),this._controller&&this._updateTileLayer()}get tileProvider(){return this._tileProvider}set tileProvider(i){var s;this._tileProvider=this._normalizeText(i!=null?i:null,{lowercase:!0}),this._reflect("tile-provider",(s=this._tileProvider)!=null?s:null),this._controller&&this._updateTileLayer()}get tileStyle(){return this._tileStyle}set tileStyle(i){var s;this._tileStyle=this._normalizeText(i!=null?i:null),this._reflect("tile-style",(s=this._tileStyle)!=null?s:null),this._controller&&this._updateTileLayer()}get apiKey(){return this._apiKey}set apiKey(i){var s;this._apiKey=this._normalizeText(i!=null?i:null),this._reflect("api-key",(s=this._apiKey)!=null?s:null),this.hasAttribute("here-api-key")&&this.removeAttribute("here-api-key"),this._controller&&this._updateTileLayer()}get status(){return this._cloneStatus(this._status)}get tileAttribution(){return this._tileAttribution}set tileAttribution(i){this._tileAttribution=i,this._reflect("tile-attribution",i!=null?i:null),this._controller&&this._updateTileLayer()}get readOnly(){return this._readOnly}set readOnly(i){this._readOnly=!!i,this._booleanReflect("read-only",this._readOnly)}get logLevel(){return this._logLevel}set logLevel(i){this._logLevel=i,this._logger.setLevel(i),this._reflect("log-level",i)}get devOverlay(){return this._devOverlay}set devOverlay(i){this._devOverlay=!!i,this._booleanReflect("dev-overlay",this._devOverlay)}get preferCanvas(){return this._preferCanvas}set preferCanvas(i){this._preferCanvas=!!i,this._booleanReflect("prefer-canvas",this._preferCanvas)}get useExternalLeaflet(){return this._useExternalLeaflet}set useExternalLeaflet(i){this._useExternalLeaflet=!!i,this._booleanReflect("use-external-leaflet",this._useExternalLeaflet)}get skipLeafletStyles(){return this._skipLeafletStyles}set skipLeafletStyles(i){this._skipLeafletStyles=!!i,this._booleanReflect("skip-leaflet-styles",this._skipLeafletStyles)}get markerIconConfig(){return this._markerIconConfig}set markerIconConfig(i){this._markerIconConfig=i,this._syncMarkerIconConfig()}get toolButtonConfig(){return this._toolButtonConfig}set toolButtonConfig(i){this._toolButtonConfig=i,this._syncToolButtonConfig()}get toolbarGroups(){return this._toolbarGroups}set toolbarGroups(i){this._toolbarGroups=i,this._syncToolbarGroups()}get snapping(){return this._snapping}set snapping(i){var r;const s=this._snapping;this._snapping=i;try{(r=this._controller)==null||r.setSnappingOptions(i)}catch(h){throw this._snapping=s,h}}get measurementOverlay(){return this._measurementOverlay}set measurementOverlay(i){var r;const s=this._measurementOverlay;this._measurementOverlay=i;try{(r=this._controller)==null||r.setMeasurementOverlayOptions(i)}catch(h){throw this._measurementOverlay=s,h}}get leafletInstance(){return this._leafletInstance}set leafletInstance(i){this._leafletInstance=i}get toolHooks(){return this._toolHooks}set toolHooks(i){this._toolHooks=i;const s=this._controller;typeof(s==null?void 0:s.setToolObservers)=="function"&&s.setToolObservers({toolHooks:this._toolHooks,toolEventEmitter:this._toolEventEmitter})}get toolEventEmitter(){return this._toolEventEmitter}set toolEventEmitter(i){this._toolEventEmitter=i;const s=this._controller;typeof(s==null?void 0:s.setToolObservers)=="function"&&s.setToolObservers({toolHooks:this._toolHooks,toolEventEmitter:this._toolEventEmitter})}get themeCss(){return this._themeCss}set themeCss(i){this._themeCss=typeof i=="string"?i:"",this.isConnected&&this._applyThemeStyles()}async getGeoJSON(){return this._logger.debug("getGeoJSON"),this._controller?this._controller.getGeoJSON():{type:"FeatureCollection",features:[]}}async importGeoJSON(i,s={}){var f,d,m,_;const r=(f=s.behavior)!=null?f:"replace";if(this._logger.debug("importGeoJSON",{behavior:r,fitToData:(d=s.fitToData)!=null?d:!1,features:(_=(m=i==null?void 0:i.features)==null?void 0:m.length)!=null?_:0}),!this._controller)return[];const h=this.status;return this._setImportLoadingStatus(h),this._performImport(i,s,h,r==="add"?"Failed to add GeoJSON features to the map":"Failed to load GeoJSON into the map")}async loadGeoJSON(i){var s,r;this._logger.debug("loadGeoJSON",{features:(r=(s=i==null?void 0:i.features)==null?void 0:s.length)!=null?r:0}),await this.importGeoJSON(i,{behavior:"replace"})}async clearLayers(){this._logger.debug("clearLayers"),this._controller&&(await this._controller.clearLayers(),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:0,lastEvent:"clearLayers",lastError:null}))}async addFeatures(i){var s,r;return this._logger.debug("addFeatures",{count:(r=(s=i==null?void 0:i.features)==null?void 0:s.length)!=null?r:0}),this.importGeoJSON(i,{behavior:"add"})}async updateFeature(i,s){this._logger.debug("updateFeature",{id:i}),this._controller&&await this._controller.updateFeature(i,s)}async removeFeature(i){this._logger.debug("removeFeature",{id:i}),this._controller&&(await this._controller.removeFeature(i),await this._syncStatusFromController({state:"ready",ready:!0,busy:!1,lastEvent:"removeFeature",clearLastError:!0}))}async fitBoundsToData(i){this._logger.debug("fitBoundsToData",{padding:i}),this._controller&&await this._controller.fitBoundsToData(typeof i=="number"?i:.05)}async fitBounds(i,s){this._logger.debug("fitBounds",{bounds:i,padding:s}),this._controller&&await this._controller.fitBounds(i,typeof s=="number"?s:.05)}async setView(i,s,r){this._logger.debug("setView",{lat:i,lng:s,zoom:r}),this.latitude=i,this.longitude=s,typeof r=="number"&&(this.zoom=r),this._controller&&await this._controller.setView(i,s,r)}async exportGeoJSON(i={}){var f;const s=(f=i.adapter)!=null?f:"editing";if(this._logger.debug("exportGeoJSON",{adapter:s}),!this._controller)return{type:"FeatureCollection",features:[]};const r=await this._exportWithController(i),h={geoJSON:r,featureCount:r.features.length,adapter:s};return this.dispatchEvent(new CustomEvent(ie.Export,{detail:h})),r}async mergePolygons(i){if(this._logger.debug("mergePolygons"),!this._controller)return null;const r=(await this._controller.getGeoJSON()).features.length,h=await this._controller.mergeVisiblePolygons(i);if(h){const f=await this._controller.getGeoJSON(),d={id:h,mergedFeatureCount:r-f.features.length+1,geoJSON:f};this.dispatchEvent(new CustomEvent("leaflet-draw:merged",{detail:d})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:f.features.length,lastEvent:"leaflet-draw:merged",lastError:null})}return h}async setMeasurementUnits(i){this._logger.debug("setMeasurementUnits",{system:i}),this._controller&&this._controller.setRulerUnits(i)}getSnappingOptions(){var i,s;return(s=(i=this._controller)==null?void 0:i.getSnappingOptions())!=null?s:this._snapping?{...this._snapping}:null}getMeasurementOverlayOptions(){var i,s;return(s=(i=this._controller)==null?void 0:i.getMeasurementOverlayOptions())!=null?s:this._measurementOverlay?{...this._measurementOverlay}:null}_nextToolCommandId(){return this._toolCommandSequence+=1,`tool-${Date.now().toString(36)}-element-${this._toolCommandSequence.toString(36)}`}_emitToolTriggerRequested(i,s){this.dispatchEvent(new CustomEvent("leaflet-geokit:tool-trigger-requested",{bubbles:!0,composed:!0,detail:{tool:i,source:s.source,groupId:s.groupId,commandId:s.commandId,handled:!1,timestamp:Date.now()}}))}_baseToolEventDetail(i,s,r){return{tool:i,action:s,source:r.source,groupId:r.groupId,commandId:r.commandId,previousTool:null,activeTool:null,featureIds:[],timestamp:Date.now()}}_emitStandaloneToolFailure(i,s,r,h,f=!0){const d=this._baseToolEventDetail(i,s,r);f&&this._emitToolLifecycleEvent(_i.ToolCommand,d),this._emitToolLifecycleEvent(_i.ToolFailed,{...d,reason:h,timestamp:Date.now()}),this._emitToolTriggerResult({tool:i,source:r.source,groupId:r.groupId,commandId:r.commandId,handled:!1,timestamp:Date.now(),error:h})}async activateTool(i,s={}){var _,x,b;const r=(_=s.source)!=null?_:"api",h=((x=s.commandId)==null?void 0:x.trim())||this._nextToolCommandId(),f={source:r,groupId:s.groupId,commandId:h};if(this._emitToolTriggerRequested(i,f),!this._controller)return this._emitStandaloneToolFailure(i,i==="select"?"deactivate":"activate",f,"Map controller is not initialized"),!1;const d=this._controller,m=typeof d.activateTool=="function"?d.activateTool.bind(d):(b=d.triggerTool)==null?void 0:b.bind(d);return m?m(i,f):(this._emitStandaloneToolFailure(i,i==="select"?"deactivate":"activate",f,"Map controller cannot activate tools"),!1)}async triggerTool(i,s={}){return this.activateTool(i,s)}async deactivateTool(i={}){var m,_,x;const s=(m=i.source)!=null?m:"api",r=((_=i.commandId)==null?void 0:_.trim())||this._nextToolCommandId(),h={source:s,groupId:i.groupId,commandId:r};if(this._emitToolTriggerRequested("select",h),!this._controller)return this._emitStandaloneToolFailure("select","deactivate",h,"Map controller is not initialized"),!1;const f=this._controller;if(typeof f.deactivateTool=="function")return f.deactivateTool(h);const d=typeof f.activateTool=="function"?f.activateTool.bind(f):(x=f.triggerTool)==null?void 0:x.bind(f);return d?d("select",h):(this._emitStandaloneToolFailure("select","deactivate",h,"Map controller cannot deactivate tools"),!1)}async loadGeoJSONFromUrl(i,s={}){var m,_,x;const r=(m=s.behavior)!=null?m:"replace";if(this._logger.debug("loadGeoJSONFromUrl",{url:i,behavior:r,fitToData:(_=s.fitToData)!=null?_:!0}),!this._controller)return;const h=this.status;this._setImportLoadingStatus(h);let f;try{f=await fetch(i,{headers:{Accept:"application/json"}})}catch(b){const E=new Error(`Failed to fetch GeoJSON from ${i}`);throw this._emitError({code:"data_fetch_failed",message:E.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),E}if(!f.ok){const b=new Error(`Failed to fetch GeoJSON from ${i}: ${f.status} ${f.statusText}`);throw this._emitError({code:"data_fetch_failed",message:b.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),b}let d;try{d=await f.json()}catch(b){const E=new Error(`Failed to parse GeoJSON from ${i}`);throw this._emitError({code:"data_parse_failed",message:E.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),E}await this._performImport(d,{behavior:r,fitToData:(x=s.fitToData)!=null?x:!0},h,r==="add"?`Failed to add GeoJSON from ${i}`:`Failed to load GeoJSON from ${i}`)}async loadGeoJSONFromText(i,s={}){var d,m,_,x;const r=(d=s.behavior)!=null?d:"replace";if(this._logger.debug("loadGeoJSONFromText",{behavior:r,fitToData:(m=s.fitToData)!=null?m:!0,length:(_=i==null?void 0:i.length)!=null?_:0}),!this._controller)return;const h=this.status;this._setImportLoadingStatus(h);let f;try{f=JSON.parse(i)}catch(b){const E=new Error("Failed to parse GeoJSON text");throw this._emitError({code:"data_parse_failed",message:E.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),E}await this._performImport(f,{behavior:r,fitToData:(x=s.fitToData)!=null?x:!0},h,r==="add"?"Failed to add parsed GeoJSON into the map":"Failed to load parsed GeoJSON into the map")}_setImportLoadingStatus(i){this._setStatus({state:"loading",ready:i.ready,busy:!0,featureCount:i.featureCount,lastEvent:ie.Ingest,lastError:null})}async _performImport(i,s,r,h){var _,x;const f=(_=s.behavior)!=null?_:"replace",d={fc:i,mode:f==="add"?"add":"load"};this.dispatchEvent(new CustomEvent(ie.Ingest,{detail:d}));const m=d.fc&&d.fc.type==="FeatureCollection"?d.fc:i;try{const b=await this._importWithController(m,{...s,behavior:f,fitToData:(x=s.fitToData)!=null?x:!1});return await this._syncStatusFromController({state:"ready",ready:!0,busy:!1,lastEvent:ie.Ingest,clearLastError:!0}),b}catch(b){throw this._emitError({code:f==="add"?"data_add_failed":"data_load_failed",message:h,recoverable:!0,cause:b},{state:r.ready?"ready":r.state,featureCount:r.featureCount}),b}}getLayers(){var i,s;return(s=(i=this._controller)==null?void 0:i.getLayers())!=null?s:[]}async setLayerVisibility(i,s){var r;(r=this._controller)==null||r.setLayerVisibility(i,s)}async setLayerStyle(i,s){var r;(r=this._controller)==null||r.setLayerStyle(i,s)}async reorderLayers(i){var s;(s=this._controller)==null||s.reorderLayers(i)}async focusLayer(i){var s;await((s=this._controller)==null?void 0:s.focusLayer(i))}async removeLayer(i){var s;await((s=this._controller)==null?void 0:s.removeLayer(i))}getLayerCakeSession(){var i,s;return(s=(i=this._controller)==null?void 0:i.getLayerCakeSession())!=null?s:null}async updateLayerCakeSession(i){var s;(s=this._controller)==null||s.updateLayerCakeSession(i)}async saveLayerCakeSession(){var i;(i=this._controller)==null||i.saveLayerCakeSession()}async cancelLayerCakeSession(){var i;(i=this._controller)==null||i.cancelLayerCakeSession()}async _importWithController(i,s){var d,m;if(!this._controller)return[];const r=(d=s.behavior)!=null?d:"replace",h=(m=s.fitToData)!=null?m:!1,f=this._controller;return typeof f.importGeoJSON=="function"?f.importGeoJSON(i,{...s,behavior:r,fitToData:h}):r==="add"?f.addFeatures(i):(await f.loadGeoJSON(i,h),[])}async _exportWithController(i){if(!this._controller)return{type:"FeatureCollection",features:[]};const s=this._controller;return typeof s.exportGeoJSON=="function"?s.exportGeoJSON(i):s.getGeoJSON()}_currentConfig(){return{latitude:this._latitude,longitude:this._longitude,zoom:this._zoom,minZoom:this._minZoom,maxZoom:this._maxZoom,tileUrl:this._tileUrl,tileAttribution:this._tileAttribution,readOnly:this._readOnly,fitToDataOnLoad:!1,logLevel:this._logLevel,devOverlay:this._devOverlay,polygonAllowIntersection:this._polygonAllowIntersection,preferCanvas:this._preferCanvas,useExternalLeaflet:this._useExternalLeaflet,skipLeafletStyles:this._skipLeafletStyles}}_applyThemeStyles(){var r;const i=(r=this._themeUrl)==null?void 0:r.trim();if(i){if(!this._themeLinkEl){const h=document.createElement("link");h.setAttribute("rel","stylesheet"),h.setAttribute("data-geokit-theme-url","true"),this._root.appendChild(h),this._themeLinkEl=h}this._themeLinkEl.getAttribute("href")!==i&&this._themeLinkEl.setAttribute("href",i)}else this._themeLinkEl&&(this._themeLinkEl.remove(),this._themeLinkEl=null);const s=this._themeCss;if(s.trim().length>0){if(!this._themeStyleEl){const h=document.createElement("style");h.setAttribute("data-geokit-theme-css","true"),this._root.appendChild(h),this._themeStyleEl=h}this._themeStyleEl.textContent!==s&&(this._themeStyleEl.textContent=s)}else this._themeStyleEl&&(this._themeStyleEl.remove(),this._themeStyleEl=null)}_emitToolLifecycleEvent(i,s){i===_i.ToolStateChanged&&(this._activeTool=s.activeTool);const r=new CustomEvent(i,{bubbles:!0,composed:!0,detail:s});this._internalToolEvents.add(r),this.dispatchEvent(r)}_emitToolTriggerResult(i){this.dispatchEvent(new CustomEvent(i.handled?"leaflet-geokit:tool-triggered":"leaflet-geokit:tool-trigger-failed",{bubbles:!0,composed:!0,detail:i}))}_syncStatusFromController(i){const s=this._controller;return!s||typeof s.getGeoJSON!="function"?(this._setStatus({state:i.state,ready:i.ready,busy:i.busy,featureCount:this._status.featureCount,lastEvent:i.lastEvent,lastError:i.clearLastError?null:void 0}),Promise.resolve()):s.getGeoJSON().then(r=>{this._setStatus({state:i.state,ready:i.ready,busy:i.busy,featureCount:r.features.length,lastEvent:i.lastEvent,lastError:i.clearLastError?null:void 0})}).catch(()=>{this._setStatus({state:i.state,ready:i.ready,busy:i.busy,lastEvent:i.lastEvent,lastError:i.clearLastError?null:void 0})})}_emitError(i,s){var h;const r={...i,timestamp:Date.now()};return this.dispatchEvent(new CustomEvent(ie.Error,{detail:r})),this._emitDiagnostic({code:r.code,message:r.message,recoverable:r.recoverable,severity:r.recoverable?"warn":"error",cause:r.cause,timestamp:r.timestamp},{state:s.state,featureCount:s.featureCount,lastEvent:(h=s.lastEvent)!=null?h:ie.Error}),r}_emitDiagnostic(i,s){var h,f;const r={...i,state:s.state};return this.dispatchEvent(new CustomEvent(_i.Diagnostic,{detail:r})),this._setStatus({state:s.state,ready:s.state==="ready",busy:s.state==="initializing"||s.state==="loading",featureCount:(h=s.featureCount)!=null?h:this._status.featureCount,lastEvent:(f=s.lastEvent)!=null?f:_i.Diagnostic,lastError:{code:r.code,message:r.message,recoverable:r.recoverable,timestamp:r.timestamp}}),r}_setStatus(i){const s={...this._status,...i,lastError:i.lastError===null?void 0:i.lastError!==void 0?{...i.lastError}:this._status.lastError?{...this._status.lastError}:void 0,timestamp:Date.now()};this._status=s,this.dispatchEvent(new CustomEvent(_i.Status,{detail:this._cloneStatus(s)}))}_cloneStatus(i){return{...i,lastError:i.lastError?{...i.lastError}:void 0}}_syncApiKeyFromAttributes(){const i=this._normalizeText(this.getAttribute("api-key")),s=this._normalizeText(this.getAttribute("here-api-key"));this._apiKey=i!=null?i:s}_normalizeText(i,s){if(typeof i!="string")return;const r=i.trim();if(r)return s!=null&&s.lowercase?r.toLowerCase():r}_resolveTileProviderErrorCode(i){return i instanceof Error&&i.message.toLowerCase().includes("unknown tile provider")?"unknown_provider":"tile_load_failed"}_resolveHereTileLayerErrorCode(i){const s=i.toLowerCase();return s.includes("permission")||s.includes("forbidden")||s.includes("403")||s.includes("unauthorized")||s.includes("not authorized")||s.includes("not authorised")||s.includes("access denied")?"permission_denied":"invalid_api_key"}_describeTileLayerError(i,s){if(i&&typeof i=="object"&&"error"in i&&i.error instanceof Error)return i.error.message;if(i instanceof Error&&i.message)return i.message;if(i&&typeof i=="object"&&"message"in i&&typeof i.message=="string"){const r=i.message.trim();if(r.length>0)return r}return s==="here"?`Failed to load HERE tiles; verify API key, project permissions, and allowed localhost origin/referrer.${this._tileStyle==="satellite.day"?" If satellite.day fails, try lite.day.":""}`:"Failed to load tile layer"}_reflect(i,s){s===null?this.removeAttribute(i):this.getAttribute(i)!==s&&this.setAttribute(i,s)}_booleanReflect(i,s){s?this.hasAttribute(i)||this.setAttribute(i,""):this.hasAttribute(i)&&this.removeAttribute(i)}_coerceNumber(i,s){if(i==null)return s!=null?s:NaN;const r=Number(i);return Number.isFinite(r)?r:s!=null?s:NaN}}const Xh="leaflet-geokit";customElements.get(Xh)||customElements.define(Xh,sl);const Jh="leaflet-draw-map";if(!customElements.get(Jh)){class a extends sl{}customElements.define(Jh,a)}Nt.DrawEvent=ie,Nt.GROWER_PRESETS=Gp,Nt.GeoJSONValidationError=Br,Nt.GeoKitEvent=_i,Nt.LAYER_STYLE_PRESETS=zn,Nt.LeafletDrawMapElement=sl,Nt.applyGeoJSONPatch=Bf,Nt.boundingBoxGeoJSON=em,Nt.bufferGeoJSON=jp,Nt.centroidGeoJSON=tm,Nt.createBedWidthGuides=im,Nt.createCustomRasterProvider=iu,Nt.createIrrigationZones=rm,Nt.createMapLibreBasemapAdapter=Hf,Nt.createRasterProvider=eu,Nt.createRowSpacingGuides=nm,Nt.diffGeoJSON=Df,Nt.exportGeoJSONData=Of,Nt.findSnap=lu,Nt.formatMeasurements=qh,Nt.getProviderDiagnostics=ga,Nt.importGeoJSONData=Kl,Nt.importGeoJSONText=Ql,Nt.importGeoJSONURL=Rf,Nt.measureGeoJSON=Uh,Nt.mergeGeoJSON=Qp,Nt.normalizeGeoJSON=qo,Nt.simplifyGeoJSON=$p,Nt.splitGeoJSON=Kp,Nt.validateGeoJSON=Ji,Object.defineProperty(Nt,Symbol.toStringTag,{value:"Module"})}));
|
|
502
|
+
`;const i=this._root.querySelector(".map-container");if(!(i instanceof HTMLDivElement))throw new Error("Failed to initialize map container");this._container=i;const s=this.getAttribute("log-level");s&&(this._logLevel=s,this._logger.setLevel(s))}_controlsFromAttributes(){return{polygon:this.hasAttribute("draw-polygon"),polyline:this.hasAttribute("draw-polyline"),rectangle:this.hasAttribute("draw-rectangle"),circle:this.hasAttribute("draw-circle"),cake:this.hasAttribute("draw-layer-cake"),marker:this.hasAttribute("draw-marker"),move:this.hasAttribute("draw-move"),edit:this.hasAttribute("edit-features"),delete:this.hasAttribute("delete-features"),ruler:this.hasAttribute("draw-ruler")}}_mapConfig(){return{latitude:this._latitude,longitude:this._longitude,zoom:this._zoom,minZoom:this._minZoom,maxZoom:this._maxZoom,tileUrl:this._tileUrl,tileAttribution:this._tileAttribution,readOnly:this._readOnly,fitToDataOnLoad:!1,logLevel:this._logLevel,devOverlay:this._devOverlay,polygonAllowIntersection:this._polygonAllowIntersection,preferCanvas:this._preferCanvas,useExternalLeaflet:this._useExternalLeaflet,skipLeafletStyles:this._skipLeafletStyles}}async connectedCallback(){var i,s,r;this._logger.debug("connectedCallback",this._currentConfig()),this._setStatus({state:"initializing",ready:!1,busy:!0,featureCount:0,lastEvent:"connected",lastError:null}),Lc({root:this._root,skipStyles:this._skipLeafletStyles}),this._applyThemeStyles(),this._controller=new sm({container:this._container,map:this._mapConfig(),controls:this._controlsFromAttributes(),readOnly:this._readOnly,logger:this._logger.child("controller"),callbacks:{onToolCapabilitiesChanged:()=>this._emitToolCapabilities(),onReady:h=>{this.dispatchEvent(new CustomEvent(ie.Ready,{detail:h})),this._syncStatusFromController({state:"ready",ready:!0,busy:!1,lastEvent:ie.Ready,clearLastError:!0})},onCreated:h=>{this.dispatchEvent(new CustomEvent(ie.Created,{detail:h})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:this._status.featureCount+1,lastEvent:ie.Created,lastError:null})},onEdited:h=>{this.dispatchEvent(new CustomEvent(ie.Edited,{detail:h})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:h.geoJSON.features.length,lastEvent:ie.Edited,lastError:null})},onDeleted:h=>{this.dispatchEvent(new CustomEvent(ie.Deleted,{detail:h})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:h.geoJSON.features.length,lastEvent:ie.Deleted,lastError:null})},onError:h=>{this._emitError(h,{state:h.recoverable?this._status.ready?"ready":this._status.state:"error",lastEvent:ie.Error})},onTileError:h=>{if(this._tileProvider)return;const f=this._describeTileLayerError(h,"tile-url");this._handleTileProviderError("tile_load_failed",f,"tile-url")},onToolTrigger:h=>{this._emitToolTriggerResult(h)},onToolEvent:(h,f)=>{this._emitToolLifecycleEvent(h,f)},onLayerEvent:(h,f)=>{this.dispatchEvent(new CustomEvent(h,{detail:f,bubbles:!0,composed:!0}))},onLayerStyleRequested:h=>!this.dispatchEvent(new CustomEvent("leaflet-geokit:layer-style-request",{detail:h,cancelable:!0,bubbles:!0,composed:!0})),onSaved:h=>{this.dispatchEvent(new CustomEvent(ie.Export,{detail:{geoJSON:h.geoJSON,featureCount:h.featureCount,adapter:"editing"}})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:h.featureCount,lastEvent:ie.Export,lastError:null})}},leaflet:(i=this._leafletInstance)!=null?i:void 0,useExternalLeaflet:this._useExternalLeaflet,toolHooks:this._toolHooks,toolEventEmitter:this._toolEventEmitter,markerIconConfig:this._effectiveMarkerIconConfig(),toolButtonConfig:this._effectiveToolButtonConfig(),toolbarGroups:this._effectiveToolbarGroups(),snapping:(s=this._snapping)!=null?s:null,measurementOverlay:(r=this._measurementOverlay)!=null?r:null}),this.addEventListener(_i.ToolCommand,this._externalToolCommandListener),this.addEventListener("leaflet-geokit:trigger-tool",this._externalToolTriggerListener),this.addEventListener("leaflet-geokit:activate-tool",this._externalToolTriggerListener),this.addEventListener("leaflet-geokit:deactivate-tool",this._externalToolDeactivateListener),await this._controller.init(),this._status.state!=="error"&&this._tileProvider&&this._updateTileLayer()}async disconnectedCallback(){this._logger.debug("disconnectedCallback"),this._activeTileProvider="tile-url",this._providerCapabilityError=null,this._controller&&(await this._controller.destroy(),this._controller=null),this._activeTool=null,this.removeEventListener(_i.ToolCommand,this._externalToolCommandListener),this.removeEventListener("leaflet-geokit:trigger-tool",this._externalToolTriggerListener),this.removeEventListener("leaflet-geokit:activate-tool",this._externalToolTriggerListener),this.removeEventListener("leaflet-geokit:deactivate-tool",this._externalToolDeactivateListener),this._setStatus({state:"uninitialized",ready:!1,busy:!1,featureCount:0,lastEvent:"disconnected",lastError:null})}static get observedAttributes(){return["latitude","longitude","zoom","min-zoom","max-zoom","tile-url","tile-attribution","tile-provider","tile-style","api-key","here-api-key","read-only","log-level","dev-overlay","prefer-canvas","use-external-leaflet","skip-leaflet-styles","marker-icon-url","marker-icon-retina-url","marker-shadow-url","marker-icon-size","marker-icon-anchor","marker-popup-anchor","tool-button-config","toolbar-groups","theme-url","draw-polygon","draw-polyline","draw-rectangle","draw-circle","draw-layer-cake","draw-marker","draw-move","draw-ruler","edit-features","delete-features","polygon-allow-intersection"]}attributeChangedCallback(i,s,r){var h;switch(this._logger.debug("attributeChanged",{name:i,value:r}),i){case"latitude":this._latitude=this._coerceNumber(r,0);break;case"longitude":this._longitude=this._coerceNumber(r,0);break;case"zoom":this._zoom=this._coerceNumber(r,2);break;case"min-zoom":this._minZoom=r!=null?this._coerceNumber(r):void 0;break;case"max-zoom":this._maxZoom=r!=null?this._coerceNumber(r):void 0;break;case"tile-url":this._tileUrl=r!=null?r:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",this._controller&&this._updateTileLayer();break;case"tile-attribution":this._tileAttribution=r!=null?r:void 0,this._controller&&this._updateTileLayer();break;case"tile-provider":this._tileProvider=this._normalizeText(r,{lowercase:!0}),this._controller&&this._updateTileLayer();break;case"tile-style":this._tileStyle=this._normalizeText(r),this._controller&&this._updateTileLayer();break;case"api-key":case"here-api-key":this._syncApiKeyFromAttributes(),this._controller&&this._updateTileLayer();break;case"theme-url":this._themeUrl=r!=null?r:void 0,this.isConnected&&this._applyThemeStyles();break;case"read-only":this._readOnly=r!==null;break;case"log-level":this._logLevel=r!=null?r:this._logLevel,this._logger.setLevel(this._logLevel);break;case"dev-overlay":this._devOverlay=r!==null;break;case"polygon-allow-intersection":this._polygonAllowIntersection=r!==null;break;case"prefer-canvas":this._preferCanvas=r!==null;break;case"use-external-leaflet":this._useExternalLeaflet=r!==null;break;case"skip-leaflet-styles":this._skipLeafletStyles=r!==null;break}if(this._controller){if(i==="latitude"||i==="longitude"||i==="zoom")this._controller.setView(this._latitude,this._longitude,this._zoom);else if(this._isMarkerIconAttribute(i))this._syncMarkerIconConfig();else if(i==="tool-button-config")this._syncToolButtonConfig();else if(i==="toolbar-groups")this._syncToolbarGroups();else if(i==="min-zoom"||i==="max-zoom"||i==="read-only"||i==="dev-overlay"||i==="log-level"||i==="prefer-canvas"||i==="use-external-leaflet"||i==="skip-leaflet-styles"||i.startsWith("draw-")||i==="edit-features"||i==="delete-features"){const f=this._controller;(h=f.configure)==null||h.call(f,this._mapConfig(),this._controlsFromAttributes()),this._configurationUpdate=this._configurationUpdate.then(async()=>{var d;this._controller!==f||!this.isConnected||((d=f.configure)==null||d.call(f,this._mapConfig(),this._controlsFromAttributes()),await f.init(),this._tileProvider&&this._updateTileLayer())})}}}_updateTileLayer(){var s,r,h,f,d,m;if(!this._controller)return;const i=this._controller;if(typeof i.setTileLayer!="function"){this._logger.warn("setTileLayer is not available on MapController yet");return}this._providerCapabilityError=null;try{if(this._tileProvider){const _=this._tileProvider,x={provider:_,style:this._tileStyle,apiKey:this._apiKey,attribution:this._tileAttribution},b=Zf(x);if(!b.valid){const S=(s=b.error)!=null&&s.toLowerCase().includes("api key")?"missing_api_key":"tile_load_failed";this._handleTileProviderError(S,(r=b.error)!=null?r:"Invalid tile provider configuration",_);return}const E=da(x),C=this._activeTileProvider;i.setTileLayer(E,{onTileError:S=>{if(this._tileProvider!==_)return;const O=this._describeTileLayerError(S,_),N=_==="here"?this._resolveHereTileLayerErrorCode(O):"tile_load_failed";this._handleTileProviderError(N,O,_)}}),this._activeTileProvider=_,this._emitTileProviderChanged(_,this._tileStyle,C);return}i.setTileLayer({urlTemplate:this._tileUrl,attribution:(h=this._tileAttribution)!=null?h:"",maxZoom:this._maxZoom,subdomains:["a","b","c"]},{onTileError:_=>{const x=this._describeTileLayerError(_,"tile-url");this._handleTileProviderError("tile_load_failed",x,"tile-url")}}),this._activeTileProvider="tile-url"}catch(_){const x=this._resolveTileProviderErrorCode(_);this._logger.error("Failed to update tile layer",{error:_,code:x}),this._handleTileProviderError(x,_ instanceof Error?_.message:"Unknown tile layer error",(f=this._tileProvider)!=null?f:"unknown")}finally{(m=(d=this._controller)==null?void 0:d.setToolProvider)==null||m.call(d,this._toolProviderCapability()),this._emitToolCapabilities()}}_handleTileProviderError(i,s,r){var d,m;this._logger.error(`Tile provider error (${i}): ${s}`);const h=Date.now();this._providerCapabilityError={code:i==="missing_api_key"?"missing_api_key":i==="unknown_provider"?"missing_provider":"runtime_error",message:i==="missing_api_key"?"Requested provider requires an API key":i==="unknown_provider"?"Requested provider is unavailable":"Requested provider failed; using fallback tiles"},this.dispatchEvent(new CustomEvent("tile-provider-error",{bubbles:!0,detail:{code:i,message:s,provider:r,timestamp:h}})),this._emitDiagnostic({code:i,message:s,recoverable:!0,severity:"warn",timestamp:h},{state:this._status.ready?"ready":this._status.state,lastEvent:"tile-provider-error"});const f=this._controller;typeof f.setTileLayer=="function"&&(f.setTileLayer({urlTemplate:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19,subdomains:["a","b","c"]}),this._activeTileProvider="osm"),(m=(d=this._controller)==null?void 0:d.setToolProvider)==null||m.call(d,this._toolProviderCapability()),this._emitToolCapabilities()}_emitTileProviderChanged(i,s,r){this.dispatchEvent(new CustomEvent("tile-provider-changed",{bubbles:!0,detail:{provider:i,style:s,previousProvider:r,timestamp:Date.now()}}))}_toolProviderCapability(){var r,h;const i=this._activeTileProvider==="adapter"?"adapter":(r=this._tileProvider)!=null?r:"tile-url";let s=this._providerCapabilityError;return i!=="adapter"&&i!=="tile-url"&&i!=="osm"&&i!=="here"?s={code:"missing_provider",message:"Requested provider is unavailable"}:i==="here"&&!((h=this._apiKey)!=null&&h.trim())&&(s={code:"missing_api_key",message:"Requested provider requires an API key"}),{requested:i,active:this._activeTileProvider,state:s?"unavailable":"enabled",reason:s?{...s}:null}}setBasemapAdapter(i){var r,h;if(!this._status.ready||!this._controller)throw new Error("Map is not ready");if(!i){this._updateTileLayer();return}this._controller.setBasemapAdapter(i);const s=this._activeTileProvider;this._activeTileProvider="adapter",this._providerCapabilityError=null,this._emitTileProviderChanged("adapter",void 0,s),(h=(r=this._controller).setToolProvider)==null||h.call(r,this._toolProviderCapability()),this._emitToolCapabilities()}getProviderDiagnostics(){var r,h,f;const i=(f=(h=(r=this._controller)==null?void 0:r.getProviderDiagnostics)==null?void 0:h.call(r))!=null?f:null;if(!i||this._activeTileProvider==="adapter")return i;const s=this._activeTileProvider==="tile-url"&&this._tileUrl===da({provider:"osm"}).urlTemplate?"osm":this._activeTileProvider;if(s==="osm"||s==="here"){const d=eu({provider:s});return{...i,...d.capabilities}}return i}getToolCapabilities(){var s,r,h;return{...(h=(r=(s=this._controller)==null?void 0:s.getToolCapabilities)==null?void 0:r.call(s))!=null?h:nu({ready:!1,readOnly:this._readOnly,controls:this._controlsFromAttributes(),available:{},layerCount:0,selectedFeatureIds:[],activeTool:null,config:this._effectiveToolButtonConfig(),groups:this._effectiveToolbarGroups(),provider:this._toolProviderCapability()}),provider:this._toolProviderCapability()}}setToolSelection(i){var s;(s=this._controller)==null||s.setToolSelection(i)}_emitToolCapabilities(){const i=this.getToolCapabilities(),s=JSON.stringify(i);s!==this._lastCapabilities&&(this._lastCapabilities=s,this.dispatchEvent(new CustomEvent(_i.ToolCapabilitiesChanged,{detail:i,bubbles:!0,composed:!0})))}_isMarkerIconAttribute(i){return i==="marker-icon-url"||i==="marker-icon-retina-url"||i==="marker-shadow-url"||i==="marker-icon-size"||i==="marker-icon-anchor"||i==="marker-popup-anchor"}_effectiveMarkerIconConfig(){const i=(r,h)=>{this._emitError({code:"invalid_marker_icon_config",message:r,recoverable:!0,cause:h},{state:this._status.ready?"ready":this._status.state})};if(this._markerIconConfig===null)return null;if(this._markerIconConfig!==void 0)return am(this._markerIconConfig,{reportError:i});const s=this.getAttribute("marker-icon-url");return s==null?null:lm({iconUrl:s,iconRetinaUrl:this.getAttribute("marker-icon-retina-url"),shadowUrl:this.getAttribute("marker-shadow-url"),iconSize:this.getAttribute("marker-icon-size"),iconAnchor:this.getAttribute("marker-icon-anchor"),popupAnchor:this.getAttribute("marker-popup-anchor")},{reportError:i})}_syncMarkerIconConfig(){const i=this._controller;typeof(i==null?void 0:i.setMarkerIconConfig)=="function"&&i.setMarkerIconConfig(this._effectiveMarkerIconConfig())}_effectiveToolButtonConfig(){if(this._toolButtonConfig!==void 0)return this._toolButtonConfig;const i=this.getAttribute("tool-button-config");if(i==null||i.trim()==="")return null;try{const s=JSON.parse(i);if(!s||typeof s!="object"||Array.isArray(s))throw new Error("tool-button-config must be a JSON object");return s}catch(s){return this._emitError({code:"invalid_tool_button_config",message:"Failed to parse tool-button-config",recoverable:!0,cause:s},{state:this._status.ready?"ready":this._status.state}),null}}_syncToolButtonConfig(){const i=this._controller;typeof(i==null?void 0:i.setToolButtonConfig)=="function"&&i.setToolButtonConfig(this._effectiveToolButtonConfig())}_effectiveToolbarGroups(){if(this._toolbarGroups!==void 0)return this._toolbarGroups;const i=this.getAttribute("toolbar-groups");if(i==null||i.trim()==="")return null;try{const s=JSON.parse(i);if(!Array.isArray(s))throw new Error("toolbar-groups must be a JSON array");return s}catch(s){return this._emitError({code:"invalid_toolbar_groups",message:"Failed to parse toolbar-groups",recoverable:!0,cause:s},{state:this._status.ready?"ready":this._status.state}),null}}_syncToolbarGroups(){const i=this._controller;typeof(i==null?void 0:i.setToolbarGroups)=="function"&&i.setToolbarGroups(this._effectiveToolbarGroups())}get latitude(){return this._latitude}set latitude(i){this._latitude=Number(i),this._reflect("latitude",String(this._latitude))}get longitude(){return this._longitude}set longitude(i){this._longitude=Number(i),this._reflect("longitude",String(this._longitude))}get zoom(){return this._zoom}set zoom(i){this._zoom=Number(i),this._reflect("zoom",String(this._zoom))}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom=i,this._reflect("min-zoom",i!=null?String(i):null)}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom=i,this._reflect("max-zoom",i!=null?String(i):null)}get tileUrl(){return this._tileUrl}set tileUrl(i){this._tileUrl=i,this._reflect("tile-url",i),this._controller&&this._updateTileLayer()}get tileProvider(){return this._tileProvider}set tileProvider(i){var s;this._tileProvider=this._normalizeText(i!=null?i:null,{lowercase:!0}),this._reflect("tile-provider",(s=this._tileProvider)!=null?s:null),this._controller&&this._updateTileLayer()}get tileStyle(){return this._tileStyle}set tileStyle(i){var s;this._tileStyle=this._normalizeText(i!=null?i:null),this._reflect("tile-style",(s=this._tileStyle)!=null?s:null),this._controller&&this._updateTileLayer()}get apiKey(){return this._apiKey}set apiKey(i){var s;this._apiKey=this._normalizeText(i!=null?i:null),this._reflect("api-key",(s=this._apiKey)!=null?s:null),this.hasAttribute("here-api-key")&&this.removeAttribute("here-api-key"),this._controller&&this._updateTileLayer()}get status(){return this._cloneStatus(this._status)}get tileAttribution(){return this._tileAttribution}set tileAttribution(i){this._tileAttribution=i,this._reflect("tile-attribution",i!=null?i:null),this._controller&&this._updateTileLayer()}get readOnly(){return this._readOnly}set readOnly(i){this._readOnly=!!i,this._booleanReflect("read-only",this._readOnly)}get logLevel(){return this._logLevel}set logLevel(i){this._logLevel=i,this._logger.setLevel(i),this._reflect("log-level",i)}get devOverlay(){return this._devOverlay}set devOverlay(i){this._devOverlay=!!i,this._booleanReflect("dev-overlay",this._devOverlay)}get preferCanvas(){return this._preferCanvas}set preferCanvas(i){this._preferCanvas=!!i,this._booleanReflect("prefer-canvas",this._preferCanvas)}get useExternalLeaflet(){return this._useExternalLeaflet}set useExternalLeaflet(i){this._useExternalLeaflet=!!i,this._booleanReflect("use-external-leaflet",this._useExternalLeaflet)}get skipLeafletStyles(){return this._skipLeafletStyles}set skipLeafletStyles(i){this._skipLeafletStyles=!!i,this._booleanReflect("skip-leaflet-styles",this._skipLeafletStyles)}get markerIconConfig(){return this._markerIconConfig}set markerIconConfig(i){this._markerIconConfig=i,this._syncMarkerIconConfig()}get toolButtonConfig(){return this._toolButtonConfig}set toolButtonConfig(i){this._toolButtonConfig=i,this._syncToolButtonConfig()}get toolbarGroups(){return this._toolbarGroups}set toolbarGroups(i){this._toolbarGroups=i,this._syncToolbarGroups()}get snapping(){return this._snapping}set snapping(i){var r;const s=this._snapping;this._snapping=i;try{(r=this._controller)==null||r.setSnappingOptions(i)}catch(h){throw this._snapping=s,h}}get measurementOverlay(){return this._measurementOverlay}set measurementOverlay(i){var r;const s=this._measurementOverlay;this._measurementOverlay=i;try{(r=this._controller)==null||r.setMeasurementOverlayOptions(i)}catch(h){throw this._measurementOverlay=s,h}}get leafletInstance(){return this._leafletInstance}set leafletInstance(i){this._leafletInstance=i}get toolHooks(){return this._toolHooks}set toolHooks(i){this._toolHooks=i;const s=this._controller;typeof(s==null?void 0:s.setToolObservers)=="function"&&s.setToolObservers({toolHooks:this._toolHooks,toolEventEmitter:this._toolEventEmitter})}get toolEventEmitter(){return this._toolEventEmitter}set toolEventEmitter(i){this._toolEventEmitter=i;const s=this._controller;typeof(s==null?void 0:s.setToolObservers)=="function"&&s.setToolObservers({toolHooks:this._toolHooks,toolEventEmitter:this._toolEventEmitter})}get themeCss(){return this._themeCss}set themeCss(i){this._themeCss=typeof i=="string"?i:"",this.isConnected&&this._applyThemeStyles()}async getGeoJSON(){return this._logger.debug("getGeoJSON"),this._controller?this._controller.getGeoJSON():{type:"FeatureCollection",features:[]}}async importGeoJSON(i,s={}){var f,d,m,_;const r=(f=s.behavior)!=null?f:"replace";if(this._logger.debug("importGeoJSON",{behavior:r,fitToData:(d=s.fitToData)!=null?d:!1,features:(_=(m=i==null?void 0:i.features)==null?void 0:m.length)!=null?_:0}),!this._controller)return[];const h=this.status;return this._setImportLoadingStatus(h),this._performImport(i,s,h,r==="add"?"Failed to add GeoJSON features to the map":"Failed to load GeoJSON into the map")}async loadGeoJSON(i){var s,r;this._logger.debug("loadGeoJSON",{features:(r=(s=i==null?void 0:i.features)==null?void 0:s.length)!=null?r:0}),await this.importGeoJSON(i,{behavior:"replace"})}async clearLayers(){this._logger.debug("clearLayers"),this._controller&&(await this._controller.clearLayers(),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:0,lastEvent:"clearLayers",lastError:null}))}async addFeatures(i){var s,r;return this._logger.debug("addFeatures",{count:(r=(s=i==null?void 0:i.features)==null?void 0:s.length)!=null?r:0}),this.importGeoJSON(i,{behavior:"add"})}async updateFeature(i,s){this._logger.debug("updateFeature",{id:i}),this._controller&&await this._controller.updateFeature(i,s)}async removeFeature(i){this._logger.debug("removeFeature",{id:i}),this._controller&&(await this._controller.removeFeature(i),await this._syncStatusFromController({state:"ready",ready:!0,busy:!1,lastEvent:"removeFeature",clearLastError:!0}))}async fitBoundsToData(i){this._logger.debug("fitBoundsToData",{padding:i}),this._controller&&await this._controller.fitBoundsToData(typeof i=="number"?i:.05)}async fitBounds(i,s){this._logger.debug("fitBounds",{bounds:i,padding:s}),this._controller&&await this._controller.fitBounds(i,typeof s=="number"?s:.05)}async setView(i,s,r){this._logger.debug("setView",{lat:i,lng:s,zoom:r}),this.latitude=i,this.longitude=s,typeof r=="number"&&(this.zoom=r),this._controller&&await this._controller.setView(i,s,r)}async exportGeoJSON(i={}){var f;const s=(f=i.adapter)!=null?f:"editing";if(this._logger.debug("exportGeoJSON",{adapter:s}),!this._controller)return{type:"FeatureCollection",features:[]};const r=await this._exportWithController(i),h={geoJSON:r,featureCount:r.features.length,adapter:s};return this.dispatchEvent(new CustomEvent(ie.Export,{detail:h})),r}async mergePolygons(i){if(this._logger.debug("mergePolygons"),!this._controller)return null;const r=(await this._controller.getGeoJSON()).features.length,h=await this._controller.mergeVisiblePolygons(i);if(h){const f=await this._controller.getGeoJSON(),d={id:h,mergedFeatureCount:r-f.features.length+1,geoJSON:f};this.dispatchEvent(new CustomEvent("leaflet-draw:merged",{detail:d})),this._setStatus({state:"ready",ready:!0,busy:!1,featureCount:f.features.length,lastEvent:"leaflet-draw:merged",lastError:null})}return h}async setMeasurementUnits(i){this._logger.debug("setMeasurementUnits",{system:i}),this._controller&&this._controller.setRulerUnits(i)}getSnappingOptions(){var i,s;return(s=(i=this._controller)==null?void 0:i.getSnappingOptions())!=null?s:this._snapping?{...this._snapping}:null}getMeasurementOverlayOptions(){var i,s;return(s=(i=this._controller)==null?void 0:i.getMeasurementOverlayOptions())!=null?s:this._measurementOverlay?{...this._measurementOverlay}:null}_nextToolCommandId(){return this._toolCommandSequence+=1,`tool-${Date.now().toString(36)}-element-${this._toolCommandSequence.toString(36)}`}_emitToolTriggerRequested(i,s){this.dispatchEvent(new CustomEvent("leaflet-geokit:tool-trigger-requested",{bubbles:!0,composed:!0,detail:{tool:i,source:s.source,groupId:s.groupId,commandId:s.commandId,handled:!1,timestamp:Date.now()}}))}_baseToolEventDetail(i,s,r){return{tool:i,action:s,source:r.source,groupId:r.groupId,commandId:r.commandId,previousTool:null,activeTool:null,featureIds:[],timestamp:Date.now()}}_emitStandaloneToolFailure(i,s,r,h,f=!0){const d=this._baseToolEventDetail(i,s,r);f&&this._emitToolLifecycleEvent(_i.ToolCommand,d),this._emitToolLifecycleEvent(_i.ToolFailed,{...d,reason:h,timestamp:Date.now()}),this._emitToolTriggerResult({tool:i,source:r.source,groupId:r.groupId,commandId:r.commandId,handled:!1,timestamp:Date.now(),error:h})}async activateTool(i,s={}){var _,x,b;const r=(_=s.source)!=null?_:"api",h=((x=s.commandId)==null?void 0:x.trim())||this._nextToolCommandId(),f={source:r,groupId:s.groupId,commandId:h};if(this._emitToolTriggerRequested(i,f),!this._controller)return this._emitStandaloneToolFailure(i,i==="select"?"deactivate":"activate",f,"Map controller is not initialized"),!1;const d=this._controller,m=typeof d.activateTool=="function"?d.activateTool.bind(d):(b=d.triggerTool)==null?void 0:b.bind(d);return m?m(i,f):(this._emitStandaloneToolFailure(i,i==="select"?"deactivate":"activate",f,"Map controller cannot activate tools"),!1)}async triggerTool(i,s={}){return this.activateTool(i,s)}async deactivateTool(i={}){var m,_,x;const s=(m=i.source)!=null?m:"api",r=((_=i.commandId)==null?void 0:_.trim())||this._nextToolCommandId(),h={source:s,groupId:i.groupId,commandId:r};if(this._emitToolTriggerRequested("select",h),!this._controller)return this._emitStandaloneToolFailure("select","deactivate",h,"Map controller is not initialized"),!1;const f=this._controller;if(typeof f.deactivateTool=="function")return f.deactivateTool(h);const d=typeof f.activateTool=="function"?f.activateTool.bind(f):(x=f.triggerTool)==null?void 0:x.bind(f);return d?d("select",h):(this._emitStandaloneToolFailure("select","deactivate",h,"Map controller cannot deactivate tools"),!1)}async loadGeoJSONFromUrl(i,s={}){var m,_,x;const r=(m=s.behavior)!=null?m:"replace";if(this._logger.debug("loadGeoJSONFromUrl",{url:i,behavior:r,fitToData:(_=s.fitToData)!=null?_:!0}),!this._controller)return;const h=this.status;this._setImportLoadingStatus(h);let f;try{f=await fetch(i,{headers:{Accept:"application/json"}})}catch(b){const E=new Error(`Failed to fetch GeoJSON from ${i}`);throw this._emitError({code:"data_fetch_failed",message:E.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),E}if(!f.ok){const b=new Error(`Failed to fetch GeoJSON from ${i}: ${f.status} ${f.statusText}`);throw this._emitError({code:"data_fetch_failed",message:b.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),b}let d;try{d=await f.json()}catch(b){const E=new Error(`Failed to parse GeoJSON from ${i}`);throw this._emitError({code:"data_parse_failed",message:E.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),E}await this._performImport(d,{behavior:r,fitToData:(x=s.fitToData)!=null?x:!0},h,r==="add"?`Failed to add GeoJSON from ${i}`:`Failed to load GeoJSON from ${i}`)}async loadGeoJSONFromText(i,s={}){var d,m,_,x;const r=(d=s.behavior)!=null?d:"replace";if(this._logger.debug("loadGeoJSONFromText",{behavior:r,fitToData:(m=s.fitToData)!=null?m:!0,length:(_=i==null?void 0:i.length)!=null?_:0}),!this._controller)return;const h=this.status;this._setImportLoadingStatus(h);let f;try{f=JSON.parse(i)}catch(b){const E=new Error("Failed to parse GeoJSON text");throw this._emitError({code:"data_parse_failed",message:E.message,recoverable:!0,cause:b},{state:h.ready?"ready":h.state,featureCount:h.featureCount}),E}await this._performImport(f,{behavior:r,fitToData:(x=s.fitToData)!=null?x:!0},h,r==="add"?"Failed to add parsed GeoJSON into the map":"Failed to load parsed GeoJSON into the map")}_setImportLoadingStatus(i){this._setStatus({state:"loading",ready:i.ready,busy:!0,featureCount:i.featureCount,lastEvent:ie.Ingest,lastError:null})}async _performImport(i,s,r,h){var _,x;const f=(_=s.behavior)!=null?_:"replace",d={fc:i,mode:f==="add"?"add":"load"};this.dispatchEvent(new CustomEvent(ie.Ingest,{detail:d}));const m=d.fc&&d.fc.type==="FeatureCollection"?d.fc:i;try{const b=await this._importWithController(m,{...s,behavior:f,fitToData:(x=s.fitToData)!=null?x:!1});return await this._syncStatusFromController({state:"ready",ready:!0,busy:!1,lastEvent:ie.Ingest,clearLastError:!0}),b}catch(b){throw this._emitError({code:f==="add"?"data_add_failed":"data_load_failed",message:h,recoverable:!0,cause:b},{state:r.ready?"ready":r.state,featureCount:r.featureCount}),b}}getLayers(){var i,s;return(s=(i=this._controller)==null?void 0:i.getLayers())!=null?s:[]}async setLayerVisibility(i,s){var r;(r=this._controller)==null||r.setLayerVisibility(i,s)}async setLayerStyle(i,s){var r;(r=this._controller)==null||r.setLayerStyle(i,s)}async reorderLayers(i){var s;(s=this._controller)==null||s.reorderLayers(i)}async focusLayer(i){var s;await((s=this._controller)==null?void 0:s.focusLayer(i))}async removeLayer(i){var s;await((s=this._controller)==null?void 0:s.removeLayer(i))}getLayerCakeSession(){var i,s;return(s=(i=this._controller)==null?void 0:i.getLayerCakeSession())!=null?s:null}async updateLayerCakeSession(i){var s;(s=this._controller)==null||s.updateLayerCakeSession(i)}async saveLayerCakeSession(){var i;(i=this._controller)==null||i.saveLayerCakeSession()}async cancelLayerCakeSession(){var i;(i=this._controller)==null||i.cancelLayerCakeSession()}async _importWithController(i,s){var d,m;if(!this._controller)return[];const r=(d=s.behavior)!=null?d:"replace",h=(m=s.fitToData)!=null?m:!1,f=this._controller;return typeof f.importGeoJSON=="function"?f.importGeoJSON(i,{...s,behavior:r,fitToData:h}):r==="add"?f.addFeatures(i):(await f.loadGeoJSON(i,h),[])}async _exportWithController(i){if(!this._controller)return{type:"FeatureCollection",features:[]};const s=this._controller;return typeof s.exportGeoJSON=="function"?s.exportGeoJSON(i):s.getGeoJSON()}_currentConfig(){return{latitude:this._latitude,longitude:this._longitude,zoom:this._zoom,minZoom:this._minZoom,maxZoom:this._maxZoom,tileUrl:this._tileUrl,tileAttribution:this._tileAttribution,readOnly:this._readOnly,fitToDataOnLoad:!1,logLevel:this._logLevel,devOverlay:this._devOverlay,polygonAllowIntersection:this._polygonAllowIntersection,preferCanvas:this._preferCanvas,useExternalLeaflet:this._useExternalLeaflet,skipLeafletStyles:this._skipLeafletStyles}}_applyThemeStyles(){var r;const i=(r=this._themeUrl)==null?void 0:r.trim();if(i){if(!this._themeLinkEl){const h=document.createElement("link");h.setAttribute("rel","stylesheet"),h.setAttribute("data-geokit-theme-url","true"),this._root.appendChild(h),this._themeLinkEl=h}this._themeLinkEl.getAttribute("href")!==i&&this._themeLinkEl.setAttribute("href",i)}else this._themeLinkEl&&(this._themeLinkEl.remove(),this._themeLinkEl=null);const s=this._themeCss;if(s.trim().length>0){if(!this._themeStyleEl){const h=document.createElement("style");h.setAttribute("data-geokit-theme-css","true"),this._root.appendChild(h),this._themeStyleEl=h}this._themeStyleEl.textContent!==s&&(this._themeStyleEl.textContent=s)}else this._themeStyleEl&&(this._themeStyleEl.remove(),this._themeStyleEl=null)}_emitToolLifecycleEvent(i,s){i===_i.ToolStateChanged&&(this._activeTool=s.activeTool);const r=new CustomEvent(i,{bubbles:!0,composed:!0,detail:s});this._internalToolEvents.add(r),this.dispatchEvent(r)}_emitToolTriggerResult(i){this.dispatchEvent(new CustomEvent(i.handled?"leaflet-geokit:tool-triggered":"leaflet-geokit:tool-trigger-failed",{bubbles:!0,composed:!0,detail:i}))}_syncStatusFromController(i){const s=this._controller;return!s||typeof s.getGeoJSON!="function"?(this._setStatus({state:i.state,ready:i.ready,busy:i.busy,featureCount:this._status.featureCount,lastEvent:i.lastEvent,lastError:i.clearLastError?null:void 0}),Promise.resolve()):s.getGeoJSON().then(r=>{this._setStatus({state:i.state,ready:i.ready,busy:i.busy,featureCount:r.features.length,lastEvent:i.lastEvent,lastError:i.clearLastError?null:void 0})}).catch(()=>{this._setStatus({state:i.state,ready:i.ready,busy:i.busy,lastEvent:i.lastEvent,lastError:i.clearLastError?null:void 0})})}_emitError(i,s){var h;const r={...i,timestamp:Date.now()};return this.dispatchEvent(new CustomEvent(ie.Error,{detail:r})),this._emitDiagnostic({code:r.code,message:r.message,recoverable:r.recoverable,severity:r.recoverable?"warn":"error",cause:r.cause,timestamp:r.timestamp},{state:s.state,featureCount:s.featureCount,lastEvent:(h=s.lastEvent)!=null?h:ie.Error}),r}_emitDiagnostic(i,s){var h,f;const r={...i,state:s.state};return this.dispatchEvent(new CustomEvent(_i.Diagnostic,{detail:r})),this._setStatus({state:s.state,ready:s.state==="ready",busy:s.state==="initializing"||s.state==="loading",featureCount:(h=s.featureCount)!=null?h:this._status.featureCount,lastEvent:(f=s.lastEvent)!=null?f:_i.Diagnostic,lastError:{code:r.code,message:r.message,recoverable:r.recoverable,timestamp:r.timestamp}}),r}_setStatus(i){const s={...this._status,...i,lastError:i.lastError===null?void 0:i.lastError!==void 0?{...i.lastError}:this._status.lastError?{...this._status.lastError}:void 0,timestamp:Date.now()};this._status=s,this.dispatchEvent(new CustomEvent(_i.Status,{detail:this._cloneStatus(s)}))}_cloneStatus(i){return{...i,lastError:i.lastError?{...i.lastError}:void 0}}_syncApiKeyFromAttributes(){const i=this._normalizeText(this.getAttribute("api-key")),s=this._normalizeText(this.getAttribute("here-api-key"));this._apiKey=i!=null?i:s}_normalizeText(i,s){if(typeof i!="string")return;const r=i.trim();if(r)return s!=null&&s.lowercase?r.toLowerCase():r}_resolveTileProviderErrorCode(i){return i instanceof Error&&i.message.toLowerCase().includes("unknown tile provider")?"unknown_provider":"tile_load_failed"}_resolveHereTileLayerErrorCode(i){const s=i.toLowerCase();return s.includes("permission")||s.includes("forbidden")||s.includes("403")||s.includes("unauthorized")||s.includes("not authorized")||s.includes("not authorised")||s.includes("access denied")?"permission_denied":"invalid_api_key"}_describeTileLayerError(i,s){if(i&&typeof i=="object"&&"error"in i&&i.error instanceof Error)return i.error.message;if(i instanceof Error&&i.message)return i.message;if(i&&typeof i=="object"&&"message"in i&&typeof i.message=="string"){const r=i.message.trim();if(r.length>0)return r}return s==="here"?`Failed to load HERE tiles; verify API key, project permissions, and allowed localhost origin/referrer.${this._tileStyle==="satellite.day"?" If satellite.day fails, try lite.day.":""}`:"Failed to load tile layer"}_reflect(i,s){s===null?this.removeAttribute(i):this.getAttribute(i)!==s&&this.setAttribute(i,s)}_booleanReflect(i,s){s?this.hasAttribute(i)||this.setAttribute(i,""):this.hasAttribute(i)&&this.removeAttribute(i)}_coerceNumber(i,s){if(i==null)return s!=null?s:NaN;const r=Number(i);return Number.isFinite(r)?r:s!=null?s:NaN}}const Xh="leaflet-geokit";customElements.get(Xh)||customElements.define(Xh,sl);const Jh="leaflet-draw-map";if(!customElements.get(Jh)){class a extends sl{}customElements.define(Jh,a)}Nt.DrawEvent=ie,Nt.GROWER_PRESETS=Gp,Nt.GeoJSONValidationError=Br,Nt.GeoKitEvent=_i,Nt.LAYER_STYLE_PRESETS=zn,Nt.LeafletDrawMapElement=sl,Nt.applyGeoJSONPatch=Bf,Nt.boundingBoxGeoJSON=em,Nt.bufferGeoJSON=jp,Nt.centroidGeoJSON=tm,Nt.createBedWidthGuides=im,Nt.createCustomRasterProvider=iu,Nt.createIrrigationZones=rm,Nt.createMapLibreBasemapAdapter=Hf,Nt.createRasterProvider=eu,Nt.createRowSpacingGuides=nm,Nt.diffGeoJSON=Df,Nt.exportGeoJSONData=Of,Nt.findSnap=lu,Nt.formatMeasurements=qh,Nt.getProviderDiagnostics=ga,Nt.importGeoJSONData=Kl,Nt.importGeoJSONText=Ql,Nt.importGeoJSONURL=Rf,Nt.measureGeoJSON=Uh,Nt.mergeGeoJSON=Qp,Nt.normalizeGeoJSON=qo,Nt.simplifyGeoJSON=$p,Nt.splitGeoJSON=Kp,Nt.validateGeoJSON=Ji,Object.defineProperty(Nt,Symbol.toStringTag,{value:"Module"})}));
|
|
506
503
|
//# sourceMappingURL=leaflet-geokit.umd.js.map
|