@maptiler/geocoding-control 0.0.38 → 0.0.42
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/dist/leaflet.js +14400 -1384
- package/dist/leaflet.umd.js +6 -3
- package/dist/lib/mask.d.ts +2 -0
- package/dist/maplibregl.js +14421 -1405
- package/dist/maplibregl.umd.js +6 -3
- package/package.json +14 -2
- package/src/lib/GeocodingControl.svelte +22 -5
- package/src/lib/leafletMapController.ts +13 -5
- package/src/lib/maplibreglMapController.ts +9 -5
- package/src/lib/mask.ts +69 -0
package/dist/maplibregl.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var jt=(C,A,k)=>{if(!A.has(C))throw TypeError("Cannot "+k)};var re=(C,A,k)=>(jt(C,A,"read from private field"),k?k.call(C):A.get(C)),ft=(C,A,k)=>{if(A.has(C))throw TypeError("Cannot add the same private member more than once");A instanceof WeakSet?A.add(C):A.set(C,k)},Ze=(C,A,k,Be)=>(jt(C,A,"write to private field"),Be?Be.call(C,k):A.set(C,k),k);(function(C,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","maplibre-gl"],A):(C=typeof globalThis<"u"?globalThis:C||self,A(C.maplibreglMaptilerGeocoder={},C.maplibregl))})(this,function(C,A){var J,de;"use strict";function k(){}function Be(n,t){for(const e in t)n[e]=t[e];return n}function at(n){return n()}function ct(){return Object.create(null)}function ie(n){n.forEach(at)}function ht(n){return typeof n=="function"}function _e(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Ht(n){return Object.keys(n).length===0}function Kt(n,t,e,r){if(n){const i=gt(n,t,e,r);return n[0](i)}}function gt(n,t,e,r){return n[1]&&r?Be(e.ctx.slice(),n[1](r(t))):e.ctx}function Jt(n,t,e,r){if(n[2]&&r){const i=n[2](r(e));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],l=Math.max(t.dirty.length,i.length);for(let s=0;s<l;s+=1)o[s]=t.dirty[s]|i[s];return o}return t.dirty|i}return t.dirty}function $t(n,t,e,r,i,o){if(i){const l=gt(t,e,r,o);n.p(l,i)}}function er(n){if(n.ctx.length>32){const t=[],e=n.ctx.length/32;for(let r=0;r<e;r++)t[r]=-1;return t}return-1}function vt(n){return n==null?"":n}function I(n,t){n.appendChild(t)}function W(n,t,e){n.insertBefore(t,e||null)}function Y(n){n.parentNode.removeChild(n)}function tr(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function N(n){return document.createElement(n)}function oe(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}function ve(n){return document.createTextNode(n)}function $(){return ve(" ")}function j(n,t,e,r){return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}function rr(n){return function(t){return t.preventDefault(),n.call(this,t)}}function y(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function nr(n){return Array.from(n.childNodes)}function Ie(n,t){t=""+t,n.wholeText!==t&&(n.data=t)}function yt(n,t){n.value=t==null?"":t}function Q(n,t,e){n.classList[e?"add":"remove"](t)}function ir(n,t,{bubbles:e=!1,cancelable:r=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(n,e,r,t),i}let Le;function Me(n){Le=n}function dt(){if(!Le)throw new Error("Function called outside component initialization");return Le}function or(n){dt().$$.on_destroy.push(n)}function lr(){const n=dt();return(t,e,{cancelable:r=!1}={})=>{const i=n.$$.callbacks[t];if(i){const o=ir(t,e,{cancelable:r});return i.slice().forEach(l=>{l.call(n,o)}),!o.defaultPrevented}return!0}}const Oe=[],Xe=[],Ge=[],mt=[],sr=Promise.resolve();let We=!1;function ur(){We||(We=!0,sr.then(pt))}function je(n){Ge.push(n)}const He=new Set;let qe=0;function pt(){const n=Le;do{for(;qe<Oe.length;){const t=Oe[qe];qe++,Me(t),fr(t.$$)}for(Me(null),Oe.length=0,qe=0;Xe.length;)Xe.pop()();for(let t=0;t<Ge.length;t+=1){const e=Ge[t];He.has(e)||(He.add(e),e())}Ge.length=0}while(Oe.length);for(;mt.length;)mt.pop()();We=!1,He.clear(),Me(n)}function fr(n){if(n.fragment!==null){n.update(),ie(n.before_update);const t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(je)}}const Fe=new Set;let ye;function Qe(){ye={r:0,c:[],p:ye}}function De(){ye.r||ie(ye.c),ye=ye.p}function B(n,t){n&&n.i&&(Fe.delete(n),n.i(t))}function Z(n,t,e,r){if(n&&n.o){if(Fe.has(n))return;Fe.add(n),ye.c.push(()=>{Fe.delete(n),r&&(e&&n.d(1),r())}),n.o(t)}else r&&r()}function Te(n){n&&n.c()}function be(n,t,e,r){const{fragment:i,after_update:o}=n.$$;i&&i.m(t,e),r||je(()=>{const l=n.$$.on_mount.map(at).filter(ht);n.$$.on_destroy?n.$$.on_destroy.push(...l):ie(l),n.$$.on_mount=[]}),o.forEach(je)}function xe(n,t){const e=n.$$;e.fragment!==null&&(ie(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function ar(n,t){n.$$.dirty[0]===-1&&(Oe.push(n),ur(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function we(n,t,e,r,i,o,l,s=[-1]){const u=Le;Me(n);const f=n.$$={fragment:null,ctx:[],props:o,update:k,not_equal:i,bound:ct(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:ct(),dirty:s,skip_bound:!1,root:t.target||u.$$.root};l&&l(f.root);let a=!1;if(f.ctx=e?e(n,t.props||{},(g,m,...v)=>{const x=v.length?v[0]:m;return f.ctx&&i(f.ctx[g],f.ctx[g]=x)&&(!f.skip_bound&&f.bound[g]&&f.bound[g](x),a&&ar(n,g)),m}):[],f.update(),a=!0,ie(f.before_update),f.fragment=r?r(f.ctx):!1,t.target){if(t.hydrate){const g=nr(t.target);f.fragment&&f.fragment.l(g),g.forEach(Y)}else f.fragment&&f.fragment.c();t.intro&&B(n.$$.fragment),be(n,t.target,t.anchor,t.customElement),pt()}Me(u)}class Ee{$destroy(){xe(this,1),this.$destroy=k}$on(t,e){if(!ht(e))return k;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(e),()=>{const i=r.indexOf(e);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!Ht(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const mn="";function cr(n){let t,e;return{c(){t=oe("svg"),e=oe("path"),y(e,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),y(t,"viewBox","0 0 60.006 21.412"),y(t,"width","14"),y(t,"height","20"),y(t,"class","svelte-en2qvf")},m(r,i){W(r,t,i),I(t,e)},p:k,i:k,o:k,d(r){r&&Y(t)}}}class hr extends Ee{constructor(t){super(),we(this,t,null,cr,_e,{})}}const pn="";function gr(n){let t,e;return{c(){t=oe("svg"),e=oe("path"),y(e,"d","M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"),y(t,"viewBox","0 0 18 18"),y(t,"width","16"),y(t,"height","16"),y(t,"class","svelte-en2qvf")},m(r,i){W(r,t,i),I(t,e)},p:k,i:k,o:k,d(r){r&&Y(t)}}}class vr extends Ee{constructor(t){super(),we(this,t,null,gr,_e,{})}}const _n="";function yr(n){let t;return{c(){t=N("div"),t.innerHTML='<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>',y(t,"class","svelte-7cmwmc")},m(e,r){W(e,t,r)},p:k,i:k,o:k,d(e){e&&Y(t)}}}class dr extends Ee{constructor(t){super(),we(this,t,null,yr,_e,{})}}const bn="";function mr(n){let t,e,r;return{c(){t=oe("svg"),e=oe("path"),y(e,"stroke-width","4"),y(e,"fill-rule","evenodd"),y(e,"clip-rule","evenodd"),y(e,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),y(e,"class","svelte-656hh2"),y(t,"width",r=n[0]!=="list"?void 0:"20"),y(t,"viewBox","0 0 70 85"),y(t,"fill","none"),y(t,"class","svelte-656hh2"),Q(t,"in-map",n[0]!=="list"),Q(t,"for-maplibre",n[0]==="maplibre"),Q(t,"for-leaflet",n[0]==="leaflet"),Q(t,"list-icon",n[0]==="list")},m(i,o){W(i,t,o),I(t,e)},p(i,[o]){o&1&&r!==(r=i[0]!=="list"?void 0:"20")&&y(t,"width",r),o&1&&Q(t,"in-map",i[0]!=="list"),o&1&&Q(t,"for-maplibre",i[0]==="maplibre"),o&1&&Q(t,"for-leaflet",i[0]==="leaflet"),o&1&&Q(t,"list-icon",i[0]==="list")},i:k,o:k,d(i){i&&Y(t)}}}function pr(n,t,e){let{displayIn:r}=t;return n.$$set=i=>{"displayIn"in i&&e(0,r=i.displayIn)},[r]}class _t extends Ee{constructor(t){super(),we(this,t,pr,mr,_e,{displayIn:0})}}const xn="";function _r(n){let t,e;return{c(){t=oe("svg"),e=oe("path"),y(e,"d","M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"),y(t,"viewBox","0 0 18 18"),y(t,"xml:space","preserve"),y(t,"width","20"),y(t,"class","svelte-en2qvf")},m(r,i){W(r,t,i),I(t,e)},p:k,i:k,o:k,d(r){r&&Y(t)}}}class br extends Ee{constructor(t){super(),we(this,t,null,_r,_e,{})}}const wn="";function bt(n,t,e){const r=n.slice();return r[63]=t[e],r[65]=e,r}function xt(n){let t,e;return t=new dr({}),{c(){Te(t.$$.fragment)},m(r,i){be(t,r,i),e=!0},i(r){e||(B(t.$$.fragment,r),e=!0)},o(r){Z(t.$$.fragment,r),e=!1},d(r){xe(t,r)}}}function wt(n){let t,e,r,i,o;return e=new hr({}),{c(){t=N("button"),Te(e.$$.fragment),y(t,"type","button"),y(t,"title",n[8]),y(t,"class","svelte-1h1zm6d"),Q(t,"active",n[1])},m(l,s){W(l,t,s),be(e,t,null),r=!0,i||(o=j(t,"click",n[50]),i=!0)},p(l,s){(!r||s[0]&256)&&y(t,"title",l[8]),(!r||s[0]&2)&&Q(t,"active",l[1])},i(l){r||(B(e.$$.fragment,l),r=!0)},o(l){Z(e.$$.fragment,l),r=!1},d(l){l&&Y(t),xe(e),i=!1,o()}}}function xr(n){let t,e,r,i,o=n[12],l=[];for(let u=0;u<o.length;u+=1)l[u]=St(bt(n,o,u));const s=u=>Z(l[u],1,1,()=>{l[u]=null});return{c(){t=N("ul");for(let u=0;u<l.length;u+=1)l[u].c();y(t,"class","svelte-1h1zm6d")},m(u,f){W(u,t,f);for(let a=0;a<l.length;a+=1)l[a].m(t,null);e=!0,r||(i=[j(t,"mouseout",n[53]),j(t,"blur",n[54])],r=!0)},p(u,f){if(f[0]&29697){o=u[12];let a;for(a=0;a<o.length;a+=1){const g=bt(u,o,a);l[a]?(l[a].p(g,f),B(l[a],1)):(l[a]=St(g),l[a].c(),B(l[a],1),l[a].m(t,null))}for(Qe(),a=o.length;a<l.length;a+=1)s(a);De()}},i(u){if(!e){for(let f=0;f<o.length;f+=1)B(l[f]);e=!0}},o(u){l=l.filter(Boolean);for(let f=0;f<l.length;f+=1)Z(l[f]);e=!1},d(u){u&&Y(t),tr(l,u),r=!1,ie(i)}}}function wr(n){let t,e;return{c(){t=N("div"),e=ve(n[5]),y(t,"class","no-results svelte-1h1zm6d")},m(r,i){W(r,t,i),I(t,e)},p(r,i){i[0]&32&&Ie(e,r[5])},i:k,o:k,d(r){r&&Y(t)}}}function Er(n){let t,e;return{c(){t=N("div"),e=ve(n[4]),y(t,"class","error svelte-1h1zm6d")},m(r,i){W(r,t,i),I(t,e)},p(r,i){i[0]&16&&Ie(e,r[4])},i:k,o:k,d(r){r&&Y(t)}}}function Sr(n){let t="",e;return{c(){e=ve(t)},m(r,i){W(r,e,i)},p:k,i:k,o:k,d(r){r&&Y(e)}}}function Et(n){let t,e=n[63].place_type+"",r;return{c(){t=N("span"),r=ve(e),y(t,"class","svelte-1h1zm6d")},m(i,o){W(i,t,o),I(t,r)},p(i,o){o[0]&4096&&e!==(e=i[63].place_type+"")&&Ie(r,e)},d(i){i&&Y(t)}}}function St(n){let t,e,r,i,o,l,s=n[63].place_name.replace(/,.*/,"")+"",u,f,a,g,m,v=n[63].place_name.replace(/[^,]*,?\s*/,"")+"",x,p,h,d,w,L;e=new _t({props:{displayIn:"list"}});let _=n[10]&&Et(n);function S(){return n[51](n[65])}function E(){return n[52](n[63])}return{c(){t=N("li"),Te(e.$$.fragment),r=$(),i=N("span"),o=N("span"),l=N("span"),u=ve(s),f=$(),_&&_.c(),a=$(),g=N("span"),m=N("span"),x=ve(v),p=$(),y(l,"class","svelte-1h1zm6d"),y(o,"class","svelte-1h1zm6d"),y(i,"class","svelte-1h1zm6d"),y(m,"class","svelte-1h1zm6d"),y(g,"class","svelte-1h1zm6d"),y(t,"tabindex","0"),y(t,"data-selected",h=n[14]===n[65]),y(t,"class","svelte-1h1zm6d"),Q(t,"selected",n[14]===n[65])},m(P,R){W(P,t,R),be(e,t,null),I(t,r),I(t,i),I(i,o),I(o,l),I(l,u),I(o,f),_&&_.m(o,null),I(t,a),I(t,g),I(g,m),I(m,x),I(t,p),d=!0,w||(L=[j(t,"mouseover",S),j(t,"focus",E)],w=!0)},p(P,R){n=P,(!d||R[0]&4096)&&s!==(s=n[63].place_name.replace(/,.*/,"")+"")&&Ie(u,s),n[10]?_?_.p(n,R):(_=Et(n),_.c(),_.m(o,null)):_&&(_.d(1),_=null),(!d||R[0]&4096)&&v!==(v=n[63].place_name.replace(/[^,]*,?\s*/,"")+"")&&Ie(x,v),(!d||R[0]&16384&&h!==(h=n[14]===n[65]))&&y(t,"data-selected",h),(!d||R[0]&16384)&&Q(t,"selected",n[14]===n[65])},i(P){d||(B(e.$$.fragment,P),d=!0)},o(P){Z(e.$$.fragment,P),d=!1},d(P){P&&Y(t),xe(e),_&&_.d(),w=!1,ie(L)}}}function kr(n){let t,e,r,i,o,l,s,u,f,a,g,m,v,x,p,h,d,w,L,_;i=new br({}),a=new vr({});let S=n[18]&&xt(),E=n[7]===!0&&wt(n);const P=n[42].default,R=Kt(P,n,n[41],null),F=[Sr,Er,wr,xr],G=[];function M(b,O){var D,fe;return b[15]?b[17]?1:((D=b[12])==null?void 0:D.length)===0?2:b[15]&&((fe=b[12])==null?void 0:fe.length)?3:-1:0}return~(p=M(n))&&(h=G[p]=F[p](n)),{c(){t=N("form"),e=N("div"),r=N("button"),Te(i.$$.fragment),o=$(),l=N("input"),s=$(),u=N("div"),f=N("button"),Te(a.$$.fragment),g=$(),S&&S.c(),m=$(),E&&E.c(),v=$(),R&&R.c(),x=$(),h&&h.c(),y(r,"type","button"),y(r,"class","svelte-1h1zm6d"),y(l,"placeholder",n[3]),y(l,"aria-label",n[3]),y(l,"class","svelte-1h1zm6d"),y(f,"type","button"),y(f,"title",n[9]),y(f,"class","svelte-1h1zm6d"),Q(f,"displayable",n[0]!==""),y(u,"class","clear-button-container svelte-1h1zm6d"),y(e,"class","input-group svelte-1h1zm6d"),y(t,"tabindex","0"),y(t,"class",d=vt(n[2])+" svelte-1h1zm6d"),Q(t,"can-collapse",n[6]&&n[0]==="")},m(b,O){W(b,t,O),I(t,e),I(e,r),be(i,r,null),I(e,o),I(e,l),n[44](l),yt(l,n[0]),I(e,s),I(e,u),I(u,f),be(a,f,null),I(u,g),S&&S.m(u,null),I(e,m),E&&E.m(e,null),I(e,v),R&&R.m(e,null),I(t,x),~p&&G[p].m(t,null),w=!0,L||(_=[j(r,"click",n[43]),j(l,"input",n[45]),j(l,"focus",n[46]),j(l,"blur",n[47]),j(l,"keydown",n[20]),j(l,"input",n[48]),j(f,"click",n[49]),j(t,"submit",rr(n[19]))],L=!0)},p(b,O){(!w||O[0]&8)&&y(l,"placeholder",b[3]),(!w||O[0]&8)&&y(l,"aria-label",b[3]),O[0]&1&&l.value!==b[0]&&yt(l,b[0]),(!w||O[0]&512)&&y(f,"title",b[9]),(!w||O[0]&1)&&Q(f,"displayable",b[0]!==""),b[18]?S?O[0]&262144&&B(S,1):(S=xt(),S.c(),B(S,1),S.m(u,null)):S&&(Qe(),Z(S,1,1,()=>{S=null}),De()),b[7]===!0?E?(E.p(b,O),O[0]&128&&B(E,1)):(E=wt(b),E.c(),B(E,1),E.m(e,v)):E&&(Qe(),Z(E,1,1,()=>{E=null}),De()),R&&R.p&&(!w||O[1]&1024)&&$t(R,P,b,b[41],w?Jt(P,b[41],O,null):er(b[41]),null);let D=p;p=M(b),p===D?~p&&G[p].p(b,O):(h&&(Qe(),Z(G[D],1,1,()=>{G[D]=null}),De()),~p?(h=G[p],h?h.p(b,O):(h=G[p]=F[p](b),h.c()),B(h,1),h.m(t,null)):h=null),(!w||O[0]&4&&d!==(d=vt(b[2])+" svelte-1h1zm6d"))&&y(t,"class",d),(!w||O[0]&69)&&Q(t,"can-collapse",b[6]&&b[0]==="")},i(b){w||(B(i.$$.fragment,b),B(a.$$.fragment,b),B(S),B(E),B(R,b),B(h),w=!0)},o(b){Z(i.$$.fragment,b),Z(a.$$.fragment,b),Z(S),Z(E),Z(R,b),Z(h),w=!1},d(b){b&&Y(t),xe(i),n[44](null),xe(a),S&&S.d(),E&&E.d(),R&&R.d(b),~p&&G[p].d(),L=!1,ie(_)}}}function Pr(n,t,e){let r,{$$slots:i={},$$scope:o}=t,{class:l=void 0}=t,{mapController:s=void 0}=t,{apiKey:u}=t,{debounceSearch:f=200}=t,{placeholder:a="Search"}=t,{errorMessage:g="Searching failed"}=t,{noResultsMessage:m="No results found"}=t,{proximity:v=void 0}=t,{bbox:x=void 0}=t,{trackProximity:p=!0}=t,{minLength:h=2}=t,{language:d=void 0}=t,{showResultsWhileTyping:w=!0}=t,{zoom:L=16}=t,{flyTo:_=!0}=t,{collapsed:S=!1}=t,{clearOnBlur:E=!1}=t,{enableReverse:P=!1}=t,{reverseButtonTitle:R="toggle reverse geocoding"}=t,{clearButtonTitle:F="clear"}=t,{filter:G=()=>!0}=t,{searchValue:M=""}=t,{reverseActive:b=P==="always"}=t,{showPlaceType:O=!1}=t,{showFullGeometry:D=!0}=t;function fe(){te.focus()}function en(){te.blur()}function Vt(c,V=!0){e(0,M=c),V?(e(14,q=-1),Zt()):(ut(),setTimeout(()=>{te.focus(),te.select()}))}let Se=!1,z,X,T,Yt="",te,q=-1,ae,Ye=[],me,ot,lt;const ce=lr();or(()=>{s&&(s.setProximityChangeHandler(void 0),s.setMapClickHandler(void 0),s.indicateReverse(!1),s.setSelectedMarker(-1),s.setMarkers(void 0,void 0))});function Zt(c){if(q>-1&&z)e(13,T=z[q]),e(0,M=T.place_name.replace(/,.*/,"")),e(17,ae=void 0),e(39,X=void 0),e(14,q=-1);else if(M){const V=c||!Xt();st(M).then(()=>{e(39,X=z),e(13,T=void 0),V&&tn()}).catch(ne=>e(17,ae=ne))}}function Xt(){return/^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(M)}async function st(c,V=!1){e(17,ae=void 0);const ne=Xt(),he=new URLSearchParams;he.set("key",u),d&&he.set("language",String(d)),ne||(x&&he.set("bbox",x.join(",")),v&&he.set("proximity",v.join(",")));const pe="https://api.maptiler.com/geocoding/"+encodeURIComponent(c)+".json?"+he.toString();if(pe===Yt){V?(e(12,z=void 0),e(13,T=Ye[0])):e(12,z=Ye);return}Yt=pe,me==null||me.abort(),e(18,me=new AbortController);let ke;try{ke=await fetch(pe,{signal:me.signal}).finally(()=>{e(18,me=void 0)})}catch(Re){if(Re&&typeof Re=="object"&&Re.name==="AbortError")return;throw new Error}if(!ke.ok)throw new Error;const Pe=await ke.json();ce("response",{url:pe,featureCollection:Pe}),V?(e(12,z=void 0),e(13,T=Pe.features[0]),Ye=[T]):(e(12,z=Pe.features.filter(G)),Ye=z,ne&&te.focus())}function tn(){var V,ne,he,pe,ke,Pe,Re,Wt;if(!(X!=null&&X.length)||!_)return;const c=[180,90,-180,-90];for(const ge of X)c[0]=Math.min(c[0],(ne=(V=ge.bbox)==null?void 0:V[0])!=null?ne:ge.center[0]),c[1]=Math.min(c[1],(pe=(he=ge.bbox)==null?void 0:he[1])!=null?pe:ge.center[1]),c[2]=Math.max(c[2],(Pe=(ke=ge.bbox)==null?void 0:ke[2])!=null?Pe:ge.center[0]),c[3]=Math.max(c[3],(Wt=(Re=ge.bbox)==null?void 0:Re[3])!=null?Wt:ge.center[1]);s&&X.length>0&&(T&&c[0]===c[2]&&c[1]===c[3]?s.flyTo(T.center,L):s.fitBounds(c,50))}function rn(c){e(1,b=P==="always"),Vt(c[0].toFixed(6)+","+c[1].toFixed(6))}function nn(c){if(!z)return;let V=c.key==="ArrowDown"?1:c.key==="ArrowUp"?-1:0;V?(q===-1&&V===-1&&e(14,q=z.length),e(14,q+=V),q>=z.length&&e(14,q=-1),c.preventDefault()):["ArrowLeft","ArrowRight","Home","End"].includes(c.key)&&e(14,q=-1)}function ut(c=!0){if(w&&M.length>h){ot&&clearTimeout(ot);const V=M;ot=window.setTimeout(()=>{st(V).catch(ne=>e(17,ae=ne))},c?f:0)}else e(12,z=void 0),e(17,ae=void 0)}const on=()=>te.focus();function ln(c){Xe[c?"unshift":"push"](()=>{te=c,e(16,te)})}function sn(){M=this.value,e(0,M),e(11,Se),e(33,E)}const un=()=>e(11,Se=!0),fn=()=>e(11,Se=!1),an=()=>ut(),cn=()=>{e(0,M=""),te.focus()},hn=()=>e(1,b=!b),gn=c=>e(14,q=c),vn=c=>{e(13,T=c),e(0,M=c.place_name.replace(/,.*/,"")),e(14,q=-1)},yn=()=>e(14,q=-1),dn=()=>{};return n.$$set=c=>{"class"in c&&e(2,l=c.class),"mapController"in c&&e(23,s=c.mapController),"apiKey"in c&&e(24,u=c.apiKey),"debounceSearch"in c&&e(25,f=c.debounceSearch),"placeholder"in c&&e(3,a=c.placeholder),"errorMessage"in c&&e(4,g=c.errorMessage),"noResultsMessage"in c&&e(5,m=c.noResultsMessage),"proximity"in c&&e(22,v=c.proximity),"bbox"in c&&e(26,x=c.bbox),"trackProximity"in c&&e(27,p=c.trackProximity),"minLength"in c&&e(28,h=c.minLength),"language"in c&&e(29,d=c.language),"showResultsWhileTyping"in c&&e(30,w=c.showResultsWhileTyping),"zoom"in c&&e(31,L=c.zoom),"flyTo"in c&&e(32,_=c.flyTo),"collapsed"in c&&e(6,S=c.collapsed),"clearOnBlur"in c&&e(33,E=c.clearOnBlur),"enableReverse"in c&&e(7,P=c.enableReverse),"reverseButtonTitle"in c&&e(8,R=c.reverseButtonTitle),"clearButtonTitle"in c&&e(9,F=c.clearButtonTitle),"filter"in c&&e(34,G=c.filter),"searchValue"in c&&e(0,M=c.searchValue),"reverseActive"in c&&e(1,b=c.reverseActive),"showPlaceType"in c&&e(10,O=c.showPlaceType),"showFullGeometry"in c&&e(35,D=c.showFullGeometry),"$$scope"in c&&e(41,o=c.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&142606336&&s&&s.setProximityChangeHandler(p?c=>{e(22,v=c)}:void 0),n.$$.dirty[0]&134217728&&(p||e(22,v=void 0)),n.$$.dirty[0]&2048|n.$$.dirty[1]&4&&setTimeout(()=>{e(15,lt=Se),E&&!Se&&e(0,M="")}),n.$$.dirty[0]&4097&&(M||(e(13,T=void 0),e(12,z=void 0),e(17,ae=void 0),e(39,X=z))),n.$$.dirty[0]&8192|n.$$.dirty[1]&16&&D&&T&&!T.address&&T.geometry.type==="Point"&&st(T.id,!0).catch(c=>e(17,ae=c)),n.$$.dirty[0]&8396800|n.$$.dirty[1]&3&&s&&T&&_&&(!T.bbox||T.bbox[0]===T.bbox[2]&&T.bbox[1]===T.bbox[3]?s.flyTo(T.center,L):s.fitBounds(T.bbox,50),e(12,z=void 0),e(39,X=void 0),e(14,q=-1)),n.$$.dirty[0]&4096|n.$$.dirty[1]&256&&X!==z&&e(39,X=void 0),n.$$.dirty[0]&8396800|n.$$.dirty[1]&256&&s&&s.setMarkers(X,T),n.$$.dirty[0]&1&&e(14,q=-1),n.$$.dirty[0]&8404992&&(s==null||s.setSelectedMarker(q)),n.$$.dirty[0]&20480&&e(40,r=z==null?void 0:z[q]),n.$$.dirty[1]&512&&ce("select",r),n.$$.dirty[0]&8192&&ce("pick",T),n.$$.dirty[0]&36864&&ce("optionsVisibilityChange",lt&&!!z),n.$$.dirty[0]&4096&&ce("featuresListed",z),n.$$.dirty[1]&256&&ce("featuresMarked",X),n.$$.dirty[0]&2&&ce("reverseToggle",b),n.$$.dirty[0]&1&&ce("queryChange",M),n.$$.dirty[0]&8388610&&s&&s.indicateReverse(b),n.$$.dirty[0]&8388610&&s&&s.setMapClickHandler(b?rn:void 0)},[M,b,l,a,g,m,S,P,R,F,O,Se,z,T,q,lt,te,ae,me,Zt,nn,ut,v,s,u,f,x,p,h,d,w,L,_,E,G,D,fe,en,Vt,X,r,o,i,on,ln,sn,un,fn,an,cn,hn,gn,vn,yn,dn]}class Rr extends Ee{constructor(t){super(),we(this,t,Pr,kr,_e,{class:2,mapController:23,apiKey:24,debounceSearch:25,placeholder:3,errorMessage:4,noResultsMessage:5,proximity:22,bbox:26,trackProximity:27,minLength:28,language:29,showResultsWhileTyping:30,zoom:31,flyTo:32,collapsed:6,clearOnBlur:33,enableReverse:7,reverseButtonTitle:8,clearButtonTitle:9,filter:34,searchValue:0,reverseActive:1,showPlaceType:10,showFullGeometry:35,focus:36,blur:37,setQuery:38},null,[-1,-1,-1])}get focus(){return this.$$.ctx[36]}get blur(){return this.$$.ctx[37]}get setQuery(){return this.$$.ctx[38]}}function kt(n,t,e){e===void 0&&(e={});var r={type:"Feature"};return(e.id===0||e.id)&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.properties=t||{},r.geometry=n,r}function Pt(n,t,e){e===void 0&&(e={});for(var r=0,i=n;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var l=0;l<o[o.length-1].length;l++)if(o[o.length-1][l]!==o[0][l])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:n};return kt(s,t,e)}function Rt(n,t,e){e===void 0&&(e={});var r={type:"MultiPolygon",coordinates:n};return kt(r,t,e)}/**
|
|
1
|
+
var Xu=(Ot,Qt,et)=>{if(!Qt.has(Ot))throw TypeError("Cannot "+et)};var Zn=(Ot,Qt,et)=>(Xu(Ot,Qt,"read from private field"),et?et.call(Ot):Qt.get(Ot)),js=(Ot,Qt,et)=>{if(Qt.has(Ot))throw TypeError("Cannot add the same private member more than once");Qt instanceof WeakSet?Qt.add(Ot):Qt.set(Ot,et)},rs=(Ot,Qt,et,yo)=>(Xu(Ot,Qt,"write to private field"),yo?yo.call(Ot,et):Qt.set(Ot,et),et);(function(Ot,Qt){typeof exports=="object"&&typeof module<"u"?Qt(exports,require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","maplibre-gl"],Qt):(Ot=typeof globalThis<"u"?globalThis:Ot||self,Qt(Ot.maplibreglMaptilerGeocoder={},Ot.maplibregl))})(this,function(Ot,Qt){var Tn,ei;"use strict";function et(){}function yo(r,t){for(const e in t)r[e]=t[e];return r}function Ks(r){return r()}function Qs(){return Object.create(null)}function hr(r){r.forEach(Ks)}function Js(r){return typeof r=="function"}function ii(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Yu(r){return Object.keys(r).length===0}function Hu(r,t,e,n){if(r){const i=Zs(r,t,e,n);return r[0](i)}}function Zs(r,t,e,n){return r[1]&&n?yo(e.ctx.slice(),r[1](n(t))):e.ctx}function Wu(r,t,e,n){if(r[2]&&n){const i=r[2](n(e));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],s=Math.max(t.dirty.length,i.length);for(let a=0;a<s;a+=1)o[a]=t.dirty[a]|i[a];return o}return t.dirty|i}return t.dirty}function ju(r,t,e,n,i,o){if(i){const s=Zs(t,e,n,o);r.p(s,i)}}function Ku(r){if(r.ctx.length>32){const t=[],e=r.ctx.length/32;for(let n=0;n<e;n++)t[n]=-1;return t}return-1}function $s(r){return r==null?"":r}function lt(r,t){r.appendChild(t)}function ze(r,t,e){r.insertBefore(t,e||null)}function Re(r){r.parentNode.removeChild(r)}function Qu(r,t){for(let e=0;e<r.length;e+=1)r[e]&&r[e].d(t)}function Jt(r){return document.createElement(r)}function gr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Ar(r){return document.createTextNode(r)}function Mn(){return Ar(" ")}function Ve(r,t,e,n){return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}function Ju(r){return function(t){return t.preventDefault(),r.call(this,t)}}function B(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Zu(r){return Array.from(r.childNodes)}function Gi(r,t){t=""+t,r.wholeText!==t&&(r.data=t)}function ta(r,t){r.value=t==null?"":t}function ge(r,t,e){r.classList[e?"add":"remove"](t)}function $u(r,t,{bubbles:e=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(r,e,n,t),i}let ki;function zi(r){ki=r}function ea(){if(!ki)throw new Error("Function called outside component initialization");return ki}function tl(r){ea().$$.on_destroy.push(r)}function el(){const r=ea();return(t,e,{cancelable:n=!1}={})=>{const i=r.$$.callbacks[t];if(i){const o=$u(t,e,{cancelable:n});return i.slice().forEach(s=>{s.call(r,o)}),!o.defaultPrevented}return!0}}const Vi=[],is=[],mo=[],na=[],nl=Promise.resolve();let os=!1;function rl(){os||(os=!0,nl.then(ra))}function ss(r){mo.push(r)}const as=new Set;let _o=0;function ra(){const r=ki;do{for(;_o<Vi.length;){const t=Vi[_o];_o++,zi(t),il(t.$$)}for(zi(null),Vi.length=0,_o=0;is.length;)is.pop()();for(let t=0;t<mo.length;t+=1){const e=mo[t];as.has(e)||(as.add(e),e())}mo.length=0}while(Vi.length);for(;na.length;)na.pop()();os=!1,as.clear(),zi(r)}function il(r){if(r.fragment!==null){r.update(),hr(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(ss)}}const Eo=new Set;let Fr;function Io(){Fr={r:0,c:[],p:Fr}}function Co(){Fr.r||hr(Fr.c),Fr=Fr.p}function Zt(r,t){r&&r.i&&(Eo.delete(r),r.i(t))}function Oe(r,t,e,n){if(r&&r.o){if(Eo.has(r))return;Eo.add(r),Fr.c.push(()=>{Eo.delete(r),n&&(e&&r.d(1),n())}),r.o(t)}else n&&n()}function Ui(r){r&&r.c()}function oi(r,t,e,n){const{fragment:i,after_update:o}=r.$$;i&&i.m(t,e),n||ss(()=>{const s=r.$$.on_mount.map(Ks).filter(Js);r.$$.on_destroy?r.$$.on_destroy.push(...s):hr(s),r.$$.on_mount=[]}),o.forEach(ss)}function si(r,t){const e=r.$$;e.fragment!==null&&(hr(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function ol(r,t){r.$$.dirty[0]===-1&&(Vi.push(r),rl(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function ai(r,t,e,n,i,o,s,a=[-1]){const u=ki;zi(r);const l=r.$$={fragment:null,ctx:[],props:o,update:et,not_equal:i,bound:Qs(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:Qs(),dirty:a,skip_bound:!1,root:t.target||u.$$.root};s&&s(l.root);let c=!1;if(l.ctx=e?e(r,t.props||{},(f,h,...g)=>{const p=g.length?g[0]:h;return l.ctx&&i(l.ctx[f],l.ctx[f]=p)&&(!l.skip_bound&&l.bound[f]&&l.bound[f](p),c&&ol(r,f)),h}):[],l.update(),c=!0,hr(l.before_update),l.fragment=n?n(l.ctx):!1,t.target){if(t.hydrate){const f=Zu(t.target);l.fragment&&l.fragment.l(f),f.forEach(Re)}else l.fragment&&l.fragment.c();t.intro&&Zt(r.$$.fragment),oi(r,t.target,t.anchor,t.customElement),ra()}zi(u)}class ui{$destroy(){si(this,1),this.$destroy=et}$on(t,e){if(!Js(e))return et;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const i=n.indexOf(e);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Yu(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const rf="";function sl(r){let t,e;return{c(){t=gr("svg"),e=gr("path"),B(e,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),B(t,"viewBox","0 0 60.006 21.412"),B(t,"width","14"),B(t,"height","20"),B(t,"class","svelte-en2qvf")},m(n,i){ze(n,t,i),lt(t,e)},p:et,i:et,o:et,d(n){n&&Re(t)}}}class al extends ui{constructor(t){super(),ai(this,t,null,sl,ii,{})}}const of="";function ul(r){let t,e;return{c(){t=gr("svg"),e=gr("path"),B(e,"d","M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"),B(t,"viewBox","0 0 18 18"),B(t,"width","16"),B(t,"height","16"),B(t,"class","svelte-en2qvf")},m(n,i){ze(n,t,i),lt(t,e)},p:et,i:et,o:et,d(n){n&&Re(t)}}}class ll extends ui{constructor(t){super(),ai(this,t,null,ul,ii,{})}}const sf="";function cl(r){let t;return{c(){t=Jt("div"),t.innerHTML='<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>',B(t,"class","svelte-7cmwmc")},m(e,n){ze(e,t,n)},p:et,i:et,o:et,d(e){e&&Re(t)}}}class fl extends ui{constructor(t){super(),ai(this,t,null,cl,ii,{})}}const af="";function hl(r){let t,e,n;return{c(){t=gr("svg"),e=gr("path"),B(e,"stroke-width","4"),B(e,"fill-rule","evenodd"),B(e,"clip-rule","evenodd"),B(e,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),B(e,"class","svelte-656hh2"),B(t,"width",n=r[0]!=="list"?void 0:"20"),B(t,"viewBox","0 0 70 85"),B(t,"fill","none"),B(t,"class","svelte-656hh2"),ge(t,"in-map",r[0]!=="list"),ge(t,"for-maplibre",r[0]==="maplibre"),ge(t,"for-leaflet",r[0]==="leaflet"),ge(t,"list-icon",r[0]==="list")},m(i,o){ze(i,t,o),lt(t,e)},p(i,[o]){o&1&&n!==(n=i[0]!=="list"?void 0:"20")&&B(t,"width",n),o&1&&ge(t,"in-map",i[0]!=="list"),o&1&&ge(t,"for-maplibre",i[0]==="maplibre"),o&1&&ge(t,"for-leaflet",i[0]==="leaflet"),o&1&&ge(t,"list-icon",i[0]==="list")},i:et,o:et,d(i){i&&Re(t)}}}function gl(r,t,e){let{displayIn:n}=t;return r.$$set=i=>{"displayIn"in i&&e(0,n=i.displayIn)},[n]}class ia extends ui{constructor(t){super(),ai(this,t,gl,hl,ii,{displayIn:0})}}const uf="";function pl(r){let t,e;return{c(){t=gr("svg"),e=gr("path"),B(e,"d","M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"),B(t,"viewBox","0 0 18 18"),B(t,"xml:space","preserve"),B(t,"width","20"),B(t,"class","svelte-en2qvf")},m(n,i){ze(n,t,i),lt(t,e)},p:et,i:et,o:et,d(n){n&&Re(t)}}}class dl extends ui{constructor(t){super(),ai(this,t,null,pl,ii,{})}}const lf="";function oa(r,t,e){const n=r.slice();return n[64]=t[e],n[66]=e,n}function sa(r){let t,e;return t=new fl({}),{c(){Ui(t.$$.fragment)},m(n,i){oi(t,n,i),e=!0},i(n){e||(Zt(t.$$.fragment,n),e=!0)},o(n){Oe(t.$$.fragment,n),e=!1},d(n){si(t,n)}}}function aa(r){let t,e,n,i,o;return e=new al({}),{c(){t=Jt("button"),Ui(e.$$.fragment),B(t,"type","button"),B(t,"title",r[8]),B(t,"class","svelte-1h1zm6d"),ge(t,"active",r[1])},m(s,a){ze(s,t,a),oi(e,t,null),n=!0,i||(o=Ve(t,"click",r[51]),i=!0)},p(s,a){(!n||a[0]&256)&&B(t,"title",s[8]),(!n||a[0]&2)&&ge(t,"active",s[1])},i(s){n||(Zt(e.$$.fragment,s),n=!0)},o(s){Oe(e.$$.fragment,s),n=!1},d(s){s&&Re(t),si(e),i=!1,o()}}}function vl(r){let t,e,n,i,o=r[12],s=[];for(let u=0;u<o.length;u+=1)s[u]=la(oa(r,o,u));const a=u=>Oe(s[u],1,1,()=>{s[u]=null});return{c(){t=Jt("ul");for(let u=0;u<s.length;u+=1)s[u].c();B(t,"class","svelte-1h1zm6d")},m(u,l){ze(u,t,l);for(let c=0;c<s.length;c+=1)s[c].m(t,null);e=!0,n||(i=[Ve(t,"mouseout",r[54]),Ve(t,"blur",r[55])],n=!0)},p(u,l){if(l[0]&29697){o=u[12];let c;for(c=0;c<o.length;c+=1){const f=oa(u,o,c);s[c]?(s[c].p(f,l),Zt(s[c],1)):(s[c]=la(f),s[c].c(),Zt(s[c],1),s[c].m(t,null))}for(Io(),c=o.length;c<s.length;c+=1)a(c);Co()}},i(u){if(!e){for(let l=0;l<o.length;l+=1)Zt(s[l]);e=!0}},o(u){s=s.filter(Boolean);for(let l=0;l<s.length;l+=1)Oe(s[l]);e=!1},d(u){u&&Re(t),Qu(s,u),n=!1,hr(i)}}}function yl(r){let t,e;return{c(){t=Jt("div"),e=Ar(r[5]),B(t,"class","no-results svelte-1h1zm6d")},m(n,i){ze(n,t,i),lt(t,e)},p(n,i){i[0]&32&&Gi(e,n[5])},i:et,o:et,d(n){n&&Re(t)}}}function ml(r){let t,e;return{c(){t=Jt("div"),e=Ar(r[4]),B(t,"class","error svelte-1h1zm6d")},m(n,i){ze(n,t,i),lt(t,e)},p(n,i){i[0]&16&&Gi(e,n[4])},i:et,o:et,d(n){n&&Re(t)}}}function _l(r){let t="",e;return{c(){e=Ar(t)},m(n,i){ze(n,e,i)},p:et,i:et,o:et,d(n){n&&Re(e)}}}function ua(r){let t,e=r[64].place_type+"",n;return{c(){t=Jt("span"),n=Ar(e),B(t,"class","svelte-1h1zm6d")},m(i,o){ze(i,t,o),lt(t,n)},p(i,o){o[0]&4096&&e!==(e=i[64].place_type+"")&&Gi(n,e)},d(i){i&&Re(t)}}}function la(r){let t,e,n,i,o,s,a=r[64].place_name.replace(/,.*/,"")+"",u,l,c,f,h,g=r[64].place_name.replace(/[^,]*,?\s*/,"")+"",p,y,d,_,I,N;e=new ia({props:{displayIn:"list"}});let C=r[10]&&ua(r);function b(){return r[52](r[66])}function S(){return r[53](r[64])}return{c(){t=Jt("li"),Ui(e.$$.fragment),n=Mn(),i=Jt("span"),o=Jt("span"),s=Jt("span"),u=Ar(a),l=Mn(),C&&C.c(),c=Mn(),f=Jt("span"),h=Jt("span"),p=Ar(g),y=Mn(),B(s,"class","svelte-1h1zm6d"),B(o,"class","svelte-1h1zm6d"),B(i,"class","svelte-1h1zm6d"),B(h,"class","svelte-1h1zm6d"),B(f,"class","svelte-1h1zm6d"),B(t,"tabindex","0"),B(t,"data-selected",d=r[14]===r[66]),B(t,"class","svelte-1h1zm6d"),ge(t,"selected",r[14]===r[66])},m(D,T){ze(D,t,T),oi(e,t,null),lt(t,n),lt(t,i),lt(i,o),lt(o,s),lt(s,u),lt(o,l),C&&C.m(o,null),lt(t,c),lt(t,f),lt(f,h),lt(h,p),lt(t,y),_=!0,I||(N=[Ve(t,"mouseover",b),Ve(t,"focus",S)],I=!0)},p(D,T){r=D,(!_||T[0]&4096)&&a!==(a=r[64].place_name.replace(/,.*/,"")+"")&&Gi(u,a),r[10]?C?C.p(r,T):(C=ua(r),C.c(),C.m(o,null)):C&&(C.d(1),C=null),(!_||T[0]&4096)&&g!==(g=r[64].place_name.replace(/[^,]*,?\s*/,"")+"")&&Gi(p,g),(!_||T[0]&16384&&d!==(d=r[14]===r[66]))&&B(t,"data-selected",d),(!_||T[0]&16384)&&ge(t,"selected",r[14]===r[66])},i(D){_||(Zt(e.$$.fragment,D),_=!0)},o(D){Oe(e.$$.fragment,D),_=!1},d(D){D&&Re(t),si(e),C&&C.d(),I=!1,hr(N)}}}function El(r){let t,e,n,i,o,s,a,u,l,c,f,h,g,p,y,d,_,I,N,C;i=new dl({}),c=new ll({});let b=r[18]&&sa(),S=r[7]===!0&&aa(r);const D=r[43].default,T=Hu(D,r,r[42],null),F=[_l,ml,yl,vl],j=[];function z(O,X){var P,W;return O[15]?O[17]?1:((P=O[12])==null?void 0:P.length)===0?2:O[15]&&((W=O[12])==null?void 0:W.length)?3:-1:0}return~(y=z(r))&&(d=j[y]=F[y](r)),{c(){t=Jt("form"),e=Jt("div"),n=Jt("button"),Ui(i.$$.fragment),o=Mn(),s=Jt("input"),a=Mn(),u=Jt("div"),l=Jt("button"),Ui(c.$$.fragment),f=Mn(),b&&b.c(),h=Mn(),S&&S.c(),g=Mn(),T&&T.c(),p=Mn(),d&&d.c(),B(n,"type","button"),B(n,"class","svelte-1h1zm6d"),B(s,"placeholder",r[3]),B(s,"aria-label",r[3]),B(s,"class","svelte-1h1zm6d"),B(l,"type","button"),B(l,"title",r[9]),B(l,"class","svelte-1h1zm6d"),ge(l,"displayable",r[0]!==""),B(u,"class","clear-button-container svelte-1h1zm6d"),B(e,"class","input-group svelte-1h1zm6d"),B(t,"tabindex","0"),B(t,"class",_=$s(r[2])+" svelte-1h1zm6d"),ge(t,"can-collapse",r[6]&&r[0]==="")},m(O,X){ze(O,t,X),lt(t,e),lt(e,n),oi(i,n,null),lt(e,o),lt(e,s),r[45](s),ta(s,r[0]),lt(e,a),lt(e,u),lt(u,l),oi(c,l,null),lt(u,f),b&&b.m(u,null),lt(e,h),S&&S.m(e,null),lt(e,g),T&&T.m(e,null),lt(t,p),~y&&j[y].m(t,null),I=!0,N||(C=[Ve(n,"click",r[44]),Ve(s,"input",r[46]),Ve(s,"focus",r[47]),Ve(s,"blur",r[48]),Ve(s,"keydown",r[20]),Ve(s,"input",r[49]),Ve(l,"click",r[50]),Ve(t,"submit",Ju(r[19]))],N=!0)},p(O,X){(!I||X[0]&8)&&B(s,"placeholder",O[3]),(!I||X[0]&8)&&B(s,"aria-label",O[3]),X[0]&1&&s.value!==O[0]&&ta(s,O[0]),(!I||X[0]&512)&&B(l,"title",O[9]),(!I||X[0]&1)&&ge(l,"displayable",O[0]!==""),O[18]?b?X[0]&262144&&Zt(b,1):(b=sa(),b.c(),Zt(b,1),b.m(u,null)):b&&(Io(),Oe(b,1,1,()=>{b=null}),Co()),O[7]===!0?S?(S.p(O,X),X[0]&128&&Zt(S,1)):(S=aa(O),S.c(),Zt(S,1),S.m(e,g)):S&&(Io(),Oe(S,1,1,()=>{S=null}),Co()),T&&T.p&&(!I||X[1]&2048)&&ju(T,D,O,O[42],I?Wu(D,O[42],X,null):Ku(O[42]),null);let P=y;y=z(O),y===P?~y&&j[y].p(O,X):(d&&(Io(),Oe(j[P],1,1,()=>{j[P]=null}),Co()),~y?(d=j[y],d?d.p(O,X):(d=j[y]=F[y](O),d.c()),Zt(d,1),d.m(t,null)):d=null),(!I||X[0]&4&&_!==(_=$s(O[2])+" svelte-1h1zm6d"))&&B(t,"class",_),(!I||X[0]&69)&&ge(t,"can-collapse",O[6]&&O[0]==="")},i(O){I||(Zt(i.$$.fragment,O),Zt(c.$$.fragment,O),Zt(b),Zt(S),Zt(T,O),Zt(d),I=!0)},o(O){Oe(i.$$.fragment,O),Oe(c.$$.fragment,O),Oe(b),Oe(S),Oe(T,O),Oe(d),I=!1},d(O){O&&Re(t),si(i),r[45](null),si(c),b&&b.d(),S&&S.d(),T&&T.d(O),~y&&j[y].d(),N=!1,hr(C)}}}function us(r,t,e){const n=t[1],i=t[0],o=n-i;return r===n&&e?r:((r-i)%o+o)%o+i}function Il(r,t,e){let n,{$$slots:i={},$$scope:o}=t,{class:s=void 0}=t,{mapController:a=void 0}=t,{apiKey:u}=t,{debounceSearch:l=200}=t,{placeholder:c="Search"}=t,{errorMessage:f="Searching failed"}=t,{noResultsMessage:h="No results found"}=t,{proximity:g=void 0}=t,{bbox:p=void 0}=t,{trackProximity:y=!0}=t,{minLength:d=2}=t,{language:_=void 0}=t,{showResultsWhileTyping:I=!0}=t,{zoom:N=16}=t,{flyTo:C=!0}=t,{collapsed:b=!1}=t,{clearOnBlur:S=!1}=t,{enableReverse:D=!1}=t,{reverseButtonTitle:T="toggle reverse geocoding"}=t,{clearButtonTitle:F="clear"}=t,{filter:j=()=>!0}=t,{searchValue:z=""}=t,{reverseActive:O=D==="always"}=t,{showPlaceType:X=!1}=t,{showFullGeometry:P=!0}=t;function W(){Yt.focus()}function pt(){Yt.blur()}function At(w,Pe=!0){e(0,z=w),Pe?(e(14,Rt=-1),Vu()):(Ws(),setTimeout(()=>{Yt.focus(),Yt.select()}))}let Ft=!1,rt,Xt,it,Qn="",Yt,Rt=-1,be,ns=[],ni,Xs,Ys;const Dr=el();tl(()=>{a&&(a.setProximityChangeHandler(void 0),a.setMapClickHandler(void 0),a.indicateReverse(!1),a.setSelectedMarker(-1),a.setMarkers(void 0,void 0))});function Vu(w){if(Rt>-1&&rt)e(13,it=rt[Rt]),e(0,z=it.place_name.replace(/,.*/,"")),e(17,be=void 0),e(40,Xt=void 0),e(14,Rt=-1);else if(z){const Pe=w||!Uu();Hs(z).then(()=>{e(40,Xt=rt),e(13,it=void 0),Pe&&Uc()}).catch(fr=>e(17,be=fr))}}function Uu(){return/^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(z)}async function Hs(w,Pe=!1){e(17,be=void 0);const fr=Uu(),Tr=new URLSearchParams;_&&Tr.set("language",String(_)),fr||(p&&Tr.set("bbox",p.map(Jn=>Jn.toFixed(6)).join(",")),g&&Tr.set("proximity",g.map(Jn=>Jn.toFixed(6)).join(","))),Tr.set("key",u);const ri="https://api.maptiler.com/geocoding/"+encodeURIComponent(w)+".json?"+Tr.toString();if(ri===Qn){Pe?(e(12,rt=void 0),e(13,it=ns[0])):e(12,rt=ns);return}Qn=ri,ni==null||ni.abort(),e(18,ni=new AbortController);let Fi;try{Fi=await fetch(ri,{signal:ni.signal}).finally(()=>{e(18,ni=void 0)})}catch(Jn){if(Jn&&typeof Jn=="object"&&Jn.name==="AbortError")return;throw new Error}if(!Fi.ok)throw new Error;const Bi=await Fi.json();Dr("response",{url:ri,featureCollection:Bi}),Pe?(e(12,rt=void 0),e(13,it=Bi.features[0]),ns=[it]):(e(12,rt=Bi.features.filter(j)),ns=rt,fr&&Yt.focus())}function Uc(){var Pe,fr,Tr,ri,Fi,Bi,Jn,qu;if(!(Xt!=null&&Xt.length)||!C)return;const w=[180,90,-180,-90];for(const Mr of Xt)w[0]=Math.min(w[0],(fr=(Pe=Mr.bbox)==null?void 0:Pe[0])!=null?fr:Mr.center[0]),w[1]=Math.min(w[1],(ri=(Tr=Mr.bbox)==null?void 0:Tr[1])!=null?ri:Mr.center[1]),w[2]=Math.max(w[2],(Bi=(Fi=Mr.bbox)==null?void 0:Fi[2])!=null?Bi:Mr.center[0]),w[3]=Math.max(w[3],(qu=(Jn=Mr.bbox)==null?void 0:Jn[3])!=null?qu:Mr.center[1]);a&&Xt.length>0&&(it&&w[0]===w[2]&&w[1]===w[3]?a.flyTo(it.center,N):a.fitBounds(w,50))}function qc(w){e(1,O=D==="always"),At(us(w[0],[-180,180],!0).toFixed(6)+","+w[1].toFixed(6))}function Xc(w){if(!rt)return;let Pe=w.key==="ArrowDown"?1:w.key==="ArrowUp"?-1:0;Pe?(Rt===-1&&Pe===-1&&e(14,Rt=rt.length),e(14,Rt+=Pe),Rt>=rt.length&&e(14,Rt=-1),w.preventDefault()):["ArrowLeft","ArrowRight","Home","End"].includes(w.key)&&e(14,Rt=-1)}function Ws(w=!0){if(I&&z.length>d){Xs&&clearTimeout(Xs);const Pe=z;Xs=window.setTimeout(()=>{Hs(Pe).catch(fr=>e(17,be=fr))},w?l:0)}else e(12,rt=void 0),e(17,be=void 0)}const Yc=()=>Yt.focus();function Hc(w){is[w?"unshift":"push"](()=>{Yt=w,e(16,Yt)})}function Wc(){z=this.value,e(0,z),e(11,Ft),e(33,S)}const jc=()=>e(11,Ft=!0),Kc=()=>e(11,Ft=!1),Qc=()=>Ws(),Jc=()=>{e(0,z=""),Yt.focus()},Zc=()=>e(1,O=!O),$c=w=>e(14,Rt=w),tf=w=>{e(13,it=w),e(0,z=w.place_name.replace(/,.*/,"")),e(14,Rt=-1)},ef=()=>e(14,Rt=-1),nf=()=>{};return r.$$set=w=>{"class"in w&&e(2,s=w.class),"mapController"in w&&e(23,a=w.mapController),"apiKey"in w&&e(24,u=w.apiKey),"debounceSearch"in w&&e(25,l=w.debounceSearch),"placeholder"in w&&e(3,c=w.placeholder),"errorMessage"in w&&e(4,f=w.errorMessage),"noResultsMessage"in w&&e(5,h=w.noResultsMessage),"proximity"in w&&e(22,g=w.proximity),"bbox"in w&&e(26,p=w.bbox),"trackProximity"in w&&e(27,y=w.trackProximity),"minLength"in w&&e(28,d=w.minLength),"language"in w&&e(29,_=w.language),"showResultsWhileTyping"in w&&e(30,I=w.showResultsWhileTyping),"zoom"in w&&e(31,N=w.zoom),"flyTo"in w&&e(32,C=w.flyTo),"collapsed"in w&&e(6,b=w.collapsed),"clearOnBlur"in w&&e(33,S=w.clearOnBlur),"enableReverse"in w&&e(7,D=w.enableReverse),"reverseButtonTitle"in w&&e(8,T=w.reverseButtonTitle),"clearButtonTitle"in w&&e(9,F=w.clearButtonTitle),"filter"in w&&e(34,j=w.filter),"searchValue"in w&&e(0,z=w.searchValue),"reverseActive"in w&&e(1,O=w.reverseActive),"showPlaceType"in w&&e(10,X=w.showPlaceType),"showFullGeometry"in w&&e(35,P=w.showFullGeometry),"$$scope"in w&&e(42,o=w.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&142606336&&a&&a.setProximityChangeHandler(y?w=>{e(22,g=w)}:void 0),r.$$.dirty[0]&134217728&&(y||e(22,g=void 0)),r.$$.dirty[0]&2048|r.$$.dirty[1]&4&&setTimeout(()=>{e(15,Ys=Ft),S&&!Ft&&e(0,z="")}),r.$$.dirty[0]&4097&&(z||(e(13,it=void 0),e(12,rt=void 0),e(17,be=void 0),e(40,Xt=rt))),r.$$.dirty[0]&8192|r.$$.dirty[1]&16&&P&&it&&!it.address&&it.geometry.type==="Point"&&Hs(it.id,!0).catch(w=>e(17,be=w)),r.$$.dirty[0]&8396800|r.$$.dirty[1]&3&&a&&it&&C&&(!it.bbox||it.bbox[0]===it.bbox[2]&&it.bbox[1]===it.bbox[3]?a.flyTo(it.center,N):a.fitBounds(it.bbox,50),e(12,rt=void 0),e(40,Xt=void 0),e(14,Rt=-1)),r.$$.dirty[0]&4096|r.$$.dirty[1]&512&&Xt!==rt&&e(40,Xt=void 0),r.$$.dirty[0]&8396800|r.$$.dirty[1]&512&&a&&a.setMarkers(Xt,it),r.$$.dirty[0]&1&&e(14,Rt=-1),r.$$.dirty[0]&8404992&&(a==null||a.setSelectedMarker(Rt)),r.$$.dirty[0]&20480&&e(41,n=rt==null?void 0:rt[Rt]),r.$$.dirty[1]&1024&&Dr("select",n),r.$$.dirty[0]&8192&&Dr("pick",it),r.$$.dirty[0]&36864&&Dr("optionsVisibilityChange",Ys&&!!rt),r.$$.dirty[0]&4096&&Dr("featuresListed",rt),r.$$.dirty[1]&512&&Dr("featuresMarked",Xt),r.$$.dirty[0]&2&&Dr("reverseToggle",O),r.$$.dirty[0]&1&&Dr("queryChange",z),r.$$.dirty[0]&8388610&&a&&a.indicateReverse(O),r.$$.dirty[0]&8388610&&a&&a.setMapClickHandler(O?qc:void 0)},[z,O,s,c,f,h,b,D,T,F,X,Ft,rt,it,Rt,Ys,Yt,be,ni,Vu,Xc,Ws,g,a,u,l,p,y,d,_,I,N,C,S,j,P,W,pt,At,us,Xt,n,o,i,Yc,Hc,Wc,jc,Kc,Qc,Jc,Zc,$c,tf,ef,nf]}class Cl extends ui{constructor(t){super(),ai(this,t,Il,El,ii,{class:2,mapController:23,apiKey:24,debounceSearch:25,placeholder:3,errorMessage:4,noResultsMessage:5,proximity:22,bbox:26,trackProximity:27,minLength:28,language:29,showResultsWhileTyping:30,zoom:31,flyTo:32,collapsed:6,clearOnBlur:33,enableReverse:7,reverseButtonTitle:8,clearButtonTitle:9,filter:34,searchValue:0,reverseActive:1,showPlaceType:10,showFullGeometry:35,focus:36,blur:37,setQuery:38,wrapNum:39},null,[-1,-1,-1])}get focus(){return this.$$.ctx[36]}get blur(){return this.$$.ctx[37]}get setQuery(){return this.$$.ctx[38]}get wrapNum(){return us}}/**
|
|
2
2
|
* splaytree v3.1.1
|
|
3
3
|
* Fast Splay tree for Node and browser
|
|
4
4
|
*
|
|
@@ -18,5 +18,8 @@ var jt=(C,A,k)=>{if(!A.has(C))throw TypeError("Cannot "+k)};var re=(C,A,k)=>(jt(
|
|
|
18
18
|
|
|
19
19
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
20
20
|
and limitations under the License.
|
|
21
|
-
***************************************************************************** */function
|
|
22
|
-
`);var o=t+(e?" ":"\u2502 ");n.left&&Je(n.left,o,!1,r,i),n.right&&Je(n.right,o,!0,r,i)}}var $e=function(){function n(t){t===void 0&&(t=Lr),this._root=null,this._size=0,this._comparator=t}return n.prototype.insert=function(t,e){return this._size++,this._root=Ke(t,e,this._root,this._comparator)},n.prototype.add=function(t,e){var r=new le(t,e);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,o=se(t,this._root,i),l=i(t,o.key);return l===0?this._root=o:(l<0?(r.left=o.left,r.right=o,o.left=null):l>0&&(r.right=o.right,r.left=o,o.right=null),this._size++,this._root=r),this._root},n.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},n.prototype._remove=function(t,e,r){var i;if(e===null)return null;e=se(t,e,r);var o=r(t,e.key);return o===0?(e.left===null?i=e.right:(i=se(t,e.left,r),i.right=e.right),this._size--,i):e},n.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=se(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},n.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var i=r(t,e.key);if(i===0)return e;i<0?e=e.left:e=e.right}return null},n.prototype.find=function(t){return this._root&&(this._root=se(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},n.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var i=r(t,e.key);if(i===0)return!0;i<0?e=e.left:e=e.right}return!1},n.prototype.forEach=function(t,e){for(var r=this._root,i=[],o=!1;!o;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),t.call(e,r),r=r.right):o=!0;return this},n.prototype.range=function(t,e,r,i){for(var o=[],l=this._comparator,s=this._root,u;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),u=l(s.key,e),u>0)break;if(l(s.key,t)>=0&&r.call(i,s))return this;s=s.right}return this},n.prototype.keys=function(){var t=[];return this.forEach(function(e){var r=e.key;return t.push(r)}),t},n.prototype.values=function(){var t=[];return this.forEach(function(e){var r=e.data;return t.push(r)}),t},n.prototype.min=function(){return this._root?this.minNode(this._root).key:null},n.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},n.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},n.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},n.prototype.at=function(t){for(var e=this._root,r=!1,i=0,o=[];!r;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),i===t)return e;i++,e=e.right}else r=!0;return null},n.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?(r=e,e=e.left):e=e.right}return r},n.prototype.prev=function(t){var e=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?e=e.left:(r=e,e=e.right)}return r},n.prototype.clear=function(){return this._root=null,this._size=0,this},n.prototype.toList=function(){return Tr(this._root)},n.prototype.load=function(t,e,r){e===void 0&&(e=[]),r===void 0&&(r=!1);var i=t.length,o=this._comparator;if(r&&rt(t,e,0,i-1,o),this._root===null)this._root=et(t,e,0,i),this._size=i;else{var l=Cr(this.toList(),Or(t,e),o);i=this._size+i,this._root=tt({head:l},0,i)}return this},n.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(n.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),n.prototype.toString=function(t){t===void 0&&(t=function(r){return String(r.key)});var e=[];return Je(this._root,"",!0,function(r){return e.push(r)},t),e.join("")},n.prototype.update=function(t,e,r){var i=this._comparator,o=It(t,this._root,i),l=o.left,s=o.right;i(t,e)<0?s=Ke(e,r,s,i):l=Ke(e,r,l,i),this._root=Mr(l,s,i)},n.prototype.split=function(t){return It(t,this._root,this._comparator)},n.prototype[Symbol.iterator]=function(){var t;return Ir(this,function(e){switch(e.label){case 0:t=this.minNode(),e.label=1;case 1:return t?[4,t]:[3,3];case 2:return e.sent(),t=this.next(t),[3,1];case 3:return[2]}})},n}();function et(n,t,e,r){var i=r-e;if(i>0){var o=e+Math.floor(i/2),l=n[o],s=t[o],u=new le(l,s);return u.left=et(n,t,e,o),u.right=et(n,t,o+1,r),u}return null}function Or(n,t){for(var e=new le(null,null),r=e,i=0;i<n.length;i++)r=r.next=new le(n[i],t[i]);return r.next=null,e.next}function Tr(n){for(var t=n,e=[],r=!1,i=new le(null,null),o=i;!r;)t?(e.push(t),t=t.left):e.length>0?(t=o=o.next=e.pop(),t=t.right):r=!0;return o.next=null,i.next}function tt(n,t,e){var r=e-t;if(r>0){var i=t+Math.floor(r/2),o=tt(n,t,i),l=n.head;return l.left=o,n.head=n.head.next,l.right=tt(n,i+1,e),l}return null}function Cr(n,t,e){for(var r=new le(null,null),i=r,o=n,l=t;o!==null&&l!==null;)e(o.key,l.key)<0?(i.next=o,o=o.next):(i.next=l,l=l.next),i=i.next;return o!==null?i.next=o:l!==null&&(i.next=l),r.next}function rt(n,t,e,r,i){if(!(e>=r)){for(var o=n[e+r>>1],l=e-1,s=r+1;;){do l++;while(i(n[l],o)<0);do s--;while(i(n[s],o)>0);if(l>=s)break;var u=n[l];n[l]=n[s],n[s]=u,u=t[l],t[l]=t[s],t[s]=u}rt(n,t,e,s,i),rt(n,t,s+1,r,i)}}function H(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function Lt(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function U(n,t,e){return t&&Lt(n.prototype,t),e&&Lt(n,e),n}var Ce=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},nt=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,i=t.ur.x<e.ur.x?t.ur.x:e.ur.x,o=t.ll.y<e.ll.y?e.ll.y:t.ll.y,l=t.ur.y<e.ur.y?t.ur.y:e.ur.y;return{ll:{x:r,y:o},ur:{x:i,y:l}}},ue=Number.EPSILON;ue===void 0&&(ue=Math.pow(2,-52));var zr=ue*ue,it=function(t,e){if(-ue<t&&t<ue&&-ue<e&&e<ue)return 0;var r=t-e;return r*r<zr*t*e?0:t<e?-1:1},Ar=function(){function n(){H(this,n),this.reset()}return U(n,[{key:"reset",value:function(){this.xRounder=new Mt,this.yRounder=new Mt}},{key:"round",value:function(e,r){return{x:this.xRounder.round(e),y:this.yRounder.round(r)}}}]),n}(),Mt=function(){function n(){H(this,n),this.tree=new $e,this.round(0)}return U(n,[{key:"round",value:function(e){var r=this.tree.add(e),i=this.tree.prev(r);if(i!==null&&it(r.key,i.key)===0)return this.tree.remove(e),i.key;var o=this.tree.next(r);return o!==null&&it(r.key,o.key)===0?(this.tree.remove(e),o.key):e}}]),n}(),ze=new Ar,Ae=function(t,e){return t.x*e.y-t.y*e.x},Ot=function(t,e){return t.x*e.x+t.y*e.y},Tt=function(t,e,r){var i={x:e.x-t.x,y:e.y-t.y},o={x:r.x-t.x,y:r.y-t.y},l=Ae(i,o);return it(l,0)},Ue=function(t){return Math.sqrt(Ot(t,t))},Nr=function(t,e,r){var i={x:e.x-t.x,y:e.y-t.y},o={x:r.x-t.x,y:r.y-t.y};return Ae(o,i)/Ue(o)/Ue(i)},Br=function(t,e,r){var i={x:e.x-t.x,y:e.y-t.y},o={x:r.x-t.x,y:r.y-t.y};return Ot(o,i)/Ue(o)/Ue(i)},Ct=function(t,e,r){return e.y===0?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},zt=function(t,e,r){return e.x===0?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},Gr=function(t,e,r,i){if(e.x===0)return zt(r,i,t.x);if(i.x===0)return zt(t,e,r.x);if(e.y===0)return Ct(r,i,t.y);if(i.y===0)return Ct(t,e,r.y);var o=Ae(e,i);if(o==0)return null;var l={x:r.x-t.x,y:r.y-t.y},s=Ae(l,e)/o,u=Ae(l,i)/o,f=t.x+u*e.x,a=r.x+s*i.x,g=t.y+u*e.y,m=r.y+s*i.y,v=(f+a)/2,x=(g+m)/2;return{x:v,y:x}},ee=function(){U(n,null,[{key:"compare",value:function(e,r){var i=n.comparePoints(e.point,r.point);return i!==0?i:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:Ve.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(e,r){return e.x<r.x?-1:e.x>r.x?1:e.y<r.y?-1:e.y>r.y?1:0}}]);function n(t,e){H(this,n),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}return U(n,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var r=e.point.events,i=0,o=r.length;i<o;i++){var l=r[i];this.point.events.push(l),l.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var e=this.point.events.length,r=0;r<e;r++){var i=this.point.events[r];if(i.segment.consumedBy===void 0)for(var o=r+1;o<e;o++){var l=this.point.events[o];l.consumedBy===void 0&&i.otherSE.point.events===l.otherSE.point.events&&i.segment.consume(l.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var e=[],r=0,i=this.point.events.length;r<i;r++){var o=this.point.events[r];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&e.push(o)}return e}},{key:"getLeftmostComparator",value:function(e){var r=this,i=new Map,o=function(s){var u=s.otherSE;i.set(s,{sine:Nr(r.point,e.point,u.point),cosine:Br(r.point,e.point,u.point)})};return function(l,s){i.has(l)||o(l),i.has(s)||o(s);var u=i.get(l),f=u.sine,a=u.cosine,g=i.get(s),m=g.sine,v=g.cosine;return f>=0&&m>=0?a<v?1:a>v?-1:0:f<0&&m<0?a<v?-1:a>v?1:0:m<f?-1:m>f?1:0}}}]),n}(),qr=0,Ve=function(){U(n,null,[{key:"compare",value:function(e,r){var i=e.leftSE.point.x,o=r.leftSE.point.x,l=e.rightSE.point.x,s=r.rightSE.point.x;if(s<i)return 1;if(l<o)return-1;var u=e.leftSE.point.y,f=r.leftSE.point.y,a=e.rightSE.point.y,g=r.rightSE.point.y;if(i<o){if(f<u&&f<a)return 1;if(f>u&&f>a)return-1;var m=e.comparePoint(r.leftSE.point);if(m<0)return 1;if(m>0)return-1;var v=r.comparePoint(e.rightSE.point);return v!==0?v:-1}if(i>o){if(u<f&&u<g)return-1;if(u>f&&u>g)return 1;var x=r.comparePoint(e.leftSE.point);if(x!==0)return x;var p=e.comparePoint(r.rightSE.point);return p<0?1:p>0?-1:1}if(u<f)return-1;if(u>f)return 1;if(l<s){var h=r.comparePoint(e.rightSE.point);if(h!==0)return h}if(l>s){var d=e.comparePoint(r.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(l!==s){var w=a-u,L=l-i,_=g-f,S=s-o;if(w>L&&_<S)return 1;if(w<L&&_>S)return-1}return l>s?1:l<s||a<g?-1:a>g?1:e.id<r.id?-1:e.id>r.id?1:0}}]);function n(t,e,r,i){H(this,n),this.id=++qr,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=r,this.windings=i}return U(n,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e<r?e:r},ur:{x:this.rightSE.point.x,y:e>r?e:r}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var r=this.leftSE.point,i=this.rightSE.point,o=this.vector();if(r.x===i.x)return e.x===r.x?0:e.x<r.x?1:-1;var l=(e.y-r.y)/o.y,s=r.x+l*o.x;if(e.x===s)return 0;var u=(e.x-r.x)/o.x,f=r.y+u*o.y;return e.y===f?0:e.y<f?-1:1}},{key:"getIntersection",value:function(e){var r=this.bbox(),i=e.bbox(),o=nt(r,i);if(o===null)return null;var l=this.leftSE.point,s=this.rightSE.point,u=e.leftSE.point,f=e.rightSE.point,a=Ce(r,u)&&this.comparePoint(u)===0,g=Ce(i,l)&&e.comparePoint(l)===0,m=Ce(r,f)&&this.comparePoint(f)===0,v=Ce(i,s)&&e.comparePoint(s)===0;if(g&&a)return v&&!m?s:!v&&m?f:null;if(g)return m&&l.x===f.x&&l.y===f.y?null:l;if(a)return v&&s.x===u.x&&s.y===u.y?null:u;if(v&&m)return null;if(v)return s;if(m)return f;var x=Gr(l,this.vector(),u,e.vector());return x===null||!Ce(o,x)?null:ze.round(x.x,x.y)}},{key:"split",value:function(e){var r=[],i=e.events!==void 0,o=new ee(e,!0),l=new ee(e,!1),s=this.rightSE;this.replaceRightSE(l),r.push(l),r.push(o);var u=new n(o,s,this.rings.slice(),this.windings.slice());return ee.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),ee.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(o.checkForConsuming(),l.checkForConsuming()),r}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var r=0,i=this.windings.length;r<i;r++)this.windings[r]*=-1}},{key:"consume",value:function(e){for(var r=this,i=e;r.consumedBy;)r=r.consumedBy;for(;i.consumedBy;)i=i.consumedBy;var o=n.compare(r,i);if(o!==0){if(o>0){var l=r;r=i,i=l}if(r.prev===i){var s=r;r=i,i=s}for(var u=0,f=i.rings.length;u<f;u++){var a=i.rings[u],g=i.windings[u],m=r.rings.indexOf(a);m===-1?(r.rings.push(a),r.windings.push(g)):r.windings[m]+=g}i.rings=null,i.windings=null,i.consumedBy=r,i.leftSE.consumedBy=r.leftSE,i.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){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)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};for(var r=this._afterState.rings,i=this._afterState.windings,o=this._afterState.multiPolys,l=0,s=this.rings.length;l<s;l++){var u=this.rings[l],f=this.windings[l],a=r.indexOf(u);a===-1?(r.push(u),i.push(f)):i[a]+=f}for(var g=[],m=[],v=0,x=r.length;v<x;v++)if(i[v]!==0){var p=r[v],h=p.poly;if(m.indexOf(h)===-1)if(p.isExterior)g.push(h);else{m.indexOf(h)===-1&&m.push(h);var d=g.indexOf(p.poly);d!==-1&&g.splice(d,1)}}for(var w=0,L=g.length;w<L;w++){var _=g[w].multiPoly;o.indexOf(_)===-1&&o.push(_)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var e=this.beforeState().multiPolys,r=this.afterState().multiPolys;switch(K.type){case"union":{var i=e.length===0,o=r.length===0;this._isInResult=i!==o;break}case"intersection":{var l,s;e.length<r.length?(l=e.length,s=r.length):(l=r.length,s=e.length),this._isInResult=s===K.numMultiPolys&&l<s;break}case"xor":{var u=Math.abs(e.length-r.length);this._isInResult=u%2===1;break}case"difference":{var f=function(g){return g.length===1&&g[0].isSubject};this._isInResult=f(e)!==f(r);break}default:throw new Error("Unrecognized operation type found ".concat(K.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,i){var o,l,s,u=ee.comparePoints(e,r);if(u<0)o=e,l=r,s=1;else if(u>0)o=r,l=e,s=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var f=new ee(o,!0),a=new ee(l,!1);return new n(f,a,[i],[s])}}]),n}(),At=function(){function n(t,e,r){if(H(this,n),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=ze.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,l=1,s=t.length;l<s;l++){if(typeof t[l][0]!="number"||typeof t[l][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=ze.round(t[l][0],t[l][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Ve.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(Ve.fromRing(o,i,this))}return U(n,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,i=this.segments.length;r<i;r++){var o=this.segments[r];e.push(o.leftSE),e.push(o.rightSE)}return e}}]),n}(),Fr=function(){function n(t,e){if(H(this,n),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new At(t[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(var r=1,i=t.length;r<i;r++){var o=new At(t[r],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}return U(n,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),r=0,i=this.interiorRings.length;r<i;r++)for(var o=this.interiorRings[r].getSweepEvents(),l=0,s=o.length;l<s;l++)e.push(o[l]);return e}}]),n}(),Nt=function(){function n(t,e){if(H(this,n),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var r=0,i=t.length;r<i;r++){var o=new Fr(t[r],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}return U(n,[{key:"getSweepEvents",value:function(){for(var e=[],r=0,i=this.polys.length;r<i;r++)for(var o=this.polys[r].getSweepEvents(),l=0,s=o.length;l<s;l++)e.push(o[l]);return e}}]),n}(),Qr=function(){U(n,null,[{key:"factory",value:function(e){for(var r=[],i=0,o=e.length;i<o;i++){var l=e[i];if(!(!l.isInResult()||l.ringOut)){for(var s=null,u=l.leftSE,f=l.rightSE,a=[u],g=u.point,m=[];s=u,u=f,a.push(u),u.point!==g;)for(;;){var v=u.getAvailableLinkedEvents();if(v.length===0){var x=a[0].point,p=a[a.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(x.x,",")+" ".concat(x.y,"]. Last matching segment found ends at")+" [".concat(p.x,", ").concat(p.y,"]."))}if(v.length===1){f=v[0].otherSE;break}for(var h=null,d=0,w=m.length;d<w;d++)if(m[d].point===u.point){h=d;break}if(h!==null){var L=m.splice(h)[0],_=a.splice(L.index);_.unshift(_[0].otherSE),r.push(new n(_.reverse()));continue}m.push({index:a.length,point:u.point});var S=u.getLeftmostComparator(s);f=v.sort(S)[0].otherSE;break}r.push(new n(a))}}return r}}]);function n(t){H(this,n),this.events=t;for(var e=0,r=t.length;e<r;e++)t[e].segment.ringOut=this;this.poly=null}return U(n,[{key:"getGeom",value:function(){for(var e=this.events[0].point,r=[e],i=1,o=this.events.length-1;i<o;i++){var l=this.events[i].point,s=this.events[i+1].point;Tt(l,e,s)!==0&&(r.push(l),e=l)}if(r.length===1)return null;var u=r[0],f=r[1];Tt(u,e,f)===0&&r.shift(),r.push(r[0]);for(var a=this.isExteriorRing()?1:-1,g=this.isExteriorRing()?0:r.length-1,m=this.isExteriorRing()?r.length:-1,v=[],x=g;x!=m;x+=a)v.push([r[x].x,r[x].y]);return v}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var e=this.events[0],r=1,i=this.events.length;r<i;r++){var o=this.events[r];ee.compare(e,o)>0&&(e=o)}for(var l=e.segment.prevInResult(),s=l?l.prevInResult():null;;){if(!l)return null;if(!s)return l.ringOut;if(s.ringOut!==l.ringOut)return s.ringOut.enclosingRing()!==l.ringOut?l.ringOut:l.ringOut.enclosingRing();l=s.prevInResult(),s=l?l.prevInResult():null}}}]),n}(),Bt=function(){function n(t){H(this,n),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return U(n,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var r=0,i=this.interiorRings.length;r<i;r++){var o=this.interiorRings[r].getGeom();o!==null&&e.push(o)}return e}}]),n}(),Dr=function(){function n(t){H(this,n),this.rings=t,this.polys=this._composePolys(t)}return U(n,[{key:"getGeom",value:function(){for(var e=[],r=0,i=this.polys.length;r<i;r++){var o=this.polys[r].getGeom();o!==null&&e.push(o)}return e}},{key:"_composePolys",value:function(e){for(var r=[],i=0,o=e.length;i<o;i++){var l=e[i];if(!l.poly)if(l.isExteriorRing())r.push(new Bt(l));else{var s=l.enclosingRing();s.poly||r.push(new Bt(s)),s.poly.addInterior(l)}}return r}}]),n}(),Ur=function(){function n(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ve.compare;H(this,n),this.queue=t,this.tree=new $e(e),this.segments=[]}return U(n,[{key:"process",value:function(e){var r=e.segment,i=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(r),i;var o=e.isLeft?this.tree.insert(r):this.tree.find(r);if(!o)throw new Error("Unable to find segment #".concat(r.id," ")+"[".concat(r.leftSE.point.x,", ").concat(r.leftSE.point.y,"] -> ")+"[".concat(r.rightSE.point.x,", ").concat(r.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var l=o,s=o,u=void 0,f=void 0;u===void 0;)l=this.tree.prev(l),l===null?u=null:l.key.consumedBy===void 0&&(u=l.key);for(;f===void 0;)s=this.tree.next(s),s===null?f=null:s.key.consumedBy===void 0&&(f=s.key);if(e.isLeft){var a=null;if(u){var g=u.getIntersection(r);if(g!==null&&(r.isAnEndpoint(g)||(a=g),!u.isAnEndpoint(g)))for(var m=this._splitSafely(u,g),v=0,x=m.length;v<x;v++)i.push(m[v])}var p=null;if(f){var h=f.getIntersection(r);if(h!==null&&(r.isAnEndpoint(h)||(p=h),!f.isAnEndpoint(h)))for(var d=this._splitSafely(f,h),w=0,L=d.length;w<L;w++)i.push(d[w])}if(a!==null||p!==null){var _=null;if(a===null)_=p;else if(p===null)_=a;else{var S=ee.comparePoints(a,p);_=S<=0?a:p}this.queue.remove(r.rightSE),i.push(r.rightSE);for(var E=r.split(_),P=0,R=E.length;P<R;P++)i.push(E[P])}i.length>0?(this.tree.remove(r),i.push(e)):(this.segments.push(r),r.prev=u)}else{if(u&&f){var F=u.getIntersection(f);if(F!==null){if(!u.isAnEndpoint(F))for(var G=this._splitSafely(u,F),M=0,b=G.length;M<b;M++)i.push(G[M]);if(!f.isAnEndpoint(F))for(var O=this._splitSafely(f,F),D=0,fe=O.length;D<fe;D++)i.push(O[D])}}this.tree.remove(r)}return i}},{key:"_splitSafely",value:function(e,r){this.tree.remove(e);var i=e.rightSE;this.queue.remove(i);var o=e.split(r);return o.push(i),e.consumedBy===void 0&&this.tree.insert(e),o}}]),n}(),Gt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Vr=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Yr=function(){function n(){H(this,n)}return U(n,[{key:"run",value:function(e,r,i){K.type=e,ze.reset();for(var o=[new Nt(r,!0)],l=0,s=i.length;l<s;l++)o.push(new Nt(i[l],!1));if(K.numMultiPolys=o.length,K.type==="difference")for(var u=o[0],f=1;f<o.length;)nt(o[f].bbox,u.bbox)!==null?f++:o.splice(f,1);if(K.type==="intersection"){for(var a=0,g=o.length;a<g;a++)for(var m=o[a],v=a+1,x=o.length;v<x;v++)if(nt(m.bbox,o[v].bbox)===null)return[]}for(var p=new $e(ee.compare),h=0,d=o.length;h<d;h++)for(var w=o[h].getSweepEvents(),L=0,_=w.length;L<_;L++)if(p.insert(w[L]),p.size>Gt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var S=new Ur(p),E=p.size,P=p.pop();P;){var R=P.key;if(p.size===E){var F=R.segment;throw new Error("Unable to pop() ".concat(R.isLeft?"left":"right"," SweepEvent ")+"[".concat(R.point.x,", ").concat(R.point.y,"] from segment #").concat(F.id," ")+"[".concat(F.leftSE.point.x,", ").concat(F.leftSE.point.y,"] -> ")+"[".concat(F.rightSE.point.x,", ").concat(F.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>Gt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(S.segments.length>Vr)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var G=S.process(R),M=0,b=G.length;M<b;M++){var O=G[M];O.consumedBy===void 0&&p.insert(O)}E=p.size,P=p.pop()}ze.reset();var D=Qr.factory(S.segments),fe=new Dr(D);return fe.getGeom()}}]),n}(),K=new Yr,Zr=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return K.run("union",t,r)},Xr=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return K.run("intersection",t,r)},Wr=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return K.run("xor",t,r)},jr=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return K.run("difference",t,r)},Ne={union:Zr,intersection:Xr,xor:Wr,difference:jr};function qt(n,t){var e=Kr(t),r=null;return n.type==="FeatureCollection"?r=Hr(n):r=Ft(Ne.union(n.geometry.coordinates)),r.geometry.coordinates.forEach(function(i){e.geometry.coordinates.push(i[0])}),e}function Hr(n){var t=n.features.length===2?Ne.union(n.features[0].geometry.coordinates,n.features[1].geometry.coordinates):Ne.union.apply(Ne,n.features.map(function(e){return e.geometry.coordinates}));return Ft(t)}function Ft(n){return Rt(n)}function Kr(n){var t=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],e=n&&n.geometry.coordinates||t;return Pt(e)}function Qt(n){return n.type==="Feature"?n.geometry:n}function Jr(n,t,e){e===void 0&&(e={});var r=Qt(n),i=Qt(t),o=Ne.union(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?Pt(o[0],e.properties):Rt(o,e.properties)}let Dt={type:"FeatureCollection",features:[]};function Ut(n,t,e=!0,r=!0,i={},o={},l={fill:{layout:{},paint:{"fill-color":"#000","fill-opacity":.1}},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"}}}){let s,u,f,a=[],g;function m(){n.addSource("full-geom",{type:"geojson",data:Dt}),n.addLayer({...l.fill,id:"full-geom-fill",type:"fill",source:"full-geom",filter:["==",["geometry-type"],"Polygon"]}),n.addLayer({...l.line,id:"full-geom-line",type:"line",source:"full-geom"})}n.loaded()?m():n.once("load",()=>{m()});const v=h=>{u==null||u([h.lngLat.lng,h.lngLat.lat])},x=()=>{let h;const d=n.getZoom()>9?[(h=n.getCenter().wrap()).lng,h.lat]:void 0;f!==d&&(f=d,s==null||s(d))};return{setProximityChangeHandler(h){h?(s=h,n.on("moveend",x),x()):(n.off("moveend",x),s==null||s(void 0),s=void 0)},setMapClickHandler(h){u=h,u?n.on("click",v):n.off("click",v)},flyTo(h,d){n.flyTo({center:h,zoom:d,...i})},fitBounds(h,d){n.fitBounds([[h[0],h[1]],[h[2],h[3]]],{padding:d,...o})},indicateReverse(h){n.getCanvas().style.cursor=h?"crosshair":""},setMarkers(h,d){function w(_){var S;(S=n.getSource("full-geom"))==null||S.setData(_)}for(const _ of a)_.remove();if(a.length=0,w(Dt),!t)return;const L=()=>{const _=document.createElement("div");return new _t({props:{displayIn:"maplibre"},target:_}),new t.Marker({element:_})};if(d){let _=!1;if(d.geometry.type==="GeometryCollection"){const S=d.geometry.geometries.filter(E=>E.type==="Polygon"||E.type==="MultiPolygon");if(S.length>0){let E=S.pop();for(const P of S)E=Jr(E,P);w(qt({...d,geometry:E})),_=!0}else{const E=d.geometry.geometries.filter(P=>P.type==="LineString"||P.type==="MultiLineString");E.length>0&&(w({...d,geometry:{type:"GeometryCollection",geometries:E}}),_=!0)}}if(!_){if(d.geometry.type==="Polygon"||d.geometry.type==="MultiPolygon")w(qt(d));else if(d.geometry.type==="LineString"||d.geometry.type==="MultiLineString"){w(d);return}}a.push((typeof e=="object"?new t.Marker(e):L()).setLngLat(d.center).addTo(n))}for(const _ of h!=null?h:[])_!==d&&a.push((typeof r=="object"?new t.Marker(r):L()).setLngLat(_.center).addTo(n))},setSelectedMarker(h){g&&g.getElement().classList.toggle("marker-selected",!1),g=h>-1?a[h]:void 0,g==null||g.getElement().classList.toggle("marker-selected",!0)}}}class $r extends A.Evented{constructor(e){super();ft(this,J,void 0);ft(this,de,void 0);Ze(this,de,e)}onAdd(e){const r=document.createElement("div");r.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl";const{maplibregl:i,marker:o,showResultMarkers:l,flyTo:s,fullGeometryStyle:u,...f}=re(this,de),a=typeof s=="boolean"?{}:s,g=Ut(e,i,o,l,a,a,u);Ze(this,J,new Rr({target:r,props:{mapController:g,flyTo:s===void 0?!0:!!s,...f}}));for(const m of["select","pick","featuresListed","featuresMarked","response","optionsVisibilityChange","reverseToggle","queryChange"])re(this,J).$on(m,v=>this.fire(m.toLowerCase(),v.detail));return r}setOptions(e){var f;Ze(this,de,e);const{maplibregl:r,marker:i,showResultMarkers:o,flyTo:l,fullGeometryStyle:s,...u}=re(this,de);(f=re(this,J))==null||f.$set(u)}setQuery(e,r=!0){var i;(i=re(this,J))==null||i.setQuery(e,r)}setReverseMode(e){var r;(r=re(this,J))==null||r.$set({reverseActive:e})}focus(){var e;(e=re(this,J))==null||e.focus()}blur(){var e;(e=re(this,J))==null||e.blur()}onRemove(){var e;(e=re(this,J))==null||e.$destroy()}}J=new WeakMap,de=new WeakMap,C.GeocodingControl=$r,C.createMaplibreglMapController=Ut,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
21
|
+
***************************************************************************** */function Nl(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,i=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(r,e)}catch(c){l=[6,c],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}var pr=function(){function r(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return r}();function xl(r,t){return r>t?1:r<t?-1:0}function dr(r,t,e){for(var n=new pr(null,null),i=n,o=n;;){var s=e(r,t.key);if(s<0){if(t.left===null)break;if(e(r,t.left.key)<0){var a=t.left;if(t.left=a.right,a.right=t,t=a,t.left===null)break}o.left=t,o=t,t=t.left}else if(s>0){if(t.right===null)break;if(e(r,t.right.key)>0){var a=t.right;if(t.right=a.left,a.left=t,t=a,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function ls(r,t,e,n){var i=new pr(r,t);if(e===null)return i.left=i.right=null,i;e=dr(r,e,n);var o=n(r,e.key);return o<0?(i.left=e.left,i.right=e,e.left=null):o>=0&&(i.right=e.right,i.left=e,e.right=null),i}function ca(r,t,e){var n=null,i=null;if(t){t=dr(r,t,e);var o=e(t.key,r);o===0?(n=t.left,i=t.right):o<0?(i=t.right,t.right=null,n=t):(n=t.left,t.left=null,i=t)}return{left:n,right:i}}function Sl(r,t,e){return t===null?r:(r===null||(t=dr(r.key,t,e),t.left=r),t)}function cs(r,t,e,n,i){if(r){n(""+t+(e?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+i(r)+`
|
|
22
|
+
`);var o=t+(e?" ":"\u2502 ");r.left&&cs(r.left,o,!1,n,i),r.right&&cs(r.right,o,!0,n,i)}}var fs=function(){function r(t){t===void 0&&(t=xl),this._root=null,this._size=0,this._comparator=t}return r.prototype.insert=function(t,e){return this._size++,this._root=ls(t,e,this._root,this._comparator)},r.prototype.add=function(t,e){var n=new pr(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=dr(t,this._root,i),s=i(t,o.key);return s===0?this._root=o:(s<0?(n.left=o.left,n.right=o,o.left=null):s>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},r.prototype._remove=function(t,e,n){var i;if(e===null)return null;e=dr(t,e,n);var o=n(t,e.key);return o===0?(e.left===null?i=e.right:(i=dr(t,e.left,n),i.right=e.right),this._size--,i):e},r.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=dr(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},r.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return e;i<0?e=e.left:e=e.right}return null},r.prototype.find=function(t){return this._root&&(this._root=dr(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},r.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return!0;i<0?e=e.left:e=e.right}return!1},r.prototype.forEach=function(t,e){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(e,n),n=n.right):o=!0;return this},r.prototype.range=function(t,e,n,i){for(var o=[],s=this._comparator,a=this._root,u;o.length!==0||a;)if(a)o.push(a),a=a.left;else{if(a=o.pop(),u=s(a.key,e),u>0)break;if(s(a.key,t)>=0&&n.call(i,a))return this;a=a.right}return this},r.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},r.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.at=function(t){for(var e=this._root,n=!1,i=0,o=[];!n;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?(n=e,e=e.left):e=e.right}return n},r.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?e=e.left:(n=e,e=e.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return Ll(this._root)},r.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&ps(t,e,0,i-1,o),this._root===null)this._root=hs(t,e,0,i),this._size=i;else{var s=bl(this.toList(),wl(t,e),o);i=this._size+i,this._root=gs({head:s},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return cs(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},r.prototype.update=function(t,e,n){var i=this._comparator,o=ca(t,this._root,i),s=o.left,a=o.right;i(t,e)<0?a=ls(e,n,a,i):s=ls(e,n,s,i),this._root=Sl(s,a,i)},r.prototype.split=function(t){return ca(t,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var t;return Nl(this,function(e){switch(e.label){case 0:t=this.minNode(),e.label=1;case 1:return t?[4,t]:[3,3];case 2:return e.sent(),t=this.next(t),[3,1];case 3:return[2]}})},r}();function hs(r,t,e,n){var i=n-e;if(i>0){var o=e+Math.floor(i/2),s=r[o],a=t[o],u=new pr(s,a);return u.left=hs(r,t,e,o),u.right=hs(r,t,o+1,n),u}return null}function wl(r,t){for(var e=new pr(null,null),n=e,i=0;i<r.length;i++)n=n.next=new pr(r[i],t[i]);return n.next=null,e.next}function Ll(r){for(var t=r,e=[],n=!1,i=new pr(null,null),o=i;!n;)t?(e.push(t),t=t.left):e.length>0?(t=o=o.next=e.pop(),t=t.right):n=!0;return o.next=null,i.next}function gs(r,t,e){var n=e-t;if(n>0){var i=t+Math.floor(n/2),o=gs(r,t,i),s=r.head;return s.left=o,r.head=r.head.next,s.right=gs(r,i+1,e),s}return null}function bl(r,t,e){for(var n=new pr(null,null),i=n,o=r,s=t;o!==null&&s!==null;)e(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;return o!==null?i.next=o:s!==null&&(i.next=s),n.next}function ps(r,t,e,n,i){if(!(e>=n)){for(var o=r[e+n>>1],s=e-1,a=n+1;;){do s++;while(i(r[s],o)<0);do a--;while(i(r[a],o)>0);if(s>=a)break;var u=r[s];r[s]=r[a],r[a]=u,u=t[s],t[s]=t[a],t[a]=u}ps(r,t,e,a,i),ps(r,t,a+1,n,i)}}function $e(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function fa(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function _e(r,t,e){return t&&fa(r.prototype,t),e&&fa(r,e),r}var qi=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},ds=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,i=t.ur.x<e.ur.x?t.ur.x:e.ur.x,o=t.ll.y<e.ll.y?e.ll.y:t.ll.y,s=t.ur.y<e.ur.y?t.ur.y:e.ur.y;return{ll:{x:n,y:o},ur:{x:i,y:s}}},vr=Number.EPSILON;vr===void 0&&(vr=Math.pow(2,-52));var Pl=vr*vr,vs=function(t,e){if(-vr<t&&t<vr&&-vr<e&&e<vr)return 0;var n=t-e;return n*n<Pl*t*e?0:t<e?-1:1},Rl=function(){function r(){$e(this,r),this.reset()}return _e(r,[{key:"reset",value:function(){this.xRounder=new ha,this.yRounder=new ha}},{key:"round",value:function(e,n){return{x:this.xRounder.round(e),y:this.yRounder.round(n)}}}]),r}(),ha=function(){function r(){$e(this,r),this.tree=new fs,this.round(0)}return _e(r,[{key:"round",value:function(e){var n=this.tree.add(e),i=this.tree.prev(n);if(i!==null&&vs(n.key,i.key)===0)return this.tree.remove(e),i.key;var o=this.tree.next(n);return o!==null&&vs(n.key,o.key)===0?(this.tree.remove(e),o.key):e}}]),r}(),Xi=new Rl,Yi=function(t,e){return t.x*e.y-t.y*e.x},ga=function(t,e){return t.x*e.x+t.y*e.y},pa=function(t,e,n){var i={x:e.x-t.x,y:e.y-t.y},o={x:n.x-t.x,y:n.y-t.y},s=Yi(i,o);return vs(s,0)},No=function(t){return Math.sqrt(ga(t,t))},Ol=function(t,e,n){var i={x:e.x-t.x,y:e.y-t.y},o={x:n.x-t.x,y:n.y-t.y};return Yi(o,i)/No(o)/No(i)},Dl=function(t,e,n){var i={x:e.x-t.x,y:e.y-t.y},o={x:n.x-t.x,y:n.y-t.y};return ga(o,i)/No(o)/No(i)},da=function(t,e,n){return e.y===0?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},va=function(t,e,n){return e.x===0?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},Tl=function(t,e,n,i){if(e.x===0)return va(n,i,t.x);if(i.x===0)return va(t,e,n.x);if(e.y===0)return da(n,i,t.y);if(i.y===0)return da(t,e,n.y);var o=Yi(e,i);if(o==0)return null;var s={x:n.x-t.x,y:n.y-t.y},a=Yi(s,e)/o,u=Yi(s,i)/o,l=t.x+u*e.x,c=n.x+a*i.x,f=t.y+u*e.y,h=n.y+a*i.y,g=(l+c)/2,p=(f+h)/2;return{x:g,y:p}},An=function(){_e(r,null,[{key:"compare",value:function(e,n){var i=r.comparePoints(e.point,n.point);return i!==0?i:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:xo.compare(e.segment,n.segment))}},{key:"comparePoints",value:function(e,n){return e.x<n.x?-1:e.x>n.x?1:e.y<n.y?-1:e.y>n.y?1:0}}]);function r(t,e){$e(this,r),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}return _e(r,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,i=0,o=n.length;i<o;i++){var s=n[i];this.point.events.push(s),s.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var e=this.point.events.length,n=0;n<e;n++){var i=this.point.events[n];if(i.segment.consumedBy===void 0)for(var o=n+1;o<e;o++){var s=this.point.events[o];s.consumedBy===void 0&&i.otherSE.point.events===s.otherSE.point.events&&i.segment.consume(s.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var e=[],n=0,i=this.point.events.length;n<i;n++){var o=this.point.events[n];o!==this&&!o.segment.ringOut&&o.segment.isInResult()&&e.push(o)}return e}},{key:"getLeftmostComparator",value:function(e){var n=this,i=new Map,o=function(a){var u=a.otherSE;i.set(a,{sine:Ol(n.point,e.point,u.point),cosine:Dl(n.point,e.point,u.point)})};return function(s,a){i.has(s)||o(s),i.has(a)||o(a);var u=i.get(s),l=u.sine,c=u.cosine,f=i.get(a),h=f.sine,g=f.cosine;return l>=0&&h>=0?c<g?1:c>g?-1:0:l<0&&h<0?c<g?-1:c>g?1:0:h<l?-1:h>l?1:0}}}]),r}(),Ml=0,xo=function(){_e(r,null,[{key:"compare",value:function(e,n){var i=e.leftSE.point.x,o=n.leftSE.point.x,s=e.rightSE.point.x,a=n.rightSE.point.x;if(a<i)return 1;if(s<o)return-1;var u=e.leftSE.point.y,l=n.leftSE.point.y,c=e.rightSE.point.y,f=n.rightSE.point.y;if(i<o){if(l<u&&l<c)return 1;if(l>u&&l>c)return-1;var h=e.comparePoint(n.leftSE.point);if(h<0)return 1;if(h>0)return-1;var g=n.comparePoint(e.rightSE.point);return g!==0?g:-1}if(i>o){if(u<l&&u<f)return-1;if(u>l&&u>f)return 1;var p=n.comparePoint(e.leftSE.point);if(p!==0)return p;var y=e.comparePoint(n.rightSE.point);return y<0?1:y>0?-1:1}if(u<l)return-1;if(u>l)return 1;if(s<a){var d=n.comparePoint(e.rightSE.point);if(d!==0)return d}if(s>a){var _=e.comparePoint(n.rightSE.point);if(_<0)return 1;if(_>0)return-1}if(s!==a){var I=c-u,N=s-i,C=f-l,b=a-o;if(I>N&&C<b)return 1;if(I<N&&C>b)return-1}return s>a?1:s<a||c<f?-1:c>f?1:e.id<n.id?-1:e.id>n.id?1:0}}]);function r(t,e,n,i){$e(this,r),this.id=++Ml,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=i}return _e(r,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e<n?e:n},ur:{x:this.rightSE.point.x,y:e>n?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,i=this.rightSE.point,o=this.vector();if(n.x===i.x)return e.x===n.x?0:e.x<n.x?1:-1;var s=(e.y-n.y)/o.y,a=n.x+s*o.x;if(e.x===a)return 0;var u=(e.x-n.x)/o.x,l=n.y+u*o.y;return e.y===l?0:e.y<l?-1:1}},{key:"getIntersection",value:function(e){var n=this.bbox(),i=e.bbox(),o=ds(n,i);if(o===null)return null;var s=this.leftSE.point,a=this.rightSE.point,u=e.leftSE.point,l=e.rightSE.point,c=qi(n,u)&&this.comparePoint(u)===0,f=qi(i,s)&&e.comparePoint(s)===0,h=qi(n,l)&&this.comparePoint(l)===0,g=qi(i,a)&&e.comparePoint(a)===0;if(f&&c)return g&&!h?a:!g&&h?l:null;if(f)return h&&s.x===l.x&&s.y===l.y?null:s;if(c)return g&&a.x===u.x&&a.y===u.y?null:u;if(g&&h)return null;if(g)return a;if(h)return l;var p=Tl(s,this.vector(),u,e.vector());return p===null||!qi(o,p)?null:Xi.round(p.x,p.y)}},{key:"split",value:function(e){var n=[],i=e.events!==void 0,o=new An(e,!0),s=new An(e,!1),a=this.rightSE;this.replaceRightSE(s),n.push(s),n.push(o);var u=new r(o,a,this.rings.slice(),this.windings.slice());return An.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),An.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),i&&(o.checkForConsuming(),s.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,i=this.windings.length;n<i;n++)this.windings[n]*=-1}},{key:"consume",value:function(e){for(var n=this,i=e;n.consumedBy;)n=n.consumedBy;for(;i.consumedBy;)i=i.consumedBy;var o=r.compare(n,i);if(o!==0){if(o>0){var s=n;n=i,i=s}if(n.prev===i){var a=n;n=i,i=a}for(var u=0,l=i.rings.length;u<l;u++){var c=i.rings[u],f=i.windings[u],h=n.rings.indexOf(c);h===-1?(n.rings.push(c),n.windings.push(f)):n.windings[h]+=f}i.rings=null,i.windings=null,i.consumedBy=n,i.leftSE.consumedBy=n.leftSE,i.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){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)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};for(var n=this._afterState.rings,i=this._afterState.windings,o=this._afterState.multiPolys,s=0,a=this.rings.length;s<a;s++){var u=this.rings[s],l=this.windings[s],c=n.indexOf(u);c===-1?(n.push(u),i.push(l)):i[c]+=l}for(var f=[],h=[],g=0,p=n.length;g<p;g++)if(i[g]!==0){var y=n[g],d=y.poly;if(h.indexOf(d)===-1)if(y.isExterior)f.push(d);else{h.indexOf(d)===-1&&h.push(d);var _=f.indexOf(y.poly);_!==-1&&f.splice(_,1)}}for(var I=0,N=f.length;I<N;I++){var C=f[I].multiPoly;o.indexOf(C)===-1&&o.push(C)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var e=this.beforeState().multiPolys,n=this.afterState().multiPolys;switch(_n.type){case"union":{var i=e.length===0,o=n.length===0;this._isInResult=i!==o;break}case"intersection":{var s,a;e.length<n.length?(s=e.length,a=n.length):(s=n.length,a=e.length),this._isInResult=a===_n.numMultiPolys&&s<a;break}case"xor":{var u=Math.abs(e.length-n.length);this._isInResult=u%2===1;break}case"difference":{var l=function(f){return f.length===1&&f[0].isSubject};this._isInResult=l(e)!==l(n);break}default:throw new Error("Unrecognized operation type found ".concat(_n.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,n,i){var o,s,a,u=An.comparePoints(e,n);if(u<0)o=e,s=n,a=1;else if(u>0)o=n,s=e,a=-1;else throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));var l=new An(o,!0),c=new An(s,!1);return new r(l,c,[i],[a])}}]),r}(),ya=function(){function r(t,e,n){if($e(this,r),!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=Xi.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=t.length;s<a;s++){if(typeof t[s][0]!="number"||typeof t[s][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=Xi.round(t[s][0],t[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(xo.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(xo.fromRing(o,i,this))}return _e(r,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,i=this.segments.length;n<i;n++){var o=this.segments[n];e.push(o.leftSE),e.push(o.rightSE)}return e}}]),r}(),Al=function(){function r(t,e){if($e(this,r),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ya(t[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(var n=1,i=t.length;n<i;n++){var o=new ya(t[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}return _e(r,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,i=this.interiorRings.length;n<i;n++)for(var o=this.interiorRings[n].getSweepEvents(),s=0,a=o.length;s<a;s++)e.push(o[s]);return e}}]),r}(),ma=function(){function r(t,e){if($e(this,r),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=t.length;n<i;n++){var o=new Al(t[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}return _e(r,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,i=this.polys.length;n<i;n++)for(var o=this.polys[n].getSweepEvents(),s=0,a=o.length;s<a;s++)e.push(o[s]);return e}}]),r}(),Fl=function(){_e(r,null,[{key:"factory",value:function(e){for(var n=[],i=0,o=e.length;i<o;i++){var s=e[i];if(!(!s.isInResult()||s.ringOut)){for(var a=null,u=s.leftSE,l=s.rightSE,c=[u],f=u.point,h=[];a=u,u=l,c.push(u),u.point!==f;)for(;;){var g=u.getAvailableLinkedEvents();if(g.length===0){var p=c[0].point,y=c[c.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(y.x,", ").concat(y.y,"]."))}if(g.length===1){l=g[0].otherSE;break}for(var d=null,_=0,I=h.length;_<I;_++)if(h[_].point===u.point){d=_;break}if(d!==null){var N=h.splice(d)[0],C=c.splice(N.index);C.unshift(C[0].otherSE),n.push(new r(C.reverse()));continue}h.push({index:c.length,point:u.point});var b=u.getLeftmostComparator(a);l=g.sort(b)[0].otherSE;break}n.push(new r(c))}}return n}}]);function r(t){$e(this,r),this.events=t;for(var e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}return _e(r,[{key:"getGeom",value:function(){for(var e=this.events[0].point,n=[e],i=1,o=this.events.length-1;i<o;i++){var s=this.events[i].point,a=this.events[i+1].point;pa(s,e,a)!==0&&(n.push(s),e=s)}if(n.length===1)return null;var u=n[0],l=n[1];pa(u,e,l)===0&&n.shift(),n.push(n[0]);for(var c=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:n.length-1,h=this.isExteriorRing()?n.length:-1,g=[],p=f;p!=h;p+=c)g.push([n[p].x,n[p].y]);return g}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var e=this.events[0],n=1,i=this.events.length;n<i;n++){var o=this.events[n];An.compare(e,o)>0&&(e=o)}for(var s=e.segment.prevInResult(),a=s?s.prevInResult():null;;){if(!s)return null;if(!a)return s.ringOut;if(a.ringOut!==s.ringOut)return a.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=a.prevInResult(),a=s?s.prevInResult():null}}}]),r}(),_a=function(){function r(t){$e(this,r),this.exteriorRing=t,t.poly=this,this.interiorRings=[]}return _e(r,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,i=this.interiorRings.length;n<i;n++){var o=this.interiorRings[n].getGeom();o!==null&&e.push(o)}return e}}]),r}(),Bl=function(){function r(t){$e(this,r),this.rings=t,this.polys=this._composePolys(t)}return _e(r,[{key:"getGeom",value:function(){for(var e=[],n=0,i=this.polys.length;n<i;n++){var o=this.polys[n].getGeom();o!==null&&e.push(o)}return e}},{key:"_composePolys",value:function(e){for(var n=[],i=0,o=e.length;i<o;i++){var s=e[i];if(!s.poly)if(s.isExteriorRing())n.push(new _a(s));else{var a=s.enclosingRing();a.poly||n.push(new _a(a)),a.poly.addInterior(s)}}return n}}]),r}(),Gl=function(){function r(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xo.compare;$e(this,r),this.queue=t,this.tree=new fs(e),this.segments=[]}return _e(r,[{key:"process",value:function(e){var n=e.segment,i=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),i;var o=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!o)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var s=o,a=o,u=void 0,l=void 0;u===void 0;)s=this.tree.prev(s),s===null?u=null:s.key.consumedBy===void 0&&(u=s.key);for(;l===void 0;)a=this.tree.next(a),a===null?l=null:a.key.consumedBy===void 0&&(l=a.key);if(e.isLeft){var c=null;if(u){var f=u.getIntersection(n);if(f!==null&&(n.isAnEndpoint(f)||(c=f),!u.isAnEndpoint(f)))for(var h=this._splitSafely(u,f),g=0,p=h.length;g<p;g++)i.push(h[g])}var y=null;if(l){var d=l.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(y=d),!l.isAnEndpoint(d)))for(var _=this._splitSafely(l,d),I=0,N=_.length;I<N;I++)i.push(_[I])}if(c!==null||y!==null){var C=null;if(c===null)C=y;else if(y===null)C=c;else{var b=An.comparePoints(c,y);C=b<=0?c:y}this.queue.remove(n.rightSE),i.push(n.rightSE);for(var S=n.split(C),D=0,T=S.length;D<T;D++)i.push(S[D])}i.length>0?(this.tree.remove(n),i.push(e)):(this.segments.push(n),n.prev=u)}else{if(u&&l){var F=u.getIntersection(l);if(F!==null){if(!u.isAnEndpoint(F))for(var j=this._splitSafely(u,F),z=0,O=j.length;z<O;z++)i.push(j[z]);if(!l.isAnEndpoint(F))for(var X=this._splitSafely(l,F),P=0,W=X.length;P<W;P++)i.push(X[P])}}this.tree.remove(n)}return i}},{key:"_splitSafely",value:function(e,n){this.tree.remove(e);var i=e.rightSE;this.queue.remove(i);var o=e.split(n);return o.push(i),e.consumedBy===void 0&&this.tree.insert(e),o}}]),r}(),Ea=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,kl=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,zl=function(){function r(){$e(this,r)}return _e(r,[{key:"run",value:function(e,n,i){_n.type=e,Xi.reset();for(var o=[new ma(n,!0)],s=0,a=i.length;s<a;s++)o.push(new ma(i[s],!1));if(_n.numMultiPolys=o.length,_n.type==="difference")for(var u=o[0],l=1;l<o.length;)ds(o[l].bbox,u.bbox)!==null?l++:o.splice(l,1);if(_n.type==="intersection"){for(var c=0,f=o.length;c<f;c++)for(var h=o[c],g=c+1,p=o.length;g<p;g++)if(ds(h.bbox,o[g].bbox)===null)return[]}for(var y=new fs(An.compare),d=0,_=o.length;d<_;d++)for(var I=o[d].getSweepEvents(),N=0,C=I.length;N<C;N++)if(y.insert(I[N]),y.size>Ea)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var b=new Gl(y),S=y.size,D=y.pop();D;){var T=D.key;if(y.size===S){var F=T.segment;throw new Error("Unable to pop() ".concat(T.isLeft?"left":"right"," SweepEvent ")+"[".concat(T.point.x,", ").concat(T.point.y,"] from segment #").concat(F.id," ")+"[".concat(F.leftSE.point.x,", ").concat(F.leftSE.point.y,"] -> ")+"[".concat(F.rightSE.point.x,", ").concat(F.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(y.size>Ea)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(b.segments.length>kl)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var j=b.process(T),z=0,O=j.length;z<O;z++){var X=j[z];X.consumedBy===void 0&&y.insert(X)}S=y.size,D=y.pop()}Xi.reset();var P=Fl.factory(b.segments),W=new Bl(P);return W.getGeom()}}]),r}(),_n=new zl,Vl=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return _n.run("union",t,n)},Ul=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return _n.run("intersection",t,n)},ql=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return _n.run("xor",t,n)},Xl=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return _n.run("difference",t,n)},Ia={union:Vl,intersection:Ul,xor:ql,difference:Xl},Ee=63710088e-1,Ca={centimeters:Ee*100,centimetres:Ee*100,degrees:Ee/111325,feet:Ee*3.28084,inches:Ee*39.37,kilometers:Ee/1e3,kilometres:Ee/1e3,meters:Ee,metres:Ee,miles:Ee/1609.344,millimeters:Ee*1e3,millimetres:Ee*1e3,nauticalmiles:Ee/1852,radians:1,yards:Ee*1.0936};function So(r,t,e){e===void 0&&(e={});var n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=r,n}function Yl(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Sa(r[0])||!Sa(r[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:r};return So(n,t,e)}function Na(r,t,e){e===void 0&&(e={});for(var n=0,i=r;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}var a={type:"Polygon",coordinates:r};return So(a,t,e)}function ys(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}function xa(r,t,e){e===void 0&&(e={});var n={type:"MultiPolygon",coordinates:r};return So(n,t,e)}function Hl(r,t){t===void 0&&(t="kilometers");var e=Ca[t];if(!e)throw new Error(t+" units is invalid");return r*e}function Wl(r,t){t===void 0&&(t="kilometers");var e=Ca[t];if(!e)throw new Error(t+" units is invalid");return r/e}function Sa(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function wo(r){return r.type==="Feature"?r.geometry:r}function jl(r,t,e){e===void 0&&(e={});var n=wo(r),i=wo(t),o=Ia.union(n.coordinates,i.coordinates);return o.length===0?null:o.length===1?Na(o[0],e.properties):xa(o,e.properties)}function wa(r,t,e){if(r!==null)for(var n,i,o,s,a,u,l,c=0,f=0,h,g=r.type,p=g==="FeatureCollection",y=g==="Feature",d=p?r.features.length:1,_=0;_<d;_++){l=p?r.features[_].geometry:y?r.geometry:r,h=l?l.type==="GeometryCollection":!1,a=h?l.geometries.length:1;for(var I=0;I<a;I++){var N=0,C=0;if(s=h?l.geometries[I]:l,s!==null){u=s.coordinates;var b=s.type;switch(c=e&&(b==="Polygon"||b==="MultiPolygon")?1:0,b){case null:break;case"Point":if(t(u,f,_,N,C)===!1)return!1;f++,N++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(t(u[n],f,_,N,C)===!1)return!1;f++,b==="MultiPoint"&&N++}b==="LineString"&&N++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-c;i++){if(t(u[n][i],f,_,N,C)===!1)return!1;f++}b==="MultiLineString"&&N++,b==="Polygon"&&C++}b==="Polygon"&&N++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(C=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-c;o++){if(t(u[n][i][o],f,_,N,C)===!1)return!1;f++}C++}N++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(wa(s.geometries[n],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function La(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function ba(r,t){var e,n,i,o,s,a,u,l,c,f,h=0,g=r.type==="FeatureCollection",p=r.type==="Feature",y=g?r.features.length:1;for(e=0;e<y;e++){for(a=g?r.features[e].geometry:p?r.geometry:r,l=g?r.features[e].properties:p?r.properties:{},c=g?r.features[e].bbox:p?r.bbox:void 0,f=g?r.features[e].id:p?r.id:void 0,u=a?a.type==="GeometryCollection":!1,s=u?a.geometries.length:1,i=0;i<s;i++){if(o=u?a.geometries[i]:a,o===null){if(t(null,h,l,c,f)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,h,l,c,f)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],h,l,c,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function ms(r){var t=[1/0,1/0,-1/0,-1/0];return wa(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}ms.default=ms;function Kl(r,t){t===void 0&&(t={});var e=ms(r),n=(e[0]+e[2])/2,i=(e[1]+e[3])/2;return Yl([n,i],t.properties,t)}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,i=1 in arguments&&parseInt(Number(arguments[1]),10)||0;i=i<0?Math.max(n+i,0):Math.min(i,n);var o=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:n;for(o=o<0?Math.max(n+arguments[2],0):Math.min(o,n);i<o;)e[i]=t,++i;return e},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!==r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var Br=function(){};Br.prototype.interfaces_=function(){return[]},Br.prototype.getClass=function(){return Br},Br.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var ft=function(r){function t(e){r.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=new r().stack}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Error),V=function(){},Pa={MAX_VALUE:{configurable:!0}};V.isNaN=function(t){return Number.isNaN(t)},V.doubleToLongBits=function(t){return t},V.longBitsToDouble=function(t){return t},V.isInfinite=function(t){return!Number.isFinite(t)},Pa.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(V,Pa);var De=function(){},Lo=function(){},li=function(){};function Te(){}var v=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.NULL_ORDINATE;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.z=t.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},Gr={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};v.prototype.setOrdinate=function(t,e){switch(t){case v.X:this.x=e;break;case v.Y:this.y=e;break;case v.Z:this.z=e;break;default:throw new ft("Invalid ordinate index: "+t)}},v.prototype.equals2D=function(){if(arguments.length===1){var t=arguments[0];return!(this.x!==t.x||this.y!==t.y)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return!(!Br.equalsWithTolerance(this.x,e.x,n)||!Br.equalsWithTolerance(this.y,e.y,n))}},v.prototype.getOrdinate=function(t){switch(t){case v.X:return this.x;case v.Y:return this.y;case v.Z:return this.z}throw new ft("Invalid ordinate index: "+t)},v.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||V.isNaN(this.z))&&V.isNaN(t.z)},v.prototype.equals=function(t){return t instanceof v?this.equals2D(t):!1},v.prototype.equalInZ=function(t,e){return Br.equalsWithTolerance(this.z,t.z,e)},v.prototype.compareTo=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},v.prototype.clone=function(){},v.prototype.copy=function(){return new v(this)},v.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},v.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)},v.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},v.prototype.hashCode=function(){var t=17;return t=37*t+v.hashCode(this.x),t=37*t+v.hashCode(this.y),t},v.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},v.prototype.interfaces_=function(){return[De,Lo,Te]},v.prototype.getClass=function(){return v},v.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=V.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},Gr.DimensionalComparator.get=function(){return $n},Gr.serialVersionUID.get=function(){return 6683108902428367e3},Gr.NULL_ORDINATE.get=function(){return V.NaN},Gr.X.get=function(){return 0},Gr.Y.get=function(){return 1},Gr.Z.get=function(){return 2},Object.defineProperties(v,Gr);var $n=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new ft("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}}};$n.prototype.compare=function(t,e){var n=t,i=e,o=$n.compare(n.x,i.x);if(o!==0)return o;var s=$n.compare(n.y,i.y);if(s!==0)return s;if(this._dimensionsToTest<=2)return 0;var a=$n.compare(n.z,i.z);return a},$n.prototype.interfaces_=function(){return[li]},$n.prototype.getClass=function(){return $n},$n.compare=function(t,e){return t<e?-1:t>e?1:V.isNaN(t)?V.isNaN(e)?0:-1:V.isNaN(e)?1:0};var ci=function(){};ci.prototype.create=function(){},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var m=function(){},Hi={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};m.prototype.interfaces_=function(){return[]},m.prototype.getClass=function(){return m},m.toLocationSymbol=function(t){switch(t){case m.EXTERIOR:return"e";case m.BOUNDARY:return"b";case m.INTERIOR:return"i";case m.NONE:return"-"}throw new ft("Unknown location value: "+t)},Hi.INTERIOR.get=function(){return 0},Hi.BOUNDARY.get=function(){return 1},Hi.EXTERIOR.get=function(){return 2},Hi.NONE.get=function(){return-1},Object.defineProperties(m,Hi);var k=function(r,t){return r.interfaces_&&r.interfaces_().indexOf(t)>-1},Ie=function(){},Ra={LOG_10:{configurable:!0}};Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie},Ie.log10=function(t){var e=Math.log(t);return V.isInfinite(e)||V.isNaN(e)?e:e/Ie.LOG_10},Ie.min=function(t,e,n,i){var o=t;return e<o&&(o=e),n<o&&(o=n),i<o&&(o=i),o},Ie.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],o=arguments[1],s=arguments[2];return i<o?o:i>s?s:i}},Ie.wrap=function(t,e){return t<0?e- -t%e:t%e},Ie.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],l=o;return s>l&&(l=s),a>l&&(l=a),u>l&&(l=u),l}},Ie.average=function(t,e){return(t+e)/2},Ra.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Ie,Ra);var tn=function(t){this.str=t};tn.prototype.append=function(t){this.str+=t},tn.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},tn.prototype.toString=function(t){return this.str};var en=function(t){this.value=t};en.prototype.intValue=function(){return this.value},en.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},en.isNaN=function(t){return Number.isNaN(t)};var Wi=function(){};Wi.isWhitespace=function(t){return t<=32&&t>=0||t===127},Wi.toUpperCase=function(t){return t.toUpperCase()};var E=function r(){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 r){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var n=arguments[0];r.call(this,r.parse(n))}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];this.init(i,o)}},Ue={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};E.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},E.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),i=E.magnitude(n._hi),o=E.TEN.pow(i);n=n.divide(o),n.gt(E.TEN)?(n=n.divide(E.TEN),i+=1):n.lt(E.ONE)&&(n=n.multiply(E.TEN),i-=1);for(var s=i+1,a=new tn,u=E.MAX_PRINT_DIGITS-1,l=0;l<=u;l++){t&&l===s&&a.append(".");var c=Math.trunc(n._hi);if(c<0)break;var f=!1,h=0;c>9?(f=!0,h="9"):h="0"+c,a.append(h),n=n.subtract(E.valueOf(c)).multiply(E.TEN),f&&n.selfAdd(E.TEN);var g=!0,p=E.magnitude(n._hi);if(p<0&&Math.abs(p)>=u-l&&(g=!1),!g)break}return e[0]=i,a.toString()},E.prototype.sqr=function(){return this.multiply(this)},E.prototype.doubleValue=function(){return this._hi+this._lo},E.prototype.subtract=function(){if(arguments[0]instanceof E){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}},E.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},E.prototype.isZero=function(){return this._hi===0&&this._lo===0},E.prototype.selfSubtract=function(){if(arguments[0]instanceof E){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},E.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},E.prototype.min=function(t){return this.le(t)?this:t},E.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof E){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],o=null,s=null,a=null,u=null,l=null,c=null,f=null,h=null;return l=this._hi/n,c=E.SPLIT*l,o=c-l,h=E.SPLIT*n,o=c-o,s=l-o,a=h-n,f=l*n,a=h-a,u=n-a,h=o*a-f+o*u+s*a+s*u,c=(this._hi-f-h+this._lo-l*i)/n,h=l+c,this._hi=h,this._lo=l-h+c,this}},E.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},E.prototype.divide=function(){if(arguments[0]instanceof E){var t=arguments[0],e=null,n=null,i=null,o=null,s=null,a=null,u=null,l=null;s=this._hi/t._hi,a=E.SPLIT*s,e=a-s,l=E.SPLIT*t._hi,e=a-e,n=s-e,i=l-t._hi,u=s*t._hi,i=l-i,o=t._hi-i,l=e*i-u+e*o+n*i+n*o,a=(this._hi-u-l+this._lo-s*t._lo)/t._hi,l=s+a;var c=l,f=s-l+a;return new E(c,f)}else if(typeof arguments[0]=="number"){var h=arguments[0];return V.isNaN(h)?E.createNaN():E.copy(this).selfDivide(h,0)}},E.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},E.prototype.pow=function(t){if(t===0)return E.valueOf(1);var e=new E(this),n=E.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2===1&&n.selfMultiply(e),i/=2,i>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},E.prototype.ceil=function(){if(this.isNaN())return E.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new E(t,e)},E.prototype.compareTo=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},E.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()},E.prototype.setValue=function(){if(arguments[0]instanceof E){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}},E.prototype.max=function(t){return this.ge(t)?this:t},E.prototype.sqrt=function(){if(this.isZero())return E.valueOf(0);if(this.isNegative())return E.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=E.valueOf(e),i=this.subtract(n.sqr()),o=i._hi*(t*.5);return n.add(o)},E.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof E){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0],n=null,i=null,o=null,s=null,a=null,u=null;return o=this._hi+e,a=o-this._hi,s=o-a,s=e-a+(this._hi-s),u=s+this._lo,n=o+u,i=u+(o-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var l=arguments[0],c=arguments[1],f=null,h=null,g=null,p=null,y=null,d=null,_=null,I=null;y=this._hi+l,g=this._lo+c,_=y-this._hi,I=g-this._lo,d=y-_,p=g-I,d=l-_+(this._hi-d),p=c-I+(this._lo-p),_=d+g,f=y+_,h=_+(y-f),_=p+h;var N=f+_,C=_+(f-N);return this._hi=N,this._lo=C,this}},E.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof E){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],o=null,s=null,a=null,u=null,l=null,c=null;l=E.SPLIT*this._hi,o=l-this._hi,c=E.SPLIT*n,o=l-o,s=this._hi-o,a=c-n,l=this._hi*n,a=c-a,u=n-a,c=o*a-l+o*u+s*a+s*u+(this._hi*i+this._lo*n);var f=l+c;o=l-f;var h=c+o;return this._hi=f,this._lo=h,this}},E.prototype.selfSqr=function(){return this.selfMultiply(this)},E.prototype.floor=function(){if(this.isNaN())return E.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new E(t,e)},E.prototype.negate=function(){return this.isNaN()?this:new E(-this._hi,-this._lo)},E.prototype.clone=function(){},E.prototype.multiply=function(){if(arguments[0]instanceof E){var t=arguments[0];return t.isNaN()?E.createNaN():E.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return V.isNaN(e)?E.createNaN():E.copy(this).selfMultiply(e,0)}},E.prototype.isNaN=function(){return V.isNaN(this._hi)},E.prototype.intValue=function(){return Math.trunc(this._hi)},E.prototype.toString=function(){var t=E.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},E.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,o=n;if(n.charAt(0)===".")o="0"+n;else if(i<0)o="0."+E.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var s=i-n.length,a=E.stringOfChar("0",s);o=n+a+".0"}return this.isNegative()?"-"+o:o},E.prototype.reciprocal=function(){var t=null,e=null,n=null,i=null,o=null,s=null,a=null,u=null;o=1/this._hi,s=E.SPLIT*o,t=s-o,u=E.SPLIT*this._hi,t=s-t,e=o-t,n=u-this._hi,a=o*this._hi,n=u-n,i=this._hi-n,u=t*n-a+t*i+e*n+e*i,s=(1-a-u-o*this._lo)/this._hi;var l=o+s,c=o-l+s;return new E(l,c)},E.prototype.toSciNotation=function(){if(this.isZero())return E.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=E.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var o="";n.length>1&&(o=n.substring(1));var s=n.charAt(0)+"."+o;return this.isNegative()?"-"+s+i:s+i},E.prototype.abs=function(){return this.isNaN()?E.NaN:this.isNegative()?this.negate():new E(this)},E.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},E.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},E.prototype.add=function(){if(arguments[0]instanceof E){var t=arguments[0];return E.copy(this).selfAdd(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return E.copy(this).selfAdd(e)}},E.prototype.init=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 E){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}},E.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},E.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},E.prototype.trunc=function(){return this.isNaN()?E.NaN:this.isPositive()?this.floor():this.ceil()},E.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},E.prototype.interfaces_=function(){return[Te,De,Lo]},E.prototype.getClass=function(){return E},E.sqr=function(t){return E.valueOf(t).selfMultiply(t)},E.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return E.parse(t)}else if(typeof arguments[0]=="number"){var e=arguments[0];return new E(e)}},E.sqrt=function(t){return E.valueOf(t).sqrt()},E.parse=function(t){for(var e=0,n=t.length;Wi.isWhitespace(t.charAt(e));)e++;var i=!1;if(e<n){var o=t.charAt(e);(o==="-"||o==="+")&&(e++,o==="-"&&(i=!0))}for(var s=new E,a=0,u=0,l=0;!(e>=n);){var c=t.charAt(e);if(e++,Wi.isDigit(c)){var f=c-"0";s.selfMultiply(E.TEN),s.selfAdd(f),a++;continue}if(c==="."){u=a;continue}if(c==="e"||c==="E"){var h=t.substring(e);try{l=en.parseInt(h)}catch(_){throw _ instanceof Error?new Error("Invalid exponent "+h+" in string "+t):_}finally{}break}throw new Error("Unexpected character '"+c+"' at position "+e+" in string "+t)}var g=s,p=a-u-l;if(p===0)g=s;else if(p>0){var y=E.TEN.pow(p);g=s.divide(y)}else if(p<0){var d=E.TEN.pow(-p);g=s.multiply(d)}return i?g.negate():g},E.createNaN=function(){return new E(V.NaN,V.NaN)},E.copy=function(t){return new E(t)},E.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n)),o=Math.pow(10,i);return o*10<=e&&(i+=1),i},E.stringOfChar=function(t,e){for(var n=new tn,i=0;i<e;i++)n.append(t);return n.toString()},Ue.PI.get=function(){return new E(3.141592653589793,12246467991473532e-32)},Ue.TWO_PI.get=function(){return new E(6.283185307179586,24492935982947064e-32)},Ue.PI_2.get=function(){return new E(1.5707963267948966,6123233995736766e-32)},Ue.E.get=function(){return new E(2.718281828459045,14456468917292502e-32)},Ue.NaN.get=function(){return new E(V.NaN,V.NaN)},Ue.EPS.get=function(){return 123259516440783e-46},Ue.SPLIT.get=function(){return 134217729},Ue.MAX_PRINT_DIGITS.get=function(){return 32},Ue.TEN.get=function(){return E.valueOf(10)},Ue.ONE.get=function(){return E.valueOf(1)},Ue.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Ue.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(E,Ue);var ue=function(){},Oa={DP_SAFE_EPSILON:{configurable:!0}};ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue},ue.orientationIndex=function(t,e,n){var i=ue.orientationIndexFilter(t,e,n);if(i<=1)return i;var o=E.valueOf(e.x).selfAdd(-t.x),s=E.valueOf(e.y).selfAdd(-t.y),a=E.valueOf(n.x).selfAdd(-e.x),u=E.valueOf(n.y).selfAdd(-e.y);return o.selfMultiply(u).selfSubtract(s.selfMultiply(a)).signum()},ue.signOfDet2x2=function(t,e,n,i){var o=t.multiply(i).selfSubtract(e.multiply(n));return o.signum()},ue.intersection=function(t,e,n,i){var o=E.valueOf(i.y).selfSubtract(n.y).selfMultiply(E.valueOf(e.x).selfSubtract(t.x)),s=E.valueOf(i.x).selfSubtract(n.x).selfMultiply(E.valueOf(e.y).selfSubtract(t.y)),a=o.subtract(s),u=E.valueOf(i.x).selfSubtract(n.x).selfMultiply(E.valueOf(t.y).selfSubtract(n.y)),l=E.valueOf(i.y).selfSubtract(n.y).selfMultiply(E.valueOf(t.x).selfSubtract(n.x)),c=u.subtract(l),f=c.selfDivide(a).doubleValue(),h=E.valueOf(t.x).selfAdd(E.valueOf(e.x).selfSubtract(t.x).selfMultiply(f)).doubleValue(),g=E.valueOf(e.x).selfSubtract(t.x).selfMultiply(E.valueOf(t.y).selfSubtract(n.y)),p=E.valueOf(e.y).selfSubtract(t.y).selfMultiply(E.valueOf(t.x).selfSubtract(n.x)),y=g.subtract(p),d=y.selfDivide(a).doubleValue(),_=E.valueOf(n.y).selfAdd(E.valueOf(i.y).selfSubtract(n.y).selfMultiply(d)).doubleValue();return new v(h,_)},ue.orientationIndexFilter=function(t,e,n){var i=null,o=(t.x-n.x)*(e.y-n.y),s=(t.y-n.y)*(e.x-n.x),a=o-s;if(o>0){if(s<=0)return ue.signum(a);i=o+s}else if(o<0){if(s>=0)return ue.signum(a);i=-o-s}else return ue.signum(a);var u=ue.DP_SAFE_EPSILON*i;return a>=u||-a>=u?ue.signum(a):2},ue.signum=function(t){return t>0?1:t<0?-1:0},Oa.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(ue,Oa);var Q=function(){},ji={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};ji.X.get=function(){return 0},ji.Y.get=function(){return 1},ji.Z.get=function(){return 2},ji.M.get=function(){return 3},Q.prototype.setOrdinate=function(t,e,n){},Q.prototype.size=function(){},Q.prototype.getOrdinate=function(t,e){},Q.prototype.getCoordinate=function(){},Q.prototype.getCoordinateCopy=function(t){},Q.prototype.getDimension=function(){},Q.prototype.getX=function(t){},Q.prototype.clone=function(){},Q.prototype.expandEnvelope=function(t){},Q.prototype.copy=function(){},Q.prototype.getY=function(t){},Q.prototype.toCoordinateArray=function(){},Q.prototype.interfaces_=function(){return[Lo]},Q.prototype.getClass=function(){return Q},Object.defineProperties(Q,ji);var Da=function(){},fi=function(r){function t(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Da),Bt=function(){};Bt.arraycopy=function(t,e,n,i,o){for(var s=0,a=e;a<e+o;a++)n[i+s]=t[a],s++},Bt.getProperty=function(t){return{"line.separator":`
|
|
23
|
+
`}[t]};var qe=function r(){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],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof v&&arguments[1]instanceof v){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(arguments.length===3){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(arguments.length===4){var f=arguments[0],h=arguments[1],g=arguments[2],p=arguments[3],y=f.y-h.y,d=h.x-f.x,_=f.x*h.y-h.x*f.y,I=g.y-p.y,N=p.x-g.x,C=g.x*p.y-p.x*g.y;this.x=d*C-N*_,this.y=I*_-y*C,this.w=y*N-I*d}};qe.prototype.getY=function(){var t=this.y/this.w;if(V.isNaN(t)||V.isInfinite(t))throw new fi;return t},qe.prototype.getX=function(){var t=this.x/this.w;if(V.isNaN(t)||V.isInfinite(t))throw new fi;return t},qe.prototype.getCoordinate=function(){var t=new v;return t.x=this.getX(),t.y=this.getY(),t},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.intersection=function(t,e,n,i){var o=t.y-e.y,s=e.x-t.x,a=t.x*e.y-e.x*t.y,u=n.y-i.y,l=i.x-n.x,c=n.x*i.y-i.x*n.y,f=s*c-l*a,h=u*a-o*c,g=o*l-u*s,p=f/g,y=h/g;if(V.isNaN(p)||V.isInfinite(p)||V.isNaN(y)||V.isInfinite(y))throw new fi;return new v(p,y)};var M=function r(){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 v){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof r){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},Ta={serialVersionUID:{configurable:!0}};M.prototype.getArea=function(){return this.getWidth()*this.getHeight()},M.prototype.equals=function(t){if(!(t instanceof M))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()},M.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new M;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx<t._maxx?this._maxx:t._maxx,o=this._maxy<t._maxy?this._maxy:t._maxy;return new M(e,i,n,o)},M.prototype.isNull=function(){return this._maxx<this._minx},M.prototype.getMaxX=function(){return this._maxx},M.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof v){var t=arguments[0];return this.covers(t.x,t.y)}else if(arguments[0]instanceof M){var e=arguments[0];return this.isNull()||e.isNull()?!1:e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}},M.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof M){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}else if(arguments[0]instanceof v){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.isNull()?!1:!(n>this._maxx||n<this._minx||i>this._maxy||i<this._miny)}},M.prototype.getMinY=function(){return this._miny},M.prototype.getMinX=function(){return this._minx},M.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof v){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof M){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 n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),i<this._miny&&(this._miny=i),i>this._maxy&&(this._maxy=i))}},M.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},M.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},M.prototype.compareTo=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},M.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},M.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},M.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},M.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},M.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},M.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},M.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof M){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof v){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}},M.prototype.centre=function(){return this.isNull()?null:new v((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},M.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof v){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof M){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 n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];o<s?(this._minx=o,this._maxx=s):(this._minx=s,this._maxx=o),a<u?(this._miny=a,this._maxy=u):(this._miny=u,this._maxy=a)}},M.prototype.getMaxY=function(){return this._maxy},M.prototype.distance=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 n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)},M.prototype.hashCode=function(){var t=17;return t=37*t+v.hashCode(this._minx),t=37*t+v.hashCode(this._maxx),t=37*t+v.hashCode(this._miny),t=37*t+v.hashCode(this._maxy),t},M.prototype.interfaces_=function(){return[De,Te]},M.prototype.getClass=function(){return M},M.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=Math.min(s.x,a.x),l=Math.max(s.x,a.x),c=Math.min(i.x,o.x),f=Math.max(i.x,o.x);return!(c>l||f<u||(u=Math.min(s.y,a.y),l=Math.max(s.y,a.y),c=Math.min(i.y,o.y),f=Math.max(i.y,o.y),c>l)||f<u)}},Ta.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(M,Ta);var nn={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},bo=function(t){this.geometryFactory=t||new H};bo.prototype.read=function(t){var e,n,i;t=t.replace(/[\n\r]/g," ");var o=nn.typeStr.exec(t);if(t.search("EMPTY")!==-1&&(o=nn.emptyTypeStr.exec(t),o[2]=void 0),o&&(n=o[1].toLowerCase(),i=o[2],hi[n]&&(e=hi[n].apply(this,[i]))),e===void 0)throw new Error("Could not parse WKT "+t);return e},bo.prototype.write=function(t){return this.extractGeometry(t)},bo.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!Fn[e])return null;var n=e.toUpperCase(),i;return t.isEmpty()?i=n+" EMPTY":i=n+"("+Fn[e].apply(this,[t])+")",i};var Fn={coordinate:function(t){return t.x+" "+t.y},point:function(t){return Fn.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=this,n=[],i=0,o=t._geometries.length;i<o;++i)n.push("("+Fn.point.apply(e,[t._geometries[i]])+")");return n.join(",")},linestring:function(t){for(var e=this,n=[],i=0,o=t._points._coordinates.length;i<o;++i)n.push(Fn.coordinate.apply(e,[t._points._coordinates[i]]));return n.join(",")},linearring:function(t){for(var e=this,n=[],i=0,o=t._points._coordinates.length;i<o;++i)n.push(Fn.coordinate.apply(e,[t._points._coordinates[i]]));return n.join(",")},multilinestring:function(t){for(var e=this,n=[],i=0,o=t._geometries.length;i<o;++i)n.push("("+Fn.linestring.apply(e,[t._geometries[i]])+")");return n.join(",")},polygon:function(t){var e=this,n=[];n.push("("+Fn.linestring.apply(this,[t._shell])+")");for(var i=0,o=t._holes.length;i<o;++i)n.push("("+Fn.linestring.apply(e,[t._holes[i]])+")");return n.join(",")},multipolygon:function(t){for(var e=this,n=[],i=0,o=t._geometries.length;i<o;++i)n.push("("+Fn.polygon.apply(e,[t._geometries[i]])+")");return n.join(",")},geometrycollection:function(t){for(var e=this,n=[],i=0,o=t._geometries.length;i<o;++i)n.push(e.extractGeometry(t._geometries[i]));return n.join(",")}},hi={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var e=t.trim().split(nn.spaces);return this.geometryFactory.createPoint(new v(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e=this;if(t===void 0)return this.geometryFactory.createMultiPoint();for(var n,i=t.trim().split(","),o=[],s=0,a=i.length;s<a;++s)n=i[s].replace(nn.trimParens,"$1"),o.push(hi.point.apply(e,[n]));return this.geometryFactory.createMultiPoint(o)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var e=t.trim().split(","),n=[],i,o=0,s=e.length;o<s;++o)i=e[o].trim().split(nn.spaces),n.push(new v(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var e=t.trim().split(","),n=[],i,o=0,s=e.length;o<s;++o)i=e[o].trim().split(nn.spaces),n.push(new v(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e=this;if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n,i=t.trim().split(nn.parenComma),o=[],s=0,a=i.length;s<a;++s)n=i[s].replace(nn.trimParens,"$1"),o.push(hi.linestring.apply(e,[n]));return this.geometryFactory.createMultiLineString(o)},polygon:function(t){var e=this;if(t===void 0)return this.geometryFactory.createPolygon();for(var n,i,o,s=t.trim().split(nn.parenComma),a,u=[],l=0,c=s.length;l<c;++l)n=s[l].replace(nn.trimParens,"$1"),i=hi.linestring.apply(e,[n]),o=e.geometryFactory.createLinearRing(i._points),l===0?a=o:u.push(o);return this.geometryFactory.createPolygon(a,u)},multipolygon:function(t){var e=this;if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n,i=t.trim().split(nn.doubleParenComma),o=[],s=0,a=i.length;s<a;++s)n=i[s].replace(nn.trimParens,"$1"),o.push(hi.polygon.apply(e,[n]));return this.geometryFactory.createMultiPolygon(o)},geometrycollection:function(t){var e=this;if(t===void 0)return this.geometryFactory.createGeometryCollection();t=t.replace(/,\s*([A-Za-z])/g,"|$1");for(var n=t.trim().split("|"),i=[],o=0,s=n.length;o<s;++o)i.push(e.read(n[o]));return this.geometryFactory.createGeometryCollection(i)}},Xe=function(t){this.parser=new bo(t)};Xe.prototype.write=function(t){return this.parser.write(t)},Xe.toLineString=function(t,e){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var Bn=function(r){function t(e){r.call(this,e),this.name="RuntimeException",this.message=e,this.stack=new r().stack}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Error),Po=function(r){function t(){if(r.call(this),arguments.length===0)r.call(this);else if(arguments.length===1){var e=arguments[0];r.call(this,e)}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Bn),q=function(){};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q},q.shouldNeverReachHere=function(){if(arguments.length===0)q.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new Po("Should never reach here"+(t!==null?": "+t:""))}},q.isTrue=function(){var t,e;if(arguments.length===1)t=arguments[0],q.isTrue(t,null);else if(arguments.length===2&&(t=arguments[0],e=arguments[1],!t))throw e===null?new Po:new Po(e)},q.equals=function(){var t,e,n;if(arguments.length===2)t=arguments[0],e=arguments[1],q.equals(t,e,null);else if(arguments.length===3&&(t=arguments[0],e=arguments[1],n=arguments[2],!e.equals(t)))throw new Po("Expected "+t+" but encountered "+e+(n!==null?": "+n:""))};var ht=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 v,this._intPt[1]=new v,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},kr={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ht.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},ht.prototype.getTopologySummary=function(){var t=new tn;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},ht.prototype.computeIntersection=function(t,e,n,i){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(t,e,n,i)},ht.prototype.getIntersectionNum=function(){return this._result},ht.prototype.computeIntLineIndex=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],e=this.getEdgeDistance(t,0),n=this.getEdgeDistance(t,1);e>n?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},ht.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ht.prototype.setPrecisionModel=function(t){this._precisionModel=t},ht.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var e=arguments[0],n=0;n<this._result;n++)if(!(t._intPt[n].equals2D(t._inputLines[e][0])||t._intPt[n].equals2D(t._inputLines[e][1])))return!0;return!1}},ht.prototype.getIntersection=function(t){return this._intPt[t]},ht.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ht.prototype.hasIntersection=function(){return this._result!==ht.NO_INTERSECTION},ht.prototype.getEdgeDistance=function(t,e){var n=ht.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1]);return n},ht.prototype.isCollinear=function(){return this._result===ht.COLLINEAR_INTERSECTION},ht.prototype.toString=function(){return Xe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Xe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ht.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},ht.prototype.isIntersection=function(t){for(var e=this,n=0;n<this._result;n++)if(e._intPt[n].equals2D(t))return!0;return!1},ht.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},ht.prototype.interfaces_=function(){return[]},ht.prototype.getClass=function(){return ht},ht.computeEdgeDistance=function(t,e,n){var i=Math.abs(n.x-e.x),o=Math.abs(n.y-e.y),s=-1;if(t.equals(e))s=0;else if(t.equals(n))i>o?s=i:s=o;else{var a=Math.abs(t.x-e.x),u=Math.abs(t.y-e.y);i>o?s=a:s=u,s===0&&!t.equals(e)&&(s=Math.max(a,u))}return q.isTrue(!(s===0&&!t.equals(e)),"Bad distance calculation"),s},ht.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,o=t.y-e.y,s=Math.sqrt(i*i+o*o);return q.isTrue(!(s===0&&!t.equals(e)),"Invalid distance calculation"),s},kr.DONT_INTERSECT.get=function(){return 0},kr.DO_INTERSECT.get=function(){return 1},kr.COLLINEAR.get=function(){return 2},kr.NO_INTERSECTION.get=function(){return 0},kr.POINT_INTERSECTION.get=function(){return 1},kr.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ht,kr);var yr=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(n){var i=new M(this._inputLines[0][0],this._inputLines[0][1]),o=new M(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&o.contains(n)},t.prototype.computeIntersection=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];if(this._isProper=!1,M.intersects(i,o,n)&&R.orientationIndex(i,o,n)===0&&R.orientationIndex(o,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(o))&&(this._isProper=!1),this._result=r.POINT_INTERSECTION,null;this._result=r.NO_INTERSECTION}else return r.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(n,i,o,s,a){a.x=this.smallestInAbsValue(n.x,i.x,o.x,s.x),a.y=this.smallestInAbsValue(n.y,i.y,o.y,s.y),n.x-=a.x,n.y-=a.y,i.x-=a.x,i.y-=a.y,o.x-=a.x,o.y-=a.y,s.x-=a.x,s.y-=a.y},t.prototype.safeHCoordinateIntersection=function(n,i,o,s){var a=null;try{a=qe.intersection(n,i,o,s)}catch(u){if(u instanceof fi)a=t.nearestEndpoint(n,i,o,s);else throw u}finally{}return a},t.prototype.intersection=function(n,i,o,s){var a=this.intersectionWithNormalization(n,i,o,s);return this.isInSegmentEnvelopes(a)||(a=new v(t.nearestEndpoint(n,i,o,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(a),a},t.prototype.smallestInAbsValue=function(n,i,o,s){var a=n,u=Math.abs(a);return Math.abs(i)<u&&(a=i,u=Math.abs(i)),Math.abs(o)<u&&(a=o,u=Math.abs(o)),Math.abs(s)<u&&(a=s),a},t.prototype.checkDD=function(n,i,o,s,a){var u=ue.intersection(n,i,o,s),l=this.isInSegmentEnvelopes(u);Bt.out.println("DD in env = "+l+" --------------------- "+u),a.distance(u)>1e-4&&Bt.out.println("Distance = "+a.distance(u))},t.prototype.intersectionWithNormalization=function(n,i,o,s){var a=new v(n),u=new v(i),l=new v(o),c=new v(s),f=new v;this.normalizeToEnvCentre(a,u,l,c,f);var h=this.safeHCoordinateIntersection(a,u,l,c);return h.x+=f.x,h.y+=f.y,h},t.prototype.computeCollinearIntersection=function(n,i,o,s){var a=M.intersects(n,i,o),u=M.intersects(n,i,s),l=M.intersects(o,s,n),c=M.intersects(o,s,i);return a&&u?(this._intPt[0]=o,this._intPt[1]=s,r.COLLINEAR_INTERSECTION):l&&c?(this._intPt[0]=n,this._intPt[1]=i,r.COLLINEAR_INTERSECTION):a&&l?(this._intPt[0]=o,this._intPt[1]=n,o.equals(n)&&!u&&!c?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):a&&c?(this._intPt[0]=o,this._intPt[1]=i,o.equals(i)&&!u&&!l?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):u&&l?(this._intPt[0]=s,this._intPt[1]=n,s.equals(n)&&!a&&!c?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):u&&c?(this._intPt[0]=s,this._intPt[1]=i,s.equals(i)&&!a&&!l?r.POINT_INTERSECTION:r.COLLINEAR_INTERSECTION):r.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(n,i,o,s,a){var u=n.x<i.x?n.x:i.x,l=n.y<i.y?n.y:i.y,c=n.x>i.x?n.x:i.x,f=n.y>i.y?n.y:i.y,h=o.x<s.x?o.x:s.x,g=o.y<s.y?o.y:s.y,p=o.x>s.x?o.x:s.x,y=o.y>s.y?o.y:s.y,d=u>h?u:h,_=c<p?c:p,I=l>g?l:g,N=f<y?f:y,C=(d+_)/2,b=(I+N)/2;a.x=C,a.y=b,n.x-=a.x,n.y-=a.y,i.x-=a.x,i.y-=a.y,o.x-=a.x,o.y-=a.y,s.x-=a.x,s.y-=a.y},t.prototype.computeIntersect=function(n,i,o,s){if(this._isProper=!1,!M.intersects(n,i,o,s))return r.NO_INTERSECTION;var a=R.orientationIndex(n,i,o),u=R.orientationIndex(n,i,s);if(a>0&&u>0||a<0&&u<0)return r.NO_INTERSECTION;var l=R.orientationIndex(o,s,n),c=R.orientationIndex(o,s,i);if(l>0&&c>0||l<0&&c<0)return r.NO_INTERSECTION;var f=a===0&&u===0&&l===0&&c===0;return f?this.computeCollinearIntersection(n,i,o,s):(a===0||u===0||l===0||c===0?(this._isProper=!1,n.equals2D(o)||n.equals2D(s)?this._intPt[0]=n:i.equals2D(o)||i.equals2D(s)?this._intPt[0]=i:a===0?this._intPt[0]=new v(o):u===0?this._intPt[0]=new v(s):l===0?this._intPt[0]=new v(n):c===0&&(this._intPt[0]=new v(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,o,s)),r.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(n,i,o,s){var a=n,u=R.distancePointLine(n,o,s),l=R.distancePointLine(i,o,s);return l<u&&(u=l,a=i),l=R.distancePointLine(o,n,i),l<u&&(u=l,a=o),l=R.distancePointLine(s,n,i),l<u&&(u=l,a=s),a},t}(ht),zr=function(){};zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.orientationIndex=function(t,e,n){var i=e.x-t.x,o=e.y-t.y,s=n.x-e.x,a=n.y-e.y;return zr.signOfDet2x2(i,o,s,a)},zr.signOfDet2x2=function(t,e,n,i){var o=null,s=null,a=null;if(o=1,t===0||i===0)return e===0||n===0?0:e>0?n>0?-o:o:n>0?o:-o;if(e===0||n===0)return i>0?t>0?o:-o:t>0?-o:o;if(e>0?i>0?e<=i||(o=-o,s=t,t=n,n=s,s=e,e=i,i=s):e<=-i?(o=-o,n=-n,i=-i):(s=t,t=-n,n=s,s=e,e=-i,i=s):i>0?-e<=i?(o=-o,t=-t,e=-e):(s=-t,t=n,n=s,s=-e,e=i,i=s):e>=i?(t=-t,e=-e,n=-n,i=-i):(o=-o,s=-t,t=-n,n=s,s=-e,e=-i,i=s),t>0)if(n>0){if(!(t<=n))return o}else return o;else{if(n>0)return-o;if(t>=n)o=-o,t=-t,n=-n;else return-o}for(;;){if(a=Math.floor(n/t),n=n-a*t,i=i-a*e,i<0)return-o;if(i>e)return o;if(t>n+n){if(e<i+i)return o}else{if(e>i+i)return-o;n=t-n,i=e-i,o=-o}if(i===0)return n===0?0:-o;if(n===0||(a=Math.floor(t/n),t=t-a*n,e=e-a*i,e<0))return o;if(e>i)return-o;if(n>t+t){if(i<e+e)return-o}else{if(i>e+e)return o;t=n-t,e=i-e,o=-o}if(e===0)return t===0?0:o;if(t===0)return-o}};var rn=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};rn.prototype.countSegment=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 n=t.x,i=e.x;return n>i&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(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 o=t.x-this._p.x,s=t.y-this._p.y,a=e.x-this._p.x,u=e.y-this._p.y,l=zr.signOfDet2x2(o,s,a,u);if(l===0)return this._isPointOnSegment=!0,null;u<s&&(l=-l),l>0&&this._crossingCount++}},rn.prototype.isPointInPolygon=function(){return this.getLocation()!==m.EXTERIOR},rn.prototype.getLocation=function(){return this._isPointOnSegment?m.BOUNDARY:this._crossingCount%2===1?m.INTERIOR:m.EXTERIOR},rn.prototype.isOnSegment=function(){return this._isPointOnSegment},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.locatePointInRing=function(){if(arguments[0]instanceof v&&k(arguments[1],Q)){for(var t=arguments[0],e=arguments[1],n=new rn(t),i=new v,o=new v,s=1;s<e.size();s++)if(e.getCoordinate(s,i),e.getCoordinate(s-1,o),n.countSegment(i,o),n.isOnSegment())return n.getLocation();return n.getLocation()}else if(arguments[0]instanceof v&&arguments[1]instanceof Array){for(var a=arguments[0],u=arguments[1],l=new rn(a),c=1;c<u.length;c++){var f=u[c],h=u[c-1];if(l.countSegment(f,h),l.isOnSegment())return l.getLocation()}return l.getLocation()}};var R=function(){},Vr={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.orientationIndex=function(t,e,n){return ue.orientationIndex(t,e,n)},R.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,i=1;i<t.length-1;i++){var o=t[i].x-n,s=t[i+1].y,a=t[i-1].y;e+=o*(a-s)}return e/2}else if(k(arguments[0],Q)){var u=arguments[0],l=u.size();if(l<3)return 0;var c=new v,f=new v,h=new v;u.getCoordinate(0,f),u.getCoordinate(1,h);var g=f.x;h.x-=g;for(var p=0,y=1;y<l-1;y++)c.y=f.y,f.x=h.x,f.y=h.y,u.getCoordinate(y+1,h),h.x-=g,p+=f.x*(c.y-h.y);return p/2}},R.distanceLineLine=function(t,e,n,i){if(t.equals(e))return R.distancePointLine(t,n,i);if(n.equals(i))return R.distancePointLine(i,t,e);var o=!1;if(!M.intersects(t,e,n,i))o=!0;else{var s=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(s===0)o=!0;else{var a=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),u=(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y),l=u/s,c=a/s;(c<0||c>1||l<0||l>1)&&(o=!0)}}return o?Ie.min(R.distancePointLine(t,n,i),R.distancePointLine(e,n,i),R.distancePointLine(n,t,e),R.distancePointLine(i,t,e)):0},R.isPointInRing=function(t,e){return R.locatePointInRing(t,e)!==m.EXTERIOR},R.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new v;t.getCoordinate(0,i);for(var o=i.x,s=i.y,a=1;a<e;a++){t.getCoordinate(a,i);var u=i.x,l=i.y,c=u-o,f=l-s;n+=Math.sqrt(c*c+f*f),o=u,s=l}return n},R.isCCW=function(t){var e=t.length-1;if(e<3)throw new ft("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],i=0,o=1;o<=e;o++){var s=t[o];s.y>n.y&&(n=s,i=o)}var a=i;do a=a-1,a<0&&(a=e);while(t[a].equals2D(n)&&a!==i);var u=i;do u=(u+1)%e;while(t[u].equals2D(n)&&u!==i);var l=t[a],c=t[u];if(l.equals2D(n)||c.equals2D(n)||l.equals2D(c))return!1;var f=R.computeOrientation(l,n,c),h=!1;return f===0?h=l.x>c.x:h=f>0,h},R.locatePointInRing=function(t,e){return rn.locatePointInRing(t,e)},R.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),o=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(o)*Math.sqrt(i)},R.computeOrientation=function(t,e,n){return R.orientationIndex(t,e,n)},R.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new ft("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i<e.length-1;i++){var o=R.distancePointLine(t,e[i],e[i+1]);o<n&&(n=o)}return n}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];if(a.x===u.x&&a.y===u.y)return s.distance(a);var l=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),c=((s.x-a.x)*(u.x-a.x)+(s.y-a.y)*(u.y-a.y))/l;if(c<=0)return s.distance(a);if(c>=1)return s.distance(u);var f=((a.y-s.y)*(u.x-a.x)-(a.x-s.x)*(u.y-a.y))/l;return Math.abs(f)*Math.sqrt(l)}},R.isOnLine=function(t,e){for(var n=new yr,i=1;i<e.length;i++){var o=e[i-1],s=e[i];if(n.computeIntersection(t,o,s),n.hasIntersection())return!0}return!1},Vr.CLOCKWISE.get=function(){return-1},Vr.RIGHT.get=function(){return R.CLOCKWISE},Vr.COUNTERCLOCKWISE.get=function(){return 1},Vr.LEFT.get=function(){return R.COUNTERCLOCKWISE},Vr.COLLINEAR.get=function(){return 0},Vr.STRAIGHT.get=function(){return R.COLLINEAR},Object.defineProperties(R,Vr);var Gn=function(){};Gn.prototype.filter=function(t){},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn};var G=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},En={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};G.prototype.isGeometryCollection=function(){return this.getSortIndex()===G.SORTINDEX_GEOMETRYCOLLECTION},G.prototype.getFactory=function(){return this._factory},G.prototype.getGeometryN=function(t){return this},G.prototype.getArea=function(){return 0},G.prototype.isRectangle=function(){return!1},G.prototype.equals=function(){if(arguments[0]instanceof G){var t=arguments[0];return t===null?!1:this.equalsTopo(t)}else if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof G))return!1;var n=e;return this.equalsExact(n)}},G.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},G.prototype.geometryChanged=function(){this.apply(G.geometryChangedFilter)},G.prototype.geometryChangedAction=function(){this._envelope=null},G.prototype.equalsNorm=function(t){return t===null?!1:this.norm().equalsExact(t.norm())},G.prototype.getLength=function(){return 0},G.prototype.getNumGeometries=function(){return 1},G.prototype.compareTo=function(){if(arguments.length===1){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,i)}},G.prototype.getUserData=function(){return this._userData},G.prototype.getSRID=function(){return this._SRID},G.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},G.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===G.SORTINDEX_GEOMETRYCOLLECTION)throw new ft("This method does not support GeometryCollection arguments")},G.prototype.equal=function(t,e,n){return n===0?t.equals(e):t.distance(e)<=n},G.prototype.norm=function(){var t=this.copy();return t.normalize(),t},G.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},G.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new M(this._envelope)},G.prototype.setSRID=function(t){this._SRID=t},G.prototype.setUserData=function(t){this._userData=t},G.prototype.compare=function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var o=n.next(),s=i.next(),a=o.compareTo(s);if(a!==0)return a}return n.hasNext()?1:i.hasNext()?-1:0},G.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},G.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===G.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===G.SORTINDEX_MULTIPOINT||this.getSortIndex()===G.SORTINDEX_MULTILINESTRING||this.getSortIndex()===G.SORTINDEX_MULTIPOLYGON},G.prototype.interfaces_=function(){return[Lo,De,Te]},G.prototype.getClass=function(){return G},G.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},G.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1},En.serialVersionUID.get=function(){return 8763622679187377e3},En.SORTINDEX_POINT.get=function(){return 0},En.SORTINDEX_MULTIPOINT.get=function(){return 1},En.SORTINDEX_LINESTRING.get=function(){return 2},En.SORTINDEX_LINEARRING.get=function(){return 3},En.SORTINDEX_MULTILINESTRING.get=function(){return 4},En.SORTINDEX_POLYGON.get=function(){return 5},En.SORTINDEX_MULTIPOLYGON.get=function(){return 6},En.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},En.geometryChangedFilter.get=function(){return _s},Object.defineProperties(G,En);var _s=function(){};_s.interfaces_=function(){return[Gn]},_s.filter=function(t){t.geometryChangedAction()};var In=function(){};In.prototype.filter=function(t){},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In};var Me=function(){},kn={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Me.prototype.isInBoundary=function(t){},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},kn.Mod2BoundaryNodeRule.get=function(){return gi},kn.EndPointBoundaryNodeRule.get=function(){return pi},kn.MultiValentEndPointBoundaryNodeRule.get=function(){return di},kn.MonoValentEndPointBoundaryNodeRule.get=function(){return vi},kn.MOD2_BOUNDARY_RULE.get=function(){return new gi},kn.ENDPOINT_BOUNDARY_RULE.get=function(){return new pi},kn.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new di},kn.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new vi},kn.OGC_SFS_BOUNDARY_RULE.get=function(){return Me.MOD2_BOUNDARY_RULE},Object.defineProperties(Me,kn);var gi=function(){};gi.prototype.isInBoundary=function(t){return t%2===1},gi.prototype.interfaces_=function(){return[Me]},gi.prototype.getClass=function(){return gi};var pi=function(){};pi.prototype.isInBoundary=function(t){return t>0},pi.prototype.interfaces_=function(){return[Me]},pi.prototype.getClass=function(){return pi};var di=function(){};di.prototype.isInBoundary=function(t){return t>1},di.prototype.interfaces_=function(){return[Me]},di.prototype.getClass=function(){return di};var vi=function(){};vi.prototype.isInBoundary=function(t){return t===1},vi.prototype.interfaces_=function(){return[Me]},vi.prototype.getClass=function(){return vi};var St=function(){};St.prototype.add=function(){},St.prototype.addAll=function(){},St.prototype.isEmpty=function(){},St.prototype.iterator=function(){},St.prototype.size=function(){},St.prototype.toArray=function(){},St.prototype.remove=function(){};function Es(r){this.message=r||""}Es.prototype=new Error,Es.prototype.name="IndexOutOfBoundsException";var yi=function(){};yi.prototype.hasNext=function(){},yi.prototype.next=function(){},yi.prototype.remove=function(){};var Ye=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(St);function mi(r){this.message=r||""}mi.prototype=new Error,mi.prototype.name="NoSuchElementException";var L=function(r){function t(){r.call(this),this.array_=[],arguments[0]instanceof St&&this.addAll(arguments[0])}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[r,St]},t.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(n){for(var i=this,o=n.iterator();o.hasNext();)i.add(o.next());return!0},t.prototype.set=function(n,i){var o=this.array_[n];return this.array_[n]=i,o},t.prototype.iterator=function(){return new Ql(this)},t.prototype.get=function(n){if(n<0||n>=this.size())throw new Es;return this.array_[n]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var n=this,i=[],o=0,s=this.array_.length;o<s;o++)i.push(n.array_[o]);return i},t.prototype.remove=function(n){for(var i=this,o=!1,s=0,a=this.array_.length;s<a;s++)if(i.array_[s]===n){i.array_.splice(s,1),o=!0;break}return o},t}(Ye),Ql=function(r){function t(e){r.call(this),this.arrayList_=e,this.position_=0}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new mi;return this.arrayList_.get(this.position_++)},t.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},t.prototype.set=function(n){return this.arrayList_.set(this.position_-1,n)},t.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},t}(yi),Ki=function(r){function t(){if(r.call(this),arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.ensureCapacity(n.length),this.add(n,!0)}else if(arguments.length===2){var i=arguments[0],o=arguments[1];this.ensureCapacity(i.length),this.add(i,o)}}}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={coordArrayType:{configurable:!0}};return e.coordArrayType.get=function(){return new Array(0).fill(null)},t.prototype.getCoordinate=function(i){return this.get(i)},t.prototype.addAll=function(){var i=this;if(arguments.length===2){for(var o=arguments[0],s=arguments[1],a=!1,u=o.iterator();u.hasNext();)i.add(u.next(),s),a=!0;return a}else return r.prototype.addAll.apply(this,arguments)},t.prototype.clone=function(){for(var i=this,o=r.prototype.clone.call(this),s=0;s<this.size();s++)o.add(s,i.get(s).copy());return o},t.prototype.toCoordinateArray=function(){return this.toArray(t.coordArrayType)},t.prototype.add=function(){var i=this;if(arguments.length===1){var o=arguments[0];r.prototype.add.call(this,o)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var s=arguments[0],a=arguments[1];return this.add(s,a,!0),!0}else if(arguments[0]instanceof v&&typeof arguments[1]=="boolean"){var u=arguments[0],l=arguments[1];if(!l&&this.size()>=1){var c=this.get(this.size()-1);if(c.equals2D(u))return null}r.prototype.add.call(this,u)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var f=arguments[0],h=arguments[1];return this.add(f,h),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var g=arguments[0],p=arguments[1],y=arguments[2];if(y)for(var d=0;d<g.length;d++)i.add(g[d],p);else for(var _=g.length-1;_>=0;_--)i.add(g[_],p);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof v){var I=arguments[0],N=arguments[1],C=arguments[2];if(!C){var b=this.size();if(b>0){if(I>0){var S=this.get(I-1);if(S.equals2D(N))return null}if(I<b){var D=this.get(I);if(D.equals2D(N))return null}}}r.prototype.add.call(this,I,N)}}else if(arguments.length===4){var T=arguments[0],F=arguments[1],j=arguments[2],z=arguments[3],O=1;j>z&&(O=-1);for(var X=j;X!==z;X+=O)i.add(T[X],F);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new v(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,e),t}(L),Y=function(){},Ro={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Ro.ForwardComparator.get=function(){return Qi},Ro.BidirectionalComparator.get=function(){return _i},Ro.coordArrayType.get=function(){return new Array(0).fill(null)},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y},Y.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},Y.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(Y.indexOf(i,e)<0)return i}return null},Y.scroll=function(t,e){var n=Y.indexOf(e,t);if(n<0)return null;var i=new Array(t.length).fill(null);Bt.arraycopy(t,n,i,0,t.length-n),Bt.arraycopy(t,0,i,t.length-n,n),Bt.arraycopy(i,0,t,0,t.length)},Y.equals=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 n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];if(i===o)return!0;if(i===null||o===null||i.length!==o.length)return!1;for(var a=0;a<i.length;a++)if(s.compare(i[a],o[a])!==0)return!1;return!0}},Y.intersection=function(t,e){for(var n=new Ki,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()},Y.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},Y.removeRepeatedPoints=function(t){if(!Y.hasRepeatedPoints(t))return t;var e=new Ki(t,!1);return e.toCoordinateArray()},Y.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var o=t[i];t[i]=t[e-i],t[e-i]=o}},Y.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)t[n]!==null&&e++;var i=new Array(e).fill(null);if(e===0)return i;for(var o=0,s=0;s<t.length;s++)t[s]!==null&&(i[o++]=t[s]);return i},Y.copyDeep=function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new v(t[n]);return e}else if(arguments.length===5)for(var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=0;l<u;l++)s[a+l]=new v(i[o+l])},Y.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=e[t.length-n-1];if(i.compareTo(o)!==0)return!1}return!0},Y.envelope=function(t){for(var e=new M,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},Y.toCoordinateArray=function(t){return t.toArray(Y.coordArrayType)},Y.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},Y.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},Y.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,i=t[e].compareTo(t[n]);if(i!==0)return i}return 1},Y.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(i!==0)return i;n++}return n<e.length?-1:n<t.length?1:0},Y.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(e===null||e.compareTo(t[n])>0)&&(e=t[n]);return e},Y.extract=function(t,e,n){e=Ie.clamp(e,0,t.length),n=Ie.clamp(n,-1,t.length);var i=n-e+1;n<0&&(i=0),e>=t.length&&(i=0),n<e&&(i=0);var o=new Array(i).fill(null);if(i===0)return o;for(var s=0,a=e;a<=n;a++)o[s++]=t[a];return o},Object.defineProperties(Y,Ro);var Qi=function(){};Qi.prototype.compare=function(t,e){var n=t,i=e;return Y.compare(n,i)},Qi.prototype.interfaces_=function(){return[li]},Qi.prototype.getClass=function(){return Qi};var _i=function(){};_i.prototype.compare=function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;var o=Y.compare(n,i),s=Y.isEqualReversed(n,i);return s?0:o},_i.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;for(var o=Y.increasingDirection(n),s=Y.increasingDirection(i),a=o>0?0:n.length-1,u=s>0?0:n.length-1,l=0;l<n.length;l++){var c=n[a].compareTo(i[u]);if(c!==0)return c;a+=o,u+=s}return 0},_i.prototype.interfaces_=function(){return[li]},_i.prototype.getClass=function(){return _i};var Ur=function(){};Ur.prototype.get=function(){},Ur.prototype.put=function(){},Ur.prototype.size=function(){},Ur.prototype.values=function(){},Ur.prototype.entrySet=function(){};var Jl=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Ur);function Ji(r){this.message=r||""}Ji.prototype=new Error,Ji.prototype.name="OperationNotSupported";function Oo(){}Oo.prototype=new St,Oo.prototype.contains=function(){};var Is=function(r){function t(){r.call(this),this.array_=[],arguments[0]instanceof St&&this.addAll(arguments[0])}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.contains=function(n){for(var i=this,o=0,s=this.array_.length;o<s;o++){var a=i.array_[o];if(a===n)return!0}return!1},t.prototype.add=function(n){return this.contains(n)?!1:(this.array_.push(n),!0)},t.prototype.addAll=function(n){for(var i=this,o=n.iterator();o.hasNext();)i.add(o.next());return!0},t.prototype.remove=function(n){throw new Error},t.prototype.size=function(){return this.array_.length},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.toArray=function(){for(var n=this,i=[],o=0,s=this.array_.length;o<s;o++)i.push(n.array_[o]);return i},t.prototype.iterator=function(){return new Zl(this)},t}(Oo),Zl=function(r){function t(e){r.call(this),this.hashSet_=e,this.position_=0}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new mi;return this.hashSet_.array_[this.position_++]},t.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},t.prototype.remove=function(){throw new Ji},t}(yi),zn=0,mr=1;function Ma(r){return r===null?zn:r.color}function at(r){return r===null?null:r.parent}function Vn(r,t){r!==null&&(r.color=t)}function Cs(r){return r===null?null:r.left}function Aa(r){return r===null?null:r.right}function Ht(){this.root_=null,this.size_=0}Ht.prototype=new Jl,Ht.prototype.get=function(r){for(var t=this.root_;t!==null;){var e=r.compareTo(t.key);if(e<0)t=t.left;else if(e>0)t=t.right;else return t.value}return null},Ht.prototype.put=function(r,t){if(this.root_===null)return this.root_={key:r,value:t,left:null,right:null,parent:null,color:zn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var e=this.root_,n,i;do if(n=e,i=r.compareTo(e.key),i<0)e=e.left;else if(i>0)e=e.right;else{var o=e.value;return e.value=t,o}while(e!==null);var s={key:r,left:null,right:null,value:t,parent:n,color:zn,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},Ht.prototype.fixAfterInsertion=function(r){var t=this;for(r.color=mr;r!=null&&r!==this.root_&&r.parent.color===mr;)if(at(r)===Cs(at(at(r)))){var e=Aa(at(at(r)));Ma(e)===mr?(Vn(at(r),zn),Vn(e,zn),Vn(at(at(r)),mr),r=at(at(r))):(r===Aa(at(r))&&(r=at(r),t.rotateLeft(r)),Vn(at(r),zn),Vn(at(at(r)),mr),t.rotateRight(at(at(r))))}else{var n=Cs(at(at(r)));Ma(n)===mr?(Vn(at(r),zn),Vn(n,zn),Vn(at(at(r)),mr),r=at(at(r))):(r===Cs(at(r))&&(r=at(r),t.rotateRight(r)),Vn(at(r),zn),Vn(at(at(r)),mr),t.rotateLeft(at(at(r))))}this.root_.color=zn},Ht.prototype.values=function(){var r=new L,t=this.getFirstEntry();if(t!==null)for(r.add(t.value);(t=Ht.successor(t))!==null;)r.add(t.value);return r},Ht.prototype.entrySet=function(){var r=new Is,t=this.getFirstEntry();if(t!==null)for(r.add(t);(t=Ht.successor(t))!==null;)r.add(t);return r},Ht.prototype.rotateLeft=function(r){if(r!=null){var t=r.right;r.right=t.left,t.left!=null&&(t.left.parent=r),t.parent=r.parent,r.parent===null?this.root_=t:r.parent.left===r?r.parent.left=t:r.parent.right=t,t.left=r,r.parent=t}},Ht.prototype.rotateRight=function(r){if(r!=null){var t=r.left;r.left=t.right,t.right!=null&&(t.right.parent=r),t.parent=r.parent,r.parent===null?this.root_=t:r.parent.right===r?r.parent.right=t:r.parent.left=t,t.right=r,r.parent=t}},Ht.prototype.getFirstEntry=function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r},Ht.successor=function(r){if(r===null)return null;if(r.right!==null){for(var t=r.right;t.left!==null;)t=t.left;return t}else{for(var e=r.parent,n=r;e!==null&&n===e.right;)n=e,e=e.parent;return e}},Ht.prototype.size=function(){return this.size_};var Zi=function(){};Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};function Fa(){}Fa.prototype=new Oo;function on(){this.array_=[],arguments[0]instanceof St&&this.addAll(arguments[0])}on.prototype=new Fa,on.prototype.contains=function(r){for(var t=this,e=0,n=this.array_.length;e<n;e++){var i=t.array_[e];if(i.compareTo(r)===0)return!0}return!1},on.prototype.add=function(r){var t=this;if(this.contains(r))return!1;for(var e=0,n=this.array_.length;e<n;e++){var i=t.array_[e];if(i.compareTo(r)===1)return t.array_.splice(e,0,r),!0}return this.array_.push(r),!0},on.prototype.addAll=function(r){for(var t=this,e=r.iterator();e.hasNext();)t.add(e.next());return!0},on.prototype.remove=function(r){throw new Ji},on.prototype.size=function(){return this.array_.length},on.prototype.isEmpty=function(){return this.array_.length===0},on.prototype.toArray=function(){for(var r=this,t=[],e=0,n=this.array_.length;e<n;e++)t.push(r.array_[e]);return t},on.prototype.iterator=function(){return new Do(this)};var Do=function(r){this.treeSet_=r,this.position_=0};Do.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new mi;return this.treeSet_.array_[this.position_++]},Do.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Do.prototype.remove=function(){throw new Ji};var _r=function(){};_r.sort=function(){var t=arguments[0],e,n,i,o;if(arguments.length===1)o=function(a,u){return a.compareTo(u)},t.sort(o);else if(arguments.length===2)i=arguments[1],o=function(a,u){return i.compare(a,u)},t.sort(o);else if(arguments.length===3){n=t.slice(arguments[1],arguments[2]),n.sort();var s=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length));for(t.splice(0,t.length),e=0;e<s.length;e++)t.push(s[e])}else if(arguments.length===4)for(n=t.slice(arguments[1],arguments[2]),i=arguments[3],o=function(a,u){return i.compare(a,u)},n.sort(o),s=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length)),t.splice(0,t.length),e=0;e<s.length;e++)t.push(s[e])},_r.asList=function(t){for(var e=new L,n=0,i=t.length;n<i;n++)e.add(t[n]);return e};var J=function(){},He={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};He.P.get=function(){return 0},He.L.get=function(){return 1},He.A.get=function(){return 2},He.FALSE.get=function(){return-1},He.TRUE.get=function(){return-2},He.DONTCARE.get=function(){return-3},He.SYM_FALSE.get=function(){return"F"},He.SYM_TRUE.get=function(){return"T"},He.SYM_DONTCARE.get=function(){return"*"},He.SYM_P.get=function(){return"0"},He.SYM_L.get=function(){return"1"},He.SYM_A.get=function(){return"2"},J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.toDimensionSymbol=function(t){switch(t){case J.FALSE:return J.SYM_FALSE;case J.TRUE:return J.SYM_TRUE;case J.DONTCARE:return J.SYM_DONTCARE;case J.P:return J.SYM_P;case J.L:return J.SYM_L;case J.A:return J.SYM_A}throw new ft("Unknown dimension value: "+t)},J.toDimensionValue=function(t){switch(Wi.toUpperCase(t)){case J.SYM_FALSE:return J.FALSE;case J.SYM_TRUE:return J.TRUE;case J.SYM_DONTCARE:return J.DONTCARE;case J.SYM_P:return J.P;case J.SYM_L:return J.L;case J.SYM_A:return J.A}throw new ft("Unknown dimension symbol: "+t)},Object.defineProperties(J,He);var sn=function(){};sn.prototype.filter=function(t){},sn.prototype.interfaces_=function(){return[]},sn.prototype.getClass=function(){return sn};var We=function(){};We.prototype.filter=function(t,e){},We.prototype.isDone=function(){},We.prototype.isGeometryChanged=function(){},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We};var $t=function(r){function t(n,i){if(r.call(this,i),this._geometries=n||[],r.hasNullElements(this._geometries))throw new ft("geometries must not contain null elements")}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){for(var i=this,o=new M,s=0;s<this._geometries.length;s++)o.expandToInclude(i._geometries[s].getEnvelopeInternal());return o},t.prototype.getGeometryN=function(i){return this._geometries[i]},t.prototype.getSortIndex=function(){return r.SORTINDEX_GEOMETRYCOLLECTION},t.prototype.getCoordinates=function(){for(var i=this,o=new Array(this.getNumPoints()).fill(null),s=-1,a=0;a<this._geometries.length;a++)for(var u=i._geometries[a].getCoordinates(),l=0;l<u.length;l++)s++,o[s]=u[l];return o},t.prototype.getArea=function(){for(var i=this,o=0,s=0;s<this._geometries.length;s++)o+=i._geometries[s].getArea();return o},t.prototype.equalsExact=function(){var i=this;if(arguments.length===2){var o=arguments[0],s=arguments[1];if(!this.isEquivalentClass(o))return!1;var a=o;if(this._geometries.length!==a._geometries.length)return!1;for(var u=0;u<this._geometries.length;u++)if(!i._geometries[u].equalsExact(a._geometries[u],s))return!1;return!0}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){for(var i=this,o=0;o<this._geometries.length;o++)i._geometries[o].normalize();_r.sort(this._geometries)},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},t.prototype.getBoundaryDimension=function(){for(var i=this,o=J.FALSE,s=0;s<this._geometries.length;s++)o=Math.max(o,i._geometries[s].getBoundaryDimension());return o},t.prototype.getDimension=function(){for(var i=this,o=J.FALSE,s=0;s<this._geometries.length;s++)o=Math.max(o,i._geometries[s].getDimension());return o},t.prototype.getLength=function(){for(var i=this,o=0,s=0;s<this._geometries.length;s++)o+=i._geometries[s].getLength();return o},t.prototype.getNumPoints=function(){for(var i=this,o=0,s=0;s<this._geometries.length;s++)o+=i._geometries[s].getNumPoints();return o},t.prototype.getNumGeometries=function(){return this._geometries.length},t.prototype.reverse=function(){for(var i=this,o=this._geometries.length,s=new Array(o).fill(null),a=0;a<this._geometries.length;a++)s[a]=i._geometries[a].reverse();return this.getFactory().createGeometryCollection(s)},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){var o=arguments[0],s=new on(_r.asList(this._geometries)),a=new on(_r.asList(o._geometries));return this.compare(s,a)}else if(arguments.length===2){for(var u=arguments[0],l=arguments[1],c=u,f=this.getNumGeometries(),h=c.getNumGeometries(),g=0;g<f&&g<h;){var p=i.getGeometryN(g),y=c.getGeometryN(g),d=p.compareToSameClass(y,l);if(d!==0)return d;g++}return g<f?1:g<h?-1:0}},t.prototype.apply=function(){var i=this;if(k(arguments[0],In))for(var o=arguments[0],s=0;s<this._geometries.length;s++)i._geometries[s].apply(o);else if(k(arguments[0],We)){var a=arguments[0];if(this._geometries.length===0)return null;for(var u=0;u<this._geometries.length&&(i._geometries[u].apply(a),!a.isDone());u++);a.isGeometryChanged()&&this.geometryChanged()}else if(k(arguments[0],sn)){var l=arguments[0];l.filter(this);for(var c=0;c<this._geometries.length;c++)i._geometries[c].apply(l)}else if(k(arguments[0],Gn)){var f=arguments[0];f.filter(this);for(var h=0;h<this._geometries.length;h++)i._geometries[h].apply(f)}},t.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),q.shouldNeverReachHere(),null},t.prototype.clone=function(){var i=this,o=r.prototype.clone.call(this);o._geometries=new Array(this._geometries.length).fill(null);for(var s=0;s<this._geometries.length;s++)o._geometries[s]=i._geometries[s].clone();return o},t.prototype.getGeometryType=function(){return"GeometryCollection"},t.prototype.copy=function(){for(var i=this,o=new Array(this._geometries.length).fill(null),s=0;s<o.length;s++)o[s]=i._geometries[s].copy();return new t(o,this._factory)},t.prototype.isEmpty=function(){for(var i=this,o=0;o<this._geometries.length;o++)if(!i._geometries[o].isEmpty())return!1;return!0},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(t,e),t}(G),Er=function(r){function t(){r.apply(this,arguments)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return G.SORTINDEX_MULTILINESTRING},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return this.isEquivalentClass(i)?r.prototype.equalsExact.call(this,i,o):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?J.FALSE:0},t.prototype.isClosed=function(){var i=this;if(this.isEmpty())return!1;for(var o=0;o<this._geometries.length;o++)if(!i._geometries[o].isClosed())return!1;return!0},t.prototype.getDimension=function(){return 1},t.prototype.reverse=function(){for(var i=this,o=this._geometries.length,s=new Array(o).fill(null),a=0;a<this._geometries.length;a++)s[o-1-a]=i._geometries[a].reverse();return this.getFactory().createMultiLineString(s)},t.prototype.getBoundary=function(){return new Ae(this).getBoundary()},t.prototype.getGeometryType=function(){return"MultiLineString"},t.prototype.copy=function(){for(var i=this,o=new Array(this._geometries.length).fill(null),s=0;s<o.length;s++)o[s]=i._geometries[s].copy();return new t(o,this._factory)},t.prototype.interfaces_=function(){return[Zi]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(t,e),t}($t),Ae=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],e=Me.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}};Ae.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return e.length===1?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},Ae.prototype.getBoundary=function(){return this._geom instanceof dt?this.boundaryLineString(this._geom):this._geom instanceof Er?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Ae.prototype.boundaryLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();if(t.isClosed()){var e=this._bnRule.isInBoundary(2);return e?t.getStartPoint():this._geomFact.createMultiPoint()}return this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},Ae.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Ae.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new L;this._endpointMap=new Ht;for(var i=0;i<t.getNumGeometries();i++){var o=t.getGeometryN(i);o.getNumPoints()!==0&&(e.addEndpoint(o.getCoordinateN(0)),e.addEndpoint(o.getCoordinateN(o.getNumPoints()-1)))}for(var s=this._endpointMap.entrySet().iterator();s.hasNext();){var a=s.next(),u=a.getValue(),l=u.count;e._bnRule.isInBoundary(l)&&n.add(a.getKey())}return Y.toCoordinateArray(n)},Ae.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);e===null&&(e=new To,this._endpointMap.put(t,e)),e.count++},Ae.prototype.interfaces_=function(){return[]},Ae.prototype.getClass=function(){return Ae},Ae.getBoundary=function(){if(arguments.length===1){var t=arguments[0],e=new Ae(t);return e.getBoundary()}else if(arguments.length===2){var n=arguments[0],i=arguments[1],o=new Ae(n,i);return o.getBoundary()}};var To=function(){this.count=null};To.prototype.interfaces_=function(){return[]},To.prototype.getClass=function(){return To};function $l(){}function tc(){}var ec=function(){};function nc(){}function rc(){}function ic(){}var Fe=function(){},Ns={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe},Fe.chars=function(t,e){for(var n=new Array(e).fill(null),i=0;i<e;i++)n[i]=t;return String(n)},Fe.getStackTrace=function(){if(arguments.length===1){var t=arguments[0],e=new nc,n=new $l;return t.printStackTrace(n),e.toString()}else if(arguments.length===2){var i=arguments[0],o=arguments[1],s="";new tc(Fe.getStackTrace(i));for(var a=new ic,u=0;u<o;u++)try{s+=a.readLine()+Fe.NEWLINE}catch(l){if(l instanceof rc)q.shouldNeverReachHere();else throw l}finally{}return s}},Fe.split=function(t,e){for(var n=e.length,i=new L,o=""+t,s=o.indexOf(e);s>=0;){var a=o.substring(0,s);i.add(a),o=o.substring(s+n),s=o.indexOf(e)}o.length>0&&i.add(o);for(var u=new Array(i.size()).fill(null),l=0;l<u.length;l++)u[l]=i.get(l);return u},Fe.toString=function(){if(arguments.length===1){var t=arguments[0];return Fe.SIMPLE_ORDINATE_FORMAT.format(t)}},Fe.spaces=function(t){return Fe.chars(" ",t)},Ns.NEWLINE.get=function(){return Bt.getProperty("line.separator")},Ns.SIMPLE_ORDINATE_FORMAT.get=function(){return new ec},Object.defineProperties(Fe,Ns);var mt=function(){};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.copyCoord=function(t,e,n,i){for(var o=Math.min(t.getDimension(),n.getDimension()),s=0;s<o;s++)n.setOrdinate(i,s,t.getOrdinate(e,s))},mt.isRing=function(t){var e=t.size();return e===0?!0:e<=3?!1:t.getOrdinate(0,Q.X)===t.getOrdinate(e-1,Q.X)&&t.getOrdinate(0,Q.Y)===t.getOrdinate(e-1,Q.Y)},mt.isEqual=function(t,e){var n=t.size(),i=e.size();if(n!==i)return!1;for(var o=Math.min(t.getDimension(),e.getDimension()),s=0;s<n;s++)for(var a=0;a<o;a++){var u=t.getOrdinate(s,a),l=e.getOrdinate(s,a);if(t.getOrdinate(s,a)!==e.getOrdinate(s,a)&&!(V.isNaN(u)&&V.isNaN(l)))return!1}return!0},mt.extend=function(t,e,n){var i=t.create(n,e.getDimension()),o=e.size();if(mt.copy(e,0,i,0,o),o>0)for(var s=o;s<n;s++)mt.copy(e,o-1,i,s,1);return i},mt.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),i=0;i<=n;i++)mt.swap(t,i,e-i)},mt.swap=function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var o=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,o)}},mt.copy=function(t,e,n,i,o){for(var s=0;s<o;s++)mt.copyCoord(t,e+s,n,i+s)},mt.toString=function(){if(arguments.length===1){var t=arguments[0],e=t.size();if(e===0)return"()";var n=t.getDimension(),i=new tn;i.append("(");for(var o=0;o<e;o++){o>0&&i.append(" ");for(var s=0;s<n;s++)s>0&&i.append(","),i.append(Fe.toString(t.getOrdinate(o,s)))}return i.append(")"),i.toString()}},mt.ensureValidRing=function(t,e){var n=e.size();if(n===0)return e;if(n<=3)return mt.createClosedRing(t,e,4);var i=e.getOrdinate(0,Q.X)===e.getOrdinate(n-1,Q.X)&&e.getOrdinate(0,Q.Y)===e.getOrdinate(n-1,Q.Y);return i?e:mt.createClosedRing(t,e,n+1)},mt.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),o=e.size();mt.copy(e,0,i,0,o);for(var s=o;s<n;s++)mt.copy(e,0,i,s,1);return i};var dt=function(r){function t(n,i){r.call(this,i),this._points=null,this.init(n)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new M:this._points.expandEnvelope(new M)},t.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},t.prototype.getSortIndex=function(){return r.SORTINDEX_LINESTRING},t.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},t.prototype.equalsExact=function(){var i=this;if(arguments.length===2){var o=arguments[0],s=arguments[1];if(!this.isEquivalentClass(o))return!1;var a=o;if(this._points.size()!==a._points.size())return!1;for(var u=0;u<this._points.size();u++)if(!i.equal(i._points.getCoordinate(u),a._points.getCoordinate(u),s))return!1;return!0}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){for(var i=this,o=0;o<Math.trunc(this._points.size()/2);o++){var s=i._points.size()-1-o;if(!i._points.getCoordinate(o).equals(i._points.getCoordinate(s)))return i._points.getCoordinate(o).compareTo(i._points.getCoordinate(s))>0&&mt.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?J.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return R.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();mt.reverse(i);var o=this.getFactory().createLineString(i);return o},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var o=arguments[0],s=o,a=0,u=0;a<this._points.size()&&u<s._points.size();){var l=i._points.getCoordinate(a).compareTo(s._points.getCoordinate(u));if(l!==0)return l;a++,u++}return a<this._points.size()?1:u<s._points.size()?-1:0}else if(arguments.length===2){var c=arguments[0],f=arguments[1],h=c;return f.compare(this._points,h._points)}},t.prototype.apply=function(){var i=this;if(k(arguments[0],In))for(var o=arguments[0],s=0;s<this._points.size();s++)o.filter(i._points.getCoordinate(s));else if(k(arguments[0],We)){var a=arguments[0];if(this._points.size()===0)return null;for(var u=0;u<this._points.size()&&(a.filter(i._points,u),!a.isDone());u++);a.isGeometryChanged()&&this.geometryChanged()}else if(k(arguments[0],sn)){var l=arguments[0];l.filter(this)}else if(k(arguments[0],Gn)){var c=arguments[0];c.filter(this)}},t.prototype.getBoundary=function(){return new Ae(this).getBoundary()},t.prototype.isEquivalentClass=function(i){return i instanceof t},t.prototype.clone=function(){var i=r.prototype.clone.call(this);return i._points=this._points.clone(),i},t.prototype.getCoordinateN=function(i){return this._points.getCoordinate(i)},t.prototype.getGeometryType=function(){return"LineString"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.getCoordinateSequence=function(){return this._points},t.prototype.isEmpty=function(){return this._points.size()===0},t.prototype.init=function(i){if(i===null&&(i=this.getFactory().getCoordinateSequenceFactory().create([])),i.size()===1)throw new ft("Invalid number of points in LineString (found "+i.size()+" - must be 0 or >= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var o=this,s=0;s<this._points.size();s++)if(o._points.getCoordinate(s).equals(i))return!0;return!1},t.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},t.prototype.getPointN=function(i){return this.getFactory().createPoint(this._points.getCoordinate(i))},t.prototype.interfaces_=function(){return[Zi]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(t,e),t}(G),$i=function(){};$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i};var pe=function(r){function t(n,i){r.call(this,i),this._coordinates=n||null,this.init(this._coordinates)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new M;var i=new M;return i.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),i},t.prototype.getSortIndex=function(){return r.SORTINDEX_POINT},t.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return this.isEquivalentClass(i)?this.isEmpty()&&i.isEmpty()?!0:this.isEmpty()!==i.isEmpty()?!1:this.equal(i.getCoordinate(),this.getCoordinate(),o):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){},t.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},t.prototype.getBoundaryDimension=function(){return J.FALSE},t.prototype.getDimension=function(){return 0},t.prototype.getNumPoints=function(){return this.isEmpty()?0:1},t.prototype.reverse=function(){return this.copy()},t.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},t.prototype.compareToSameClass=function(){if(arguments.length===1){var i=arguments[0],o=i;return this.getCoordinate().compareTo(o.getCoordinate())}else if(arguments.length===2){var s=arguments[0],a=arguments[1],u=s;return a.compare(this._coordinates,u._coordinates)}},t.prototype.apply=function(){if(k(arguments[0],In)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this.getCoordinate())}else if(k(arguments[0],We)){var o=arguments[0];if(this.isEmpty())return null;o.filter(this._coordinates,0),o.isGeometryChanged()&&this.geometryChanged()}else if(k(arguments[0],sn)){var s=arguments[0];s.filter(this)}else if(k(arguments[0],Gn)){var a=arguments[0];a.filter(this)}},t.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},t.prototype.clone=function(){var i=r.prototype.clone.call(this);return i._coordinates=this._coordinates.clone(),i},t.prototype.getGeometryType=function(){return"Point"},t.prototype.copy=function(){return new t(this._coordinates.copy(),this._factory)},t.prototype.getCoordinateSequence=function(){return this._coordinates},t.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},t.prototype.isEmpty=function(){return this._coordinates.size()===0},t.prototype.init=function(i){i===null&&(i=this.getFactory().getCoordinateSequenceFactory().create([])),q.isTrue(i.size()<=1),this._coordinates=i},t.prototype.isSimple=function(){return!0},t.prototype.interfaces_=function(){return[$i]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(t,e),t}(G),tr=function(){};tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr};var wt=function(r){function t(n,i,o){if(r.call(this,o),this._shell=null,this._holes=null,n===null&&(n=this.getFactory().createLinearRing()),i===null&&(i=[]),r.hasNullElements(i))throw new ft("holes must not contain null elements");if(n.isEmpty()&&r.hasNonEmptyElements(i))throw new ft("shell is empty but holes are not");this._shell=n,this._holes=i}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},t.prototype.getSortIndex=function(){return r.SORTINDEX_POLYGON},t.prototype.getCoordinates=function(){var i=this;if(this.isEmpty())return[];for(var o=new Array(this.getNumPoints()).fill(null),s=-1,a=this._shell.getCoordinates(),u=0;u<a.length;u++)s++,o[s]=a[u];for(var l=0;l<this._holes.length;l++)for(var c=i._holes[l].getCoordinates(),f=0;f<c.length;f++)s++,o[s]=c[f];return o},t.prototype.getArea=function(){var i=this,o=0;o+=Math.abs(R.signedArea(this._shell.getCoordinateSequence()));for(var s=0;s<this._holes.length;s++)o-=Math.abs(R.signedArea(i._holes[s].getCoordinateSequence()));return o},t.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var i=this._shell.getCoordinateSequence(),o=this.getEnvelopeInternal(),s=0;s<5;s++){var a=i.getX(s);if(!(a===o.getMinX()||a===o.getMaxX()))return!1;var u=i.getY(s);if(!(u===o.getMinY()||u===o.getMaxY()))return!1}for(var l=i.getX(0),c=i.getY(0),f=1;f<=4;f++){var h=i.getX(f),g=i.getY(f),p=h!==l,y=g!==c;if(p===y)return!1;l=h,c=g}return!0},t.prototype.equalsExact=function(){var i=this;if(arguments.length===2){var o=arguments[0],s=arguments[1];if(!this.isEquivalentClass(o))return!1;var a=o,u=this._shell,l=a._shell;if(!u.equalsExact(l,s)||this._holes.length!==a._holes.length)return!1;for(var c=0;c<this._holes.length;c++)if(!i._holes[c].equalsExact(a._holes[c],s))return!1;return!0}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.normalize=function(){var i=this;if(arguments.length===0){this.normalize(this._shell,!0);for(var o=0;o<this._holes.length;o++)i.normalize(i._holes[o],!1);_r.sort(this._holes)}else if(arguments.length===2){var s=arguments[0],a=arguments[1];if(s.isEmpty())return null;var u=new Array(s.getCoordinates().length-1).fill(null);Bt.arraycopy(s.getCoordinates(),0,u,0,u.length);var l=Y.minCoordinate(s.getCoordinates());Y.scroll(u,l),Bt.arraycopy(u,0,s.getCoordinates(),0,u.length),s.getCoordinates()[u.length]=u[0],R.isCCW(s.getCoordinates())===a&&Y.reverse(s.getCoordinates())}},t.prototype.getCoordinate=function(){return this._shell.getCoordinate()},t.prototype.getNumInteriorRing=function(){return this._holes.length},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.getLength=function(){var i=this,o=0;o+=this._shell.getLength();for(var s=0;s<this._holes.length;s++)o+=i._holes[s].getLength();return o},t.prototype.getNumPoints=function(){for(var i=this,o=this._shell.getNumPoints(),s=0;s<this._holes.length;s++)o+=i._holes[s].getNumPoints();return o},t.prototype.reverse=function(){var i=this,o=this.copy();o._shell=this._shell.copy().reverse(),o._holes=new Array(this._holes.length).fill(null);for(var s=0;s<this._holes.length;s++)o._holes[s]=i._holes[s].copy().reverse();return o},t.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){var o=arguments[0],s=this._shell,a=o._shell;return s.compareToSameClass(a)}else if(arguments.length===2){var u=arguments[0],l=arguments[1],c=u,f=this._shell,h=c._shell,g=f.compareToSameClass(h,l);if(g!==0)return g;for(var p=this.getNumInteriorRing(),y=c.getNumInteriorRing(),d=0;d<p&&d<y;){var _=i.getInteriorRingN(d),I=c.getInteriorRingN(d),N=_.compareToSameClass(I,l);if(N!==0)return N;d++}return d<p?1:d<y?-1:0}},t.prototype.apply=function(i){var o=this;if(k(i,In)){this._shell.apply(i);for(var s=0;s<this._holes.length;s++)o._holes[s].apply(i)}else if(k(i,We)){if(this._shell.apply(i),!i.isDone())for(var a=0;a<this._holes.length&&(o._holes[a].apply(i),!i.isDone());a++);i.isGeometryChanged()&&this.geometryChanged()}else if(k(i,sn))i.filter(this);else if(k(i,Gn)){i.filter(this),this._shell.apply(i);for(var u=0;u<this._holes.length;u++)o._holes[u].apply(i)}},t.prototype.getBoundary=function(){var i=this;if(this.isEmpty())return this.getFactory().createMultiLineString();var o=new Array(this._holes.length+1).fill(null);o[0]=this._shell;for(var s=0;s<this._holes.length;s++)o[s+1]=i._holes[s];return o.length<=1?this.getFactory().createLinearRing(o[0].getCoordinateSequence()):this.getFactory().createMultiLineString(o)},t.prototype.clone=function(){var i=this,o=r.prototype.clone.call(this);o._shell=this._shell.clone(),o._holes=new Array(this._holes.length).fill(null);for(var s=0;s<this._holes.length;s++)o._holes[s]=i._holes[s].clone();return o},t.prototype.getGeometryType=function(){return"Polygon"},t.prototype.copy=function(){for(var i=this,o=this._shell.copy(),s=new Array(this._holes.length).fill(null),a=0;a<s.length;a++)s[a]=i._holes[a].copy();return new t(o,s,this._factory)},t.prototype.getExteriorRing=function(){return this._shell},t.prototype.isEmpty=function(){return this._shell.isEmpty()},t.prototype.getInteriorRingN=function(i){return this._holes[i]},t.prototype.interfaces_=function(){return[tr]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(t,e),t}(G),Ei=function(r){function t(){r.apply(this,arguments)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return G.SORTINDEX_MULTIPOINT},t.prototype.isValid=function(){return!0},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return this.isEquivalentClass(i)?r.prototype.equalsExact.call(this,i,o):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.getCoordinate=function(){if(arguments.length===1){var i=arguments[0];return this._geometries[i].getCoordinate()}else return r.prototype.getCoordinate.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return J.FALSE},t.prototype.getDimension=function(){return 0},t.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},t.prototype.getGeometryType=function(){return"MultiPoint"},t.prototype.copy=function(){for(var i=this,o=new Array(this._geometries.length).fill(null),s=0;s<o.length;s++)o[s]=i._geometries[s].copy();return new t(o,this._factory)},t.prototype.interfaces_=function(){return[$i]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(t,e),t}($t),Cn=function(r){function t(n,i){n instanceof v&&i instanceof H&&(n=i.getCoordinateSequenceFactory().create(n)),r.call(this,n,i),this.validateConstruction()}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return G.SORTINDEX_LINEARRING},t.prototype.getBoundaryDimension=function(){return J.FALSE},t.prototype.isClosed=function(){return this.isEmpty()?!0:r.prototype.isClosed.call(this)},t.prototype.reverse=function(){var i=this._points.copy();mt.reverse(i);var o=this.getFactory().createLinearRing(i);return o},t.prototype.validateConstruction=function(){if(!this.isEmpty()&&!r.prototype.isClosed.call(this))throw new ft("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new ft("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.MINIMUM_VALID_SIZE.get=function(){return 4},e.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,e),t}(dt),Nn=function(r){function t(){r.apply(this,arguments)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return G.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return this.isEquivalentClass(i)?r.prototype.equalsExact.call(this,i,o):!1}else return r.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,o=this._geometries.length,s=new Array(o).fill(null),a=0;a<this._geometries.length;a++)s[a]=i._geometries[a].reverse();return this.getFactory().createMultiPolygon(s)},t.prototype.getBoundary=function(){var i=this;if(this.isEmpty())return this.getFactory().createMultiLineString();for(var o=new L,s=0;s<this._geometries.length;s++)for(var a=i._geometries[s],u=a.getBoundary(),l=0;l<u.getNumGeometries();l++)o.add(u.getGeometryN(l));var c=new Array(o.size()).fill(null);return this.getFactory().createMultiLineString(o.toArray(c))},t.prototype.getGeometryType=function(){return"MultiPolygon"},t.prototype.copy=function(){for(var i=this,o=new Array(this._geometries.length).fill(null),s=0;s<o.length;s++)o[s]=i._geometries[s].copy();return new t(o,this._factory)},t.prototype.interfaces_=function(){return[tr]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(t,e),t}($t),Be=function(t){this._factory=t||null,this._isUserDataCopied=!1},Mo={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Be.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Be.prototype.edit=function(t,e){if(t===null)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Be.prototype.editInternal=function(t,e){return this._factory===null&&(this._factory=t.getFactory()),t instanceof $t?this.editGeometryCollection(t,e):t instanceof wt?this.editPolygon(t,e):t instanceof pe?e.edit(t,this._factory):t instanceof dt?e.edit(t,this._factory):(q.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Be.prototype.editGeometryCollection=function(t,e){for(var n=this,i=e.edit(t,this._factory),o=new L,s=0;s<i.getNumGeometries();s++){var a=n.edit(i.getGeometryN(s),e);a===null||a.isEmpty()||o.add(a)}return i.getClass()===Ei?this._factory.createMultiPoint(o.toArray([])):i.getClass()===Er?this._factory.createMultiLineString(o.toArray([])):i.getClass()===Nn?this._factory.createMultiPolygon(o.toArray([])):this._factory.createGeometryCollection(o.toArray([]))},Be.prototype.editPolygon=function(t,e){var n=this,i=e.edit(t,this._factory);if(i===null&&(i=this._factory.createPolygon(null)),i.isEmpty())return i;var o=this.edit(i.getExteriorRing(),e);if(o===null||o.isEmpty())return this._factory.createPolygon();for(var s=new L,a=0;a<i.getNumInteriorRing();a++){var u=n.edit(i.getInteriorRingN(a),e);u===null||u.isEmpty()||s.add(u)}return this._factory.createPolygon(o,s.toArray([]))},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.GeometryEditorOperation=function(){},Mo.NoOpGeometryOperation.get=function(){return to},Mo.CoordinateOperation.get=function(){return eo},Mo.CoordinateSequenceOperation.get=function(){return no},Object.defineProperties(Be,Mo);var to=function(){};to.prototype.edit=function(t,e){return t},to.prototype.interfaces_=function(){return[Be.GeometryEditorOperation]},to.prototype.getClass=function(){return to};var eo=function(){};eo.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return n===null?t:t instanceof Cn?e.createLinearRing(n):t instanceof dt?e.createLineString(n):t instanceof pe?n.length>0?e.createPoint(n[0]):e.createPoint():t},eo.prototype.interfaces_=function(){return[Be.GeometryEditorOperation]},eo.prototype.getClass=function(){return eo};var no=function(){};no.prototype.edit=function(t,e){return t instanceof Cn?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof dt?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof pe?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},no.prototype.interfaces_=function(){return[Be.GeometryEditorOperation]},no.prototype.getClass=function(){return no};var _t=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)t._coordinates[n]=new v}else if(k(arguments[0],Q)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._coordinates=new Array(i.size()).fill(null);for(var o=0;o<this._coordinates.length;o++)t._coordinates[o]=i.getCoordinateCopy(o)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var s=arguments[0],a=arguments[1];this._coordinates=s,this._dimension=a,s===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],l=arguments[1];this._coordinates=new Array(u).fill(null),this._dimension=l;for(var c=0;c<u;c++)t._coordinates[c]=new v}}},Ba={serialVersionUID:{configurable:!0}};_t.prototype.setOrdinate=function(t,e,n){switch(e){case Q.X:this._coordinates[t].x=n;break;case Q.Y:this._coordinates[t].y=n;break;case Q.Z:this._coordinates[t].z=n;break;default:throw new ft("invalid ordinateIndex")}},_t.prototype.size=function(){return this._coordinates.length},_t.prototype.getOrdinate=function(t,e){switch(e){case Q.X:return this._coordinates[t].x;case Q.Y:return this._coordinates[t].y;case Q.Z:return this._coordinates[t].z}return V.NaN},_t.prototype.getCoordinate=function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}else if(arguments.length===2){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},_t.prototype.getCoordinateCopy=function(t){return new v(this._coordinates[t])},_t.prototype.getDimension=function(){return this._dimension},_t.prototype.getX=function(t){return this._coordinates[t].x},_t.prototype.clone=function(){for(var t=this,e=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)e[n]=t._coordinates[n].clone();return new _t(e,this._dimension)},_t.prototype.expandEnvelope=function(t){for(var e=this,n=0;n<this._coordinates.length;n++)t.expandToInclude(e._coordinates[n]);return t},_t.prototype.copy=function(){for(var t=this,e=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)e[n]=t._coordinates[n].copy();return new _t(e,this._dimension)},_t.prototype.toString=function(){var t=this;if(this._coordinates.length>0){var e=new tn(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var n=1;n<this._coordinates.length;n++)e.append(", "),e.append(t._coordinates[n]);return e.append(")"),e.toString()}else return"()"},_t.prototype.getY=function(t){return this._coordinates[t].y},_t.prototype.toCoordinateArray=function(){return this._coordinates},_t.prototype.interfaces_=function(){return[Q,Te]},_t.prototype.getClass=function(){return _t},Ba.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(_t,Ba);var xn=function(){},xs={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};xn.prototype.readResolve=function(){return xn.instance()},xn.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new _t(t)}else if(k(arguments[0],Q)){var e=arguments[0];return new _t(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2?new _t(n):new _t(n,i)}},xn.prototype.interfaces_=function(){return[ci,Te]},xn.prototype.getClass=function(){return xn},xn.instance=function(){return xn.instanceObject},xs.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},xs.instanceObject.get=function(){return new xn},Object.defineProperties(xn,xs);var Ga=function(r){function t(){r.call(this),this.map_=new Map}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.get=function(n){return this.map_.get(n)||null},t.prototype.put=function(n,i){return this.map_.set(n,i),i},t.prototype.values=function(){for(var n=new L,i=this.map_.values(),o=i.next();!o.done;)n.add(o.value),o=i.next();return n},t.prototype.entrySet=function(){var n=new Is;return this.map_.entries().forEach(function(i){return n.add(i)}),n},t.prototype.size=function(){return this.map_.size()},t}(Ur),Z=function r(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof an){var t=arguments[0];this._modelType=t,t===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=r.FIXED,this.setScale(e)}else if(arguments[0]instanceof r){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}},Ss={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Z.prototype.equals=function(t){if(!(t instanceof Z))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Z.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new en(n).compareTo(new en(i))},Z.prototype.getScale=function(){return this._scale},Z.prototype.isFloating=function(){return this._modelType===Z.FLOATING||this._modelType===Z.FLOATING_SINGLE},Z.prototype.getType=function(){return this._modelType},Z.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Z.FLOATING?t="Floating":this._modelType===Z.FLOATING_SINGLE?t="Floating-Single":this._modelType===Z.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Z.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(V.isNaN(t))return t;if(this._modelType===Z.FLOATING_SINGLE){var e=t;return e}return this._modelType===Z.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof v){var n=arguments[0];if(this._modelType===Z.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}},Z.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Z.FLOATING?t=16:this._modelType===Z.FLOATING_SINGLE?t=6:this._modelType===Z.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Z.prototype.setScale=function(t){this._scale=Math.abs(t)},Z.prototype.interfaces_=function(){return[Te,De]},Z.prototype.getClass=function(){return Z},Z.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Ss.serialVersionUID.get=function(){return 7777263578777804e3},Ss.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Z,Ss);var an=function r(t){this._name=t||null,r.nameToTypeMap.put(t,this)},ws={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};an.prototype.readResolve=function(){return an.nameToTypeMap.get(this._name)},an.prototype.toString=function(){return this._name},an.prototype.interfaces_=function(){return[Te]},an.prototype.getClass=function(){return an},ws.serialVersionUID.get=function(){return-552860263173159e4},ws.nameToTypeMap.get=function(){return new Ga},Object.defineProperties(an,ws),Z.Type=an,Z.FIXED=new an("FIXED"),Z.FLOATING=new an("FLOATING"),Z.FLOATING_SINGLE=new an("FLOATING SINGLE");var H=function r(){this._precisionModel=new Z,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?k(arguments[0],ci)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Z&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},ka={serialVersionUID:{configurable:!0}};H.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new v(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new v(t.getMinX(),t.getMinY()),new v(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new v(t.getMinX(),t.getMinY()),new v(t.getMinX(),t.getMaxY()),new v(t.getMaxX(),t.getMaxY()),new v(t.getMaxX(),t.getMinY()),new v(t.getMinX(),t.getMinY())]),null)},H.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new dt(this.getCoordinateSequenceFactory().create(t),this);if(k(t,Q))return new dt(t,this)}else return new dt(this.getCoordinateSequenceFactory().create([]),this)},H.prototype.createMultiLineString=function(){if(arguments.length===0)return new Er(null,this);if(arguments.length===1){var t=arguments[0];return new Er(t,this)}},H.prototype.buildGeometry=function(t){for(var e=null,n=!1,i=!1,o=t.iterator();o.hasNext();){var s=o.next(),a=s.getClass();e===null&&(e=a),a!==e&&(n=!0),s.isGeometryCollectionOrDerived()&&(i=!0)}if(e===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(H.toGeometryArray(t));var u=t.iterator().next(),l=t.size()>1;if(l){if(u instanceof wt)return this.createMultiPolygon(H.toPolygonArray(t));if(u instanceof dt)return this.createMultiLineString(H.toLineStringArray(t));if(u instanceof pe)return this.createMultiPoint(H.toPointArray(t));q.shouldNeverReachHere("Unhandled class: "+u.getClass().getName())}return u},H.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},H.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof v){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(k(arguments[0],Q)){var e=arguments[0];return new pe(e,this)}}},H.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},H.prototype.createPolygon=function(){if(arguments.length===0)return new wt(null,null,this);if(arguments.length===1){if(k(arguments[0],Q)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}else if(arguments[0]instanceof Cn){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];return new wt(i,o,this)}},H.prototype.getSRID=function(){return this._SRID},H.prototype.createGeometryCollection=function(){if(arguments.length===0)return new $t(null,this);if(arguments.length===1){var t=arguments[0];return new $t(t,this)}},H.prototype.createGeometry=function(t){var e=new Be(this);return e.edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})},H.prototype.getPrecisionModel=function(){return this._precisionModel},H.prototype.createLinearRing=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)}else if(k(arguments[0],Q)){var e=arguments[0];return new Cn(e,this)}}},H.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Nn(null,this);if(arguments.length===1){var t=arguments[0];return new Nn(t,this)}},H.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Ei(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Ei(e,this)}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}else if(k(arguments[0],Q)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var o=new Array(i.size()).fill(null),s=0;s<i.size();s++){var a=t.getCoordinateSequenceFactory().create(1,i.getDimension());mt.copy(i,s,a,0,1),o[s]=t.createPoint(a)}return this.createMultiPoint(o)}}},H.prototype.interfaces_=function(){return[Te]},H.prototype.getClass=function(){return H},H.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.toGeometryArray=function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},H.getDefaultCoordinateSequenceFactory=function(){return xn.instance()},H.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},H.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},ka.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(H,ka);var oc=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ao=function(t){this.geometryFactory=t||new H};Ao.prototype.read=function(t){var e;typeof t=="string"?e=JSON.parse(t):e=t;var n=e.type;if(!un[n])throw new Error("Unknown GeoJSON type: "+e.type);return oc.indexOf(n)!==-1?un[n].apply(this,[e.coordinates]):n==="GeometryCollection"?un[n].apply(this,[e.geometries]):un[n].apply(this,[e])},Ao.prototype.write=function(t){var e=t.getGeometryType();if(!Un[e])throw new Error("Geometry is not supported");return Un[e].apply(this,[t])};var un={Feature:function(r){var t={};for(var e in r)t[e]=r[e];if(r.geometry){var n=r.geometry.type;if(!un[n])throw new Error("Unknown GeoJSON type: "+r.type);t.geometry=this.read(r.geometry)}return r.bbox&&(t.bbox=un.bbox.apply(this,[r.bbox])),t},FeatureCollection:function(r){var t=this,e={};if(r.features){e.features=[];for(var n=0;n<r.features.length;++n)e.features.push(t.read(r.features[n]))}return r.bbox&&(e.bbox=this.parse.bbox.apply(this,[r.bbox])),e},coordinates:function(r){for(var t=[],e=0;e<r.length;++e){var n=r[e];t.push(new v(n[0],n[1]))}return t},bbox:function(r){return this.geometryFactory.createLinearRing([new v(r[0],r[1]),new v(r[2],r[1]),new v(r[2],r[3]),new v(r[0],r[3]),new v(r[0],r[1])])},Point:function(r){var t=new v(r[0],r[1]);return this.geometryFactory.createPoint(t)},MultiPoint:function(r){for(var t=this,e=[],n=0;n<r.length;++n)e.push(un.Point.apply(t,[r[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(r){var t=un.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(t)},MultiLineString:function(r){for(var t=this,e=[],n=0;n<r.length;++n)e.push(un.LineString.apply(t,[r[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(r){for(var t=this,e=un.coordinates.apply(this,[r[0]]),n=this.geometryFactory.createLinearRing(e),i=[],o=1;o<r.length;++o){var s=r[o],a=un.coordinates.apply(t,[s]),u=t.geometryFactory.createLinearRing(a);i.push(u)}return this.geometryFactory.createPolygon(n,i)},MultiPolygon:function(r){for(var t=this,e=[],n=0;n<r.length;++n){var i=r[n];e.push(un.Polygon.apply(t,[i]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(r){for(var t=this,e=[],n=0;n<r.length;++n){var i=r[n];e.push(t.read(i))}return this.geometryFactory.createGeometryCollection(e)}},Un={coordinate:function(r){return[r.x,r.y]},Point:function(r){var t=Un.coordinate.apply(this,[r.getCoordinate()]);return{type:"Point",coordinates:t}},MultiPoint:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],o=Un.Point.apply(t,[i]);e.push(o.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(r){for(var t=this,e=[],n=r.getCoordinates(),i=0;i<n.length;++i){var o=n[i];e.push(Un.coordinate.apply(t,[o]))}return{type:"LineString",coordinates:e}},MultiLineString:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],o=Un.LineString.apply(t,[i]);e.push(o.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(r){var t=this,e=[],n=Un.LineString.apply(this,[r._shell]);e.push(n.coordinates);for(var i=0;i<r._holes.length;++i){var o=r._holes[i],s=Un.LineString.apply(t,[o]);e.push(s.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],o=Un.Polygon.apply(t,[i]);e.push(o.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(r){for(var t=this,e=[],n=0;n<r._geometries.length;++n){var i=r._geometries[n],o=i.getGeometryType();e.push(Un[o].apply(t,[i]))}return{type:"GeometryCollection",geometries:e}}},Ls=function(t){this.geometryFactory=t||new H,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Ao(this.geometryFactory)};Ls.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Z.FIXED&&this.reducePrecision(e),e},Ls.prototype.reducePrecision=function(t){var e=this,n,i;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(n=0,i=t.points.length;n<i;n++)e.precisionModel.makePrecise(t.points[n]);else if(t.geometries)for(n=0,i=t.geometries.length;n<i;n++)e.reducePrecision(t.geometries[n])};var za=function(){this.parser=new Ao(this.geometryFactory)};za.prototype.write=function(t){return this.parser.write(t)};var x=function(){},Fo={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};x.prototype.interfaces_=function(){return[]},x.prototype.getClass=function(){return x},x.opposite=function(t){return t===x.LEFT?x.RIGHT:t===x.RIGHT?x.LEFT:t},Fo.ON.get=function(){return 0},Fo.LEFT.get=function(){return 1},Fo.RIGHT.get=function(){return 2},Object.defineProperties(x,Fo);function Bo(r){this.message=r||""}Bo.prototype=new Error,Bo.prototype.name="EmptyStackException";function ln(){this.array_=[]}ln.prototype=new Ye,ln.prototype.add=function(r){return this.array_.push(r),!0},ln.prototype.get=function(r){if(r<0||r>=this.size())throw new Error;return this.array_[r]},ln.prototype.push=function(r){return this.array_.push(r),r},ln.prototype.pop=function(r){if(this.array_.length===0)throw new Bo;return this.array_.pop()},ln.prototype.peek=function(){if(this.array_.length===0)throw new Bo;return this.array_[this.array_.length-1]},ln.prototype.empty=function(){return this.array_.length===0},ln.prototype.isEmpty=function(){return this.empty()},ln.prototype.search=function(r){return this.array_.indexOf(r)},ln.prototype.size=function(){return this.array_.length},ln.prototype.toArray=function(){for(var r=this,t=[],e=0,n=this.array_.length;e<n;e++)t.push(r.array_[e]);return t};var cn=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};cn.prototype.getCoordinate=function(){return this._minCoord},cn.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},cn.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();q.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],i=R.computeOrientation(this._minCoord,n,e),o=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&i===R.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&i===R.CLOCKWISE)&&(o=!0),o&&(this._minIndex=this._minIndex-1)},cn.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge(),i=n.getCoordinates();if(e<0||e+1>=i.length||i[e].y===i[e+1].y)return-1;var o=x.LEFT;return i[e].y<i[e+1].y&&(o=x.RIGHT),o},cn.prototype.getEdge=function(){return this._orientedDe},cn.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),i=0;i<n.length-1;i++)(e._minCoord===null||n[i].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=i,e._minCoord=n[i])},cn.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),e=t.getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},cn.prototype.findEdge=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next();!i.isForward()||e.checkForRightmostCoordinate(i)}q.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;var o=this.getRightmostSide(this._minDe,this._minIndex);o===x.LEFT&&(this._orientedDe=this._minDe.getSym())},cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn};var qn=function(r){function t(e,n){r.call(this,t.msgWithCoord(e,n)),this.pt=n?new v(n):null,this.name="TopologyException"}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(n,i){return i?n:n+" [ "+i+" ]"},t}(Bn),Go=function(){this.array_=[]};Go.prototype.addLast=function(t){this.array_.push(t)},Go.prototype.removeFirst=function(){return this.array_.shift()},Go.prototype.isEmpty=function(){return this.array_.length===0};var te=function(){this._finder=null,this._dirEdgeList=new L,this._nodes=new L,this._rightMostCoord=null,this._env=null,this._finder=new cn};te.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.setVisited(!1)}},te.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},te.prototype.computeNodeDepth=function(t){for(var e=this,n=null,i=t.getEdges().iterator();i.hasNext();){var o=i.next();if(o.isVisited()||o.getSym().isVisited()){n=o;break}}if(n===null)throw new qn("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var s=t.getEdges().iterator();s.hasNext();){var a=s.next();a.setVisited(!0),e.copySymDepths(a)}},te.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(x.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},te.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},te.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(x.RIGHT)>=1&&e.getDepth(x.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},te.prototype.computeDepths=function(t){var e=this,n=new Is,i=new Go,o=t.getNode();for(i.addLast(o),n.add(o),t.setVisited(!0);!i.isEmpty();){var s=i.removeFirst();n.add(s),e.computeNodeDepth(s);for(var a=s.getEdges().iterator();a.hasNext();){var u=a.next(),l=u.getSym();if(!l.isVisited()){var c=l.getNode();n.contains(c)||(i.addLast(c),n.add(c))}}}},te.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},te.prototype.getEnvelope=function(){if(this._env===null){for(var t=new M,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),i=n.getEdge().getCoordinates(),o=0;o<i.length-1;o++)t.expandToInclude(i[o]);this._env=t}return this._env},te.prototype.addReachable=function(t){var e=this,n=new ln;for(n.add(t);!n.empty();){var i=n.pop();e.add(i,n)}},te.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(x.LEFT,t.getDepth(x.RIGHT)),e.setDepth(x.RIGHT,t.getDepth(x.LEFT))},te.prototype.add=function(t,e){var n=this;t.setVisited(!0),this._nodes.add(t);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();n._dirEdgeList.add(o);var s=o.getSym(),a=s.getNode();a.isVisited()||e.push(a)}},te.prototype.getNodes=function(){return this._nodes},te.prototype.getDirectedEdges=function(){return this._dirEdgeList},te.prototype.interfaces_=function(){return[De]},te.prototype.getClass=function(){return te};var ut=function r(){var t=this;if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[x.ON]=n}else if(arguments[0]instanceof r){var i=arguments[0];if(this.init(i.location.length),i!==null)for(var o=0;o<this.location.length;o++)t.location[o]=i.location[o]}}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this.init(3),this.location[x.ON]=s,this.location[x.LEFT]=a,this.location[x.RIGHT]=u}};ut.prototype.setAllLocations=function(t){for(var e=this,n=0;n<this.location.length;n++)e.location[n]=t},ut.prototype.isNull=function(){for(var t=this,e=0;e<this.location.length;e++)if(t.location[e]!==m.NONE)return!1;return!0},ut.prototype.setAllLocationsIfNull=function(t){for(var e=this,n=0;n<this.location.length;n++)e.location[n]===m.NONE&&(e.location[n]=t)},ut.prototype.isLine=function(){return this.location.length===1},ut.prototype.merge=function(t){var e=this;if(t.location.length>this.location.length){var n=new Array(3).fill(null);n[x.ON]=this.location[x.ON],n[x.LEFT]=m.NONE,n[x.RIGHT]=m.NONE,this.location=n}for(var i=0;i<this.location.length;i++)e.location[i]===m.NONE&&i<t.location.length&&(e.location[i]=t.location[i])},ut.prototype.getLocations=function(){return this.location},ut.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[x.LEFT];this.location[x.LEFT]=this.location[x.RIGHT],this.location[x.RIGHT]=t},ut.prototype.toString=function(){var t=new tn;return this.location.length>1&&t.append(m.toLocationSymbol(this.location[x.LEFT])),t.append(m.toLocationSymbol(this.location[x.ON])),this.location.length>1&&t.append(m.toLocationSymbol(this.location[x.RIGHT])),t.toString()},ut.prototype.setLocations=function(t,e,n){this.location[x.ON]=t,this.location[x.LEFT]=e,this.location[x.RIGHT]=n},ut.prototype.get=function(t){return t<this.location.length?this.location[t]:m.NONE},ut.prototype.isArea=function(){return this.location.length>1},ut.prototype.isAnyNull=function(){for(var t=this,e=0;e<this.location.length;e++)if(t.location[e]===m.NONE)return!0;return!1},ut.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(x.ON,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.location[e]=n}},ut.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(m.NONE)},ut.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},ut.prototype.allPositionsEqual=function(t){for(var e=this,n=0;n<this.location.length;n++)if(e.location[n]!==t)return!1;return!0},ut.prototype.interfaces_=function(){return[]},ut.prototype.getClass=function(){return ut};var nt=function r(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new ut(t),this.elt[1]=new ut(t)}else if(arguments[0]instanceof r){var e=arguments[0];this.elt[0]=new ut(e.elt[0]),this.elt[1]=new ut(e.elt[1])}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[0]=new ut(m.NONE),this.elt[1]=new ut(m.NONE),this.elt[n].setLocation(i)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new ut(o,s,a),this.elt[1]=new ut(o,s,a)}else if(arguments.length===4){var u=arguments[0],l=arguments[1],c=arguments[2],f=arguments[3];this.elt[0]=new ut(m.NONE,m.NONE,m.NONE),this.elt[1]=new ut(m.NONE,m.NONE,m.NONE),this.elt[u].setLocations(l,c,f)}};nt.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},nt.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},nt.prototype.isNull=function(t){return this.elt[t].isNull()},nt.prototype.setAllLocationsIfNull=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],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},nt.prototype.isLine=function(t){return this.elt[t].isLine()},nt.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)e.elt[n]===null&&t.elt[n]!==null?e.elt[n]=new ut(t.elt[n]):e.elt[n].merge(t.elt[n])},nt.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},nt.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(x.ON)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},nt.prototype.toString=function(){var t=new tn;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()},nt.prototype.isArea=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()}},nt.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},nt.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(x.ON,e)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];this.elt[n].setLocation(i,o)}},nt.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},nt.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},nt.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new ut(this.elt[t].location[0]))},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt},nt.toLineLabel=function(t){for(var e=new nt(m.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var Ct=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new L,this._pts=new L,this._label=new nt(m.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new L,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};Ct.prototype.computeRing=function(){var t=this;if(this._ring!==null)return null;for(var e=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)e[n]=t._pts.get(n);this._ring=this._geometryFactory.createLinearRing(e),this._isHole=R.isCCW(this._ring.getCoordinates())},Ct.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Ct.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,i=!0;do{if(n===null)throw new qn("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new qn("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var o=n.getLabel();q.isTrue(o.isArea()),e.mergeLabel(o),e.addPoints(n.getEdge(),n.isForward(),i),i=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},Ct.prototype.getLinearRing=function(){return this._ring},Ct.prototype.getCoordinate=function(t){return this._pts.get(t)},Ct.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode(),i=n.getEdges().getOutgoingDegree(t);i>t._maxNodeDegree&&(t._maxNodeDegree=i),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},Ct.prototype.addPoints=function(t,e,n){var i=this,o=t.getCoordinates();if(e){var s=1;n&&(s=0);for(var a=s;a<o.length;a++)i._pts.add(o[a])}else{var u=o.length-2;n&&(u=o.length-1);for(var l=u;l>=0;l--)i._pts.add(o[l])}},Ct.prototype.isHole=function(){return this._isHole},Ct.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},Ct.prototype.containsPoint=function(t){var e=this.getLinearRing(),n=e.getEnvelopeInternal();if(!n.contains(t)||!R.isPointInRing(t,e.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var o=i.next();if(o.containsPoint(t))return!1}return!0},Ct.prototype.addHole=function(t){this._holes.add(t)},Ct.prototype.isShell=function(){return this._shell===null},Ct.prototype.getLabel=function(){return this._label},Ct.prototype.getEdges=function(){return this._edges},Ct.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Ct.prototype.getShell=function(){return this._shell},Ct.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=e.getLocation(n,x.RIGHT);if(i===m.NONE)return null;if(this._label.getLocation(n)===m.NONE)return this._label.setLocation(n,i),null}},Ct.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},Ct.prototype.toPolygon=function(t){for(var e=this,n=new Array(this._holes.size()).fill(null),i=0;i<this._holes.size();i++)n[i]=e._holes.get(i).getLinearRing();var o=t.createPolygon(this.getLinearRing(),n);return o},Ct.prototype.interfaces_=function(){return[]},Ct.prototype.getClass=function(){return Ct};var sc=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.setEdgeRing=function(n,i){n.setMinEdgeRing(i)},t.prototype.getNext=function(n){return n.getNextMin()},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ct),ac=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.buildMinimalRings=function(){var n=this,i=new L,o=this._startDe;do{if(o.getMinEdgeRing()===null){var s=new sc(o,n._geometryFactory);i.add(s)}o=o.getNext()}while(o!==this._startDe);return i},t.prototype.setEdgeRing=function(n,i){n.setEdgeRing(i)},t.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var n=this,i=this._startDe;do{var o=i.getNode();o.getEdges().linkMinimalDirectedEdges(n),i=i.getNext()}while(i!==this._startDe)},t.prototype.getNext=function(n){return n.getNext()},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ct),Ce=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 t=arguments[0];this._label=t}}};Ce.prototype.setVisited=function(t){this._isVisited=t},Ce.prototype.setInResult=function(t){this._isInResult=t},Ce.prototype.isCovered=function(){return this._isCovered},Ce.prototype.isCoveredSet=function(){return this._isCoveredSet},Ce.prototype.setLabel=function(t){this._label=t},Ce.prototype.getLabel=function(){return this._label},Ce.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Ce.prototype.updateIM=function(t){q.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},Ce.prototype.isInResult=function(){return this._isInResult},Ce.prototype.isVisited=function(){return this._isVisited},Ce.prototype.interfaces_=function(){return[]},Ce.prototype.getClass=function(){return Ce};var ko=function(r){function t(){r.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new nt(0,m.NONE)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(n){},t.prototype.computeMergedLocation=function(n,i){var o=m.NONE;if(o=this._label.getLocation(i),!n.isNull(i)){var s=n.getLocation(i);o!==m.BOUNDARY&&(o=s)}return o},t.prototype.setLabel=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this._label===null?this._label=new nt(n,i):this._label.setLocation(n,i)}else return r.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof nt)for(var o=arguments[0],s=0;s<2;s++){var a=n.computeMergedLocation(o,s),u=n._label.getLocation(s);u===m.NONE&&n._label.setLocation(s,a)}},t.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},t.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var i=m.NONE;this._label!==null&&(i=this._label.getLocation(n));var o=null;switch(i){case m.BOUNDARY:o=m.INTERIOR;break;case m.INTERIOR:o=m.BOUNDARY;break;default:o=m.BOUNDARY;break}this._label.setLocation(n,o)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ce),fn=function(){this.nodeMap=new Ht,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};fn.prototype.find=function(t){return this.nodeMap.get(t)},fn.prototype.addNode=function(){if(arguments[0]instanceof v){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}else if(arguments[0]instanceof ko){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}},fn.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},fn.prototype.iterator=function(){return this.nodeMap.values().iterator()},fn.prototype.values=function(){return this.nodeMap.values()},fn.prototype.getBoundaryNodes=function(t){for(var e=new L,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===m.BOUNDARY&&e.add(i)}return e},fn.prototype.add=function(t){var e=t.getCoordinate(),n=this.addNode(e);n.add(t)},fn.prototype.interfaces_=function(){return[]},fn.prototype.getClass=function(){return fn};var ot=function(){},ro={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.isNorthern=function(t){return t===ot.NE||t===ot.NW},ot.isOpposite=function(t,e){if(t===e)return!1;var n=(t-e+4)%4;return n===2},ot.commonHalfPlane=function(t,e){if(t===e)return t;var n=(t-e+4)%4;if(n===2)return-1;var i=t<e?t:e,o=t>e?t:e;return i===0&&o===3?3:i},ot.isInHalfPlane=function(t,e){return e===ot.SE?t===ot.SE||t===ot.SW:t===e||t===e+1},ot.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new ft("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?ot.NE:ot.SE:e>=0?ot.NW:ot.SW}else if(arguments[0]instanceof v&&arguments[1]instanceof v){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new ft("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?ot.NE:ot.SE:i.y>=n.y?ot.NW:ot.SW}},ro.NE.get=function(){return 0},ro.NW.get=function(){return 1},ro.SW.get=function(){return 2},ro.SE.get=function(){return 3},Object.defineProperties(ot,ro);var Wt=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],n=arguments[1],i=arguments[2],o=null;this._edge=e,this.init(n,i),this._label=o}else if(arguments.length===4){var s=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3];this._edge=s,this.init(a,u),this._label=l}};Wt.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:R.computeOrientation(t._p0,t._p1,this._p1)},Wt.prototype.getDy=function(){return this._dy},Wt.prototype.getCoordinate=function(){return this._p0},Wt.prototype.setNode=function(t){this._node=t},Wt.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),o=n.substring(i+1);t.print(" "+o+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},Wt.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},Wt.prototype.getDirectedCoordinate=function(){return this._p1},Wt.prototype.getDx=function(){return this._dx},Wt.prototype.getLabel=function(){return this._label},Wt.prototype.getEdge=function(){return this._edge},Wt.prototype.getQuadrant=function(){return this._quadrant},Wt.prototype.getNode=function(){return this._node},Wt.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf("."),i=e.substring(n+1);return" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},Wt.prototype.computeLabel=function(t){},Wt.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=ot.quadrant(this._dx,this._dy),q.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Wt.prototype.interfaces_=function(){return[De]},Wt.prototype.getClass=function(){return Wt};var bs=function(r){function t(){var e=arguments[0],n=arguments[1];if(r.call(this,e),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],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var i=e.getNumPoints()-1;this.init(e.getCoordinate(i),e.getCoordinate(i-1))}this.computeDirectedLabel()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getNextMin=function(){return this._nextMin},t.prototype.getDepth=function(n){return this._depth[n]},t.prototype.setVisited=function(n){this._isVisited=n},t.prototype.computeDirectedLabel=function(){this._label=new nt(this._edge.getLabel()),this._isForward||this._label.flip()},t.prototype.getNext=function(){return this._next},t.prototype.setDepth=function(n,i){if(this._depth[n]!==-999&&this._depth[n]!==i)throw new qn("assigned depths do not match",this.getCoordinate());this._depth[n]=i},t.prototype.isInteriorAreaEdge=function(){for(var n=this,i=!0,o=0;o<2;o++)n._label.isArea(o)&&n._label.getLocation(o,x.LEFT)===m.INTERIOR&&n._label.getLocation(o,x.RIGHT)===m.INTERIOR||(i=!1);return i},t.prototype.setNextMin=function(n){this._nextMin=n},t.prototype.print=function(n){r.prototype.print.call(this,n),n.print(" "+this._depth[x.LEFT]+"/"+this._depth[x.RIGHT]),n.print(" ("+this.getDepthDelta()+")"),this._isInResult&&n.print(" inResult")},t.prototype.setMinEdgeRing=function(n){this._minEdgeRing=n},t.prototype.isLineEdge=function(){var n=this._label.isLine(0)||this._label.isLine(1),i=!this._label.isArea(0)||this._label.allPositionsEqual(0,m.EXTERIOR),o=!this._label.isArea(1)||this._label.allPositionsEqual(1,m.EXTERIOR);return n&&i&&o},t.prototype.setEdgeRing=function(n){this._edgeRing=n},t.prototype.getMinEdgeRing=function(){return this._minEdgeRing},t.prototype.getDepthDelta=function(){var n=this._edge.getDepthDelta();return this._isForward||(n=-n),n},t.prototype.setInResult=function(n){this._isInResult=n},t.prototype.getSym=function(){return this._sym},t.prototype.isForward=function(){return this._isForward},t.prototype.getEdge=function(){return this._edge},t.prototype.printEdge=function(n){this.print(n),n.print(" "),this._isForward?this._edge.print(n):this._edge.printReverse(n)},t.prototype.setSym=function(n){this._sym=n},t.prototype.setVisitedEdge=function(n){this.setVisited(n),this._sym.setVisited(n)},t.prototype.setEdgeDepths=function(n,i){var o=this.getEdge().getDepthDelta();this._isForward||(o=-o);var s=1;n===x.LEFT&&(s=-1);var a=x.opposite(n),u=o*s,l=i+u;this.setDepth(n,i),this.setDepth(a,l)},t.prototype.getEdgeRing=function(){return this._edgeRing},t.prototype.isInResult=function(){return this._isInResult},t.prototype.setNext=function(n){this._next=n},t.prototype.isVisited=function(){return this._isVisited},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.depthFactor=function(n,i){return n===m.EXTERIOR&&i===m.INTERIOR?1:n===m.INTERIOR&&i===m.EXTERIOR?-1:0},t}(Wt),Ii=function(){};Ii.prototype.createNode=function(t){return new ko(t,null)},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var gt=function(){if(this._edges=new L,this._nodes=null,this._edgeEndList=new L,arguments.length===0)this._nodes=new fn(new Ii);else if(arguments.length===1){var t=arguments[0];this._nodes=new fn(t)}};gt.prototype.printEdges=function(t){var e=this;t.println("Edges:");for(var n=0;n<this._edges.size();n++){t.println("edge "+n+":");var i=e._edges.get(n);i.print(t),i.eiList.print(t)}},gt.prototype.find=function(t){return this._nodes.find(t)},gt.prototype.addNode=function(){if(arguments[0]instanceof ko){var t=arguments[0];return this._nodes.addNode(t)}else if(arguments[0]instanceof v){var e=arguments[0];return this._nodes.addNode(e)}},gt.prototype.getNodeIterator=function(){return this._nodes.iterator()},gt.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){var e=t.next();e.getEdges().linkResultDirectedEdges()}},gt.prototype.debugPrintln=function(t){Bt.out.println(t)},gt.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(n===null)return!1;var i=n.getLabel();return i!==null&&i.getLocation(t)===m.BOUNDARY},gt.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){var e=t.next();e.getEdges().linkAllDirectedEdges()}},gt.prototype.matchInSameDirection=function(t,e,n,i){return t.equals(n)?R.computeOrientation(t,e,i)===R.COLLINEAR&&ot.quadrant(t,e)===ot.quadrant(n,i):!1},gt.prototype.getEdgeEnds=function(){return this._edgeEndList},gt.prototype.debugPrint=function(t){Bt.out.print(t)},gt.prototype.getEdgeIterator=function(){return this._edges.iterator()},gt.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,i=0;i<this._edges.size();i++){var o=n._edges.get(i),s=o.getCoordinates();if(n.matchInSameDirection(t,e,s[0],s[1])||n.matchInSameDirection(t,e,s[s.length-1],s[s.length-2]))return o}return null},gt.prototype.insertEdge=function(t){this._edges.add(t)},gt.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},gt.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next();e._edges.add(i);var o=new bs(i,!0),s=new bs(i,!1);o.setSym(s),s.setSym(o),e.add(o),e.add(s)}},gt.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},gt.prototype.getNodes=function(){return this._nodes.values()},gt.prototype.findEdge=function(t,e){for(var n=this,i=0;i<this._edges.size();i++){var o=n._edges.get(i),s=o.getCoordinates();if(t.equals(s[0])&&e.equals(s[1]))return o}return null},gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt},gt.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.getEdges().linkResultDirectedEdges()}};var de=function(){this._geometryFactory=null,this._shellList=new L;var t=arguments[0];this._geometryFactory=t};de.prototype.sortShellsAndHoles=function(t,e,n){for(var i=t.iterator();i.hasNext();){var o=i.next();o.isHole()?n.add(o):e.add(o)}},de.prototype.computePolygons=function(t){for(var e=this,n=new L,i=t.iterator();i.hasNext();){var o=i.next(),s=o.toPolygon(e._geometryFactory);n.add(s)}return n},de.prototype.placeFreeHoles=function(t,e){for(var n=this,i=e.iterator();i.hasNext();){var o=i.next();if(o.getShell()===null){var s=n.findEdgeRingContaining(o,t);if(s===null)throw new qn("unable to assign hole to a shell",o.getCoordinate(0));o.setShell(s)}}},de.prototype.buildMinimalEdgeRings=function(t,e,n){for(var i=this,o=new L,s=t.iterator();s.hasNext();){var a=s.next();if(a.getMaxNodeDegree()>2){a.linkDirectedEdgesForMinimalEdgeRings();var u=a.buildMinimalRings(),l=i.findShell(u);l!==null?(i.placePolygonHoles(l,u),e.add(l)):n.addAll(u)}else o.add(a)}return o},de.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){var n=e.next();if(n.containsPoint(t))return!0}return!1},de.prototype.buildMaximalEdgeRings=function(t){for(var e=this,n=new L,i=t.iterator();i.hasNext();){var o=i.next();if(o.isInResult()&&o.getLabel().isArea()&&o.getEdgeRing()===null){var s=new ac(o,e._geometryFactory);n.add(s),s.setInResult()}}return n},de.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}},de.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t},de.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),o=n.getCoordinateN(0),s=null,a=null,u=e.iterator();u.hasNext();){var l=u.next(),c=l.getLinearRing(),f=c.getEnvelopeInternal();s!==null&&(a=s.getLinearRing().getEnvelopeInternal());var h=!1;f.contains(i)&&R.isPointInRing(o,c.getCoordinates())&&(h=!0),h&&(s===null||a.contains(f))&&(s=l)}return s},de.prototype.findShell=function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var o=i.next();o.isHole()||(n=o,e++)}return q.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},de.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];gt.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),o=new L,s=this.buildMinimalEdgeRings(i,this._shellList,o);this.sortShellsAndHoles(s,this._shellList,o),this.placeFreeHoles(this._shellList,o)}},de.prototype.interfaces_=function(){return[]},de.prototype.getClass=function(){return de};var Ci=function(){};Ci.prototype.getBounds=function(){},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var je=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};je.prototype.getItem=function(){return this._item},je.prototype.getBounds=function(){return this._bounds},je.prototype.interfaces_=function(){return[Ci,Te]},je.prototype.getClass=function(){return je};var Xn=function(){this._size=null,this._items=null,this._size=0,this._items=new L,this._items.add(null)};Xn.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Xn.prototype.size=function(){return this._size},Xn.prototype.reorder=function(t){for(var e=this,n=null,i=this._items.get(t);t*2<=this._size&&(n=t*2,n!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(i)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,i)},Xn.prototype.clear=function(){this._size=0,this._items.clear()},Xn.prototype.isEmpty=function(){return this._size===0},Xn.prototype.add=function(t){var e=this;this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)e._items.set(n,e._items.get(Math.trunc(n/2)));this._items.set(n,t)},Xn.prototype.interfaces_=function(){return[]},Xn.prototype.getClass=function(){return Xn};var er=function(){};er.prototype.visitItem=function(t){},er.prototype.interfaces_=function(){return[]},er.prototype.getClass=function(){return er};var qr=function(){};qr.prototype.insert=function(t,e){},qr.prototype.remove=function(t,e){},qr.prototype.query=function(){},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr};var Lt=function(){if(this._childBoundables=new L,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},Va={serialVersionUID:{configurable:!0}};Lt.prototype.getLevel=function(){return this._level},Lt.prototype.size=function(){return this._childBoundables.size()},Lt.prototype.getChildBoundables=function(){return this._childBoundables},Lt.prototype.addChildBoundable=function(t){q.isTrue(this._bounds===null),this._childBoundables.add(t)},Lt.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Lt.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Lt.prototype.interfaces_=function(){return[Ci,Te]},Lt.prototype.getClass=function(){return Lt},Va.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Lt,Va);var Ke=function(){};Ke.reverseOrder=function(){return{compare:function(e,n){return n.compareTo(e)}}},Ke.min=function(t){return Ke.sort(t),t.get(0)},Ke.sort=function(t,e){var n=t.toArray();e?_r.sort(n,e):_r.sort(n);for(var i=t.iterator(),o=0,s=n.length;o<s;o++)i.next(),i.set(n[o])},Ke.singletonList=function(t){var e=new L;return e.add(t),e};var Nt=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};Nt.prototype.expandToQueue=function(t,e){var n=Nt.isComposite(this._boundable1),i=Nt.isComposite(this._boundable2);if(n&&i)return Nt.area(this._boundable1)>Nt.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new ft("neither boundable is composite")},Nt.prototype.isLeaves=function(){return!(Nt.isComposite(this._boundable1)||Nt.isComposite(this._boundable2))},Nt.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Nt.prototype.expand=function(t,e,n,i){for(var o=this,s=t.getChildBoundables(),a=s.iterator();a.hasNext();){var u=a.next(),l=new Nt(u,e,o._itemDistance);l.getDistance()<i&&n.add(l)}},Nt.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},Nt.prototype.getDistance=function(){return this._distance},Nt.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Nt.prototype.interfaces_=function(){return[De]},Nt.prototype.getClass=function(){return Nt},Nt.area=function(t){return t.getBounds().getArea()},Nt.isComposite=function(t){return t instanceof Lt};var Dt=function r(){if(this._root=null,this._built=!1,this._itemBoundables=new L,this._nodeCapacity=null,arguments.length===0){var t=r.DEFAULT_NODE_CAPACITY;this._nodeCapacity=t}else if(arguments.length===1){var e=arguments[0];q.isTrue(e>1,"Node capacity must be greater than 1"),this._nodeCapacity=e}},zo={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Dt.prototype.getNodeCapacity=function(){return this._nodeCapacity},Dt.prototype.lastNode=function(t){return t.get(t.size()-1)},Dt.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,i=e.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof Lt?n+=t.size(o):o instanceof je&&(n+=1)}return n}},Dt.prototype.removeItem=function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof je&&o.getItem()===e&&(n=o)}return n!==null?(t.getChildBoundables().remove(n),!0):!1},Dt.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new L:e}else if(arguments.length===1){for(var n=arguments[0],i=new L,o=n.getChildBoundables().iterator();o.hasNext();){var s=o.next();if(s instanceof Lt){var a=t.itemsTree(s);a!==null&&i.add(a)}else s instanceof je?i.add(s.getItem()):q.shouldNeverReachHere()}return i.size()<=0?null:i}},Dt.prototype.insert=function(t,e){q.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new je(t,e))},Dt.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new L;return this.boundablesAtLevel(e,this._root,n),n}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];if(q.isTrue(i>-2),o.getLevel()===i)return s.add(o),null;for(var a=o.getChildBoundables().iterator();a.hasNext();){var u=a.next();u instanceof Lt?t.boundablesAtLevel(i,u,s):(q.isTrue(u instanceof je),i===-1&&s.add(u))}return null}},Dt.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new L;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}else if(arguments.length===2){var i=arguments[0],o=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,o)}else if(arguments.length===3){if(k(arguments[2],er)&&arguments[0]instanceof Object&&arguments[1]instanceof Lt)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getChildBoundables(),c=0;c<l.size();c++){var f=l.get(c);!t.getIntersectsOp().intersects(f.getBounds(),s)||(f instanceof Lt?t.query(s,f,u):f instanceof je?u.visitItem(f.getItem()):q.shouldNeverReachHere())}else if(k(arguments[2],Ye)&&arguments[0]instanceof Object&&arguments[1]instanceof Lt)for(var h=arguments[0],g=arguments[1],p=arguments[2],y=g.getChildBoundables(),d=0;d<y.size();d++){var _=y.get(d);!t.getIntersectsOp().intersects(_.getBounds(),h)||(_ instanceof Lt?t.query(h,_,p):_ instanceof je?p.add(_.getItem()):q.shouldNeverReachHere())}}},Dt.prototype.build=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},Dt.prototype.getRoot=function(){return this.build(),this._root},Dt.prototype.remove=function(){var t=this;if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.build(),this.getIntersectsOp().intersects(this._root.getBounds(),e)?this.remove(e,this._root,n):!1}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2],a=this.removeItem(o,s);if(a)return!0;for(var u=null,l=o.getChildBoundables().iterator();l.hasNext();){var c=l.next();if(!!t.getIntersectsOp().intersects(c.getBounds(),i)&&c instanceof Lt&&(a=t.remove(i,c,s),a)){u=c;break}}return u!==null&&u.getChildBoundables().isEmpty()&&o.getChildBoundables().remove(u),a}},Dt.prototype.createHigherLevels=function(t,e){q.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return n.size()===1?n.get(0):this.createHigherLevels(n,e+1)},Dt.prototype.depth=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,i=e.getChildBoundables().iterator();i.hasNext();){var o=i.next();if(o instanceof Lt){var s=t.depth(o);s>n&&(n=s)}}return n+1}},Dt.prototype.createParentBoundables=function(t,e){var n=this;q.isTrue(!t.isEmpty());var i=new L;i.add(this.createNode(e));var o=new L(t);Ke.sort(o,this.getComparator());for(var s=o.iterator();s.hasNext();){var a=s.next();n.lastNode(i).getChildBoundables().size()===n.getNodeCapacity()&&i.add(n.createNode(e)),n.lastNode(i).addChildBoundable(a)}return i},Dt.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Dt.prototype.interfaces_=function(){return[Te]},Dt.prototype.getClass=function(){return Dt},Dt.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},zo.IntersectsOp.get=function(){return uc},zo.serialVersionUID.get=function(){return-3886435814360241e3},zo.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Dt,zo);var uc=function(){},Ni=function(){};Ni.prototype.distance=function(t,e){},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var Ua=function(r){function t(n){n=n||t.DEFAULT_NODE_CAPACITY,r.call(this,n)}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return t.prototype.createParentBoundablesFromVerticalSlices=function(i,o){var s=this;q.isTrue(i.length>0);for(var a=new L,u=0;u<i.length;u++)a.addAll(s.createParentBoundablesFromVerticalSlice(i[u],o));return a},t.prototype.createNode=function(i){return new qa(i)},t.prototype.size=function(){return arguments.length===0?r.prototype.size.call(this):r.prototype.size.apply(this,arguments)},t.prototype.insert=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];if(i.isNull())return null;r.prototype.insert.call(this,i,o)}else return r.prototype.insert.apply(this,arguments)},t.prototype.getIntersectsOp=function(){return t.intersectsOp},t.prototype.verticalSlices=function(i,o){for(var s=Math.trunc(Math.ceil(i.size()/o)),a=new Array(o).fill(null),u=i.iterator(),l=0;l<o;l++){a[l]=new L;for(var c=0;u.hasNext()&&c<s;){var f=u.next();a[l].add(f),c++}}return a},t.prototype.query=function(){if(arguments.length===1){var i=arguments[0];return r.prototype.query.call(this,i)}else if(arguments.length===2){var o=arguments[0],s=arguments[1];r.prototype.query.call(this,o,s)}else if(arguments.length===3){if(k(arguments[2],er)&&arguments[0]instanceof Object&&arguments[1]instanceof Lt){var a=arguments[0],u=arguments[1],l=arguments[2];r.prototype.query.call(this,a,u,l)}else if(k(arguments[2],Ye)&&arguments[0]instanceof Object&&arguments[1]instanceof Lt){var c=arguments[0],f=arguments[1],h=arguments[2];r.prototype.query.call(this,c,f,h)}}},t.prototype.getComparator=function(){return t.yComparator},t.prototype.createParentBoundablesFromVerticalSlice=function(i,o){return r.prototype.createParentBoundables.call(this,i,o)},t.prototype.remove=function(){if(arguments.length===2){var i=arguments[0],o=arguments[1];return r.prototype.remove.call(this,i,o)}else return r.prototype.remove.apply(this,arguments)},t.prototype.depth=function(){return arguments.length===0?r.prototype.depth.call(this):r.prototype.depth.apply(this,arguments)},t.prototype.createParentBoundables=function(i,o){q.isTrue(!i.isEmpty());var s=Math.trunc(Math.ceil(i.size()/this.getNodeCapacity())),a=new L(i);Ke.sort(a,t.xComparator);var u=this.verticalSlices(a,Math.trunc(Math.ceil(Math.sqrt(s))));return this.createParentBoundablesFromVerticalSlices(u,o)},t.prototype.nearestNeighbour=function(){if(arguments.length===1){if(k(arguments[0],Ni)){var i=arguments[0],o=new Nt(this.getRoot(),this.getRoot(),i);return this.nearestNeighbour(o)}else if(arguments[0]instanceof Nt){var s=arguments[0];return this.nearestNeighbour(s,V.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof t&&k(arguments[1],Ni)){var a=arguments[0],u=arguments[1],l=new Nt(this.getRoot(),a.getRoot(),u);return this.nearestNeighbour(l)}else if(arguments[0]instanceof Nt&&typeof arguments[1]=="number"){var c=arguments[0],f=arguments[1],h=f,g=null,p=new Xn;for(p.add(c);!p.isEmpty()&&h>0;){var y=p.poll(),d=y.getDistance();if(d>=h)break;y.isLeaves()?(h=d,g=y):y.expandToQueue(p,h)}return[g.getBoundable(0).getItem(),g.getBoundable(1).getItem()]}}else if(arguments.length===3){var _=arguments[0],I=arguments[1],N=arguments[2],C=new je(_,I),b=new Nt(this.getRoot(),C,N);return this.nearestNeighbour(b)[0]}},t.prototype.interfaces_=function(){return[qr,Te]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,o){return(i+o)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},e.STRtreeNode.get=function(){return qa},e.serialVersionUID.get=function(){return 0x39920f7d5f261e0},e.xComparator.get=function(){return{interfaces_:function(){return[li]},compare:function(n,i){return r.compareDoubles(t.centreX(n.getBounds()),t.centreX(i.getBounds()))}}},e.yComparator.get=function(){return{interfaces_:function(){return[li]},compare:function(n,i){return r.compareDoubles(t.centreY(n.getBounds()),t.centreY(i.getBounds()))}}},e.intersectsOp.get=function(){return{interfaces_:function(){return[r.IntersectsOp]},intersects:function(n,i){return n.intersects(i)}}},e.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,e),t}(Dt),qa=function(r){function t(){var e=arguments[0];r.call(this,e)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var o=i.next();n===null?n=new M(o.getBounds()):n.expandToInclude(o.getBounds())}return n},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Lt),le=function(){};le.prototype.interfaces_=function(){return[]},le.prototype.getClass=function(){return le},le.relativeSign=function(t,e){return t<e?-1:t>e?1:0},le.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=le.relativeSign(e.x,n.x),o=le.relativeSign(e.y,n.y);switch(t){case 0:return le.compareValue(i,o);case 1:return le.compareValue(o,i);case 2:return le.compareValue(o,-i);case 3:return le.compareValue(-i,o);case 4:return le.compareValue(-i,-o);case 5:return le.compareValue(-o,-i);case 6:return le.compareValue(-o,i);case 7:return le.compareValue(i,-o)}return q.shouldNeverReachHere("invalid octant value"),0},le.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var nr=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new v(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))};nr.prototype.getCoordinate=function(){return this.coord},nr.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},nr.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:le.compare(this._segmentOctant,this.coord,e.coord)},nr.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},nr.prototype.isInterior=function(){return this._isInterior},nr.prototype.interfaces_=function(){return[De]},nr.prototype.getClass=function(){return nr};var ee=function(){this._nodeMap=new Ht,this._edge=null;var t=arguments[0];this._edge=t};ee.prototype.getSplitCoordinates=function(){var t=this,e=new Ki;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var o=n.next();t.addEdgeCoordinates(i,o,e),i=o}return e.toCoordinateArray()},ee.prototype.addCollapsedNodes=function(){var t=this,e=new L;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var n=e.iterator();n.hasNext();){var i=n.next().intValue();t.add(t._edge.getCoordinate(i),i)}},ee.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},ee.prototype.findCollapsesFromExistingVertices=function(t){for(var e=this,n=0;n<this._edge.size()-2;n++){var i=e._edge.getCoordinate(n),o=e._edge.getCoordinate(n+2);i.equals2D(o)&&t.add(new en(n+1))}},ee.prototype.addEdgeCoordinates=function(t,e,n){var i=this,o=this._edge.getCoordinate(e.segmentIndex),s=e.isInterior()||!e.coord.equals2D(o);n.add(new v(t.coord),!1);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)n.add(i._edge.getCoordinate(a));s&&n.add(new v(e.coord))},ee.prototype.iterator=function(){return this._nodeMap.values().iterator()},ee.prototype.addSplitEdges=function(t){var e=this;this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var o=n.next(),s=e.createSplitEdge(i,o);t.add(s),i=o}},ee.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,i===1?(n[0]=t.segmentIndex+1,!0):!1},ee.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=this,n=new Array(1).fill(null),i=this.iterator(),o=i.next();i.hasNext();){var s=i.next(),a=e.findCollapseIndex(o,s,n);a&&t.add(new en(n[0])),o=s}},ee.prototype.getEdge=function(){return this._edge},ee.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},ee.prototype.createSplitEdge=function(t,e){var n=this,i=e.segmentIndex-t.segmentIndex+2,o=this._edge.getCoordinate(e.segmentIndex),s=e.isInterior()||!e.coord.equals2D(o);s||i--;var a=new Array(i).fill(null),u=0;a[u++]=new v(t.coord);for(var l=t.segmentIndex+1;l<=e.segmentIndex;l++)a[u++]=n._edge.getCoordinate(l);return s&&(a[u]=new v(e.coord)),new Et(a,this._edge.getData())},ee.prototype.add=function(t,e){var n=new nr(this._edge,t,e,this._edge.getSegmentOctant(e)),i=this._nodeMap.get(n);return i!==null?(q.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)},ee.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0),i=n.getCoordinate(0);if(!i.equals2D(e[0]))throw new Bn("bad split edge start point at "+i);var o=t.get(t.size()-1),s=o.getCoordinates(),a=s[s.length-1];if(!a.equals2D(e[e.length-1]))throw new Bn("bad split edge end point at "+a)},ee.prototype.interfaces_=function(){return[]},ee.prototype.getClass=function(){return ee};var Xr=function(){};Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new ft("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),i=Math.abs(e);return t>=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}else if(arguments[0]instanceof v&&arguments[1]instanceof v){var o=arguments[0],s=arguments[1],a=s.x-o.x,u=s.y-o.y;if(a===0&&u===0)throw new ft("Cannot compute the octant for two identical points "+o);return Xr.octant(a,u)}};var Sn=function(){};Sn.prototype.getCoordinates=function(){},Sn.prototype.size=function(){},Sn.prototype.getCoordinate=function(t){},Sn.prototype.isClosed=function(){},Sn.prototype.setData=function(t){},Sn.prototype.getData=function(){},Sn.prototype.interfaces_=function(){return[]},Sn.prototype.getClass=function(){return Sn};var io=function(){};io.prototype.addIntersection=function(t,e){},io.prototype.interfaces_=function(){return[Sn]},io.prototype.getClass=function(){return io};var Et=function(){this._nodeList=new ee(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Et.prototype.getCoordinates=function(){return this._pts},Et.prototype.size=function(){return this._pts.length},Et.prototype.getCoordinate=function(t){return this._pts[t]},Et.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Et.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Et.prototype.setData=function(t){this._data=t},Et.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Xr.octant(t,e)},Et.prototype.getData=function(){return this._data},Et.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],o=arguments[3],s=new v(n.getIntersection(o));this.addIntersection(s,i)}},Et.prototype.toString=function(){return Xe.toLineString(new _t(this._pts))},Et.prototype.getNodeList=function(){return this._nodeList},Et.prototype.addIntersectionNode=function(t,e){var n=e,i=n+1;if(i<this._pts.length){var o=this._pts[i];t.equals2D(o)&&(n=i)}var s=this._nodeList.add(t,n);return s},Et.prototype.addIntersections=function(t,e,n){for(var i=this,o=0;o<t.getIntersectionNum();o++)i.addIntersection(t,e,n,o)},Et.prototype.interfaces_=function(){return[io]},Et.prototype.getClass=function(){return Et},Et.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],e=new L;return Et.getNodedSubstrings(t,e),e}else if(arguments.length===2)for(var n=arguments[0],i=arguments[1],o=n.iterator();o.hasNext();){var s=o.next();s.getNodeList().addSplitEdges(i)}};var A=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new v,this.p1=new v;else if(arguments.length===1){var t=arguments[0];this.p0=new v(t.p0),this.p1=new v(t.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var e=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this.p0=new v(e,n),this.p1=new v(i,o)}},Xa={serialVersionUID:{configurable:!0}};A.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},A.prototype.orientationIndex=function(){if(arguments[0]instanceof A){var t=arguments[0],e=R.orientationIndex(this.p0,this.p1,t.p0),n=R.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}else if(arguments[0]instanceof v){var i=arguments[0];return R.orientationIndex(this.p0,this.p1,i)}},A.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},A.prototype.isVertical=function(){return this.p0.x===this.p1.x},A.prototype.equals=function(t){if(!(t instanceof A))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},A.prototype.intersection=function(t){var e=new yr;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},A.prototype.project=function(){if(arguments[0]instanceof v){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new v(t);var e=this.projectionFactor(t),n=new v;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}else if(arguments[0]instanceof A){var i=arguments[0],o=this.projectionFactor(i.p0),s=this.projectionFactor(i.p1);if(o>=1&&s>=1||o<=0&&s<=0)return null;var a=this.project(i.p0);o<0&&(a=this.p0),o>1&&(a=this.p1);var u=this.project(i.p1);return s<0&&(u=this.p0),s>1&&(u=this.p1),new A(a,u)}},A.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},A.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},A.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},A.prototype.distancePerpendicular=function(t){return R.distancePointLinePerpendicular(t,this.p0,this.p1)},A.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},A.prototype.midPoint=function(){return A.midPoint(this.p0,this.p1)},A.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;if(i<=0)return V.NaN;var o=((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i;return o},A.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),i=V.MAX_VALUE,o=null,s=this.closestPoint(t.p0);i=s.distance(t.p0),n[0]=s,n[1]=t.p0;var a=this.closestPoint(t.p1);o=a.distance(t.p1),o<i&&(i=o,n[0]=a,n[1]=t.p1);var u=t.closestPoint(this.p0);o=u.distance(this.p0),o<i&&(i=o,n[0]=this.p0,n[1]=u);var l=t.closestPoint(this.p1);return o=l.distance(this.p1),o<i&&(i=o,n[0]=this.p1,n[1]=l),n},A.prototype.closestPoint=function(t){var e=this.projectionFactor(t);if(e>0&&e<1)return this.project(t);var n=this.p0.distance(t),i=this.p1.distance(t);return n<i?this.p0:this.p1},A.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},A.prototype.getLength=function(){return this.p0.distance(this.p1)},A.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return n!==0?n:this.p1.compareTo(e.p1)},A.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},A.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},A.prototype.lineIntersection=function(t){try{var e=qe.intersection(this.p0,this.p1,t.p0,t.p1);return e}catch(n){if(!(n instanceof fi))throw n}finally{}return null},A.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},A.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),i=this.p0.y+t*(this.p1.y-this.p0.y),o=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,a=Math.sqrt(o*o+s*s),u=0,l=0;if(e!==0){if(a<=0)throw new Error("Cannot compute offset from zero-length line segment");u=e*o/a,l=e*s/a}var c=n-l,f=i+u,h=new v(c,f);return h},A.prototype.setCoordinates=function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},A.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||V.isNaN(e))&&(e=1),e},A.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},A.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},A.prototype.distance=function(){if(arguments[0]instanceof A){var t=arguments[0];return R.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof v){var e=arguments[0];return R.distancePointLine(e,this.p0,this.p1)}},A.prototype.pointAlong=function(t){var e=new v;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},A.prototype.hashCode=function(){var t=V.doubleToLongBits(this.p0.x);t^=V.doubleToLongBits(this.p0.y)*31;var e=Math.trunc(t)^Math.trunc(t>>32),n=V.doubleToLongBits(this.p1.x);n^=V.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(n)^Math.trunc(n>>32);return e^i},A.prototype.interfaces_=function(){return[De,Te]},A.prototype.getClass=function(){return A},A.midPoint=function(t,e){return new v((t.x+e.x)/2,(t.y+e.y)/2)},Xa.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(A,Xa);var oo=function(){this.tempEnv1=new M,this.tempEnv2=new M,this._overlapSeg1=new A,this._overlapSeg2=new A};oo.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo};var ve=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i};ve.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},ve.prototype.computeSelect=function(t,e,n,i){var o=this._pts[e],s=this._pts[n];if(i.tempEnv1.init(o,s),n-e===1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var a=Math.trunc((e+n)/2);e<a&&this.computeSelect(t,e,a,i),a<n&&this.computeSelect(t,a,n,i)},ve.prototype.getCoordinates=function(){for(var t=this,e=new Array(this._end-this._start+1).fill(null),n=0,i=this._start;i<=this._end;i++)e[n++]=t._pts[i];return e},ve.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},ve.prototype.setId=function(t){this._id=t},ve.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},ve.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],e=this._pts[this._end];this._env=new M(t,e)}return this._env},ve.prototype.getEndIndex=function(){return this._end},ve.prototype.getStartIndex=function(){return this._start},ve.prototype.getContext=function(){return this._context},ve.prototype.getId=function(){return this._id},ve.prototype.computeOverlapsInternal=function(t,e,n,i,o,s){var a=this._pts[t],u=this._pts[e],l=n._pts[i],c=n._pts[o];if(e-t===1&&o-i===1)return s.overlap(this,t,n,i),null;if(s.tempEnv1.init(a,u),s.tempEnv2.init(l,c),!s.tempEnv1.intersects(s.tempEnv2))return null;var f=Math.trunc((t+e)/2),h=Math.trunc((i+o)/2);t<f&&(i<h&&this.computeOverlapsInternal(t,f,n,i,h,s),h<o&&this.computeOverlapsInternal(t,f,n,h,o,s)),f<e&&(i<h&&this.computeOverlapsInternal(f,e,n,i,h,s),h<o&&this.computeOverlapsInternal(f,e,n,h,o,s))},ve.prototype.interfaces_=function(){return[]},ve.prototype.getClass=function(){return ve};var hn=function(){};hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn},hn.getChainStartIndices=function(t){var e=0,n=new L;n.add(new en(e));do{var i=hn.findChainEnd(t,e);n.add(new en(i)),e=i}while(e<t.length-1);var o=hn.toIntArray(n);return o},hn.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var i=ot.quadrant(t[n],t[n+1]),o=e+1;o<t.length;){if(!t[o-1].equals2D(t[o])){var s=ot.quadrant(t[o-1],t[o]);if(s!==i)break}o++}return o-1},hn.getChains=function(){if(arguments.length===1){var t=arguments[0];return hn.getChains(t,null)}else if(arguments.length===2){for(var e=arguments[0],n=arguments[1],i=new L,o=hn.getChainStartIndices(e),s=0;s<o.length-1;s++){var a=new ve(e,o[s],o[s+1],n);i.add(a)}return i}},hn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Ir=function(){};Ir.prototype.computeNodes=function(t){},Ir.prototype.getNodedSubstrings=function(){},Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir};var so=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};so.prototype.setSegmentIntersector=function(t){this._segInt=t},so.prototype.interfaces_=function(){return[Ir]},so.prototype.getClass=function(){return so};var Ps=function(r){function t(n){n?r.call(this,n):r.call(this),this._monoChains=new L,this._index=new Ua,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t;var e={SegmentOverlapAction:{configurable:!0}};return t.prototype.getMonotoneChains=function(){return this._monoChains},t.prototype.getNodedSubstrings=function(){return Et.getNodedSubstrings(this._nodedSegStrings)},t.prototype.getIndex=function(){return this._index},t.prototype.add=function(i){for(var o=this,s=hn.getChains(i.getCoordinates(),i),a=s.iterator();a.hasNext();){var u=a.next();u.setId(o._idCounter++),o._index.insert(u.getEnvelope(),u),o._monoChains.add(u)}},t.prototype.computeNodes=function(i){var o=this;this._nodedSegStrings=i;for(var s=i.iterator();s.hasNext();)o.add(s.next());this.intersectChains()},t.prototype.intersectChains=function(){for(var i=this,o=new Ya(this._segInt),s=this._monoChains.iterator();s.hasNext();)for(var a=s.next(),u=i._index.query(a.getEnvelope()),l=u.iterator();l.hasNext();){var c=l.next();if(c.getId()>a.getId()&&(a.computeOverlaps(c,o),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.SegmentOverlapAction.get=function(){return Ya},Object.defineProperties(t,e),t}(so),Ya=function(r){function t(){r.call(this),this._si=null;var e=arguments[0];this._si=e}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=n.getContext(),u=o.getContext();this._si.processIntersections(a,i,u,s)}else return r.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(oo),$=function r(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.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],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}}},Yn={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};$.prototype.getEndCapStyle=function(){return this._endCapStyle},$.prototype.isSingleSided=function(){return this._isSingleSided},$.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=$.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=$.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==$.JOIN_ROUND&&(this._quadrantSegments=$.DEFAULT_QUADRANT_SEGMENTS)},$.prototype.getJoinStyle=function(){return this._joinStyle},$.prototype.setJoinStyle=function(t){this._joinStyle=t},$.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},$.prototype.getSimplifyFactor=function(){return this._simplifyFactor},$.prototype.getQuadrantSegments=function(){return this._quadrantSegments},$.prototype.setEndCapStyle=function(t){this._endCapStyle=t},$.prototype.getMitreLimit=function(){return this._mitreLimit},$.prototype.setMitreLimit=function(t){this._mitreLimit=t},$.prototype.setSingleSided=function(t){this._isSingleSided=t},$.prototype.interfaces_=function(){return[]},$.prototype.getClass=function(){return $},$.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Yn.CAP_ROUND.get=function(){return 1},Yn.CAP_FLAT.get=function(){return 2},Yn.CAP_SQUARE.get=function(){return 3},Yn.JOIN_ROUND.get=function(){return 1},Yn.JOIN_MITRE.get=function(){return 2},Yn.JOIN_BEVEL.get=function(){return 3},Yn.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Yn.DEFAULT_MITRE_LIMIT.get=function(){return 5},Yn.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties($,Yn);var vt=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=R.COUNTERCLOCKWISE,this._inputLine=t||null},ao={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};vt.prototype.isDeletable=function(t,e,n,i){var o=this._inputLine[t],s=this._inputLine[e],a=this._inputLine[n];return!this.isConcave(o,s,a)||!this.isShallow(o,s,a,i)?!1:this.isShallowSampled(o,s,t,n,i)},vt.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),i=this.findNextNonDeletedIndex(n),o=!1;i<this._inputLine.length;){var s=!1;t.isDeletable(e,n,i,t._distanceTol)&&(t._isDeleted[n]=vt.DELETE,s=!0,o=!0),s?e=i:e=n,n=t.findNextNonDeletedIndex(e),i=t.findNextNonDeletedIndex(n)}return o},vt.prototype.isShallowConcavity=function(t,e,n,i){var o=R.computeOrientation(t,e,n),s=o===this._angleOrientation;if(!s)return!1;var a=R.distancePointLine(e,t,n);return a<i},vt.prototype.isShallowSampled=function(t,e,n,i,o){var s=this,a=Math.trunc((i-n)/vt.NUM_PTS_TO_CHECK);a<=0&&(a=1);for(var u=n;u<i;u+=a)if(!s.isShallow(t,e,s._inputLine[u],o))return!1;return!0},vt.prototype.isConcave=function(t,e,n){var i=R.computeOrientation(t,e,n),o=i===this._angleOrientation;return o},vt.prototype.simplify=function(t){var e=this;this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=R.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var n=!1;do n=e.deleteShallowConcavities();while(n);return this.collapseLine()},vt.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===vt.DELETE;)e++;return e},vt.prototype.isShallow=function(t,e,n,i){var o=R.distancePointLine(e,t,n);return o<i},vt.prototype.collapseLine=function(){for(var t=this,e=new Ki,n=0;n<this._inputLine.length;n++)t._isDeleted[n]!==vt.DELETE&&e.add(t._inputLine[n]);return e.toCoordinateArray()},vt.prototype.interfaces_=function(){return[]},vt.prototype.getClass=function(){return vt},vt.simplify=function(t,e){var n=new vt(t);return n.simplify(e)},ao.INIT.get=function(){return 0},ao.DELETE.get=function(){return 1},ao.KEEP.get=function(){return 1},ao.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(vt,ao);var Ne=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new L},Ha={COORDINATE_ARRAY_TYPE:{configurable:!0}};Ne.prototype.getCoordinates=function(){var t=this._ptList.toArray(Ne.COORDINATE_ARRAY_TYPE);return t},Ne.prototype.setPrecisionModel=function(t){this._precisionModel=t},Ne.prototype.addPt=function(t){var e=new v(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Ne.prototype.revere=function(){},Ne.prototype.addPts=function(t,e){var n=this;if(e)for(var i=0;i<t.length;i++)n.addPt(t[i]);else for(var o=t.length-1;o>=0;o--)n.addPt(t[o])},Ne.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1),n=t.distance(e);return n<this._minimimVertexDistance},Ne.prototype.toString=function(){var t=new H,e=t.createLineString(this.getCoordinates());return e.toString()},Ne.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new v(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Ne.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Ne.prototype.interfaces_=function(){return[]},Ne.prototype.getClass=function(){return Ne},Ha.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Ne,Ha);var K=function(){},Yr={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};K.prototype.interfaces_=function(){return[]},K.prototype.getClass=function(){return K},K.toDegrees=function(t){return t*180/Math.PI},K.normalize=function(t){for(;t>Math.PI;)t-=K.PI_TIMES_2;for(;t<=-Math.PI;)t+=K.PI_TIMES_2;return t},K.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=n.x-e.x,o=n.y-e.y;return Math.atan2(o,i)}},K.isAcute=function(t,e,n){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,u=i*s+o*a;return u>0},K.isObtuse=function(t,e,n){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,u=i*s+o*a;return u<0},K.interiorAngle=function(t,e,n){var i=K.angle(e,t),o=K.angle(e,n);return Math.abs(o-i)},K.normalizePositive=function(t){if(t<0){for(;t<0;)t+=K.PI_TIMES_2;t>=K.PI_TIMES_2&&(t=0)}else{for(;t>=K.PI_TIMES_2;)t-=K.PI_TIMES_2;t<0&&(t=0)}return t},K.angleBetween=function(t,e,n){var i=K.angle(e,t),o=K.angle(e,n);return K.diff(i,o)},K.diff=function(t,e){var n=null;return t<e?n=e-t:n=t-e,n>Math.PI&&(n=2*Math.PI-n),n},K.toRadians=function(t){return t*Math.PI/180},K.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?K.COUNTERCLOCKWISE:n<0?K.CLOCKWISE:K.NONE},K.angleBetweenOriented=function(t,e,n){var i=K.angle(e,t),o=K.angle(e,n),s=o-i;return s<=-Math.PI?s+K.PI_TIMES_2:s>Math.PI?s-K.PI_TIMES_2:s},Yr.PI_TIMES_2.get=function(){return 2*Math.PI},Yr.PI_OVER_2.get=function(){return Math.PI/2},Yr.PI_OVER_4.get=function(){return Math.PI/4},Yr.COUNTERCLOCKWISE.get=function(){return R.COUNTERCLOCKWISE},Yr.CLOCKWISE.get=function(){return R.CLOCKWISE},Yr.NONE.get=function(){return R.COLLINEAR},Object.defineProperties(K,Yr);var ct=function r(){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 A,this._seg1=new A,this._offset0=new A,this._offset1=new A,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new yr,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===$.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},uo={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};ct.prototype.addNextSegment=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 n=R.computeOrientation(this._s0,this._s1,this._s2),i=n===R.CLOCKWISE&&this._side===x.LEFT||n===R.COUNTERCLOCKWISE&&this._side===x.RIGHT;n===0?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},ct.prototype.addLineEndCap=function(t,e){var n=new A(t,e),i=new A;this.computeOffsetSegment(n,x.LEFT,this._distance,i);var o=new A;this.computeOffsetSegment(n,x.RIGHT,this._distance,o);var s=e.x-t.x,a=e.y-t.y,u=Math.atan2(a,s);switch(this._bufParams.getEndCapStyle()){case $.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(e,u+Math.PI/2,u-Math.PI/2,R.CLOCKWISE,this._distance),this._segList.addPt(o.p1);break;case $.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(o.p1);break;case $.CAP_SQUARE:var l=new v;l.x=Math.abs(this._distance)*Math.cos(u),l.y=Math.abs(this._distance)*Math.sin(u);var c=new v(i.p1.x+l.x,i.p1.y+l.y),f=new v(o.p1.x+l.x,o.p1.y+l.y);this._segList.addPt(c),this._segList.addPt(f);break}},ct.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t},ct.prototype.addMitreJoin=function(t,e,n,i){var o=!0,s=null;try{s=qe.intersection(e.p0,e.p1,n.p0,n.p1);var a=i<=0?1:s.distance(t)/Math.abs(i);a>this._bufParams.getMitreLimit()&&(o=!1)}catch(u){if(u instanceof fi)s=new v(0,0),o=!1;else throw u}finally{}o?this._segList.addPt(s):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},ct.prototype.addFilletCorner=function(t,e,n,i,o){var s=e.x-t.x,a=e.y-t.y,u=Math.atan2(a,s),l=n.x-t.x,c=n.y-t.y,f=Math.atan2(c,l);i===R.CLOCKWISE?u<=f&&(u+=2*Math.PI):u>=f&&(u-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,u,f,i,o),this._segList.addPt(n)},ct.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*ct.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===$.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===$.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},ct.prototype.createSquare=function(t){this._segList.addPt(new v(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new v(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new v(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new v(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},ct.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},ct.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},ct.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},ct.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},ct.prototype.addLimitedMitreJoin=function(t,e,n,i){var o=this._seg0.p1,s=K.angle(o,this._seg0.p0),a=K.angleBetweenOriented(this._seg0.p0,o,this._seg1.p1),u=a/2,l=K.normalize(s+u),c=K.normalize(l+Math.PI),f=i*n,h=f*Math.abs(Math.sin(u)),g=n-h,p=o.x+f*Math.cos(c),y=o.y+f*Math.sin(c),d=new v(p,y),_=new A(o,d),I=_.pointAlongOffset(1,g),N=_.pointAlongOffset(1,-g);this._side===x.LEFT?(this._segList.addPt(I),this._segList.addPt(N)):(this._segList.addPt(N),this._segList.addPt(I))},ct.prototype.computeOffsetSegment=function(t,e,n,i){var o=e===x.LEFT?1:-1,s=t.p1.x-t.p0.x,a=t.p1.y-t.p0.y,u=Math.sqrt(s*s+a*a),l=o*n*s/u,c=o*n*a/u;i.p0.x=t.p0.x-c,i.p0.y=t.p0.y+l,i.p1.x=t.p1.x-c,i.p1.y=t.p1.y+l},ct.prototype.addFilletArc=function(t,e,n,i,o){var s=this,a=i===R.CLOCKWISE?-1:1,u=Math.abs(e-n),l=Math.trunc(u/this._filletAngleQuantum+.5);if(l<1)return null;for(var c=0,f=u/l,h=c,g=new v;h<u;){var p=e+a*h;g.x=t.x+o*Math.cos(p),g.y=t.y+o*Math.sin(p),s._segList.addPt(g),h+=f}},ct.prototype.addInsideTurn=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*ct.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new v((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(n);var i=new v((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(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},ct.prototype.createCircle=function(t){var e=new v(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},ct.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},ct.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Ne,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*ct.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},ct.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var e=this._li.getIntersectionNum();e>=2&&(this._bufParams.getJoinStyle()===$.JOIN_BEVEL||this._bufParams.getJoinStyle()===$.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,R.CLOCKWISE,this._distance))},ct.prototype.closeRing=function(){this._segList.closeRing()},ct.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct},uo.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},uo.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},uo.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},uo.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(ct,uo);var ce=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};ce.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,i=Math.abs(e),o=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],o):this.computeOffsetCurve(t,n,o);var s=o.getCoordinates();return n&&Y.reverse(s),s},ce.prototype.computeSingleSidedBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var o=vt.simplify(t,-i),s=o.length-1;n.initSideSegments(o[s],o[s-1],x.LEFT),n.addFirstSegment();for(var a=s-2;a>=0;a--)n.addNextSegment(o[a],!0)}else{n.addSegments(t,!1);var u=vt.simplify(t,i),l=u.length-1;n.initSideSegments(u[0],u[1],x.LEFT),n.addFirstSegment();for(var c=2;c<=l;c++)n.addNextSegment(u[c],!0)}n.addLastSegment(),n.closeRing()},ce.prototype.computeRingBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);e===x.RIGHT&&(i=-i);var o=vt.simplify(t,i),s=o.length-1;n.initSideSegments(o[s-1],o[0],e);for(var a=1;a<=s;a++){var u=a!==1;n.addNextSegment(o[a],u)}n.closeRing()},ce.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),i=vt.simplify(t,n),o=i.length-1;e.initSideSegments(i[0],i[1],x.LEFT);for(var s=2;s<=o;s++)e.addNextSegment(i[s],!0);e.addLastSegment(),e.addLineEndCap(i[o-1],i[o]);var a=vt.simplify(t,-n),u=a.length-1;e.initSideSegments(a[u],a[u-1],x.LEFT);for(var l=u-2;l>=0;l--)e.addNextSegment(a[l],!0);e.addLastSegment(),e.addLineEndCap(a[1],a[0]),e.closeRing()},ce.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case $.CAP_ROUND:e.createCircle(t);break;case $.CAP_SQUARE:e.createSquare(t);break}},ce.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var o=e<0;this.computeSingleSidedBufferCurve(t,o,i)}else this.computeLineBufferCurve(t,i);var s=i.getCoordinates();return s},ce.prototype.getBufferParameters=function(){return this._bufParams},ce.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},ce.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return ce.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()},ce.prototype.computeOffsetCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var o=vt.simplify(t,-i),s=o.length-1;n.initSideSegments(o[s],o[s-1],x.LEFT),n.addFirstSegment();for(var a=s-2;a>=0;a--)n.addNextSegment(o[a],!0)}else{var u=vt.simplify(t,i),l=u.length-1;n.initSideSegments(u[0],u[1],x.LEFT),n.addFirstSegment();for(var c=2;c<=l;c++)n.addNextSegment(u[c],!0)}n.addLastSegment()},ce.prototype.getSegGen=function(t){return new ct(this._precisionModel,this._bufParams,t)},ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce},ce.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new v(t[n]);return e};var Hr=function(){this._subgraphs=null,this._seg=new A,this._cga=new R;var t=arguments[0];this._subgraphs=t},Wa={DepthSegment:{configurable:!0}};Hr.prototype.findStabbedSegments=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=new L,i=this._subgraphs.iterator();i.hasNext();){var o=i.next(),s=o.getEnvelope();e.y<s.getMinY()||e.y>s.getMaxY()||t.findStabbedSegments(e,o.getDirectedEdges(),n)}return n}else if(arguments.length===3){if(k(arguments[2],Ye)&&arguments[0]instanceof v&&arguments[1]instanceof bs)for(var a=arguments[0],u=arguments[1],l=arguments[2],c=u.getEdge().getCoordinates(),f=0;f<c.length-1;f++){t._seg.p0=c[f],t._seg.p1=c[f+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse();var h=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(h<a.x)&&!t._seg.isHorizontal()&&!(a.y<t._seg.p0.y||a.y>t._seg.p1.y)&&R.computeOrientation(t._seg.p0,t._seg.p1,a)!==R.RIGHT){var g=u.getDepth(x.LEFT);t._seg.p0.equals(c[f])||(g=u.getDepth(x.RIGHT));var p=new Cr(t._seg,g);l.add(p)}}else if(k(arguments[2],Ye)&&arguments[0]instanceof v&&k(arguments[1],Ye))for(var y=arguments[0],d=arguments[1],_=arguments[2],I=d.iterator();I.hasNext();){var N=I.next();!N.isForward()||t.findStabbedSegments(y,N,_)}}},Hr.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);if(e.size()===0)return 0;var n=Ke.min(e);return n._leftDepth},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr},Wa.DepthSegment.get=function(){return Cr},Object.defineProperties(Hr,Wa);var Cr=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new A(t),this._leftDepth=e};Cr.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg),n!==0)?n:this._upwardSeg.compareTo(e._upwardSeg)},Cr.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)},Cr.prototype.toString=function(){return this._upwardSeg.toString()},Cr.prototype.interfaces_=function(){return[De]},Cr.prototype.getClass=function(){return Cr};var tt=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};tt.prototype.area=function(){return tt.area(this.p0,this.p1,this.p2)},tt.prototype.signedArea=function(){return tt.signedArea(this.p0,this.p1,this.p2)},tt.prototype.interpolateZ=function(t){if(t===null)throw new ft("Supplied point is null.");return tt.interpolateZ(t,this.p0,this.p1,this.p2)},tt.prototype.longestSideLength=function(){return tt.longestSideLength(this.p0,this.p1,this.p2)},tt.prototype.isAcute=function(){return tt.isAcute(this.p0,this.p1,this.p2)},tt.prototype.circumcentre=function(){return tt.circumcentre(this.p0,this.p1,this.p2)},tt.prototype.area3D=function(){return tt.area3D(this.p0,this.p1,this.p2)},tt.prototype.centroid=function(){return tt.centroid(this.p0,this.p1,this.p2)},tt.prototype.inCentre=function(){return tt.inCentre(this.p0,this.p1,this.p2)},tt.prototype.interfaces_=function(){return[]},tt.prototype.getClass=function(){return tt},tt.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},tt.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},tt.det=function(t,e,n,i){return t*i-e*n},tt.interpolateZ=function(t,e,n,i){var o=e.x,s=e.y,a=n.x-o,u=i.x-o,l=n.y-s,c=i.y-s,f=a*c-u*l,h=t.x-o,g=t.y-s,p=(c*h-u*g)/f,y=(-l*h+a*g)/f,d=e.z+p*(n.z-e.z)+y*(i.z-e.z);return d},tt.longestSideLength=function(t,e,n){var i=t.distance(e),o=e.distance(n),s=n.distance(t),a=i;return o>a&&(a=o),s>a&&(a=s),a},tt.isAcute=function(t,e,n){return!(!K.isAcute(t,e,n)||!K.isAcute(e,n,t)||!K.isAcute(n,t,e))},tt.circumcentre=function(t,e,n){var i=n.x,o=n.y,s=t.x-i,a=t.y-o,u=e.x-i,l=e.y-o,c=2*tt.det(s,a,u,l),f=tt.det(a,s*s+a*a,l,u*u+l*l),h=tt.det(s,s*s+a*a,u,u*u+l*l),g=i-f/c,p=o+h/c;return new v(g,p)},tt.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y,o=new qe(t.x+n/2,t.y+i/2,1),s=new qe(t.x-i+n/2,t.y+n+i/2,1);return new qe(o,s)},tt.angleBisector=function(t,e,n){var i=e.distance(t),o=e.distance(n),s=i/(i+o),a=n.x-t.x,u=n.y-t.y,l=new v(t.x+s*a,t.y+s*u);return l},tt.area3D=function(t,e,n){var i=e.x-t.x,o=e.y-t.y,s=e.z-t.z,a=n.x-t.x,u=n.y-t.y,l=n.z-t.z,c=o*l-s*u,f=s*a-i*l,h=i*u-o*a,g=c*c+f*f+h*h,p=Math.sqrt(g)/2;return p},tt.centroid=function(t,e,n){var i=(t.x+e.x+n.x)/3,o=(t.y+e.y+n.y)/3;return new v(i,o)},tt.inCentre=function(t,e,n){var i=e.distance(n),o=t.distance(n),s=t.distance(e),a=i+o+s,u=(i*t.x+o*e.x+s*n.x)/a,l=(i*t.y+o*e.y+s*n.y)/a;return new v(u,l)};var Ge=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new L;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Ge.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,m.EXTERIOR,m.INTERIOR)},Ge.prototype.addPolygon=function(t){var e=this,n=this._distance,i=x.LEFT;this._distance<0&&(n=-this._distance,i=x.RIGHT);var o=t.getExteriorRing(),s=Y.removeRepeatedPoints(o.getCoordinates());if(this._distance<0&&this.isErodedCompletely(o,this._distance)||this._distance<=0&&s.length<3)return null;this.addPolygonRing(s,n,i,m.EXTERIOR,m.INTERIOR);for(var a=0;a<t.getNumInteriorRing();a++){var u=t.getInteriorRingN(a),l=Y.removeRepeatedPoints(u.getCoordinates());e._distance>0&&e.isErodedCompletely(u,-e._distance)||e.addPolygonRing(l,n,x.opposite(i),m.INTERIOR,m.EXTERIOR)}},Ge.prototype.isTriangleErodedCompletely=function(t,e){var n=new tt(t[0],t[1],t[2]),i=n.inCentre(),o=R.distancePointLine(i,n.p0,n.p1);return o<Math.abs(e)},Ge.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=Y.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,m.EXTERIOR,m.INTERIOR)},Ge.prototype.addCurve=function(t,e,n){if(t===null||t.length<2)return null;var i=new Et(t,new nt(0,m.BOUNDARY,e,n));this._curveList.add(i)},Ge.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Ge.prototype.addPolygonRing=function(t,e,n,i,o){if(e===0&&t.length<Cn.MINIMUM_VALID_SIZE)return null;var s=i,a=o;t.length>=Cn.MINIMUM_VALID_SIZE&&R.isCCW(t)&&(s=o,a=i,n=x.opposite(n));var u=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(u,s,a)},Ge.prototype.add=function(t){if(t.isEmpty())return null;t instanceof wt?this.addPolygon(t):t instanceof dt?this.addLineString(t):t instanceof pe?this.addPoint(t):t instanceof Ei?this.addCollection(t):t instanceof Er?this.addCollection(t):t instanceof Nn?this.addCollection(t):t instanceof $t&&this.addCollection(t)},Ge.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),o=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>o},Ge.prototype.addCollection=function(t){for(var e=this,n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);e.add(i)}},Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge};var xi=function(){};xi.prototype.locate=function(t){},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi};var wn=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()};wn.prototype.next=function(){if(this._atStart)return this._atStart=!1,wn.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 mi;var t=this._parent.getGeometryN(this._index++);return t instanceof $t?(this._subcollectionIterator=new wn(t),this._subcollectionIterator.next()):t},wn.prototype.remove=function(){throw new Error(this.getClass().getName())},wn.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},wn.prototype.interfaces_=function(){return[yi]},wn.prototype.getClass=function(){return wn},wn.isAtomic=function(t){return!(t instanceof $t)};var xe=function(){this._geom=null;var t=arguments[0];this._geom=t};xe.prototype.locate=function(t){return xe.locate(t,this._geom)},xe.prototype.interfaces_=function(){return[xi]},xe.prototype.getClass=function(){return xe},xe.isPointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?R.isPointInRing(t,e.getCoordinates()):!1},xe.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!xe.isPointInRing(t,n))return!1;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i);if(xe.isPointInRing(t,o))return!1}return!0},xe.containsPoint=function(t,e){if(e instanceof wt)return xe.containsPointInPolygon(t,e);if(e instanceof $t)for(var n=new wn(e);n.hasNext();){var i=n.next();if(i!==e&&xe.containsPoint(t,i))return!0}return!1},xe.locate=function(t,e){return e.isEmpty()?m.EXTERIOR:xe.containsPoint(t,e)?m.INTERIOR:m.EXTERIOR};var jt=function(){this._edgeMap=new Ht,this._edgeList=null,this._ptInAreaLocation=[m.NONE,m.NONE]};jt.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return e===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)},jt.prototype.propagateSideLabels=function(t){for(var e=m.NONE,n=this.iterator();n.hasNext();){var i=n.next(),o=i.getLabel();o.isArea(t)&&o.getLocation(t,x.LEFT)!==m.NONE&&(e=o.getLocation(t,x.LEFT))}if(e===m.NONE)return null;for(var s=e,a=this.iterator();a.hasNext();){var u=a.next(),l=u.getLabel();if(l.getLocation(t,x.ON)===m.NONE&&l.setLocation(t,x.ON,s),l.isArea(t)){var c=l.getLocation(t,x.LEFT),f=l.getLocation(t,x.RIGHT);if(f!==m.NONE){if(f!==s)throw new qn("side location conflict",u.getCoordinate());c===m.NONE&&q.shouldNeverReachHere("found single null side (at "+u.getCoordinate()+")"),s=c}else q.isTrue(l.getLocation(t,x.LEFT)===m.NONE,"found single null side"),l.setLocation(t,x.RIGHT,s),l.setLocation(t,x.LEFT,s)}}},jt.prototype.getCoordinate=function(){var t=this.iterator();if(!t.hasNext())return null;var e=t.next();return e.getCoordinate()},jt.prototype.print=function(t){Bt.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},jt.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jt.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,i=e.get(n).getLabel(),o=i.getLocation(t,x.LEFT);q.isTrue(o!==m.NONE,"Found unlabelled area edge");for(var s=o,a=this.iterator();a.hasNext();){var u=a.next(),l=u.getLabel();q.isTrue(l.isArea(t),"Found non-area edge");var c=l.getLocation(t,x.LEFT),f=l.getLocation(t,x.RIGHT);if(c===f||f!==s)return!1;s=c}return!0},jt.prototype.findIndex=function(t){var e=this;this.iterator();for(var n=0;n<this._edgeList.size();n++){var i=e._edgeList.get(n);if(i===t)return n}return-1},jt.prototype.iterator=function(){return this.getEdges().iterator()},jt.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new L(this._edgeMap.values())),this._edgeList},jt.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===m.NONE&&(this._ptInAreaLocation[t]=xe.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},jt.prototype.toString=function(){var t=new tn;t.append("EdgeEndStar: "+this.getCoordinate()),t.append(`
|
|
24
|
+
`);for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append(`
|
|
25
|
+
`)}return t.toString()},jt.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();n.computeLabel(t)}},jt.prototype.computeLabelling=function(t){var e=this;this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var o=i.next(),s=o.getLabel(),a=0;a<2;a++)s.isLine(a)&&s.getLocation(a)===m.BOUNDARY&&(n[a]=!0);for(var u=this.iterator();u.hasNext();)for(var l=u.next(),c=l.getLabel(),f=0;f<2;f++)if(c.isAnyNull(f)){var h=m.NONE;if(n[f])h=m.EXTERIOR;else{var g=l.getCoordinate();h=e.getLocation(f,g,t)}c.setAllLocationsIfNull(f,h)}},jt.prototype.getDegree=function(){return this._edgeMap.size()},jt.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},jt.prototype.interfaces_=function(){return[]},jt.prototype.getClass=function(){return jt};var lc=function(r){function t(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var i=null,o=null,s=this._SCANNING_FOR_INCOMING,a=0;a<this._resultAreaEdgeList.size();a++){var u=n._resultAreaEdgeList.get(a),l=u.getSym();if(!!u.getLabel().isArea())switch(i===null&&u.isInResult()&&(i=u),s){case n._SCANNING_FOR_INCOMING:if(!l.isInResult())continue;o=l,s=n._LINKING_TO_OUTGOING;break;case n._LINKING_TO_OUTGOING:if(!u.isInResult())continue;o.setNext(u),s=n._SCANNING_FOR_INCOMING;break}}if(s===this._LINKING_TO_OUTGOING){if(i===null)throw new qn("no outgoing dirEdge found",this.getCoordinate());q.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),o.setNext(i)}},t.prototype.insert=function(n){var i=n;this.insertEdgeEnd(i,i)},t.prototype.getRightmostEdge=function(){var n=this.getEdges(),i=n.size();if(i<1)return null;var o=n.get(0);if(i===1)return o;var s=n.get(i-1),a=o.getQuadrant(),u=s.getQuadrant();return ot.isNorthern(a)&&ot.isNorthern(u)?o:!ot.isNorthern(a)&&!ot.isNorthern(u)?s:o.getDy()!==0?o:s.getDy()!==0?s:(q.shouldNeverReachHere("found two horizontal edges incident on node"),null)},t.prototype.print=function(n){Bt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();){var o=i.next();n.print("out "),o.print(n),n.println(),n.print("in "),o.getSym().print(n),n.println()}},t.prototype.getResultAreaEdges=function(){var n=this;if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new L;for(var i=this.iterator();i.hasNext();){var o=i.next();(o.isInResult()||o.getSym().isInResult())&&n._resultAreaEdgeList.add(o)}return this._resultAreaEdgeList},t.prototype.updateLabelling=function(n){for(var i=this.iterator();i.hasNext();){var o=i.next(),s=o.getLabel();s.setAllLocationsIfNull(0,n.getLocation(0)),s.setAllLocationsIfNull(1,n.getLocation(1))}},t.prototype.linkAllDirectedEdges=function(){var n=this;this.getEdges();for(var i=null,o=null,s=this._edgeList.size()-1;s>=0;s--){var a=n._edgeList.get(s),u=a.getSym();o===null&&(o=u),i!==null&&u.setNext(i),i=a}o.setNext(i)},t.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var i=arguments[0],o=this.findIndex(i),s=i.getDepth(x.LEFT),a=i.getDepth(x.RIGHT),u=this.computeDepths(o+1,this._edgeList.size(),s),l=this.computeDepths(0,o,u);if(l!==a)throw new qn("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var c=arguments[0],f=arguments[1],h=arguments[2],g=h,p=c;p<f;p++){var y=n._edgeList.get(p);y.setEdgeDepths(x.RIGHT,g),g=y.getDepth(x.LEFT)}return g}},t.prototype.mergeSymLabels=function(){for(var n=this.iterator();n.hasNext();){var i=n.next(),o=i.getLabel();o.merge(i.getSym().getLabel())}},t.prototype.linkMinimalDirectedEdges=function(n){for(var i=this,o=null,s=null,a=this._SCANNING_FOR_INCOMING,u=this._resultAreaEdgeList.size()-1;u>=0;u--){var l=i._resultAreaEdgeList.get(u),c=l.getSym();switch(o===null&&l.getEdgeRing()===n&&(o=l),a){case i._SCANNING_FOR_INCOMING:if(c.getEdgeRing()!==n)continue;s=c,a=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(l.getEdgeRing()!==n)continue;s.setNextMin(l),a=i._SCANNING_FOR_INCOMING;break}}a===this._LINKING_TO_OUTGOING&&(q.isTrue(o!==null,"found null for first outgoing dirEdge"),q.isTrue(o.getEdgeRing()===n,"unable to link last incoming dirEdge"),s.setNextMin(o))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var o=i.next();o.isInResult()&&n++}return n}else if(arguments.length===1){for(var s=arguments[0],a=0,u=this.iterator();u.hasNext();){var l=u.next();l.getEdgeRing()===s&&a++}return a}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var n=m.NONE,i=this.iterator();i.hasNext();){var o=i.next(),s=o.getSym();if(!o.isLineEdge()){if(o.isInResult()){n=m.INTERIOR;break}if(s.isInResult()){n=m.EXTERIOR;break}}}if(n===m.NONE)return null;for(var a=n,u=this.iterator();u.hasNext();){var l=u.next(),c=l.getSym();l.isLineEdge()?l.getEdge().setCovered(a===m.INTERIOR):(l.isInResult()&&(a=m.EXTERIOR),c.isInResult()&&(a=m.INTERIOR))}},t.prototype.computeLabelling=function(n){var i=this;r.prototype.computeLabelling.call(this,n),this._label=new nt(m.NONE);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getEdge(),u=a.getLabel(),l=0;l<2;l++){var c=u.getLocation(l);(c===m.INTERIOR||c===m.BOUNDARY)&&i._label.setLocation(l,m.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(jt),ja=function(r){function t(){r.apply(this,arguments)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.createNode=function(n){return new ko(n,new lc)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ii),rr=function r(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=r.orientation(t)};rr.prototype.compareTo=function(t){var e=t,n=rr.compareOriented(this._pts,this._orientation,e._pts,e._orientation);return n},rr.prototype.interfaces_=function(){return[De]},rr.prototype.getClass=function(){return rr},rr.orientation=function(t){return Y.increasingDirection(t)===1},rr.compareOriented=function(t,e,n,i){for(var o=e?1:-1,s=i?1:-1,a=e?t.length:-1,u=i?n.length:-1,l=e?0:t.length-1,c=i?0:n.length-1;;){var f=t[l].compareTo(n[c]);if(f!==0)return f;l+=o,c+=s;var h=l===a,g=c===u;if(h&&!g)return-1;if(!h&&g)return 1;if(h&&g)return 0}};var Qe=function(){this._edges=new L,this._ocaMap=new Ht};Qe.prototype.print=function(t){var e=this;t.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var i=e._edges.get(n);n>0&&t.print(","),t.print("(");for(var o=i.getCoordinates(),s=0;s<o.length;s++)s>0&&t.print(","),t.print(o[s].x+" "+o[s].y);t.println(")")}t.print(") ")},Qe.prototype.addAll=function(t){for(var e=this,n=t.iterator();n.hasNext();)e.add(n.next())},Qe.prototype.findEdgeIndex=function(t){for(var e=this,n=0;n<this._edges.size();n++)if(e._edges.get(n).equals(t))return n;return-1},Qe.prototype.iterator=function(){return this._edges.iterator()},Qe.prototype.getEdges=function(){return this._edges},Qe.prototype.get=function(t){return this._edges.get(t)},Qe.prototype.findEqualEdge=function(t){var e=new rr(t.getCoordinates()),n=this._ocaMap.get(e);return n},Qe.prototype.add=function(t){this._edges.add(t);var e=new rr(t.getCoordinates());this._ocaMap.put(e,t)},Qe.prototype.interfaces_=function(){return[]},Qe.prototype.getClass=function(){return Qe};var Nr=function(){};Nr.prototype.processIntersections=function(t,e,n,i){},Nr.prototype.isDone=function(){},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var Se=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};Se.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(Se.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var o=t.size()-1;if(e===0&&i===o||i===0&&e===o)return!0}}return!1},Se.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Se.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Se.prototype.getLineIntersector=function(){return this._li},Se.prototype.hasProperIntersection=function(){return this._hasProper},Se.prototype.processIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var o=t.getCoordinates()[e],s=t.getCoordinates()[e+1],a=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(o,s,a,u),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Se.prototype.hasIntersection=function(){return this._hasIntersection},Se.prototype.isDone=function(){return!1},Se.prototype.hasInteriorIntersection=function(){return this._hasInterior},Se.prototype.interfaces_=function(){return[Nr]},Se.prototype.getClass=function(){return Se},Se.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var gn=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new v(t),this.segmentIndex=e,this.dist=n};gn.prototype.getSegmentIndex=function(){return this.segmentIndex},gn.prototype.getCoordinate=function(){return this.coord},gn.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},gn.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},gn.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},gn.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},gn.prototype.getDistance=function(){return this.dist},gn.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},gn.prototype.interfaces_=function(){return[De]},gn.prototype.getClass=function(){return gn};var Ln=function(){this._nodeMap=new Ht,this.edge=null;var t=arguments[0];this.edge=t};Ln.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){var n=e.next();n.print(t)}},Ln.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ln.prototype.addSplitEdges=function(t){var e=this;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var o=n.next(),s=e.createSplitEdge(i,o);t.add(s),i=o}},Ln.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Ln.prototype.createSplitEdge=function(t,e){var n=this,i=e.segmentIndex-t.segmentIndex+2,o=this.edge.pts[e.segmentIndex],s=e.dist>0||!e.coord.equals2D(o);s||i--;var a=new Array(i).fill(null),u=0;a[u++]=new v(t.coord);for(var l=t.segmentIndex+1;l<=e.segmentIndex;l++)a[u++]=n.edge.pts[l];return s&&(a[u]=e.coord),new Vo(a,new nt(this.edge._label))},Ln.prototype.add=function(t,e,n){var i=new gn(t,e,n),o=this._nodeMap.get(i);return o!==null?o:(this._nodeMap.put(i,i),i)},Ln.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next();if(n.coord.equals(t))return!0}return!1},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln};var xr=function(){};xr.prototype.getChainStartIndices=function(t){var e=this,n=0,i=new L;i.add(new en(n));do{var o=e.findChainEnd(t,n);i.add(new en(o)),n=o}while(n<t.length-1);var s=xr.toIntArray(i);return s},xr.prototype.findChainEnd=function(t,e){for(var n=ot.quadrant(t[e],t[e+1]),i=e+1;i<t.length;){var o=ot.quadrant(t[i-1],t[i]);if(o!==n)break;i++}return i-1},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr},xr.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Hn=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new M,this.env2=new M;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new xr;this.startIndex=e.getChainStartIndices(this.pts)};Hn.prototype.getCoordinates=function(){return this.pts},Hn.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Hn.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Hn.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(arguments.length===6){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],l=arguments[4],c=arguments[5],f=this.pts[o],h=this.pts[s],g=a.pts[u],p=a.pts[l];if(s-o===1&&l-u===1)return c.addIntersections(this.e,o,a.e,u),null;if(this.env1.init(f,h),this.env2.init(g,p),!this.env1.intersects(this.env2))return null;var y=Math.trunc((o+s)/2),d=Math.trunc((u+l)/2);o<y&&(u<d&&this.computeIntersectsForChain(o,y,a,u,d,c),d<l&&this.computeIntersectsForChain(o,y,a,d,l,c)),y<s&&(u<d&&this.computeIntersectsForChain(y,s,a,u,d,c),d<l&&this.computeIntersectsForChain(y,s,a,d,l,c))}},Hn.prototype.getStartIndexes=function(){return this.startIndex},Hn.prototype.computeIntersects=function(t,e){for(var n=this,i=0;i<this.startIndex.length-1;i++)for(var o=0;o<t.startIndex.length-1;o++)n.computeIntersectsForChain(i,t,o,e)},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn};var Gt=function r(){var t=this;this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var n=0;n<3;n++)t._depth[e][n]=r.NULL_VALUE},Ka={NULL_VALUE:{configurable:!0}};Gt.prototype.getDepth=function(t,e){return this._depth[t][e]},Gt.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Gt.prototype.isNull=function(){var t=this;if(arguments.length===0){for(var e=0;e<2;e++)for(var n=0;n<3;n++)if(t._depth[e][n]!==Gt.NULL_VALUE)return!1;return!0}else if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===Gt.NULL_VALUE}else if(arguments.length===2){var o=arguments[0],s=arguments[1];return this._depth[o][s]===Gt.NULL_VALUE}},Gt.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var i=1;i<3;i++){var o=0;t._depth[e][i]>n&&(o=1),t._depth[e][i]=o}}},Gt.prototype.getDelta=function(t){return this._depth[t][x.RIGHT]-this._depth[t][x.LEFT]},Gt.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?m.EXTERIOR:m.INTERIOR},Gt.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Gt.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var o=e.getLocation(n,i);(o===m.EXTERIOR||o===m.INTERIOR)&&(t.isNull(n,i)?t._depth[n][i]=Gt.depthAtLocation(o):t._depth[n][i]+=Gt.depthAtLocation(o))}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];u===m.INTERIOR&&this._depth[s][a]++}},Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.depthAtLocation=function(t){return t===m.EXTERIOR?0:t===m.INTERIOR?1:Gt.NULL_VALUE},Ka.NULL_VALUE.get=function(){return-1},Object.defineProperties(Gt,Ka);var Vo=function(r){function t(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new Ln(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Gt,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.call(this,e,null)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);n[0]=this.pts[0],n[1]=this.pts[1];var i=new t(n,nt.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(n){this._isIsolated=n},t.prototype.setName=function(n){this._name=n},t.prototype.equals=function(n){var i=this;if(!(n instanceof t))return!1;var o=n;if(this.pts.length!==o.pts.length)return!1;for(var s=!0,a=!0,u=this.pts.length,l=0;l<this.pts.length;l++)if(i.pts[l].equals2D(o.pts[l])||(s=!1),i.pts[l].equals2D(o.pts[--u])||(a=!1),!s&&!a)return!1;return!0},t.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}},t.prototype.print=function(n){var i=this;n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var o=0;o<this.pts.length;o++)o>0&&n.print(","),n.print(i.pts[o].x+" "+i.pts[o].y);n.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(n){t.updateIM(this._label,n)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(n){var i=this;n.print("edge "+this._name+": ");for(var o=this.pts.length-1;o>=0;o--)n.print(i.pts[o]+" ");n.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Hn(this)),this._mce},t.prototype.getEnvelope=function(){var n=this;if(this._env===null){this._env=new M;for(var i=0;i<this.pts.length;i++)n._env.expandToInclude(n.pts[i])}return this._env},t.prototype.addIntersection=function(n,i,o,s){var a=new v(n.getIntersection(s)),u=i,l=n.getEdgeDistance(o,s),c=u+1;if(c<this.pts.length){var f=this.pts[c];a.equals2D(f)&&(u=c,l=0)}this.eiList.add(a,u,l)},t.prototype.toString=function(){var n=this,i=new tn;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var o=0;o<this.pts.length;o++)o>0&&i.append(","),i.append(n.pts[o].x+" "+n.pts[o].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(n){var i=this;if(this.pts.length!==n.pts.length)return!1;for(var o=0;o<this.pts.length;o++)if(!i.pts[o].equals2D(n.pts[o]))return!1;return!0},t.prototype.setDepthDelta=function(n){this._depthDelta=n},t.prototype.getEdgeIntersectionList=function(){return this.eiList},t.prototype.addIntersections=function(n,i,o){for(var s=this,a=0;a<n.getIntersectionNum();a++)s.addIntersection(n,i,o,a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.updateIM=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,x.ON),n.getLocation(1,x.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,x.LEFT),n.getLocation(1,x.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,x.RIGHT),n.getLocation(1,x.RIGHT),2))}else return r.prototype.updateIM.apply(this,arguments)},t}(Ce),ne=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Qe,this._bufParams=t||null};ne.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},ne.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new nt(t.getLabel()),i.flip()),n.merge(i);var o=ne.depthDelta(i),s=e.getDepthDelta(),a=s+o;e.setDepthDelta(a)}else this._edgeList.add(t),t.setDepthDelta(ne.depthDelta(t.getLabel()))},ne.prototype.buildSubgraphs=function(t,e){for(var n=new L,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getRightmostCoordinate(),a=new Hr(n),u=a.getDepth(s);o.computeDepth(u),o.findResultEdges(),n.add(o),e.add(o.getDirectedEdges(),o.getNodes())}},ne.prototype.createSubgraphs=function(t){for(var e=new L,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var o=new te;o.create(i),e.add(o)}}return Ke.sort(e,Ke.reverseOrder()),e},ne.prototype.createEmptyResultGeometry=function(){var t=this._geomFact.createPolygon();return t},ne.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Ps,n=new yr;return n.setPrecisionModel(t),e.setSegmentIntersector(new Se(n)),e},ne.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new ce(n,this._bufParams),o=new Ge(t,e,i),s=o.getCurves();if(s.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(s,n),this._graph=new gt(new ja),this._graph.addEdges(this._edgeList.getEdges());var a=this.createSubgraphs(this._graph),u=new de(this._geomFact);this.buildSubgraphs(a,u);var l=u.getPolygons();if(l.size()<=0)return this.createEmptyResultGeometry();var c=this._geomFact.buildGeometry(l);return c},ne.prototype.computeNodedEdges=function(t,e){var n=this,i=this.getNoder(e);i.computeNodes(t);for(var o=i.getNodedSubstrings(),s=o.iterator();s.hasNext();){var a=s.next(),u=a.getCoordinates();if(!(u.length===2&&u[0].equals2D(u[1]))){var l=a.getData(),c=new Vo(a.getCoordinates(),new nt(l));n.insertUniqueEdge(c)}}},ne.prototype.setNoder=function(t){this._workingNoder=t},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.depthDelta=function(t){var e=t.getLocation(0,x.LEFT),n=t.getLocation(0,x.RIGHT);return e===m.INTERIOR&&n===m.EXTERIOR?1:e===m.EXTERIOR&&n===m.INTERIOR?-1:0},ne.convertSegStrings=function(t){for(var e=new H,n=new L;t.hasNext();){var i=t.next(),o=e.createLineString(i.getCoordinates());n.add(o)}return e.buildGeometry(n)};var ir=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];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var n=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3];this._noder=n,this._scaleFactor=i,this._offsetX=o,this._offsetY=s,this._isScaled=!this.isIntegerPrecision()}};ir.prototype.rescale=function(){var t=this;if(k(arguments[0],St))for(var e=arguments[0],n=e.iterator();n.hasNext();){var i=n.next();t.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var o=arguments[0],s=0;s<o.length;s++)o[s].x=o[s].x/t._scaleFactor+t._offsetX,o[s].y=o[s].y/t._scaleFactor+t._offsetY;o.length===2&&o[0].equals2D(o[1])&&Bt.out.println(o)}},ir.prototype.scale=function(){var t=this;if(k(arguments[0],St)){for(var e=arguments[0],n=new L,i=e.iterator();i.hasNext();){var o=i.next();n.add(new Et(t.scale(o.getCoordinates()),o.getData()))}return n}else if(arguments[0]instanceof Array){for(var s=arguments[0],a=new Array(s.length).fill(null),u=0;u<s.length;u++)a[u]=new v(Math.round((s[u].x-t._offsetX)*t._scaleFactor),Math.round((s[u].y-t._offsetY)*t._scaleFactor),s[u].z);var l=Y.removeRepeatedPoints(a);return l}},ir.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},ir.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},ir.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},ir.prototype.interfaces_=function(){return[Ir]},ir.prototype.getClass=function(){return ir};var pn=function(){this._li=new yr,this._segStrings=null;var t=arguments[0];this._segStrings=t},Qa={fact:{configurable:!0}};pn.prototype.checkEndPtVertexIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next(),i=n.getCoordinates();t.checkEndPtVertexIntersections(i[0],t._segStrings),t.checkEndPtVertexIntersections(i[i.length-1],t._segStrings)}else if(arguments.length===2){for(var o=arguments[0],s=arguments[1],a=s.iterator();a.hasNext();)for(var u=a.next(),l=u.getCoordinates(),c=1;c<l.length-1;c++)if(l[c].equals(o))throw new Bn("found endpt/interior pt intersection at index "+c+" :pt "+o)}},pn.prototype.checkInteriorIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var n=e.next(),i=this._segStrings.iterator();i.hasNext();){var o=i.next();t.checkInteriorIntersections(n,o)}else if(arguments.length===2)for(var s=arguments[0],a=arguments[1],u=s.getCoordinates(),l=a.getCoordinates(),c=0;c<u.length-1;c++)for(var f=0;f<l.length-1;f++)t.checkInteriorIntersections(s,c,a,f);else if(arguments.length===4){var h=arguments[0],g=arguments[1],p=arguments[2],y=arguments[3];if(h===p&&g===y)return null;var d=h.getCoordinates()[g],_=h.getCoordinates()[g+1],I=p.getCoordinates()[y],N=p.getCoordinates()[y+1];if(this._li.computeIntersection(d,_,I,N),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,_)||this.hasInteriorIntersection(this._li,I,N)))throw new Bn("found non-noded intersection at "+d+"-"+_+" and "+I+"-"+N)}},pn.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},pn.prototype.checkCollapses=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next();t.checkCollapses(n)}else if(arguments.length===1)for(var i=arguments[0],o=i.getCoordinates(),s=0;s<o.length-2;s++)t.checkCollapse(o[s],o[s+1],o[s+2])},pn.prototype.hasInteriorIntersection=function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var o=t.getIntersection(i);if(!(o.equals(e)||o.equals(n)))return!0}return!1},pn.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new Bn("found non-noded collapse at "+pn.fact.createLineString([t,e,n]))},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},Qa.fact.get=function(){return new H},Object.defineProperties(pn,Qa);var fe=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],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new ft("Scale factor must be non-zero");e!==1&&(this._pt=new v(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new v,this._p1Scaled=new v),this.initCorners(this._pt)},Ja={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};fe.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),o=Math.min(t.y,e.y),s=Math.max(t.y,e.y),a=this._maxx<n||this._minx>i||this._maxy<o||this._miny>s;if(a)return!1;var u=this.intersectsToleranceSquare(t,e);return q.isTrue(!(a&&u),"Found bad envelope test"),u},fe.prototype.initCorners=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 v(this._maxx,this._maxy),this._corner[1]=new v(this._minx,this._maxy),this._corner[2]=new v(this._minx,this._miny),this._corner[3]=new v(this._maxx,this._miny)},fe.prototype.intersects=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))},fe.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},fe.prototype.getCoordinate=function(){return this._originalPt},fe.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},fe.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=fe.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new M(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},fe.prototype.intersectsPixelClosure=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()))},fe.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!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()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper())||n&&i||t.equals(this._pt)||e.equals(this._pt))},fe.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return this.intersects(n,i)?(t.addIntersection(this.getCoordinate(),e),!0):!1},fe.prototype.interfaces_=function(){return[]},fe.prototype.getClass=function(){return fe},Ja.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(fe,Ja);var lo=function(){this.tempEnv1=new M,this.selectedSegment=new A};lo.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}}},lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo};var Si=function(){this._index=null;var t=arguments[0];this._index=t},Za={HotPixelSnapAction:{configurable:!0}};Si.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],o=e.getSafeEnvelope(),s=new $a(e,n,i);return this._index.query(o,{interfaces_:function(){return[er]},visitItem:function(a){var u=a;u.select(o,s)}}),s.isNodeAdded()}},Si.prototype.interfaces_=function(){return[]},Si.prototype.getClass=function(){return Si},Za.HotPixelSnapAction.get=function(){return $a},Object.defineProperties(Si,Za);var $a=function(r){function t(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=i}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],o=n.getContext();if(this._parentEdge!==null&&o===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(o,i)}else return r.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(lo),Wr=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new L};Wr.prototype.processIntersections=function(t,e,n,i){var o=this;if(t===n&&e===i)return null;var s=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[i],l=n.getCoordinates()[i+1];if(this._li.computeIntersection(s,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var c=0;c<this._li.getIntersectionNum();c++)o._interiorIntersections.add(o._li.getIntersection(c));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}},Wr.prototype.isDone=function(){return!1},Wr.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Wr.prototype.interfaces_=function(){return[Nr]},Wr.prototype.getClass=function(){return Wr};var bn=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new yr,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};bn.prototype.checkCorrectness=function(t){var e=Et.getNodedSubstrings(t),n=new pn(e);try{n.checkValid()}catch(i){if(i instanceof Da)i.printStackTrace();else throw i}finally{}},bn.prototype.getNodedSubstrings=function(){return Et.getNodedSubstrings(this._nodedSegStrings)},bn.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},bn.prototype.findInteriorIntersections=function(t,e){var n=new Wr(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},bn.prototype.computeVertexSnaps=function(){var t=this;if(k(arguments[0],St))for(var e=arguments[0],n=e.iterator();n.hasNext();){var i=n.next();t.computeVertexSnaps(i)}else if(arguments[0]instanceof Et)for(var o=arguments[0],s=o.getCoordinates(),a=0;a<s.length;a++){var u=new fe(s[a],t._scaleFactor,t._li),l=t._pointSnapper.snap(u,o,a);l&&o.addIntersection(s[a],a)}},bn.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Ps,this._pointSnapper=new Si(this._noder.getIndex()),this.snapRound(t,this._li)},bn.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next(),o=new fe(i,e._scaleFactor,e._li);e._pointSnapper.snap(o)}},bn.prototype.interfaces_=function(){return[Ir]},bn.prototype.getClass=function(){return bn};var kt=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new $,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],n=arguments[1];this._argGeom=e,this._bufParams=n}},wi={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};kt.prototype.bufferFixedPrecision=function(t){var e=new ir(new bn(new Z(1)),t.getScale()),n=new ne(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},kt.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var e=kt.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(s){if(s instanceof qn)t._saveException=s;else throw s}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var n=arguments[0],i=kt.precisionScaleFactor(this._argGeom,this._distance,n),o=new Z(i);this.bufferFixedPrecision(o)}},kt.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Z.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},kt.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},kt.prototype.bufferOriginalPrecision=function(){try{var t=new ne(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(e instanceof Bn)this._saveException=e;else throw e}finally{}},kt.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},kt.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},kt.prototype.interfaces_=function(){return[]},kt.prototype.getClass=function(){return kt},kt.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new kt(t),i=n.getResultGeometry(e);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof G&&typeof arguments[1]=="number"){var o=arguments[0],s=arguments[1],a=arguments[2],u=new kt(o);u.setQuadrantSegments(a);var l=u.getResultGeometry(s);return l}else if(arguments[2]instanceof $&&arguments[0]instanceof G&&typeof arguments[1]=="number"){var c=arguments[0],f=arguments[1],h=arguments[2],g=new kt(c,h),p=g.getResultGeometry(f);return p}}else if(arguments.length===4){var y=arguments[0],d=arguments[1],_=arguments[2],I=arguments[3],N=new kt(y);N.setQuadrantSegments(_),N.setEndCapStyle(I);var C=N.getResultGeometry(d);return C}},kt.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),o=Ie.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),s=e>0?e:0,a=o+2*s,u=Math.trunc(Math.log(a)/Math.log(10)+1),l=n-u,c=Math.pow(10,l);return c},wi.CAP_ROUND.get=function(){return $.CAP_ROUND},wi.CAP_BUTT.get=function(){return $.CAP_FLAT},wi.CAP_FLAT.get=function(){return $.CAP_FLAT},wi.CAP_SQUARE.get=function(){return $.CAP_SQUARE},wi.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(kt,wi);var re=function(){this._pt=[new v,new v],this._distance=V.NaN,this._isNull=!0};re.prototype.getCoordinates=function(){return this._pt},re.prototype.getCoordinate=function(t){return this._pt[t]},re.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i<this._distance&&this.initialize(e,n,i)}},re.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=o,this._isNull=!1}},re.prototype.getDistance=function(){return this._distance},re.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re};var Pn=function(){};Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn},Pn.computeDistance=function(){if(arguments[2]instanceof re&&arguments[0]instanceof dt&&arguments[1]instanceof v)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),o=new A,s=0;s<i.length-1;s++){o.setCoordinates(i[s],i[s+1]);var a=o.closestPoint(e);n.setMinimum(a,e)}else if(arguments[2]instanceof re&&arguments[0]instanceof wt&&arguments[1]instanceof v){var u=arguments[0],l=arguments[1],c=arguments[2];Pn.computeDistance(u.getExteriorRing(),l,c);for(var f=0;f<u.getNumInteriorRing();f++)Pn.computeDistance(u.getInteriorRingN(f),l,c)}else if(arguments[2]instanceof re&&arguments[0]instanceof G&&arguments[1]instanceof v){var h=arguments[0],g=arguments[1],p=arguments[2];if(h instanceof dt)Pn.computeDistance(h,g,p);else if(h instanceof wt)Pn.computeDistance(h,g,p);else if(h instanceof $t)for(var y=h,d=0;d<y.getNumGeometries();d++){var _=y.getGeometryN(d);Pn.computeDistance(_,g,p)}else p.setMinimum(h.getCoordinate(),g)}else if(arguments[2]instanceof re&&arguments[0]instanceof A&&arguments[1]instanceof v){var I=arguments[0],N=arguments[1],C=arguments[2],b=I.closestPoint(N);C.setMinimum(b,N)}};var Sr=function(t){this._maxPtDist=new re,this._inputGeom=t||null},Rs={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Sr.prototype.computeMaxMidpointDistance=function(t){var e=new or(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Sr.prototype.computeMaxVertexDistance=function(t){var e=new jr(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Sr.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Sr.prototype.getDistancePoints=function(){return this._maxPtDist},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Rs.MaxPointDistanceFilter.get=function(){return jr},Rs.MaxMidpointDistanceFilter.get=function(){return or},Object.defineProperties(Sr,Rs);var jr=function(t){this._maxPtDist=new re,this._minPtDist=new re,this._geom=t||null};jr.prototype.filter=function(t){this._minPtDist.initialize(),Pn.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},jr.prototype.getMaxPointDistance=function(){return this._maxPtDist},jr.prototype.interfaces_=function(){return[In]},jr.prototype.getClass=function(){return jr};var or=function(t){this._maxPtDist=new re,this._minPtDist=new re,this._geom=t||null};or.prototype.filter=function(t,e){if(e===0)return null;var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=new v((n.x+i.x)/2,(n.y+i.y)/2);this._minPtDist.initialize(),Pn.computeDistance(this._geom,o,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},or.prototype.isDone=function(){return!1},or.prototype.isGeometryChanged=function(){return!1},or.prototype.getMaxPointDistance=function(){return this._maxPtDist},or.prototype.interfaces_=function(){return[We]},or.prototype.getClass=function(){return or};var Wn=function(t){this._comps=t||null};Wn.prototype.filter=function(t){t instanceof wt&&this._comps.add(t)},Wn.prototype.interfaces_=function(){return[sn]},Wn.prototype.getClass=function(){return Wn},Wn.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return Wn.getPolygons(t,new L)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof wt?n.add(e):e instanceof $t&&e.apply(new Wn(n)),n}};var zt=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var t=arguments[0];this._lines=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};zt.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Cn){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof dt&&this._lines.add(t)},zt.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},zt.prototype.interfaces_=function(){return[Gn]},zt.prototype.getClass=function(){return zt},zt.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(zt.getLines(t))}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(zt.getLines(e,n))}},zt.getLines=function(){if(arguments.length===1){var t=arguments[0];return zt.getLines(t,!1)}else if(arguments.length===2){if(k(arguments[0],St)&&k(arguments[1],St)){for(var e=arguments[0],n=arguments[1],i=e.iterator();i.hasNext();){var o=i.next();zt.getLines(o,n)}return n}else if(arguments[0]instanceof G&&typeof arguments[1]=="boolean"){var s=arguments[0],a=arguments[1],u=new L;return s.apply(new zt(u,a)),u}else if(arguments[0]instanceof G&&k(arguments[1],St)){var l=arguments[0],c=arguments[1];return l instanceof dt?c.add(l):l.apply(new zt(c)),c}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&k(arguments[0],St)&&k(arguments[1],St)){for(var f=arguments[0],h=arguments[1],g=arguments[2],p=f.iterator();p.hasNext();){var y=p.next();zt.getLines(y,h,g)}return h}else if(typeof arguments[2]=="boolean"&&arguments[0]instanceof G&&k(arguments[1],St)){var d=arguments[0],_=arguments[1],I=arguments[2];return d.apply(new zt(_,I)),_}}};var Je=function(){if(this._boundaryRule=Me.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];if(t===null)throw new ft("Rule must be non-null");this._boundaryRule=t}}};Je.prototype.locateInternal=function(){var t=this;if(arguments[0]instanceof v&&arguments[1]instanceof wt){var e=arguments[0],n=arguments[1];if(n.isEmpty())return m.EXTERIOR;var i=n.getExteriorRing(),o=this.locateInPolygonRing(e,i);if(o===m.EXTERIOR)return m.EXTERIOR;if(o===m.BOUNDARY)return m.BOUNDARY;for(var s=0;s<n.getNumInteriorRing();s++){var a=n.getInteriorRingN(s),u=t.locateInPolygonRing(e,a);if(u===m.INTERIOR)return m.EXTERIOR;if(u===m.BOUNDARY)return m.BOUNDARY}return m.INTERIOR}else if(arguments[0]instanceof v&&arguments[1]instanceof dt){var l=arguments[0],c=arguments[1];if(!c.getEnvelopeInternal().intersects(l))return m.EXTERIOR;var f=c.getCoordinates();return!c.isClosed()&&(l.equals(f[0])||l.equals(f[f.length-1]))?m.BOUNDARY:R.isOnLine(l,f)?m.INTERIOR:m.EXTERIOR}else if(arguments[0]instanceof v&&arguments[1]instanceof pe){var h=arguments[0],g=arguments[1],p=g.getCoordinate();return p.equals2D(h)?m.INTERIOR:m.EXTERIOR}},Je.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?R.locatePointInRing(t,e.getCoordinates()):m.EXTERIOR},Je.prototype.intersects=function(t,e){return this.locate(t,e)!==m.EXTERIOR},Je.prototype.updateLocationInfo=function(t){t===m.INTERIOR&&(this._isIn=!0),t===m.BOUNDARY&&this._numBoundaries++},Je.prototype.computeLocation=function(t,e){var n=this;if(e instanceof pe&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof dt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof wt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Er)for(var i=e,o=0;o<i.getNumGeometries();o++){var s=i.getGeometryN(o);n.updateLocationInfo(n.locateInternal(t,s))}else if(e instanceof Nn)for(var a=e,u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);n.updateLocationInfo(n.locateInternal(t,l))}else if(e instanceof $t)for(var c=new wn(e);c.hasNext();){var f=c.next();f!==e&&n.computeLocation(t,f)}},Je.prototype.locate=function(t,e){return e.isEmpty()?m.EXTERIOR:e instanceof dt?this.locateInternal(t,e):e instanceof wt?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?m.BOUNDARY:this._numBoundaries>0||this._isIn?m.INTERIOR:m.EXTERIOR)},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je};var ie=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],e=arguments[1];r.call(this,t,r.INSIDE_AREA,e)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];this._component=n,this._segIndex=i,this._pt=o}},tu={INSIDE_AREA:{configurable:!0}};ie.prototype.isInsideArea=function(){return this._segIndex===ie.INSIDE_AREA},ie.prototype.getCoordinate=function(){return this._pt},ie.prototype.getGeometryComponent=function(){return this._component},ie.prototype.getSegmentIndex=function(){return this._segIndex},ie.prototype.interfaces_=function(){return[]},ie.prototype.getClass=function(){return ie},tu.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ie,tu);var sr=function(t){this._pts=t||null};sr.prototype.filter=function(t){t instanceof pe&&this._pts.add(t)},sr.prototype.interfaces_=function(){return[sn]},sr.prototype.getClass=function(){return sr},sr.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof pe?Ke.singletonList(t):sr.getPoints(t,new L)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof pe?n.add(e):e instanceof $t&&e.apply(new sr(n)),n}};var Kr=function(){this._locations=null;var t=arguments[0];this._locations=t};Kr.prototype.filter=function(t){(t instanceof pe||t instanceof dt||t instanceof wt)&&this._locations.add(new ie(t,0,t.getCoordinate()))},Kr.prototype.interfaces_=function(){return[sn]},Kr.prototype.getClass=function(){return Kr},Kr.getLocations=function(t){var e=new L;return t.apply(new Kr(e)),e};var Vt=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Je,this._minDistanceLocation=null,this._minDistance=V.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=o}};Vt.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],o=1-n,s=Wn.getPolygons(this._geom[n]);if(s.size()>0){var a=Kr.getLocations(this._geom[o]);if(this.computeContainmentDistance(a,s,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[o]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&k(arguments[0],Ye)&&k(arguments[1],Ye)){for(var u=arguments[0],l=arguments[1],c=arguments[2],f=0;f<u.size();f++)for(var h=u.get(f),g=0;g<l.size();g++)if(t.computeContainmentDistance(h,l.get(g),c),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ie&&arguments[1]instanceof wt){var p=arguments[0],y=arguments[1],d=arguments[2],_=p.getCoordinate();if(m.EXTERIOR!==this._ptLocator.locate(_,y))return this._minDistance=0,d[0]=p,d[1]=new ie(y,_),null}}},Vt.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var i=this,o=0;o<t.size();o++)for(var s=t.get(o),a=0;a<e.size();a++){var u=e.get(a);if(i.computeMinDistance(s,u,n),i._minDistance<=i._terminateDistance)return null}},Vt.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=zt.getLines(this._geom[0]),n=zt.getLines(this._geom[1]),i=sr.getPoints(this._geom[0]),o=sr.getPoints(this._geom[1]);if(this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,o,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance)||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,i,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance))return null;t[0]=null,t[1]=null,this.computeMinDistancePoints(i,o,t),this.updateMinDistance(t,!1)},Vt.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Vt.prototype.updateMinDistance=function(t,e){if(t[0]===null)return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},Vt.prototype.nearestPoints=function(){this.computeMinDistance();var t=[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()];return t},Vt.prototype.computeMinDistance=function(){var t=this;if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof dt&&arguments[1]instanceof pe){var e=arguments[0],n=arguments[1],i=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var o=e.getCoordinates(),s=n.getCoordinate(),a=0;a<o.length-1;a++){var u=R.distancePointLine(s,o[a],o[a+1]);if(u<t._minDistance){t._minDistance=u;var l=new A(o[a],o[a+1]),c=l.closestPoint(s);i[0]=new ie(e,a,c),i[1]=new ie(n,0,s)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof dt&&arguments[1]instanceof dt){var f=arguments[0],h=arguments[1],g=arguments[2];if(f.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var p=f.getCoordinates(),y=h.getCoordinates(),d=0;d<p.length-1;d++)for(var _=0;_<y.length-1;_++){var I=R.distanceLineLine(p[d],p[d+1],y[_],y[_+1]);if(I<t._minDistance){t._minDistance=I;var N=new A(p[d],p[d+1]),C=new A(y[_],y[_+1]),b=N.closestPoints(C);g[0]=new ie(f,d,b[0]),g[1]=new ie(h,_,b[1])}if(t._minDistance<=t._terminateDistance)return null}}}},Vt.prototype.computeMinDistancePoints=function(t,e,n){for(var i=this,o=0;o<t.size();o++)for(var s=t.get(o),a=0;a<e.size();a++){var u=e.get(a),l=s.getCoordinate().distance(u.getCoordinate());if(l<i._minDistance&&(i._minDistance=l,n[0]=new ie(s,0,s.getCoordinate()),n[1]=new ie(u,0,u.getCoordinate())),i._minDistance<=i._terminateDistance)return null}},Vt.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new ft("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Vt.prototype.computeMinDistanceLines=function(t,e,n){for(var i=this,o=0;o<t.size();o++)for(var s=t.get(o),a=0;a<e.size();a++){var u=e.get(a);if(i.computeMinDistance(s,u,n),i._minDistance<=i._terminateDistance)return null}},Vt.prototype.interfaces_=function(){return[]},Vt.prototype.getClass=function(){return Vt},Vt.distance=function(t,e){var n=new Vt(t,e);return n.distance()},Vt.isWithinDistance=function(t,e,n){var i=new Vt(t,e,n);return i.distance()<=n},Vt.nearestPoints=function(t,e){var n=new Vt(t,e);return n.nearestPoints()};var Kt=function(){this._pt=[new v,new v],this._distance=V.NaN,this._isNull=!0};Kt.prototype.getCoordinates=function(){return this._pt},Kt.prototype.getCoordinate=function(t){return this._pt[t]},Kt.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i<this._distance&&this.initialize(e,n,i)}},Kt.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=o,this._isNull=!1}},Kt.prototype.toString=function(){return Xe.toLineString(this._pt[0],this._pt[1])},Kt.prototype.getDistance=function(){return this._distance},Kt.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},Kt.prototype.interfaces_=function(){return[]},Kt.prototype.getClass=function(){return Kt};var dn=function(){};dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},dn.computeDistance=function(){if(arguments[2]instanceof Kt&&arguments[0]instanceof dt&&arguments[1]instanceof v)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new A,o=t.getCoordinates(),s=0;s<o.length-1;s++){i.setCoordinates(o[s],o[s+1]);var a=i.closestPoint(e);n.setMinimum(a,e)}else if(arguments[2]instanceof Kt&&arguments[0]instanceof wt&&arguments[1]instanceof v){var u=arguments[0],l=arguments[1],c=arguments[2];dn.computeDistance(u.getExteriorRing(),l,c);for(var f=0;f<u.getNumInteriorRing();f++)dn.computeDistance(u.getInteriorRingN(f),l,c)}else if(arguments[2]instanceof Kt&&arguments[0]instanceof G&&arguments[1]instanceof v){var h=arguments[0],g=arguments[1],p=arguments[2];if(h instanceof dt)dn.computeDistance(h,g,p);else if(h instanceof wt)dn.computeDistance(h,g,p);else if(h instanceof $t)for(var y=h,d=0;d<y.getNumGeometries();d++){var _=y.getGeometryN(d);dn.computeDistance(_,g,p)}else p.setMinimum(h.getCoordinate(),g)}else if(arguments[2]instanceof Kt&&arguments[0]instanceof A&&arguments[1]instanceof v){var I=arguments[0],N=arguments[1],C=arguments[2],b=I.closestPoint(N);C.setMinimum(b,N)}};var ke=function(){this._g0=null,this._g1=null,this._ptDist=new Kt,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Os={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ke.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ke.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new ft("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},ke.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},ke.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ke.prototype.computeOrientedDistance=function(t,e,n){var i=new Qr(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var o=new ar(e,this._densifyFrac);t.apply(o),n.setMaximum(o.getMaxPointDistance())}},ke.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke},ke.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ke(t,e);return n.distance()}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2],a=new ke(i,o);return a.setDensifyFraction(s),a.distance()}},Os.MaxPointDistanceFilter.get=function(){return Qr},Os.MaxDensifiedByFractionDistanceFilter.get=function(){return ar},Object.defineProperties(ke,Os);var Qr=function(){this._maxPtDist=new Kt,this._minPtDist=new Kt,this._euclideanDist=new dn,this._geom=null;var t=arguments[0];this._geom=t};Qr.prototype.filter=function(t){this._minPtDist.initialize(),dn.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Qr.prototype.getMaxPointDistance=function(){return this._maxPtDist},Qr.prototype.interfaces_=function(){return[In]},Qr.prototype.getClass=function(){return Qr};var ar=function(){this._maxPtDist=new Kt,this._minPtDist=new Kt,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};ar.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var i=t.getCoordinate(e-1),o=t.getCoordinate(e),s=(o.x-i.x)/this._numSubSegs,a=(o.y-i.y)/this._numSubSegs,u=0;u<this._numSubSegs;u++){var l=i.x+u*s,c=i.y+u*a,f=new v(l,c);n._minPtDist.initialize(),dn.computeDistance(n._geom,f,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},ar.prototype.isDone=function(){return!1},ar.prototype.isGeometryChanged=function(){return!1},ar.prototype.getMaxPointDistance=function(){return this._maxPtDist},ar.prototype.interfaces_=function(){return[We]},ar.prototype.getClass=function(){return ar};var ye=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Ds={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};ye.prototype.checkMaximumDistance=function(t,e,n){var i=new ke(e,t);if(i.setDensifyFraction(.25),this._maxDistanceFound=i.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var o=i.getCoordinates();this._errorLocation=o[1],this._errorIndicator=t.getFactory().createLineString(o),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Xe.toLineString(o[0],o[1])+")"}},ye.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=ye.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),ye.VERBOSE&&Bt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},ye.prototype.checkNegativeValid=function(){if(!(this._input instanceof wt||this._input instanceof Nn||this._input instanceof $t))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},ye.prototype.getErrorIndicator=function(){return this._errorIndicator},ye.prototype.checkMinimumDistance=function(t,e,n){var i=new Vt(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound<n){this._isValid=!1;var o=i.nearestPoints();this._errorLocation=i.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(o),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Xe.toLineString(o[0],o[1])+" )"}},ye.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},ye.prototype.getErrorLocation=function(){return this._errorLocation},ye.prototype.getPolygonLines=function(t){for(var e=new L,n=new zt(e),i=Wn.getPolygons(t),o=i.iterator();o.hasNext();){var s=o.next();s.apply(n)}return t.getFactory().buildGeometry(e)},ye.prototype.getErrorMessage=function(){return this._errMsg},ye.prototype.interfaces_=function(){return[]},ye.prototype.getClass=function(){return ye},Ds.VERBOSE.get=function(){return!1},Ds.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(ye,Ds);var Ut=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},Ts={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Ut.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Ut.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Ut.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var e=new M(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new M(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Ut.prototype.checkDistance=function(){var t=new ye(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},Ut.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Ut.prototype.checkPolygonal=function(){this._result instanceof wt||this._result instanceof Nn||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Ut.prototype.getErrorIndicator=function(){return this._errorIndicator},Ut.prototype.getErrorLocation=function(){return this._errorLocation},Ut.prototype.checkExpectedEmpty=function(){if(this._input.getDimension()>=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")},Ut.prototype.report=function(t){if(!Ut.VERBOSE)return null;Bt.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Ut.prototype.getErrorMessage=function(){return this._errorMsg},Ut.prototype.interfaces_=function(){return[]},Ut.prototype.getClass=function(){return Ut},Ut.isValidMsg=function(t,e,n){var i=new Ut(t,e,n);return i.isValid()?null:i.getErrorMessage()},Ut.isValid=function(t,e,n){var i=new Ut(t,e,n);return!!i.isValid()},Ts.VERBOSE.get=function(){return!1},Ts.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Ut,Ts);var vn=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};vn.prototype.getCoordinates=function(){return this._pts},vn.prototype.size=function(){return this._pts.length},vn.prototype.getCoordinate=function(t){return this._pts[t]},vn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},vn.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Xr.octant(this.getCoordinate(t),this.getCoordinate(t+1))},vn.prototype.setData=function(t){this._data=t},vn.prototype.getData=function(){return this._data},vn.prototype.toString=function(){return Xe.toLineString(new _t(this._pts))},vn.prototype.interfaces_=function(){return[Sn]},vn.prototype.getClass=function(){return vn};var Tt=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new L,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Tt.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Tt.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Tt.prototype.getIntersectionSegments=function(){return this._intSegments},Tt.prototype.count=function(){return this._intersectionCount},Tt.prototype.getIntersections=function(){return this._intersections},Tt.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Tt.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Tt.prototype.processIntersections=function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly){var o=this.isEndSegment(t,e)||this.isEndSegment(n,i);if(!o)return null}var s=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[i],l=n.getCoordinates()[i+1];this._li.computeIntersection(s,a,u,l),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=a,this._intSegments[2]=u,this._intSegments[3]=l,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Tt.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2},Tt.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Tt.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null},Tt.prototype.interfaces_=function(){return[Nr]},Tt.prototype.getClass=function(){return Tt},Tt.createAllIntersectionsFinder=function(t){var e=new Tt(t);return e.setFindAllIntersections(!0),e},Tt.createAnyIntersectionFinder=function(t){return new Tt(t)},Tt.createIntersectionCounter=function(t){var e=new Tt(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ze=function(){this._li=new yr,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ze.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Ze.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ze.prototype.isValid=function(){return this.execute(),this._isValid},Ze.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ze.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Tt(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ps;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ze.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new qn(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ze.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Xe.toLineString(t[0],t[1])+" and "+Xe.toLineString(t[2],t[3])},Ze.prototype.interfaces_=function(){return[]},Ze.prototype.getClass=function(){return Ze},Ze.computeIntersections=function(t){var e=new Ze(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var wr=function r(){this._nv=null;var t=arguments[0];this._nv=new Ze(r.toSegmentStrings(t))};wr.prototype.checkValid=function(){this._nv.checkValid()},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.toSegmentStrings=function(t){for(var e=new L,n=t.iterator();n.hasNext();){var i=n.next();e.add(new vn(i.getCoordinates(),i))}return e},wr.checkValid=function(t){var e=new wr(t);e.checkValid()};var Jr=function(t){this._mapOp=t};Jr.prototype.map=function(t){for(var e=this,n=new L,i=0;i<t.getNumGeometries();i++){var o=e._mapOp.map(t.getGeometryN(i));o.isEmpty()||n.add(o)}return t.getFactory().createGeometryCollection(H.toGeometryArray(n))},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr},Jr.map=function(t,e){var n=new Jr(e);return n.map(t)};var yn=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new L,this._resultLineList=new L;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};yn.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next();e.collectLineEdge(i,t,e._lineEdgesList),e.collectBoundaryTouchEdge(i,t,e._lineEdgesList)}},yn.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},yn.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},yn.prototype.collectLineEdge=function(t,e,n){var i=t.getLabel(),o=t.getEdge();t.isLineEdge()&&!t.isVisited()&&U.isResultOfOp(i,e)&&!o.isCovered()&&(n.add(o),t.setVisitedEdge(!0))},yn.prototype.findCoveredLineEdges=function(){for(var t=this,e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();n.getEdges().findCoveredLineEdges()}for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var o=i.next(),s=o.getEdge();if(o.isLineEdge()&&!s.isCoveredSet()){var a=t._op.isCoveredByA(o.getCoordinate());s.setCovered(a)}}},yn.prototype.labelIsolatedLines=function(t){for(var e=this,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getLabel();i.isIsolated()&&(o.isNull(0)?e.labelIsolatedLine(i,0):e.labelIsolatedLine(i,1))}},yn.prototype.buildLines=function(t){for(var e=this,n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),o=e._geometryFactory.createLineString(i.getCoordinates());e._resultLineList.add(o),i.setInResult(!0)}},yn.prototype.collectBoundaryTouchEdge=function(t,e,n){var i=t.getLabel();if(t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult())return null;q.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),U.isResultOfOp(i,e)&&e===U.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))},yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn};var Zr=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new L;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Zr.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Zr.prototype.extractNonCoveredResultNodes=function(t){for(var e=this,n=this._op.getGraph().getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isInResult()&&!i.isIncidentEdgeInResult()&&(i.getEdges().getDegree()===0||t===U.INTERSECTION)){var o=i.getLabel();U.isResultOfOp(o,t)&&e.filterCoveredNodeToPoint(i)}}},Zr.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr};var he=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};he.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},he.prototype.transformPolygon=function(t,e){var n=this,i=!0,o=this.transformLinearRing(t.getExteriorRing(),t);(o===null||!(o instanceof Cn)||o.isEmpty())&&(i=!1);for(var s=new L,a=0;a<t.getNumInteriorRing();a++){var u=n.transformLinearRing(t.getInteriorRingN(a),t);u===null||u.isEmpty()||(u instanceof Cn||(i=!1),s.add(u))}if(i)return this._factory.createPolygon(o,s.toArray([]));var l=new L;return o!==null&&l.add(o),l.addAll(s),this._factory.buildGeometry(l)},he.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},he.prototype.getInputGeometry=function(){return this._inputGeom},he.prototype.transformMultiLineString=function(t,e){for(var n=this,i=new L,o=0;o<t.getNumGeometries();o++){var s=n.transformLineString(t.getGeometryN(o),t);s!==null&&(s.isEmpty()||i.add(s))}return this._factory.buildGeometry(i)},he.prototype.transformCoordinates=function(t,e){return this.copy(t)},he.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},he.prototype.transformMultiPoint=function(t,e){for(var n=this,i=new L,o=0;o<t.getNumGeometries();o++){var s=n.transformPoint(t.getGeometryN(o),t);s!==null&&(s.isEmpty()||i.add(s))}return this._factory.buildGeometry(i)},he.prototype.transformMultiPolygon=function(t,e){for(var n=this,i=new L,o=0;o<t.getNumGeometries();o++){var s=n.transformPolygon(t.getGeometryN(o),t);s!==null&&(s.isEmpty()||i.add(s))}return this._factory.buildGeometry(i)},he.prototype.copy=function(t){return t.copy()},he.prototype.transformGeometryCollection=function(t,e){for(var n=this,i=new L,o=0;o<t.getNumGeometries();o++){var s=n.transform(t.getGeometryN(o));s!==null&&(n._pruneEmptyGeometry&&s.isEmpty()||i.add(s))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(H.toGeometryArray(i)):this._factory.buildGeometry(i)},he.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof pe)return this.transformPoint(t,null);if(t instanceof Ei)return this.transformMultiPoint(t,null);if(t instanceof Cn)return this.transformLinearRing(t,null);if(t instanceof dt)return this.transformLineString(t,null);if(t instanceof Er)return this.transformMultiLineString(t,null);if(t instanceof wt)return this.transformPolygon(t,null);if(t instanceof Nn)return this.transformMultiPolygon(t,null);if(t instanceof $t)return this.transformGeometryCollection(t,null);throw new ft("Unknown Geometry subtype: "+t.getClass().getName())},he.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(n===null)return this._factory.createLinearRing(null);var i=n.size();return i>0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},he.prototype.interfaces_=function(){return[]},he.prototype.getClass=function(){return he};var Rn=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new A,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof dt&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];r.call(this,t.getCoordinates(),e)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];this._srcPts=n,this._isClosed=r.isClosed(n),this._snapTolerance=i}};Rn.prototype.snapVertices=function(t,e){for(var n=this,i=this._isClosed?t.size()-1:t.size(),o=0;o<i;o++){var s=t.get(o),a=n.findSnapForVertex(s,e);a!==null&&(t.set(o,new v(a)),o===0&&n._isClosed&&t.set(t.size()-1,new v(a)))}},Rn.prototype.findSnapForVertex=function(t,e){for(var n=this,i=0;i<e.length;i++){if(t.equals2D(e[i]))return null;if(t.distance(e[i])<n._snapTolerance)return e[i]}return null},Rn.prototype.snapTo=function(t){var e=new Ki(this._srcPts);this.snapVertices(e,t),this.snapSegments(e,t);var n=e.toCoordinateArray();return n},Rn.prototype.snapSegments=function(t,e){var n=this;if(e.length===0)return null;var i=e.length;e[0].equals2D(e[e.length-1])&&(i=e.length-1);for(var o=0;o<i;o++){var s=e[o],a=n.findSegmentIndexToSnap(s,t);a>=0&&t.add(a+1,new v(s),!1)}},Rn.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,i=V.MAX_VALUE,o=-1,s=0;s<e.size()-1;s++){if(n._seg.p0=e.get(s),n._seg.p1=e.get(s+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var a=n._seg.distance(t);a<n._snapTolerance&&a<i&&(i=a,o=s)}return o},Rn.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn},Rn.isClosed=function(t){return t.length<=1?!1:t[0].equals2D(t[t.length-1])};var It=function(t){this._srcGeom=t||null},eu={SNAP_PRECISION_FACTOR:{configurable:!0}};It.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t),i=new nu(e,n);return i.transform(this._srcGeom)},It.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),i=new nu(t,n,!0),o=i.transform(this._srcGeom),s=o;return e&&k(s,tr)&&(s=o.buffer(0)),s},It.prototype.computeSnapTolerance=function(t){var e=this.computeMinimumSegmentLength(t),n=e/10;return n},It.prototype.extractTargetCoordinates=function(t){for(var e=new on,n=t.getCoordinates(),i=0;i<n.length;i++)e.add(n[i]);return e.toArray(new Array(0).fill(null))},It.prototype.computeMinimumSegmentLength=function(t){for(var e=V.MAX_VALUE,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);i<e&&(e=i)}return e},It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.snap=function(t,e,n){var i=new Array(2).fill(null),o=new It(t);i[0]=o.snapTo(e,n);var s=new It(e);return i[1]=s.snapTo(i[0],n),i},It.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],e=It.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===Z.FIXED){var i=1/n.getScale()*2/1.415;i>e&&(e=i)}return e}else if(arguments.length===2){var o=arguments[0],s=arguments[1];return Math.min(It.computeOverlaySnapTolerance(o),It.computeOverlaySnapTolerance(s))}},It.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal(),n=Math.min(e.getHeight(),e.getWidth()),i=n*It.SNAP_PRECISION_FACTOR;return i},It.snapToSelf=function(t,e,n){var i=new It(t);return i.snapToSelf(e,n)},eu.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(It,eu);var nu=function(r){function t(e,n,i){r.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=i!==void 0?i:!1}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(n,i){var o=new Rn(n,this._snapTolerance);return o.setAllowSnappingToSourceVertices(this._isSelfSnap),o.snapTo(i)},t.prototype.transformCoordinates=function(n,i){var o=n.toCoordinateArray(),s=this.snapLine(o,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(s)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(he),oe=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};oe.prototype.getCommon=function(){return V.longBitsToDouble(this._commonBits)},oe.prototype.add=function(t){var e=V.doubleToLongBits(t);if(this._isFirst)return this._commonBits=e,this._commonSignExp=oe.signExpBits(this._commonBits),this._isFirst=!1,null;var n=oe.signExpBits(e);if(n!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=oe.numCommonMostSigMantissaBits(this._commonBits,e),this._commonBits=oe.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},oe.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=V.longBitsToDouble(t),n=V.toBinaryString(t),i="0000000000000000000000000000000000000000000000000000000000000000"+n,o=i.substring(i.length-64),s=o.substring(0,1)+" "+o.substring(1,12)+"(exp) "+o.substring(12)+" [ "+e+" ]";return s}},oe.prototype.interfaces_=function(){return[]},oe.prototype.getClass=function(){return oe},oe.getBit=function(t,e){var n=1<<e;return(t&n)!==0?1:0},oe.signExpBits=function(t){return t>>52},oe.zeroLowerBits=function(t,e){var n=(1<<e)-1,i=~n,o=t&i;return o},oe.numCommonMostSigMantissaBits=function(t,e){for(var n=0,i=52;i>=0;i--){if(oe.getBit(t,i)!==oe.getBit(e,i))return n;n++}return 52};var ur=function(){this._commonCoord=null,this._ccFilter=new $r},Ms={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};ur.prototype.addCommonBits=function(t){var e=new lr(this._commonCoord);t.apply(e),t.geometryChanged()},ur.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new v(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new lr(e);return t.apply(n),t.geometryChanged(),t},ur.prototype.getCommonCoordinate=function(){return this._commonCoord},ur.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},Ms.CommonCoordinateFilter.get=function(){return $r},Ms.Translater.get=function(){return lr},Object.defineProperties(ur,Ms);var $r=function(){this._commonBitsX=new oe,this._commonBitsY=new oe};$r.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},$r.prototype.getCommonCoordinate=function(){return new v(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},$r.prototype.interfaces_=function(){return[In]},$r.prototype.getClass=function(){return $r};var lr=function(){this.trans=null;var t=arguments[0];this.trans=t};lr.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)},lr.prototype.isDone=function(){return!1},lr.prototype.isGeometryChanged=function(){return!0},lr.prototype.interfaces_=function(){return[We]},lr.prototype.getClass=function(){return lr};var Mt=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Mt.prototype.selfSnap=function(t){var e=new It(t),n=e.snapTo(t,this._snapTolerance);return n},Mt.prototype.removeCommonBits=function(t){this._cbr=new ur,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},Mt.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Mt.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=U.overlayOp(e[0],e[1],t);return this.prepareResult(n)},Mt.prototype.checkValid=function(t){t.isValid()||Bt.out.println("Snapped geometry is invalid")},Mt.prototype.computeSnapTolerance=function(){this._snapTolerance=It.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Mt.prototype.snap=function(t){var e=this.removeCommonBits(t),n=It.snap(e[0],e[1],this._snapTolerance);return n},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt},Mt.overlayOp=function(t,e,n){var i=new Mt(t,e);return i.getResultGeometry(n)},Mt.union=function(t,e){return Mt.overlayOp(t,e,U.UNION)},Mt.intersection=function(t,e){return Mt.overlayOp(t,e,U.INTERSECTION)},Mt.symDifference=function(t,e){return Mt.overlayOp(t,e,U.SYMDIFFERENCE)},Mt.difference=function(t,e){return Mt.overlayOp(t,e,U.DIFFERENCE)};var se=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};se.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=U.overlayOp(this._geom[0],this._geom[1],t);var o=!0;o&&(n=!0)}catch(s){if(s instanceof Bn)i=s;else throw s}finally{}if(!n)try{e=Mt.overlayOp(this._geom[0],this._geom[1],t)}catch(s){throw s instanceof Bn?i:s}finally{}return e},se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se},se.overlayOp=function(t,e,n){var i=new se(t,e);return i.getResultGeometry(n)},se.union=function(t,e){return se.overlayOp(t,e,U.UNION)},se.intersection=function(t,e){return se.overlayOp(t,e,U.INTERSECTION)},se.symDifference=function(t,e){return se.overlayOp(t,e,U.SYMDIFFERENCE)},se.difference=function(t,e){return se.overlayOp(t,e,U.DIFFERENCE)};var co=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};co.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var me=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],e=arguments[1];this._eventType=r.DELETE,this._xValue=t,this._insertEvent=e}else if(arguments.length===3){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=r.INSERT,this._label=n,this._xValue=i,this._obj=o}},As={INSERT:{configurable:!0},DELETE:{configurable:!0}};me.prototype.isDelete=function(){return this._eventType===me.DELETE},me.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},me.prototype.getObject=function(){return this._obj},me.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},me.prototype.getInsertEvent=function(){return this._insertEvent},me.prototype.isInsert=function(){return this._eventType===me.INSERT},me.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label},me.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},me.prototype.interfaces_=function(){return[De]},me.prototype.getClass=function(){return me},As.INSERT.get=function(){return 1},As.DELETE.get=function(){return 2},Object.defineProperties(me,As);var Uo=function(){};Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo};var qt=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};qt.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(qt.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var o=t.getNumPoints()-1;if(e===0&&i===o||i===0&&e===o)return!0}}return!1},qt.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},qt.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},qt.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},qt.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next(),o=i.getCoordinate();if(t.isIntersection(o))return!0}return!1},qt.prototype.hasProperIntersection=function(){return this._hasProper},qt.prototype.hasIntersection=function(){return this._hasIntersection},qt.prototype.isDone=function(){return this._isDone},qt.prototype.isBoundaryPoint=function(t,e){return e===null?!1:!!(this.isBoundaryPointInternal(t,e[0])||this.isBoundaryPointInternal(t,e[1]))},qt.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},qt.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var o=t.getCoordinates()[e],s=t.getCoordinates()[e+1],a=n.getCoordinates()[i],u=n.getCoordinates()[i+1];this._li.computeIntersection(o,s,a,u),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},qt.prototype.interfaces_=function(){return[]},qt.prototype.getClass=function(){return qt},qt.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var cc=function(r){function t(){r.call(this),this.events=new L,this.nOverlaps=null}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var n=this;Ke.sort(this.events);for(var i=0;i<this.events.size();i++){var o=n.events.get(i);o.isDelete()&&o.getInsertEvent().setDeleteEventIndex(i)}},t.prototype.computeIntersections=function(){var n=this;if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var o=0;o<this.events.size();o++){var s=n.events.get(o);if(s.isInsert()&&n.processOverlaps(o,s.getDeleteEventIndex(),s,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof qt&&k(arguments[0],Ye)&&k(arguments[1],Ye)){var a=arguments[0],u=arguments[1],l=arguments[2];this.addEdges(a,a),this.addEdges(u,u),this.computeIntersections(l)}else if(typeof arguments[2]=="boolean"&&k(arguments[0],Ye)&&arguments[1]instanceof qt){var c=arguments[0],f=arguments[1],h=arguments[2];h?this.addEdges(c,null):this.addEdges(c),this.computeIntersections(f)}}},t.prototype.addEdge=function(n,i){for(var o=this,s=n.getMonotoneChainEdge(),a=s.getStartIndexes(),u=0;u<a.length-1;u++){var l=new co(s,u),c=new me(i,s.getMinX(u),l);o.events.add(c),o.events.add(new me(s.getMaxX(u),c))}},t.prototype.processOverlaps=function(n,i,o,s){for(var a=this,u=o.getObject(),l=n;l<i;l++){var c=a.events.get(l);if(c.isInsert()){var f=c.getObject();o.isSameLabel(c)||(u.computeIntersections(f,s),a.nOverlaps++)}}},t.prototype.addEdges=function(){var n=this;if(arguments.length===1)for(var i=arguments[0],o=i.iterator();o.hasNext();){var s=o.next();n.addEdge(s,s)}else if(arguments.length===2)for(var a=arguments[0],u=arguments[1],l=a.iterator();l.hasNext();){var c=l.next();n.addEdge(c,u)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Uo),On=function(){this._min=V.POSITIVE_INFINITY,this._max=V.NEGATIVE_INFINITY},ru={NodeComparator:{configurable:!0}};On.prototype.getMin=function(){return this._min},On.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},On.prototype.getMax=function(){return this._max},On.prototype.toString=function(){return Xe.toLineString(new v(this._min,0),new v(this._max,0))},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},ru.NodeComparator.get=function(){return fo},Object.defineProperties(On,ru);var fo=function(){};fo.prototype.compare=function(t,e){var n=t,i=e,o=(n._min+n._max)/2,s=(i._min+i._max)/2;return o<s?-1:o>s?1:0},fo.prototype.interfaces_=function(){return[li]},fo.prototype.getClass=function(){return fo};var fc=function(r){function t(){r.call(this),this._item=null;var e=arguments[0],n=arguments[1],i=arguments[2];this._min=e,this._max=n,this._item=i}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.query=function(n,i,o){if(!this.intersects(n,i))return null;o.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(On),hc=function(r){function t(){r.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(n,i){this._min=Math.min(n._min,i._min),this._max=Math.max(n._max,i._max)},t.prototype.query=function(n,i,o){if(!this.intersects(n,i))return null;this._node1!==null&&this._node1.query(n,i,o),this._node2!==null&&this._node2.query(n,i,o)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(On),Dn=function(){this._leaves=new L,this._root=null,this._level=0};Dn.prototype.buildTree=function(){var t=this;Ke.sort(this._leaves,new On.NodeComparator);for(var e=this._leaves,n=null,i=new L;;){if(t.buildLevel(e,i),i.size()===1)return i.get(0);n=e,e=i,i=n}},Dn.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new fc(t,e,n))},Dn.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Dn.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Dn.prototype.printNode=function(t){Bt.out.println(Xe.toLineString(new v(t._min,this._level),new v(t._max,this._level)))},Dn.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Dn.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var i=t.get(n),o=n+1<t.size()?t.get(n):null;if(o===null)e.add(i);else{var s=new hc(t.get(n),t.get(n+1));e.add(s)}}},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn};var Li=function(){this._items=new L};Li.prototype.visitItem=function(t){this._items.add(t)},Li.prototype.getItems=function(){return this._items},Li.prototype.interfaces_=function(){return[er]},Li.prototype.getClass=function(){return Li};var bi=function(){this._index=null;var t=arguments[0];if(!k(t,tr))throw new ft("Argument must be Polygonal");this._index=new Lr(t)},Fs={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};bi.prototype.locate=function(t){var e=new rn(t),n=new Pi(e);return this._index.query(t.y,t.y,n),e.getLocation()},bi.prototype.interfaces_=function(){return[xi]},bi.prototype.getClass=function(){return bi},Fs.SegmentVisitor.get=function(){return Pi},Fs.IntervalIndexedGeometry.get=function(){return Lr},Object.defineProperties(bi,Fs);var Pi=function(){this._counter=null;var t=arguments[0];this._counter=t};Pi.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Pi.prototype.interfaces_=function(){return[er]},Pi.prototype.getClass=function(){return Pi};var Lr=function(){this._index=new Dn;var t=arguments[0];this.init(t)};Lr.prototype.init=function(t){for(var e=this,n=zt.getLines(t),i=n.iterator();i.hasNext();){var o=i.next(),s=o.getCoordinates();e.addLine(s)}},Lr.prototype.addLine=function(t){for(var e=this,n=1;n<t.length;n++){var i=new A(t[n-1],t[n]),o=Math.min(i.p0.y,i.p1.y),s=Math.max(i.p0.y,i.p1.y);e._index.insert(o,s,i)}},Lr.prototype.query=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Li;return this._index.query(t,e,n),n.getItems()}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];this._index.query(i,o,s)}},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr};var ho=function(r){function t(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new Ga,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Je,arguments.length===2){var e=arguments[0],n=arguments[1],i=Me.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=i,n!==null&&this.add(n)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];this._argIndex=o,this._parentGeom=s,this._boundaryNodeRule=a,s!==null&&this.add(s)}}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.insertBoundaryPoint=function(n,i){var o=this._nodes.addNode(i),s=o.getLabel(),a=1,u=m.NONE;u=s.getLocation(n,x.ON),u===m.BOUNDARY&&a++;var l=t.determineBoundary(this._boundaryNodeRule,a);s.setLocation(n,l)},t.prototype.computeSelfNodes=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.computeSelfNodes(n,i,!1)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2],u=new qt(o,!0,!1);u.setIsDoneIfProperInt(a);var l=this.createEdgeSetIntersector(),c=this._parentGeom instanceof Cn||this._parentGeom instanceof wt||this._parentGeom instanceof Nn,f=s||!c;return l.computeIntersections(this._edges,u,f),this.addSelfIntersectionNodes(this._argIndex),u}},t.prototype.computeSplitEdges=function(n){for(var i=this._edges.iterator();i.hasNext();){var o=i.next();o.eiList.addSplitEdges(n)}},t.prototype.computeEdgeIntersections=function(n,i,o){var s=new qt(i,o,!0);s.setBoundaryNodes(this.getBoundaryNodes(),n.getBoundaryNodes());var a=this.createEdgeSetIntersector();return a.computeIntersections(this._edges,n._edges,s),s},t.prototype.getGeometry=function(){return this._parentGeom},t.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},t.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},t.prototype.addPoint=function(){if(arguments[0]instanceof pe){var n=arguments[0],i=n.getCoordinate();this.insertPoint(this._argIndex,i,m.INTERIOR)}else if(arguments[0]instanceof v){var o=arguments[0];this.insertPoint(this._argIndex,o,m.INTERIOR)}},t.prototype.addPolygon=function(n){var i=this;this.addPolygonRing(n.getExteriorRing(),m.EXTERIOR,m.INTERIOR);for(var o=0;o<n.getNumInteriorRing();o++){var s=n.getInteriorRingN(o);i.addPolygonRing(s,m.INTERIOR,m.EXTERIOR)}},t.prototype.addEdge=function(n){this.insertEdge(n);var i=n.getCoordinates();this.insertPoint(this._argIndex,i[0],m.BOUNDARY),this.insertPoint(this._argIndex,i[i.length-1],m.BOUNDARY)},t.prototype.addLineString=function(n){var i=Y.removeRepeatedPoints(n.getCoordinates());if(i.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var o=new Vo(i,new nt(this._argIndex,m.INTERIOR));this._lineEdgeMap.put(n,o),this.insertEdge(o),q.isTrue(i.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),i=new Array(n.size()).fill(null),o=0,s=n.iterator();s.hasNext();){var a=s.next();i[o++]=a.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(n,i,o){if(this.isBoundaryNode(n,i))return null;o===m.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,i):this.insertPoint(n,i,o)},t.prototype.addPolygonRing=function(n,i,o){if(n.isEmpty())return null;var s=Y.removeRepeatedPoints(n.getCoordinates());if(s.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var a=i,u=o;R.isCCW(s)&&(a=o,u=i);var l=new Vo(s,new nt(this._argIndex,m.BOUNDARY,a,u));this._lineEdgeMap.put(n,l),this.insertEdge(l),this.insertPoint(this._argIndex,s[0],m.BOUNDARY)},t.prototype.insertPoint=function(n,i,o){var s=this._nodes.addNode(i),a=s.getLabel();a===null?s._label=new nt(n,o):a.setLocation(n,o)},t.prototype.createEdgeSetIntersector=function(){return new cc},t.prototype.addSelfIntersectionNodes=function(n){for(var i=this,o=this._edges.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel().getLocation(n),u=s.eiList.iterator();u.hasNext();){var l=u.next();i.addSelfIntersectionNode(n,l.coord,a)}},t.prototype.add=function(){if(arguments.length===1){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Nn&&(this._useBoundaryDeterminationRule=!1),n instanceof wt)this.addPolygon(n);else if(n instanceof dt)this.addLineString(n);else if(n instanceof pe)this.addPoint(n);else if(n instanceof Ei)this.addCollection(n);else if(n instanceof Er)this.addCollection(n);else if(n instanceof Nn)this.addCollection(n);else if(n instanceof $t)this.addCollection(n);else throw new Error(n.getClass().getName())}else return r.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(n){for(var i=this,o=0;o<n.getNumGeometries();o++){var s=n.getGeometryN(o);i.add(s)}},t.prototype.locate=function(n){return k(this._parentGeom,tr)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new bi(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}else return r.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(n,i){return n.isInBoundary(i)?m.BOUNDARY:m.INTERIOR},t}(gt),Ri=function(){if(this._li=new yr,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ho(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=Me.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ho(0,e,i),this._arg[1]=new ho(1,n,i)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];o.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(o.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ho(0,o,a),this._arg[1]=new ho(1,s,a)}};Ri.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Ri.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var br=function(){};br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br},br.map=function(){if(arguments[0]instanceof G&&k(arguments[1],br.MapOp)){for(var t=arguments[0],e=arguments[1],n=new L,i=0;i<t.getNumGeometries();i++){var o=e.map(t.getGeometryN(i));o!==null&&n.add(o)}return t.getFactory().buildGeometry(n)}else if(k(arguments[0],St)&&k(arguments[1],br.MapOp)){for(var s=arguments[0],a=arguments[1],u=new L,l=s.iterator();l.hasNext();){var c=l.next(),f=a.map(c);f!==null&&u.add(f)}return u}},br.MapOp=function(){};var U=function(r){function t(){var e=arguments[0],n=arguments[1];r.call(this,e,n),this._ptLocator=new Je,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Qe,this._resultPolyList=new L,this._resultLineList=new L,this._resultPointList=new L,this._graph=new gt(new ja),this._geomFact=e.getFactory()}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var o=i.getLabel(),s=n.getLabel();i.isPointwiseEqual(n)||(s=new nt(n.getLabel()),s.flip());var a=i.getDepth();a.isNull()&&a.add(o),a.add(s),o.merge(s)}else this._edgeList.add(n)},t.prototype.getGraph=function(){return this._graph},t.prototype.cancelDuplicateResultEdges=function(){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var i=n.next(),o=i.getSym();i.isInResult()&&o.isInResult()&&(i.setInResult(!1),o.setInResult(!1))}},t.prototype.isCoveredByLA=function(n){return!!(this.isCovered(n,this._resultLineList)||this.isCovered(n,this._resultPolyList))},t.prototype.computeGeometry=function(n,i,o,s){var a=new L;return a.addAll(n),a.addAll(i),a.addAll(o),a.isEmpty()?t.createEmptyResult(s,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(a)},t.prototype.mergeSymLabels=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var i=n.next();i.getEdges().mergeSymLabels()}},t.prototype.isCovered=function(n,i){for(var o=this,s=i.iterator();s.hasNext();){var a=s.next(),u=o._ptLocator.locate(n,a);if(u!==m.EXTERIOR)return!0}return!1},t.prototype.replaceCollapsedEdges=function(){for(var n=new L,i=this._edgeList.iterator();i.hasNext();){var o=i.next();o.isCollapsed()&&(i.remove(),n.add(o.getCollapsedEdge()))}this._edgeList.addAll(n)},t.prototype.updateNodeLabelling=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var i=n.next(),o=i.getEdges().getLabel();i.getLabel().merge(o)}},t.prototype.getResultGeometry=function(n){return this.computeOverlay(n),this._resultGeom},t.prototype.insertUniqueEdges=function(n){for(var i=this,o=n.iterator();o.hasNext();){var s=o.next();i.insertUniqueEdge(s)}},t.prototype.computeOverlay=function(n){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var i=new L;this._arg[0].computeSplitEdges(i),this._arg[1].computeSplitEdges(i),this.insertUniqueEdges(i),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),wr.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(n),this.cancelDuplicateResultEdges();var o=new de(this._geomFact);o.add(this._graph),this._resultPolyList=o.getPolygons();var s=new yn(this,this._geomFact,this._ptLocator);this._resultLineList=s.build(n);var a=new Zr(this,this._geomFact,this._ptLocator);this._resultPointList=a.build(n),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,n)},t.prototype.labelIncompleteNode=function(n,i){var o=this._ptLocator.locate(n.getCoordinate(),this._arg[i].getGeometry());n.getLabel().setLocation(i,o)},t.prototype.copyPoints=function(n){for(var i=this,o=this._arg[n].getNodeIterator();o.hasNext();){var s=o.next(),a=i._graph.addNode(s.getCoordinate());a.setLabel(n,s.getLabel().getLocation(n))}},t.prototype.findResultAreaEdges=function(n){for(var i=this._graph.getEdgeEnds().iterator();i.hasNext();){var o=i.next(),s=o.getLabel();s.isArea()&&!o.isInteriorAreaEdge()&&t.isResultOfOp(s.getLocation(0,x.RIGHT),s.getLocation(1,x.RIGHT),n)&&o.setInResult(!0)}},t.prototype.computeLabelsFromDepths=function(){for(var n=this._edgeList.iterator();n.hasNext();){var i=n.next(),o=i.getLabel(),s=i.getDepth();if(!s.isNull()){s.normalize();for(var a=0;a<2;a++)!o.isNull(a)&&o.isArea()&&!s.isNull(a)&&(s.getDelta(a)===0?o.toLine(a):(q.isTrue(!s.isNull(a,x.LEFT),"depth of LEFT side has not been initialized"),o.setLocation(a,x.LEFT,s.getLocation(a,x.LEFT)),q.isTrue(!s.isNull(a,x.RIGHT),"depth of RIGHT side has not been initialized"),o.setLocation(a,x.RIGHT,s.getLocation(a,x.RIGHT))))}}},t.prototype.computeLabelling=function(){for(var n=this,i=this._graph.getNodes().iterator();i.hasNext();){var o=i.next();o.getEdges().computeLabelling(n._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},t.prototype.labelIncompleteNodes=function(){for(var n=this,i=this._graph.getNodes().iterator();i.hasNext();){var o=i.next(),s=o.getLabel();o.isIsolated()&&(s.isNull(0)?n.labelIncompleteNode(o,0):n.labelIncompleteNode(o,1)),o.getEdges().updateLabelling(s)}},t.prototype.isCoveredByA=function(n){return!!this.isCovered(n,this._resultPolyList)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ri);U.overlayOp=function(r,t,e){var n=new U(r,t),i=n.getResultGeometry(e);return i},U.intersection=function(r,t){if(r.isEmpty()||t.isEmpty())return U.createEmptyResult(U.INTERSECTION,r,t,r.getFactory());if(r.isGeometryCollection()){var e=t;return Jr.map(r,{interfaces_:function(){return[br.MapOp]},map:function(n){return n.intersection(e)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),se.overlayOp(r,t,U.INTERSECTION)},U.symDifference=function(r,t){if(r.isEmpty()||t.isEmpty()){if(r.isEmpty()&&t.isEmpty())return U.createEmptyResult(U.SYMDIFFERENCE,r,t,r.getFactory());if(r.isEmpty())return t.copy();if(t.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),se.overlayOp(r,t,U.SYMDIFFERENCE)},U.resultDimension=function(r,t,e){var n=t.getDimension(),i=e.getDimension(),o=-1;switch(r){case U.INTERSECTION:o=Math.min(n,i);break;case U.UNION:o=Math.max(n,i);break;case U.DIFFERENCE:o=n;break;case U.SYMDIFFERENCE:o=Math.max(n,i);break}return o},U.createEmptyResult=function(r,t,e,n){var i=null;switch(U.resultDimension(r,t,e)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon();break}return i},U.difference=function(r,t){return r.isEmpty()?U.createEmptyResult(U.DIFFERENCE,r,t,r.getFactory()):t.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(t),se.overlayOp(r,t,U.DIFFERENCE))},U.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],t=arguments[1],e=r.getLocation(0),n=r.getLocation(1);return U.isResultOfOp(e,n,t)}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===m.BOUNDARY&&(i=m.INTERIOR),o===m.BOUNDARY&&(o=m.INTERIOR),s){case U.INTERSECTION:return i===m.INTERIOR&&o===m.INTERIOR;case U.UNION:return i===m.INTERIOR||o===m.INTERIOR;case U.DIFFERENCE:return i===m.INTERIOR&&o!==m.INTERIOR;case U.SYMDIFFERENCE:return i===m.INTERIOR&&o!==m.INTERIOR||i!==m.INTERIOR&&o===m.INTERIOR}return!1}},U.INTERSECTION=1,U.UNION=2,U.DIFFERENCE=3,U.SYMDIFFERENCE=4;var cr=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Je,this._seg=new A;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};cr.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var i=e._linework.getGeometryN(n),o=i.getCoordinateSequence(),s=0;s<o.size()-1;s++){o.getCoordinate(s,e._seg.p0),o.getCoordinate(s+1,e._seg.p1);var a=e._seg.distance(t);if(a<=e._boundaryDistanceTolerance)return!0}return!1},cr.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?m.BOUNDARY:this._ptLocator.locate(t,this._g)},cr.prototype.extractLinework=function(t){var e=new Oi;t.apply(e);var n=e.getLinework(),i=H.toLineStringArray(n);return t.getFactory().createMultiLineString(i)},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr};var Oi=function(){this._linework=null,this._linework=new L};Oi.prototype.getLinework=function(){return this._linework},Oi.prototype.filter=function(t){var e=this;if(t instanceof wt){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)e._linework.add(n.getInteriorRingN(i))}},Oi.prototype.interfaces_=function(){return[sn]},Oi.prototype.getClass=function(){return Oi};var Pr=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Pr.prototype.extractPoints=function(t,e,n){for(var i=this,o=t.getCoordinates(),s=0;s<o.length-1;s++)i.computeOffsetPoints(o[s],o[s+1],e,n)},Pr.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Pr.prototype.getPoints=function(t){for(var e=this,n=new L,i=zt.getLines(this._g),o=i.iterator();o.hasNext();){var s=o.next();e.extractPoints(s,t,n)}return n},Pr.prototype.computeOffsetPoints=function(t,e,n,i){var o=e.x-t.x,s=e.y-t.y,a=Math.sqrt(o*o+s*s),u=n*o/a,l=n*s/a,c=(e.x+t.x)/2,f=(e.y+t.y)/2;if(this._doLeft){var h=new v(c-l,f+u);i.add(h)}if(this._doRight){var g=new v(c+l,f-u);i.add(g)}},Pr.prototype.interfaces_=function(){return[]},Pr.prototype.getClass=function(){return Pr};var we=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new L;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(t,e),this._geom=[t,e,n],this._locFinder=[new cr(this._geom[0],this._boundaryDistanceTolerance),new cr(this._geom[1],this._boundaryDistanceTolerance),new cr(this._geom[2],this._boundaryDistanceTolerance)]},iu={TOLERANCE:{configurable:!0}};we.prototype.reportResult=function(t,e,n){Bt.out.println("Overlay result invalid - A:"+m.toLocationSymbol(e[0])+" B:"+m.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+m.toLocationSymbol(e[2]))},we.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},we.prototype.checkValid=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var i=t._testCoords.get(n);if(!t.checkValid(e,i))return t._invalidLocation=i,!1}return!0}else if(arguments.length===2){var o=arguments[0],s=arguments[1];return this._location[0]=this._locFinder[0].getLocation(s),this._location[1]=this._locFinder[1].getLocation(s),this._location[2]=this._locFinder[2].getLocation(s),we.hasLocation(this._location,m.BOUNDARY)?!0:this.isValidResult(o,this._location)}},we.prototype.addTestPts=function(t){var e=new Pr(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},we.prototype.isValidResult=function(t,e){var n=U.isResultOfOp(e[0],e[1],t),i=e[2]===m.INTERIOR,o=!(n^i);return o||this.reportResult(t,e,n),o},we.prototype.getInvalidLocation=function(){return this._invalidLocation},we.prototype.interfaces_=function(){return[]},we.prototype.getClass=function(){return we},we.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},we.computeBoundaryDistanceTolerance=function(t,e){return Math.min(It.computeSizeBasedSnapTolerance(t),It.computeSizeBasedSnapTolerance(e))},we.isValid=function(t,e,n,i){var o=new we(t,e,i);return o.isValid(n)},iu.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(we,iu);var Le=function r(t){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(t),this._inputGeoms=t};Le.prototype.extractElements=function(t,e){var n=this;if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var o=t.getGeometryN(i);n._skipEmpty&&o.isEmpty()||e.add(o)}},Le.prototype.combine=function(){for(var t=this,e=new L,n=this._inputGeoms.iterator();n.hasNext();){var i=n.next();t.extractElements(i,e)}return e.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(e)},Le.prototype.interfaces_=function(){return[]},Le.prototype.getClass=function(){return Le},Le.combine=function(){if(arguments.length===1){var t=arguments[0],e=new Le(t);return e.combine()}else if(arguments.length===2){var n=arguments[0],i=arguments[1],o=new Le(Le.createList(n,i));return o.combine()}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2],l=new Le(Le.createList(s,a,u));return l.combine()}},Le.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Le.createList=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new L;return n.add(t),n.add(e),n}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2],a=new L;return a.add(i),a.add(o),a.add(s),a}};var xt=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new L)},ou={STRTREE_NODE_CAPACITY:{configurable:!0}};xt.prototype.reduceToGeometries=function(t){for(var e=this,n=new L,i=t.iterator();i.hasNext();){var o=i.next(),s=null;k(o,Ye)?s=e.unionTree(o):o instanceof G&&(s=o),n.add(s)}return n},xt.prototype.extractByEnvelope=function(t,e,n){for(var i=new L,o=0;o<e.getNumGeometries();o++){var s=e.getGeometryN(o);s.getEnvelopeInternal().intersects(t)?i.add(s):n.add(s)}return this._geomFactory.buildGeometry(i)},xt.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),i=e.getEnvelopeInternal();if(!n.intersects(i)){var o=Le.combine(t,e);return o}if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var s=n.intersection(i);return this.unionUsingEnvelopeIntersection(t,e,s)},xt.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new Ua(xt.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var i=t.itemsTree(),o=this.unionTree(i);return o},xt.prototype.binaryUnion=function(){if(arguments.length===1){var t=arguments[0];return this.binaryUnion(t,0,t.size())}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2];if(i-n<=1){var o=xt.getGeometry(e,n);return this.unionSafe(o,null)}else{if(i-n===2)return this.unionSafe(xt.getGeometry(e,n),xt.getGeometry(e,n+1));var s=Math.trunc((i+n)/2),a=this.binaryUnion(e,n,s),u=this.binaryUnion(e,s,i);return this.unionSafe(a,u)}}},xt.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var i=n.next();e===null?e=i.copy():e=e.union(i)}return e},xt.prototype.unionSafe=function(t,e){return t===null&&e===null?null:t===null?e.copy():e===null?t.copy():this.unionOptimized(t,e)},xt.prototype.unionActual=function(t,e){return xt.restrictToPolygons(t.union(e))},xt.prototype.unionTree=function(t){var e=this.reduceToGeometries(t),n=this.binaryUnion(e);return n},xt.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var i=new L,o=this.extractByEnvelope(n,t,i),s=this.extractByEnvelope(n,e,i),a=this.unionActual(o,s);i.add(a);var u=Le.combine(i);return u},xt.prototype.bufferUnion=function(){if(arguments.length===1){var t=arguments[0],e=t.get(0).getFactory(),n=e.buildGeometry(t),i=n.buffer(0);return i}else if(arguments.length===2){var o=arguments[0],s=arguments[1],a=o.getFactory(),u=a.createGeometryCollection([o,s]),l=u.buffer(0);return l}},xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.restrictToPolygons=function(t){if(k(t,tr))return t;var e=Wn.getPolygons(t);return e.size()===1?e.get(0):t.getFactory().createMultiPolygon(H.toPolygonArray(e))},xt.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},xt.union=function(t){var e=new xt(t);return e.union()},ou.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(xt,ou);var qo=function(){};qo.prototype.interfaces_=function(){return[]},qo.prototype.getClass=function(){return qo},qo.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return U.createEmptyResult(U.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),se.overlayOp(t,e,U.UNION)};function Rr(){return new Xo}function Xo(){this.reset()}Xo.prototype={constructor:Xo,reset:function(){this.s=this.t=0},add:function(r){su(Yo,r,this.t),su(this,Yo.s,this.s),this.s?this.t+=Yo.t:this.s=Yo.t},valueOf:function(){return this.s}};var Yo=new Xo;function su(r,t,e){var n=r.s=t+e,i=n-t,o=n-i;r.t=t-o+(e-i)}var yt=1e-6,st=Math.PI,jn=st/2,au=st/4,Kn=st*2,Or=180/st,mn=st/180,ae=Math.abs,gc=Math.atan,Di=Math.atan2,bt=Math.cos,Pt=Math.sin,Ti=Math.sqrt;function uu(r){return r>1?0:r<-1?st:Math.acos(r)}function ti(r){return r>1?jn:r<-1?-jn:Math.asin(r)}function go(){}function Ho(r,t){r&&cu.hasOwnProperty(r.type)&&cu[r.type](r,t)}var lu={Feature:function(r,t){Ho(r.geometry,t)},FeatureCollection:function(r,t){for(var e=r.features,n=-1,i=e.length;++n<i;)Ho(e[n].geometry,t)}},cu={Sphere:function(r,t){t.sphere()},Point:function(r,t){r=r.coordinates,t.point(r[0],r[1],r[2])},MultiPoint:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)r=e[n],t.point(r[0],r[1],r[2])},LineString:function(r,t){Bs(r.coordinates,t,0)},MultiLineString:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)Bs(e[n],t,0)},Polygon:function(r,t){fu(r.coordinates,t)},MultiPolygon:function(r,t){for(var e=r.coordinates,n=-1,i=e.length;++n<i;)fu(e[n],t)},GeometryCollection:function(r,t){for(var e=r.geometries,n=-1,i=e.length;++n<i;)Ho(e[n],t)}};function Bs(r,t,e){var n=-1,i=r.length-e,o;for(t.lineStart();++n<i;)o=r[n],t.point(o[0],o[1],o[2]);t.lineEnd()}function fu(r,t){var e=-1,n=r.length;for(t.polygonStart();++e<n;)Bs(r[e],t,1);t.polygonEnd()}function pc(r,t){r&&lu.hasOwnProperty(r.type)?lu[r.type](r,t):Ho(r,t)}Rr(),Rr();function Gs(r){return[Di(r[1],r[0]),ti(r[2])]}function Mi(r){var t=r[0],e=r[1],n=bt(e);return[n*bt(t),n*Pt(t),Pt(e)]}function Wo(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function jo(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function ks(r,t){r[0]+=t[0],r[1]+=t[1],r[2]+=t[2]}function Ko(r,t){return[r[0]*t,r[1]*t,r[2]*t]}function zs(r){var t=Ti(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}Rr();function hu(r,t){function e(n,i){return n=r(n,i),t(n[0],n[1])}return r.invert&&t.invert&&(e.invert=function(n,i){return n=t.invert(n,i),n&&r.invert(n[0],n[1])}),e}function Vs(r,t){return[r>st?r-Kn:r<-st?r+Kn:r,t]}Vs.invert=Vs;function dc(r,t,e){return(r%=Kn)?t||e?hu(pu(r),du(t,e)):pu(r):t||e?du(t,e):Vs}function gu(r){return function(t,e){return t+=r,[t>st?t-Kn:t<-st?t+Kn:t,e]}}function pu(r){var t=gu(r);return t.invert=gu(-r),t}function du(r,t){var e=bt(r),n=Pt(r),i=bt(t),o=Pt(t);function s(a,u){var l=bt(u),c=bt(a)*l,f=Pt(a)*l,h=Pt(u),g=h*e+c*n;return[Di(f*i-g*o,c*e-h*n),ti(g*i+f*o)]}return s.invert=function(a,u){var l=bt(u),c=bt(a)*l,f=Pt(a)*l,h=Pt(u),g=h*i-f*o;return[Di(f*i+h*o,c*e+g*n),ti(g*e-c*n)]},s}function vc(r,t,e,n,i,o){if(!!e){var s=bt(t),a=Pt(t),u=n*e;i==null?(i=t+n*Kn,o=t-u/2):(i=vu(s,i),o=vu(s,o),(n>0?i<o:i>o)&&(i+=n*Kn));for(var l,c=i;n>0?c>o:c<o;c-=u)l=Gs([s,-a*bt(c),-a*Pt(c)]),r.point(l[0],l[1])}}function vu(r,t){t=Mi(t),t[0]-=r,zs(t);var e=uu(-t[1]);return((-t[2]<0?-e:e)+Kn-yt)%Kn}function yu(){var r=[],t;return{point:function(e,n){t.push([e,n])},lineStart:function(){r.push(t=[])},lineEnd:go,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function yc(r,t,e,n,i,o){var s=r[0],a=r[1],u=t[0],l=t[1],c=0,f=1,h=u-s,g=l-a,p;if(p=e-s,!(!h&&p>0)){if(p/=h,h<0){if(p<c)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>c&&(c=p)}if(p=i-s,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>c&&(c=p)}else if(h>0){if(p<c)return;p<f&&(f=p)}if(p=n-a,!(!g&&p>0)){if(p/=g,g<0){if(p<c)return;p<f&&(f=p)}else if(g>0){if(p>f)return;p>c&&(c=p)}if(p=o-a,!(!g&&p<0)){if(p/=g,g<0){if(p>f)return;p>c&&(c=p)}else if(g>0){if(p<c)return;p<f&&(f=p)}return c>0&&(r[0]=s+c*h,r[1]=a+c*g),f<1&&(t[0]=s+f*h,t[1]=a+f*g),!0}}}}}function Qo(r,t){return ae(r[0]-t[0])<yt&&ae(r[1]-t[1])<yt}function Jo(r,t,e,n){this.x=r,this.z=t,this.o=e,this.e=n,this.v=!1,this.n=this.p=null}function mu(r,t,e,n,i){var o=[],s=[],a,u;if(r.forEach(function(p){if(!((y=p.length-1)<=0)){var y,d=p[0],_=p[y],I;if(Qo(d,_)){for(i.lineStart(),a=0;a<y;++a)i.point((d=p[a])[0],d[1]);i.lineEnd();return}o.push(I=new Jo(d,p,null,!0)),s.push(I.o=new Jo(d,null,I,!1)),o.push(I=new Jo(_,p,null,!1)),s.push(I.o=new Jo(_,null,I,!0))}}),!!o.length){for(s.sort(t),_u(o),_u(s),a=0,u=s.length;a<u;++a)s[a].e=e=!e;for(var l=o[0],c,f;;){for(var h=l,g=!0;h.v;)if((h=h.n)===l)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(g)for(a=0,u=c.length;a<u;++a)i.point((f=c[a])[0],f[1]);else n(h.x,h.n.x,1,i);h=h.n}else{if(g)for(c=h.p.z,a=c.length-1;a>=0;--a)i.point((f=c[a])[0],f[1]);else n(h.x,h.p.x,-1,i);h=h.p}h=h.o,c=h.z,g=!g}while(!h.v);i.lineEnd()}}}function _u(r){if(!!(t=r.length)){for(var t,e=0,n=r[0],i;++e<t;)n.n=i=r[e],i.p=n,n=i;n.n=i=r[0],i.p=n}}function Eu(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function mc(r){return r.length===1&&(r=_c(r)),{left:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;r(t[o],e)<0?n=o+1:i=o}return n},right:function(t,e,n,i){for(n==null&&(n=0),i==null&&(i=t.length);n<i;){var o=n+i>>>1;r(t[o],e)>0?i=o:n=o+1}return n}}}function _c(r){return function(t,e){return Eu(r(t),e)}}mc(Eu);function Iu(r){for(var t=r.length,e,n=-1,i=0,o,s;++n<t;)i+=r[n].length;for(o=new Array(i);--t>=0;)for(s=r[t],e=s.length;--e>=0;)o[--i]=s[e];return o}var po=1e9,Zo=-po;function Ec(r,t,e,n){function i(l,c){return r<=l&&l<=e&&t<=c&&c<=n}function o(l,c,f,h){var g=0,p=0;if(l==null||(g=s(l,f))!==(p=s(c,f))||u(l,c)<0^f>0)do h.point(g===0||g===3?r:e,g>1?n:t);while((g=(g+f+4)%4)!==p);else h.point(c[0],c[1])}function s(l,c){return ae(l[0]-r)<yt?c>0?0:3:ae(l[0]-e)<yt?c>0?2:1:ae(l[1]-t)<yt?c>0?1:0:c>0?3:2}function a(l,c){return u(l.x,c.x)}function u(l,c){var f=s(l,1),h=s(c,1);return f!==h?f-h:f===0?c[1]-l[1]:f===1?l[0]-c[0]:f===2?l[1]-c[1]:c[0]-l[0]}return function(l){var c=l,f=yu(),h,g,p,y,d,_,I,N,C,b,S,D={point:T,lineStart:O,lineEnd:X,polygonStart:j,polygonEnd:z};function T(W,pt){i(W,pt)&&c.point(W,pt)}function F(){for(var W=0,pt=0,At=g.length;pt<At;++pt)for(var Ft=g[pt],rt=1,Xt=Ft.length,it=Ft[0],Qn,Yt,Rt=it[0],be=it[1];rt<Xt;++rt)Qn=Rt,Yt=be,it=Ft[rt],Rt=it[0],be=it[1],Yt<=n?be>n&&(Rt-Qn)*(n-Yt)>(be-Yt)*(r-Qn)&&++W:be<=n&&(Rt-Qn)*(n-Yt)<(be-Yt)*(r-Qn)&&--W;return W}function j(){c=f,h=[],g=[],S=!0}function z(){var W=F(),pt=S&&W,At=(h=Iu(h)).length;(pt||At)&&(l.polygonStart(),pt&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),At&&mu(h,a,W,o,l),l.polygonEnd()),c=l,h=g=p=null}function O(){D.point=P,g&&g.push(p=[]),b=!0,C=!1,I=N=NaN}function X(){h&&(P(y,d),_&&C&&f.rejoin(),h.push(f.result())),D.point=T,C&&c.lineEnd()}function P(W,pt){var At=i(W,pt);if(g&&p.push([W,pt]),b)y=W,d=pt,_=At,b=!1,At&&(c.lineStart(),c.point(W,pt));else if(At&&C)c.point(W,pt);else{var Ft=[I=Math.max(Zo,Math.min(po,I)),N=Math.max(Zo,Math.min(po,N))],rt=[W=Math.max(Zo,Math.min(po,W)),pt=Math.max(Zo,Math.min(po,pt))];yc(Ft,rt,r,t,e,n)?(C||(c.lineStart(),c.point(Ft[0],Ft[1])),c.point(rt[0],rt[1]),At||c.lineEnd(),S=!1):At&&(c.lineStart(),c.point(W,pt),S=!1)}I=W,N=pt,C=At}return D}}var Us=Rr();function Ic(r,t){var e=t[0],n=t[1],i=[Pt(e),-bt(e),0],o=0,s=0;Us.reset();for(var a=0,u=r.length;a<u;++a)if(!!(c=(l=r[a]).length))for(var l,c,f=l[c-1],h=f[0],g=f[1]/2+au,p=Pt(g),y=bt(g),d=0;d<c;++d,h=I,p=C,y=b,f=_){var _=l[d],I=_[0],N=_[1]/2+au,C=Pt(N),b=bt(N),S=I-h,D=S>=0?1:-1,T=D*S,F=T>st,j=p*C;if(Us.add(Di(j*D*Pt(T),y*b+j*bt(T))),o+=F?S+D*Kn:S,F^h>=e^I>=e){var z=jo(Mi(f),Mi(_));zs(z);var O=jo(i,z);zs(O);var X=(F^S>=0?-1:1)*ti(O[2]);(n>X||n===X&&(z[0]||z[1]))&&(s+=F^S>=0?1:-1)}}return(o<-yt||o<yt&&Us<-yt)^s&1}Rr();function Cu(r){return r}Rr(),Rr();var Ai=1/0,$o=Ai,vo=-Ai,ts=vo,Nu={point:Cc,lineStart:go,lineEnd:go,polygonStart:go,polygonEnd:go,result:function(){var r=[[Ai,$o],[vo,ts]];return vo=ts=-($o=Ai=1/0),r}};function Cc(r,t){r<Ai&&(Ai=r),r>vo&&(vo=r),t<$o&&($o=t),t>ts&&(ts=t)}Rr();function xu(r,t,e,n){return function(i,o){var s=t(o),a=i.invert(n[0],n[1]),u=yu(),l=t(u),c=!1,f,h,g,p={point:y,lineStart:_,lineEnd:I,polygonStart:function(){p.point=N,p.lineStart=C,p.lineEnd=b,h=[],f=[]},polygonEnd:function(){p.point=y,p.lineStart=_,p.lineEnd=I,h=Iu(h);var S=Ic(f,a);h.length?(c||(o.polygonStart(),c=!0),mu(h,xc,S,e,o)):S&&(c||(o.polygonStart(),c=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),c&&(o.polygonEnd(),c=!1),h=f=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function y(S,D){var T=i(S,D);r(S=T[0],D=T[1])&&o.point(S,D)}function d(S,D){var T=i(S,D);s.point(T[0],T[1])}function _(){p.point=d,s.lineStart()}function I(){p.point=y,s.lineEnd()}function N(S,D){g.push([S,D]);var T=i(S,D);l.point(T[0],T[1])}function C(){l.lineStart(),g=[]}function b(){N(g[0][0],g[0][1]),l.lineEnd();var S=l.clean(),D=u.result(),T,F=D.length,j,z,O;if(g.pop(),f.push(g),g=null,!!F){if(S&1){if(z=D[0],(j=z.length-1)>0){for(c||(o.polygonStart(),c=!0),o.lineStart(),T=0;T<j;++T)o.point((O=z[T])[0],O[1]);o.lineEnd()}return}F>1&&S&2&&D.push(D.pop().concat(D.shift())),h.push(D.filter(Nc))}}return p}}function Nc(r){return r.length>1}function xc(r,t){return((r=r.x)[0]<0?r[1]-jn-yt:jn-r[1])-((t=t.x)[0]<0?t[1]-jn-yt:jn-t[1])}const Su=xu(function(){return!0},Sc,Lc,[-st,-jn]);function Sc(r){var t=NaN,e=NaN,n=NaN,i;return{lineStart:function(){r.lineStart(),i=1},point:function(o,s){var a=o>0?st:-st,u=ae(o-t);ae(u-st)<yt?(r.point(t,e=(e+s)/2>0?jn:-jn),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(a,e),r.point(o,e),i=0):n!==a&&u>=st&&(ae(t-n)<yt&&(t-=n*yt),ae(o-a)<yt&&(o-=a*yt),e=wc(t,e,o,s),r.point(n,e),r.lineEnd(),r.lineStart(),r.point(a,e),i=0),r.point(t=o,e=s),n=a},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-i}}}function wc(r,t,e,n){var i,o,s=Pt(r-e);return ae(s)>yt?gc((Pt(t)*(o=bt(n))*Pt(e)-Pt(n)*(i=bt(t))*Pt(r))/(i*o*s)):(t+n)/2}function Lc(r,t,e,n){var i;if(r==null)i=e*jn,n.point(-st,i),n.point(0,i),n.point(st,i),n.point(st,0),n.point(st,-i),n.point(0,-i),n.point(-st,-i),n.point(-st,0),n.point(-st,i);else if(ae(r[0]-t[0])>yt){var o=r[0]<t[0]?st:-st;i=e*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function bc(r,t){var e=bt(r),n=e>0,i=ae(e)>yt;function o(c,f,h,g){vc(g,r,t,h,c,f)}function s(c,f){return bt(c)*bt(f)>e}function a(c){var f,h,g,p,y;return{lineStart:function(){p=g=!1,y=1},point:function(d,_){var I=[d,_],N,C=s(d,_),b=n?C?0:l(d,_):C?l(d+(d<0?st:-st),_):0;if(!f&&(p=g=C)&&c.lineStart(),C!==g&&(N=u(f,I),(!N||Qo(f,N)||Qo(I,N))&&(I[0]+=yt,I[1]+=yt,C=s(I[0],I[1]))),C!==g)y=0,C?(c.lineStart(),N=u(I,f),c.point(N[0],N[1])):(N=u(f,I),c.point(N[0],N[1]),c.lineEnd()),f=N;else if(i&&f&&n^C){var S;!(b&h)&&(S=u(I,f,!0))&&(y=0,n?(c.lineStart(),c.point(S[0][0],S[0][1]),c.point(S[1][0],S[1][1]),c.lineEnd()):(c.point(S[1][0],S[1][1]),c.lineEnd(),c.lineStart(),c.point(S[0][0],S[0][1])))}C&&(!f||!Qo(f,I))&&c.point(I[0],I[1]),f=I,g=C,h=b},lineEnd:function(){g&&c.lineEnd(),f=null},clean:function(){return y|(p&&g)<<1}}}function u(c,f,h){var g=Mi(c),p=Mi(f),y=[1,0,0],d=jo(g,p),_=Wo(d,d),I=d[0],N=_-I*I;if(!N)return!h&&c;var C=e*_/N,b=-e*I/N,S=jo(y,d),D=Ko(y,C),T=Ko(d,b);ks(D,T);var F=S,j=Wo(D,F),z=Wo(F,F),O=j*j-z*(Wo(D,D)-1);if(!(O<0)){var X=Ti(O),P=Ko(F,(-j-X)/z);if(ks(P,D),P=Gs(P),!h)return P;var W=c[0],pt=f[0],At=c[1],Ft=f[1],rt;pt<W&&(rt=W,W=pt,pt=rt);var Xt=pt-W,it=ae(Xt-st)<yt,Qn=it||Xt<yt;if(!it&&Ft<At&&(rt=At,At=Ft,Ft=rt),Qn?it?At+Ft>0^P[1]<(ae(P[0]-W)<yt?At:Ft):At<=P[1]&&P[1]<=Ft:Xt>st^(W<=P[0]&&P[0]<=pt)){var Yt=Ko(F,(-j+X)/z);return ks(Yt,D),[P,Gs(Yt)]}}}function l(c,f){var h=n?r:st-r,g=0;return c<-h?g|=1:c>h&&(g|=2),f<-h?g|=4:f>h&&(g|=8),g}return xu(s,a,o,n?[0,-r]:[-st,r-st])}function wu(r){return function(t){var e=new qs;for(var n in r)e[n]=r[n];return e.stream=t,e}}function qs(){}qs.prototype={constructor:qs,point:function(r,t){this.stream.point(r,t)},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 Lu(r,t,e){var n=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),o!=null&&r.clipExtent(null),pc(e,r.stream(Nu));var s=Nu.result(),a=Math.min(n/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+t[0][0]+(n-a*(s[1][0]+s[0][0]))/2,l=+t[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return o!=null&&r.clipExtent(o),r.scale(a*150).translate([u,l])}function Pc(r,t,e){return Lu(r,[[0,0],t],e)}var bu=16,Rc=bt(30*mn);function Pu(r,t){return+t?Dc(r,t):Oc(r)}function Oc(r){return wu({point:function(t,e){t=r(t,e),this.stream.point(t[0],t[1])}})}function Dc(r,t){function e(n,i,o,s,a,u,l,c,f,h,g,p,y,d){var _=l-n,I=c-i,N=_*_+I*I;if(N>4*t&&y--){var C=s+h,b=a+g,S=u+p,D=Ti(C*C+b*b+S*S),T=ti(S/=D),F=ae(ae(S)-1)<yt||ae(o-f)<yt?(o+f)/2:Di(b,C),j=r(F,T),z=j[0],O=j[1],X=z-n,P=O-i,W=I*X-_*P;(W*W/N>t||ae((_*X+I*P)/N-.5)>.3||s*h+a*g+u*p<Rc)&&(e(n,i,o,s,a,u,z,O,F,C/=D,b/=D,S,y,d),d.point(z,O),e(z,O,F,C,b,S,l,c,f,h,g,p,y,d))}}return function(n){var i,o,s,a,u,l,c,f,h,g,p,y,d={point:_,lineStart:I,lineEnd:C,polygonStart:function(){n.polygonStart(),d.lineStart=b},polygonEnd:function(){n.polygonEnd(),d.lineStart=I}};function _(T,F){T=r(T,F),n.point(T[0],T[1])}function I(){f=NaN,d.point=N,n.lineStart()}function N(T,F){var j=Mi([T,F]),z=r(T,F);e(f,h,c,g,p,y,f=z[0],h=z[1],c=T,g=j[0],p=j[1],y=j[2],bu,n),n.point(f,h)}function C(){d.point=_,n.lineEnd()}function b(){I(),d.point=S,d.lineEnd=D}function S(T,F){N(i=T,F),o=f,s=h,a=g,u=p,l=y,d.point=N}function D(){e(f,h,c,g,p,y,o,s,i,a,u,l,bu,n),d.lineEnd=C,C()}return d}}var Tc=wu({point:function(r,t){this.stream.point(r*mn,t*mn)}});function Mc(r){return Ac(function(){return r})()}function Ac(r){var t,e=150,n=480,i=250,o,s,a=0,u=0,l=0,c=0,f=0,h,g,p=null,y=Su,d=null,_,I,N,C=Cu,b=.5,S=Pu(z,b),D,T;function F(P){return P=g(P[0]*mn,P[1]*mn),[P[0]*e+o,s-P[1]*e]}function j(P){return P=g.invert((P[0]-o)/e,(s-P[1])/e),P&&[P[0]*Or,P[1]*Or]}function z(P,W){return P=t(P,W),[P[0]*e+o,s-P[1]*e]}F.stream=function(P){return D&&T===P?D:D=Tc(y(h,S(C(T=P))))},F.clipAngle=function(P){return arguments.length?(y=+P?bc(p=P*mn,6*mn):(p=null,Su),X()):p*Or},F.clipExtent=function(P){return arguments.length?(C=P==null?(d=_=I=N=null,Cu):Ec(d=+P[0][0],_=+P[0][1],I=+P[1][0],N=+P[1][1]),X()):d==null?null:[[d,_],[I,N]]},F.scale=function(P){return arguments.length?(e=+P,O()):e},F.translate=function(P){return arguments.length?(n=+P[0],i=+P[1],O()):[n,i]},F.center=function(P){return arguments.length?(a=P[0]%360*mn,u=P[1]%360*mn,O()):[a*Or,u*Or]},F.rotate=function(P){return arguments.length?(l=P[0]%360*mn,c=P[1]%360*mn,f=P.length>2?P[2]%360*mn:0,O()):[l*Or,c*Or,f*Or]},F.precision=function(P){return arguments.length?(S=Pu(z,b=P*P),X()):Ti(b)},F.fitExtent=function(P,W){return Lu(F,P,W)},F.fitSize=function(P,W){return Pc(F,P,W)};function O(){g=hu(h=dc(l,c,f),t);var P=t(a,u);return o=n-P[0]*e,s=i+P[1]*e,X()}function X(){return D=T=null,F}return function(){return t=r.apply(this,arguments),F.invert=t.invert&&j,O()}}function Ru(r){return function(t,e){var n=bt(t),i=bt(e),o=r(n*i);return[o*i*Pt(t),o*Pt(e)]}}function Ou(r){return function(t,e){var n=Ti(t*t+e*e),i=r(n),o=Pt(i),s=bt(i);return[Di(t*o,n*s),ti(n&&e*o/n)]}}var Fc=Ru(function(r){return Ti(2/(1+r))});Fc.invert=Ou(function(r){return 2*ti(r/2)});var Du=Ru(function(r){return(r=uu(r))&&r/Pt(r)});Du.invert=Ou(function(r){return r});function Bc(){return Mc(Du).scale(79.4188).clipAngle(180-.001)}function Tu(r,t){return[r,t]}Tu.invert=Tu;function Gc(r,t,e){e=e||{};var n=e.units||"kilometers",i=e.steps||8;if(!r)throw new Error("geojson is required");if(typeof e!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(r.type){case"GeometryCollection":return ba(r,function(s){var a=es(s,t,n,i);a&&o.push(a)}),ys(o);case"FeatureCollection":return La(r,function(s){var a=es(s,t,n,i);a&&La(a,function(u){u&&o.push(u)})}),ys(o)}return es(r,t,n,i)}function es(r,t,e,n){var i=r.properties||{},o=r.type==="Feature"?r.geometry:r;if(o.type==="GeometryCollection"){var s=[];return ba(r,function(y){var d=es(y,t,e,n);d&&s.push(d)}),ys(s)}var a=kc(o),u={type:o.type,coordinates:Au(o.coordinates,a)},l=new Ls,c=l.read(u),f=Hl(Wl(t,e),"meters"),h=kt.bufferOp(c,f,n),g=new za;if(h=g.write(h),!Mu(h.coordinates)){var p={type:h.type,coordinates:Fu(h.coordinates,a)};return So(p,i)}}function Mu(r){return Array.isArray(r[0])?Mu(r[0]):isNaN(r[0])}function Au(r,t){return typeof r[0]!="object"?t(r):r.map(function(e){return Au(e,t)})}function Fu(r,t){return typeof r[0]!="object"?t.invert(r):r.map(function(e){return Fu(e,t)})}function kc(r){var t=Kl(r).geometry.coordinates,e=[-t[0],-t[1]];return Bc().rotate(e).scale(Ee)}function zc(r,t){var e=wo(r),n=wo(t),i=r.properties||{},o=Ia.difference(e.coordinates,n.coordinates);return o.length===0?null:o.length===1?Na(o[0],i):xa(o,i)}function Bu(r){let t;for(const e of r)t&&e[0]-t[0]>=180?e[0]-=360:t&&e[0]-t[0]<-180&&(e[0]+=360),t=e}function Gu(r,t){const e=zc({type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]},r);if(!e)return;e.properties={isMask:"y"};const n=Gc(r,0);if(n.geometry.type==="Polygon")for(const i of n.geometry.coordinates)Bu(i);else for(const i of n.geometry.coordinates)for(const o of i)Bu(o);t({type:"FeatureCollection",features:[n,e]})}let ku={type:"FeatureCollection",features:[]};function zu(r,t,e=!0,n=!0,i={},o={},s={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let a,u,l,c=[],f;function h(){r.addSource("full-geom",{type:"geojson",data:ku}),r.addLayer({...s.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),r.addLayer({...s.line,id:"full-geom-line",type:"line",source:"full-geom"})}r.loaded()?h():r.once("load",()=>{h()});const g=d=>{u==null||u([d.lngLat.lng,d.lngLat.lat])},p=()=>{let d;const _=r.getZoom()>9?[(d=r.getCenter().wrap()).lng,d.lat]:void 0;l!==_&&(l=_,a==null||a(_))};return{setProximityChangeHandler(d){d?(a=d,r.on("moveend",p),p()):(r.off("moveend",p),a==null||a(void 0),a=void 0)},setMapClickHandler(d){u=d,u?r.on("click",g):r.off("click",g)},flyTo(d,_){r.flyTo({center:d,zoom:_,...i})},fitBounds(d,_){r.fitBounds([[d[0],d[1]],[d[2],d[3]]],{padding:_,...o})},indicateReverse(d){r.getCanvas().style.cursor=d?"crosshair":""},setMarkers(d,_){function I(C){var b;(b=r.getSource("full-geom"))==null||b.setData(C)}for(const C of c)C.remove();if(c.length=0,I(ku),!t)return;const N=()=>{const C=document.createElement("div");return new ia({props:{displayIn:"maplibre"},target:C}),new t.Marker({element:C})};if(_){let C=!1;if(_.geometry.type==="GeometryCollection"){const b=_.geometry.geometries.filter(S=>S.type==="Polygon"||S.type==="MultiPolygon");if(b.length>0){let S=b.pop();for(const D of b)S=jl(S,D);Gu({..._,geometry:S},I),C=!0}else{const S=_.geometry.geometries.filter(D=>D.type==="LineString"||D.type==="MultiLineString");S.length>0&&(I({..._,geometry:{type:"GeometryCollection",geometries:S}}),C=!0)}}if(!C){if(_.geometry.type==="Polygon"||_.geometry.type==="MultiPolygon")Gu(_,I);else if(_.geometry.type==="LineString"||_.geometry.type==="MultiLineString"){I(_);return}}c.push((typeof e=="object"?new t.Marker(e):N()).setLngLat(_.center).addTo(r))}for(const C of d!=null?d:[])C!==_&&c.push((typeof n=="object"?new t.Marker(n):N()).setLngLat(C.center).addTo(r))},setSelectedMarker(d){f&&f.getElement().classList.toggle("marker-selected",!1),f=d>-1?c[d]:void 0,f==null||f.getElement().classList.toggle("marker-selected",!0)}}}class Vc extends Qt.Evented{constructor(e){super();js(this,Tn,void 0);js(this,ei,void 0);rs(this,ei,e)}onAdd(e){const n=document.createElement("div");n.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl";const{maplibregl:i,marker:o,showResultMarkers:s,flyTo:a,fullGeometryStyle:u,...l}=Zn(this,ei),c=typeof a=="boolean"?{}:a,f=zu(e,i,o,s,c,c,u);rs(this,Tn,new Cl({target:n,props:{mapController:f,flyTo:a===void 0?!0:!!a,...l}}));for(const h of["select","pick","featuresListed","featuresMarked","response","optionsVisibilityChange","reverseToggle","queryChange"])Zn(this,Tn).$on(h,g=>this.fire(h.toLowerCase(),g.detail));return n}setOptions(e){var l;rs(this,ei,e);const{maplibregl:n,marker:i,showResultMarkers:o,flyTo:s,fullGeometryStyle:a,...u}=Zn(this,ei);(l=Zn(this,Tn))==null||l.$set(u)}setQuery(e,n=!0){var i;(i=Zn(this,Tn))==null||i.setQuery(e,n)}setReverseMode(e){var n;(n=Zn(this,Tn))==null||n.$set({reverseActive:e})}focus(){var e;(e=Zn(this,Tn))==null||e.focus()}blur(){var e;(e=Zn(this,Tn))==null||e.blur()}onRemove(){var e;(e=Zn(this,Tn))==null||e.$destroy()}}Tn=new WeakMap,ei=new WeakMap,Ot.GeocodingControl=Vc,Ot.createMaplibreglMapController=zu,Object.defineProperties(Ot,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|