jsts.min.js 467 KB

123456789
  1. /**
  2. * JSTS. See https://github.com/bjornharrtell/jsts
  3. * https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EDLv1.txt
  4. * https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EPLv1.txt
  5. * https://github.com/bjornharrtell/jsts/blob/master/LICENSE_LICENSE_ES6_COLLECTIONS.txt
  6. * @license
  7. */
  8. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.jsts={})}(this,function(t){"use strict";function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function n(){}function i(){}function r(t,e){this.low=0|e,this.high=0|t}function s(){}var o,a,u,l,h,c,f;function g(){}function d(){}function _(){}function p(){}function m(t){this.name="RuntimeException",this.message=t,this.stack=(new Error).stack,Error.call(this,t)}function v(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t}function y(){if(0===arguments.length)m.call(this);else if(1===arguments.length){var t=arguments[0];m.call(this,t)}}function x(){}function E(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)E.call(this,0,0);else if(1===arguments.length){var t=arguments[0];E.call(this,t.x,t.y,t.z)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];E.call(this,e,n,E.NULL_ORDINATE)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this.x=i,this.y=r,this.z=s}}function I(){if(this._dimensionsToTest=2,0===arguments.length)I.call(this,2);else if(1===arguments.length){var t=arguments[0];if(2!==t&&3!==t)throw new i("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}function N(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1}function C(){}function S(){}function L(t){this.message=t||""}function w(){}function R(t){this.message=t||""}function T(t){this.message=t||""}function P(){this.array_=[],arguments[0]instanceof S&&this.addAll(arguments[0])}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(void 0===this||null===this)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 r=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(r=r<0?Math.max(n+arguments[2],0):Math.min(r,n);i<r;)e[i]=t,++i;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)},e(n.prototype,{interfaces_:function(){return[]},getClass:function(){return n}}),n.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n},r.toBinaryString=function(t){for(var e="",n=2147483648;n>0;n>>>=1)e+=(t.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=1)e+=(t.low&n)===n?"1":"0";return e},s.isNaN=function(t){return Number.isNaN(t)},s.isInfinite=function(t){return!Number.isFinite(t)},s.MAX_VALUE=Number.MAX_VALUE,"function"==typeof Float64Array&&"function"==typeof Int32Array?(h=2146435072,c=new Float64Array(1),f=new Int32Array(c.buffer),s.doubleToLongBits=function(t){c[0]=t;var e=0|f[0],n=0|f[1];return(n&h)===h&&0!=(1048575&n)&&0!==e&&(e=0,n=2146959360),new r(n,e)},s.longBitsToDouble=function(t){return f[0]=t.low,f[1]=t.high,c[0]}):(o=Math.log2,a=Math.floor,u=Math.pow,l=function(){for(var t=53;t>0;t--){var e=u(2,t)-1;if(a(o(e))+1===t)return e}return 0}(),s.doubleToLongBits=function(t){var e,n,i,s,h,c,f,g,d;if(t<0||1/t===Number.NEGATIVE_INFINITY?(c=1<<31,t=-t):c=0,0===t)return new r(g=c,d=0);if(t===1/0)return new r(g=2146435072|c,d=0);if(t!=t)return new r(g=2146959360,d=0);if(s=0,d=0,(e=a(t))>1)if(e<=l)(s=a(o(e)))<=20?(d=0,g=e<<20-s&1048575):(d=e%(n=u(2,i=s-20))<<32-i,g=e/n&1048575);else for(i=e,d=0;0!==(i=a(n=i/2));)s++,d>>>=1,d|=(1&g)<<31,g>>>=1,n!==i&&(g|=524288);if(f=s+1023,h=0===e,e=t-e,s<52&&0!==e)for(i=0;;){if((n=2*e)>=1?(e=n-1,h?(f--,h=!1):(i<<=1,i|=1,s++)):(e=n,h?0==--f&&(s++,h=!1):(i<<=1,s++)),20===s)g|=i,i=0;else if(52===s){d|=i;break}if(1===n){s<20?g|=i<<20-s:s<52&&(d|=i<<52-s);break}}return g|=f<<20,new r(g|=c,d)},s.longBitsToDouble=function(t){var e,n,i,r,s=t.high,o=t.low;n=s&1<<31?-1:1,i=((2146435072&s)>>20)-1023,r=0,e=1<<19;for(var a=1;a<=20;a++)s&e&&(r+=u(2,-a)),e>>>=1;for(e=1<<31,a=21;a<=52;a++)o&e&&(r+=u(2,-a)),e>>>=1;if(-1023===i){if(0===r)return 0*n;i=-1022}else{if(1024===i)return 0===r?n/0:NaN;r+=1}return n*r*u(2,i)}),m.prototype=Object.create(Error.prototype),m.prototype.constructor=Error,v(y,m),e(y.prototype,{interfaces_:function(){return[]},getClass:function(){return y}}),e(x.prototype,{interfaces_:function(){return[]},getClass:function(){return x}}),x.shouldNeverReachHere=function(){if(0===arguments.length)x.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new y("Should never reach here"+(null!==t?": "+t:""))}},x.isTrue=function(){if(1===arguments.length){var t=arguments[0];x.isTrue(t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!e)throw null===n?new y:new y(n)}},x.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];x.equals(t,e,null)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(!i.equals(n))throw new y("Expected "+n+" but encountered "+i+(null!==r?": "+r:""))}},e(E.prototype,{setOrdinate:function(t,e){switch(t){case E.X:this.x=e;break;case E.Y:this.y=e;break;case E.Z:this.z=e;break;default:throw new i("Invalid ordinate index: "+t)}},equals2D:function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],i=arguments[1];return!!n.equalsWithTolerance(this.x,e.x,i)&&!!n.equalsWithTolerance(this.y,e.y,i)}},getOrdinate:function(t){switch(t){case E.X:return this.x;case E.Y:return this.y;case E.Z:return this.z}throw new i("Invalid ordinate index: "+t)},equals3D:function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||s.isNaN(this.z)&&s.isNaN(t.z))},equals:function(t){return t instanceof E&&this.equals2D(t)},equalInZ:function(t,e){return n.equalsWithTolerance(this.z,t.z,e)},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},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return x.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}},copy:function(){return new E(this)},toString:function(){return"("+this.x+", "+this.y+", "+this.z+")"},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)},distance:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},hashCode:function(){var t=17;return t=37*(t=37*t+E.hashCode(this.x))+E.hashCode(this.y)},setCoordinate:function(t){this.x=t.x,this.y=t.y,this.z=t.z},interfaces_:function(){return[g,d,p]},getClass:function(){return E}}),E.hashCode=function(){if(1===arguments.length&&"number"==typeof arguments[0]){var t=arguments[0],e=s.doubleToLongBits(t);return Math.trunc(e^e>>>32)}},e(I.prototype,{compare:function(t,e){var n=t,i=e,r=I.compare(n.x,i.x);if(0!==r)return r;var s=I.compare(n.y,i.y);return 0!==s?s:this._dimensionsToTest<=2?0:I.compare(n.z,i.z)},interfaces_:function(){return[_]},getClass:function(){return I}}),I.compare=function(t,e){return t<e?-1:t>e?1:s.isNaN(t)?s.isNaN(e)?0:-1:s.isNaN(e)?1:0},E.DimensionalComparator=I,E.serialVersionUID=0x5cbf2c235c7e5800,E.NULL_ORDINATE=s.NaN,E.X=0,E.Y=1,E.Z=2,C.prototype.hasNext=function(){},C.prototype.next=function(){},C.prototype.remove=function(){},S.prototype.add=function(){},S.prototype.addAll=function(){},S.prototype.isEmpty=function(){},S.prototype.iterator=function(){},S.prototype.size=function(){},S.prototype.toArray=function(){},S.prototype.remove=function(){},L.prototype=new Error,L.prototype.name="IndexOutOfBoundsException",w.prototype=Object.create(S.prototype),w.prototype.constructor=w,w.prototype.get=function(){},w.prototype.set=function(){},w.prototype.isEmpty=function(){},R.prototype=new Error,R.prototype.name="NoSuchElementException",T.prototype=new Error,T.prototype.name="OperationNotSupported",P.prototype=Object.create(w.prototype),P.prototype.constructor=P,P.prototype.ensureCapacity=function(){},P.prototype.interfaces_=function(){return[w,S]},P.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],0,arguments[1]),!0},P.prototype.clear=function(){this.array_=[]},P.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},P.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},P.prototype.iterator=function(){return new O(this)},P.prototype.get=function(t){if(t<0||t>=this.size())throw new L;return this.array_[t]},P.prototype.isEmpty=function(){return 0===this.array_.length},P.prototype.size=function(){return this.array_.length},P.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},P.prototype.remove=function(t){for(var e=!1,n=0,i=this.array_.length;n<i;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e};var O=function(t){this.arrayList_=t,this.position_=0};function b(){if(P.apply(this),0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.ensureCapacity(e.length),this.add(e,n)}}function M(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof E){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.init(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];this.init(r,s,o,a)}}function D(){}function A(){D.call(this,"Projective point not representable on the Cartesian plane.")}function F(t){this.str=t}function G(t){this.value=t}function q(){}function B(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof B){var e=arguments[0];this.init(e)}else if("string"==typeof arguments[0]){var n=arguments[0];B.call(this,B.parse(n))}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this.init(i,r)}}function V(){}function z(){}function Y(){}function k(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof k&&arguments[1]instanceof k){var i=arguments[0],r=arguments[1];this.x=i.y*r.w-r.y*i.w,this.y=r.x*i.w-i.x*r.w,this.w=i.x*r.y-r.x*i.y}else if(arguments[0]instanceof E&&arguments[1]instanceof E){var s=arguments[0],o=arguments[1];this.x=s.y-o.y,this.y=o.x-s.x,this.w=s.x*o.y-o.x*s.y}}else if(3===arguments.length){var a=arguments[0],u=arguments[1],l=arguments[2];this.x=a,this.y=u,this.w=l}else if(4===arguments.length){var h=arguments[0],c=arguments[1],f=arguments[2],g=arguments[3],d=h.y-c.y,_=c.x-h.x,p=h.x*c.y-c.x*h.y,m=f.y-g.y,v=g.x-f.x,y=f.x*g.y-g.x*f.y;this.x=_*y-v*p,this.y=m*p-d*y,this.w=d*v-m*_}}function U(){}function X(){}function H(){}function W(){}function j(){}function K(){this._envelope=null,this._factory=null,this._SRID=null,this._userData=null;var t=arguments[0];this._factory=t,this._SRID=t.getSRID()}function Z(){}function Q(){}function J(){}function $(){}function tt(){}function et(){}function nt(){}function it(){}function rt(){}function st(){}function ot(){}function at(){}function ut(){this.array_=[],arguments[0]instanceof S&&this.addAll(arguments[0])}O.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new R;return this.arrayList_.get(this.position_++)},O.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},O.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},O.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},v(b,P),e(b.prototype,{getCoordinate:function(t){return this.get(t)},addAll:function(){if(2===arguments.length&&"boolean"==typeof arguments[1]&&N(arguments[0],S)){for(var t=arguments[0],e=arguments[1],n=!1,i=t.iterator();i.hasNext();)this.add(i.next(),e),n=!0;return n}return P.prototype.addAll.apply(this,arguments)},clone:function(){for(var t=P.prototype.clone.call(this),e=0;e<this.size();e++)t.add(e,this.get(e).clone());return t},toCoordinateArray:function(){return this.toArray(b.coordArrayType)},add:function(){if(1===arguments.length){var t=arguments[0];P.prototype.add.call(this,t)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var e=arguments[0],n=arguments[1];return this.add(e,n,!0),!0}if(arguments[0]instanceof E&&"boolean"==typeof arguments[1]){var i=arguments[0];if(!arguments[1])if(this.size()>=1)if(this.get(this.size()-1).equals2D(i))return null;P.prototype.add.call(this,i)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var r=arguments[0],s=arguments[1];return this.add(r,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var o=arguments[0],a=arguments[1];if(arguments[2])for(var u=0;u<o.length;u++)this.add(o[u],a);else for(u=o.length-1;u>=0;u--)this.add(o[u],a);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof E){var l=arguments[0],h=arguments[1];if(!arguments[2]){var c=this.size();if(c>0){if(l>0)if(this.get(l-1).equals2D(h))return null;if(l<c)if(this.get(l).equals2D(h))return null}}P.prototype.add.call(this,l,h)}}else if(4===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],_=arguments[3],p=1;d>_&&(p=-1);for(u=d;u!==_;u+=p)this.add(f[u],g);return!0}},closeRing:function(){this.size()>0&&this.add(new E(this.get(0)),!1)},interfaces_:function(){return[]},getClass:function(){return b}}),b.coordArrayType=new Array(0).fill(null),e(M.prototype,{getArea:function(){return this.getWidth()*this.getHeight()},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()},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;return new M(e,this._maxx<t._maxx?this._maxx:t._maxx,n,this._maxy<t._maxy?this._maxy:t._maxy)},isNull:function(){return this._maxx<this._minx},getMaxX:function(){return this._maxx},covers:function(){if(1===arguments.length){if(arguments[0]instanceof E){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof M){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&(n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy)}},intersects:function(){if(1===arguments.length){if(arguments[0]instanceof M){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof E){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){if(arguments[0]instanceof E&&arguments[1]instanceof E){var n=arguments[0],i=arguments[1];return!this.isNull()&&(!((n.x<i.x?n.x:i.x)>this._maxx)&&(!((n.x>i.x?n.x:i.x)<this._minx)&&(!((n.y<i.y?n.y:i.y)>this._maxy)&&!((n.y>i.y?n.y:i.y)<this._miny))))}if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],s=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||s>this._maxy||s<this._miny)}}},getMinY:function(){return this._miny},getMinX:function(){return this._minx},expandToInclude:function(){if(1===arguments.length){if(arguments[0]instanceof E){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(2===arguments.length){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))}},minExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},getWidth:function(){return this.isNull()?0:this._maxx-this._minx},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},translate:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},toString:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},setToNull:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},getHeight:function(){return this.isNull()?0:this._maxy-this._miny},maxExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},expandBy:function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){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()}},contains:function(){if(1===arguments.length){if(arguments[0]instanceof M){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof E){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return this.covers(n,i)}},centre:function(){return this.isNull()?null:new E((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},init:function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof E){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(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];r<s?(this._minx=r,this._maxx=s):(this._minx=s,this._maxx=r),o<a?(this._miny=o,this._maxy=a):(this._miny=a,this._maxy=o)}},getMaxY:function(){return this._maxy},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),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},hashCode:function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+E.hashCode(this._minx))+E.hashCode(this._maxx))+E.hashCode(this._miny))+E.hashCode(this._maxy)},interfaces_:function(){return[g,p]},getClass:function(){return M}}),M.intersects=function(){if(3===arguments.length){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)}if(4===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3],a=Math.min(s.x,o.x),u=Math.max(s.x,o.x),l=Math.min(i.x,r.x),h=Math.max(i.x,r.x);return!(l>u)&&(!(h<a)&&(a=Math.min(s.y,o.y),u=Math.max(s.y,o.y),l=Math.min(i.y,r.y),h=Math.max(i.y,r.y),!(l>u)&&!(h<a)))}},M.serialVersionUID=0x51845cd552189800,v(A,D),e(A.prototype,{interfaces_:function(){return[]},getClass:function(){return A}}),F.prototype.append=function(t){this.str+=t},F.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},F.prototype.toString=function(t){return this.str},G.prototype.intValue=function(){return this.value},G.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},G.isNaN=function(t){return Number.isNaN(t)},q.isWhitespace=function(t){return t<=32&&t>=0||127==t},q.toUpperCase=function(t){return t.toUpperCase()},e(B.prototype,{le:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo},extractSignificantDigits:function(t,e){var n=this.abs(),i=B.magnitude(n._hi),r=B.TEN.pow(i);(n=n.divide(r)).gt(B.TEN)?(n=n.divide(B.TEN),i+=1):n.lt(B.ONE)&&(n=n.multiply(B.TEN),i-=1);for(var s=i+1,o=new F,a=B.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===s&&o.append(".");var l=Math.trunc(n._hi);if(l<0)break;var h=!1,c=0;l>9?(h=!0,c="9"):c="0"+l,o.append(c),n=n.subtract(B.valueOf(l)).multiply(B.TEN),h&&n.selfAdd(B.TEN);var f=!0,g=B.magnitude(n._hi);if(g<0&&Math.abs(g)>=a-u&&(f=!1),!f)break}return e[0]=i,o.toString()},sqr:function(){return this.multiply(this)},doubleValue:function(){return this._hi+this._lo},subtract:function(){if(arguments[0]instanceof B){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},equals:function(){if(1===arguments.length&&arguments[0]instanceof B){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},isZero:function(){return 0===this._hi&&0===this._lo},selfSubtract:function(){if(arguments[0]instanceof B){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},getSpecialNumberString:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},min:function(t){return this.le(t)?this:t},selfDivide:function(){if(1===arguments.length){if(arguments[0]instanceof B){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n,i,r,s,o=arguments[0],a=arguments[1],u=null,l=null,h=null,c=null;return r=this._hi/o,c=(u=(h=B.SPLIT*r)-(u=h-r))*(l=(c=B.SPLIT*o)-(l=c-o))-(s=r*o)+u*(i=o-l)+(n=r-u)*l+n*i,c=r+(h=(this._hi-s-c+this._lo-r*a)/o),this._hi=c,this._lo=r-c+h,this}},dump:function(){return"DD<"+this._hi+", "+this._lo+">"},divide:function(){if(arguments[0]instanceof B){var t,e,n,i,r=arguments[0],o=null,a=null,u=null,l=null;return n=this._hi/r._hi,o=(u=B.SPLIT*n)-n,l=B.SPLIT*r._hi,t=n-(o=u-o),a=l-r._hi,i=n*r._hi,l=o*(a=l-a)-i+o*(e=r._hi-a)+t*a+t*e,new B(l=n+(u=(this._hi-i-l+this._lo-n*r._lo)/r._hi),n-l+u)}if("number"==typeof arguments[0]){var h=arguments[0];return s.isNaN(h)?B.createNaN():B.copy(this).selfDivide(h,0)}},ge:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo},pow:function(t){if(0===t)return B.valueOf(1);var e=new B(this),n=B.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(e),(i/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},ceil:function(){if(this.isNaN())return B.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new B(t,e)},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},rint:function(){return this.isNaN()?this:this.add(.5).floor()},setValue:function(){if(arguments[0]instanceof B){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},max:function(t){return this.ge(t)?this:t},sqrt:function(){if(this.isZero())return B.valueOf(0);if(this.isNegative())return B.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=B.valueOf(e),i=this.subtract(n.sqr())._hi*(.5*t);return n.add(i)},selfAdd:function(){if(1===arguments.length){if(arguments[0]instanceof B){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,i=null,r=null,s=null,o=null,a=null;return s=(r=this._hi+e)-(o=r-this._hi),i=(a=(s=e-o+(this._hi-s))+this._lo)+(r-(n=r+a)),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(2===arguments.length){var u,l=arguments[0],h=arguments[1],c=(n=null,i=null,null);r=null,s=null,o=null,a=null;r=this._hi+l,u=this._lo+h,s=r-(o=r-this._hi),c=u-(a=u-this._lo),s=l-o+(this._hi-s),c=h-a+(this._lo-c);var f=(n=r+(o=s+u))+(o=c+(i=o+(r-n))),g=o+(n-f);return this._hi=f,this._lo=g,this}},selfMultiply:function(){if(1===arguments.length){if(arguments[0]instanceof B){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n,i,r=arguments[0],s=arguments[1],o=null,a=null,u=null,l=null;o=(u=B.SPLIT*this._hi)-this._hi,l=B.SPLIT*r,o=u-o,n=this._hi-o,a=l-r;var h=(u=this._hi*r)+(l=o*(a=l-a)-u+o*(i=r-a)+n*a+n*i+(this._hi*s+this._lo*r)),c=l+(o=u-h);return this._hi=h,this._lo=c,this}},selfSqr:function(){return this.selfMultiply(this)},floor:function(){if(this.isNaN())return B.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new B(t,e)},negate:function(){return this.isNaN()?this:new B(-this._hi,-this._lo)},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}},multiply:function(){if(arguments[0]instanceof B){var t=arguments[0];return t.isNaN()?B.createNaN():B.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return s.isNaN(e)?B.createNaN():B.copy(this).selfMultiply(e,0)}},isNaN:function(){return s.isNaN(this._hi)},intValue:function(){return Math.trunc(this._hi)},toString:function(){var t=B.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},toStandardNotation:function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,r=n;if("."===n.charAt(0))r="0"+n;else if(i<0)r="0."+B.stringOfChar("0",-i)+n;else if(-1===n.indexOf(".")){var s=i-n.length;r=n+B.stringOfChar("0",s)+".0"}return this.isNegative()?"-"+r:r},reciprocal:function(){var t,e,n,i,r=null,s=null,o=null,a=null;n=1/this._hi,r=(o=B.SPLIT*n)-n,a=B.SPLIT*this._hi,t=n-(r=o-r),s=a-this._hi;var u=n+(o=(1-(i=n*this._hi)-(a=r*(s=a-s)-i+r*(e=this._hi-s)+t*s+t*e)-n*this._lo)/this._hi);return new B(u,n-u+o)},toSciNotation:function(){if(this.isZero())return B.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=B.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new IllegalStateException("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var s=n.charAt(0)+"."+r;return this.isNegative()?"-"+s+i:s+i},abs:function(){return this.isNaN()?B.NaN:this.isNegative()?this.negate():new B(this)},isPositive:function(){return this._hi>0||0===this._hi&&this._lo>0},lt:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo},add:function(){if(arguments[0]instanceof B){var t=arguments[0];return B.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return B.copy(this).selfAdd(e)}},init:function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof B){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}},gt:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo},isNegative:function(){return this._hi<0||0===this._hi&&this._lo<0},trunc:function(){return this.isNaN()?B.NaN:this.isPositive()?this.floor():this.ceil()},signum:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},interfaces_:function(){return[p,g,d]},getClass:function(){return B}}),B.sqr=function(t){return B.valueOf(t).selfMultiply(t)},B.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return B.parse(t)}if("number"==typeof arguments[0])return new B(arguments[0])},B.sqrt=function(t){return B.valueOf(t).sqrt()},B.parse=function(t){for(var e=0,n=t.length;q.isWhitespace(t.charAt(e));)e++;var i=!1;if(e<n){var r=t.charAt(e);"-"!==r&&"+"!==r||(e++,"-"===r&&(i=!0))}for(var s=new B,o=0,a=0,u=0;!(e>=n);){var l=t.charAt(e);if(e++,q.isDigit(l)){var h=l-"0";s.selfMultiply(B.TEN),s.selfAdd(h),o++}else{if("."!==l){if("e"===l||"E"===l){var c=t.substring(e);try{u=G.parseInt(c)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+c+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=o}}var f=s,g=o-a-u;if(0===g)f=s;else if(g>0){var d=B.TEN.pow(g);f=s.divide(d)}else if(g<0){d=B.TEN.pow(-g);f=s.multiply(d)}return i?f.negate():f},B.createNaN=function(){return new B(s.NaN,s.NaN)},B.copy=function(t){return new B(t)},B.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=e&&(i+=1),i},B.stringOfChar=function(t,e){for(var n=new F,i=0;i<e;i++)n.append(t);return n.toString()},B.PI=new B(3.141592653589793,1.2246467991473532e-16),B.TWO_PI=new B(6.283185307179586,2.4492935982947064e-16),B.PI_2=new B(1.5707963267948966,6.123233995736766e-17),B.E=new B(2.718281828459045,1.4456468917292502e-16),B.NaN=new B(s.NaN,s.NaN),B.EPS=1.23259516440783e-32,B.SPLIT=134217729,B.MAX_PRINT_DIGITS=32,B.TEN=B.valueOf(10),B.ONE=B.valueOf(1),B.SCI_NOT_EXPONENT_CHAR="E",B.SCI_NOT_ZERO="0.0E0",e(V.prototype,{interfaces_:function(){return[]},getClass:function(){return V}}),V.orientationIndex=function(t,e,n){var i=V.orientationIndexFilter(t,e,n);if(i<=1)return i;var r=B.valueOf(e.x).selfAdd(-t.x),s=B.valueOf(e.y).selfAdd(-t.y),o=B.valueOf(n.x).selfAdd(-e.x),a=B.valueOf(n.y).selfAdd(-e.y);return r.selfMultiply(a).selfSubtract(s.selfMultiply(o)).signum()},V.signOfDet2x2=function(){if(arguments[0]instanceof B){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];return t.multiply(i).selfSubtract(e.multiply(n)).signum()}if("number"==typeof arguments[0]){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3],u=B.valueOf(r),l=B.valueOf(s),h=B.valueOf(o),c=B.valueOf(a);return u.multiply(c).selfSubtract(l.multiply(h)).signum()}},V.intersection=function(t,e,n,i){var r=B.valueOf(i.y).selfSubtract(n.y).selfMultiply(B.valueOf(e.x).selfSubtract(t.x)),s=B.valueOf(i.x).selfSubtract(n.x).selfMultiply(B.valueOf(e.y).selfSubtract(t.y)),o=r.subtract(s),a=B.valueOf(i.x).selfSubtract(n.x).selfMultiply(B.valueOf(t.y).selfSubtract(n.y)),u=B.valueOf(i.y).selfSubtract(n.y).selfMultiply(B.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(o).doubleValue(),h=B.valueOf(t.x).selfAdd(B.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),c=B.valueOf(e.x).selfSubtract(t.x).selfMultiply(B.valueOf(t.y).selfSubtract(n.y)),f=B.valueOf(e.y).selfSubtract(t.y).selfMultiply(B.valueOf(t.x).selfSubtract(n.x)),g=c.subtract(f).selfDivide(o).doubleValue();return new E(h,B.valueOf(n.y).selfAdd(B.valueOf(i.y).selfSubtract(n.y).selfMultiply(g)).doubleValue())},V.orientationIndexFilter=function(t,e,n){var i=null,r=(t.x-n.x)*(e.y-n.y),s=(t.y-n.y)*(e.x-n.x),o=r-s;if(r>0){if(s<=0)return V.signum(o);i=r+s}else{if(!(r<0))return V.signum(o);if(s>=0)return V.signum(o);i=-r-s}var a=V.DP_SAFE_EPSILON*i;return o>=a||-o>=a?V.signum(o):2},V.signum=function(t){return t>0?1:t<0?-1:0},V.DP_SAFE_EPSILON=1e-15,e(z.prototype,{interfaces_:function(){return[]},getClass:function(){return z}}),z.index=function(t,e,n){return V.orientationIndex(t,e,n)},z.isCCW=function(t){var e=t.length-1;if(e<3)throw new i("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,s=1;s<=e;s++){var o=t[s];o.y>n.y&&(n=o,r=s)}var a=r;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(n)&&a!==r);var u=r;do{u=(u+1)%e}while(t[u].equals2D(n)&&u!==r);var l=t[a],h=t[u];if(l.equals2D(n)||h.equals2D(n)||l.equals2D(h))return!1;var c=z.index(l,n,h);return 0===c?l.x>h.x:c>0},z.CLOCKWISE=-1,z.RIGHT=z.CLOCKWISE,z.COUNTERCLOCKWISE=1,z.LEFT=z.COUNTERCLOCKWISE,z.COLLINEAR=0,z.STRAIGHT=z.COLLINEAR,Y.arraycopy=function(t,e,n,i,r){for(var s=0,o=e;o<e+r;o++)n[i+s]=t[o],s++},Y.getProperty=function(t){return{"line.separator":"\n"}[t]},e(k.prototype,{getY:function(){var t=this.y/this.w;if(s.isNaN(t)||s.isInfinite(t))throw new A;return t},getX:function(){var t=this.x/this.w;if(s.isNaN(t)||s.isInfinite(t))throw new A;return t},getCoordinate:function(){var t=new E;return t.x=this.getX(),t.y=this.getY(),t},interfaces_:function(){return[]},getClass:function(){return k}}),k.intersection=function(t,e,n,i){var r=t.y-e.y,o=e.x-t.x,a=t.x*e.y-e.x*t.y,u=n.y-i.y,l=i.x-n.x,h=n.x*i.y-i.x*n.y,c=r*l-u*o,f=(o*h-l*a)/c,g=(u*a-r*h)/c;if(s.isNaN(f)||s.isInfinite(f)||s.isNaN(g)||s.isInfinite(g))throw new A;return new E(f,g)},e(U.prototype,{interfaces_:function(){return[]},getClass:function(){return U}}),U.log10=function(t){var e=Math.log(t);return s.isInfinite(e)?e:s.isNaN(e)?e:e/U.LOG_10},U.min=function(t,e,n,i){var r=t;return e<r&&(r=e),n<r&&(r=n),i<r&&(r=i),r},U.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],s=arguments[2];return i<r?r:i>s?s:i}},U.wrap=function(t,e){return t<0?e- -t%e:t%e},U.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return e>(i=t)&&(i=e),n>i&&(i=n),i}if(4===arguments.length){var i,r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];return s>(i=r)&&(i=s),o>i&&(i=o),a>i&&(i=a),i}},U.average=function(t,e){return(t+e)/2},U.LOG_10=Math.log(10),e(X.prototype,{interfaces_:function(){return[]},getClass:function(){return X}}),X.segmentToSegment=function(t,e,n,i){if(t.equals(e))return X.pointToSegment(t,n,i);if(n.equals(i))return X.pointToSegment(i,t,e);var r=!1;if(M.intersects(t,e,n,i)){var s=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(0===s)r=!0;else{var o=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/s,u=o/s;(u<0||u>1||a<0||a>1)&&(r=!0)}}else r=!0;return r?U.min(X.pointToSegment(t,n,i),X.pointToSegment(e,n,i),X.pointToSegment(n,t,e),X.pointToSegment(i,t,e)):0},X.pointToSegment=function(t,e,n){if(e.x===n.x&&e.y===n.y)return t.distance(e);var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),r=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/i;if(r<=0)return t.distance(e);if(r>=1)return t.distance(n);var s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(s)*Math.sqrt(i)},X.pointToLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),r=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(r)*Math.sqrt(i)},X.pointToSegmentString=function(t,e){if(0===e.length)throw new i("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var s=X.pointToSegment(t,e[r],e[r+1]);s<n&&(n=s)}return n},e(H.prototype,{setOrdinate:function(t,e,n){},size:function(){},getOrdinate:function(t,e){},getCoordinate:function(){},getCoordinateCopy:function(t){},getDimension:function(){},getX:function(t){},expandEnvelope:function(t){},copy:function(){},getY:function(t){},toCoordinateArray:function(){},interfaces_:function(){return[d]},getClass:function(){return H}}),H.X=0,H.Y=1,H.Z=2,H.M=3,e(W.prototype,{create:function(){1===arguments.length?arguments[0]instanceof Array||N(arguments[0],H):arguments.length},interfaces_:function(){return[]},getClass:function(){return W}}),e(j.prototype,{filter:function(t){},interfaces_:function(){return[]},getClass:function(){return j}}),e(K.prototype,{isGeometryCollection:function(){return this.getTypeCode()===K.TYPECODE_GEOMETRYCOLLECTION},getFactory:function(){return this._factory},getGeometryN:function(t){return this},getArea:function(){return 0},isRectangle:function(){return!1},equals:function(){if(arguments[0]instanceof K){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof K))return!1;var n=e;return this.equalsExact(n)}},equalsExact:function(t){return this===t||this.equalsExact(t,0)},geometryChanged:function(){this.apply(K.geometryChangedFilter)},geometryChangedAction:function(){this._envelope=null},equalsNorm:function(t){return null!==t&&this.norm().equalsExact(t.norm())},getLength:function(){return 0},getNumGeometries:function(){return 1},compareTo:function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],i=arguments[1];e=n;return this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(n,i)}},getUserData:function(){return this._userData},getSRID:function(){return this._SRID},getEnvelope:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},checkNotGeometryCollection:function(t){if(t.getTypeCode()===K.TYPECODE_GEOMETRYCOLLECTION)throw new i("This method does not support GeometryCollection arguments")},equal:function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},norm:function(){var t=this.copy();return t.normalize(),t},getPrecisionModel:function(){return this._factory.getPrecisionModel()},getEnvelopeInternal:function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new M(this._envelope)},setSRID:function(t){this._SRID=t},setUserData:function(t){this._userData=t},compare:function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var r=n.next(),s=i.next(),o=r.compareTo(s);if(0!==o)return o}return n.hasNext()?1:i.hasNext()?-1:0},hashCode:function(){return this.getEnvelopeInternal().hashCode()},isGeometryCollectionOrDerived:function(){return this.getTypeCode()===K.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===K.TYPECODE_MULTIPOINT||this.getTypeCode()===K.TYPECODE_MULTILINESTRING||this.getTypeCode()===K.TYPECODE_MULTIPOLYGON},interfaces_:function(){return[d,g,p]},getClass:function(){return K}}),K.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},K.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},K.serialVersionUID=0x799ea46522854c00,K.TYPECODE_POINT=0,K.TYPECODE_MULTIPOINT=1,K.TYPECODE_LINESTRING=2,K.TYPECODE_LINEARRING=3,K.TYPECODE_MULTILINESTRING=4,K.TYPECODE_POLYGON=5,K.TYPECODE_MULTIPOLYGON=6,K.TYPECODE_GEOMETRYCOLLECTION=7,K.TYPENAME_POINT="Point",K.TYPENAME_MULTIPOINT="MultiPoint",K.TYPENAME_LINESTRING="LineString",K.TYPENAME_LINEARRING="LinearRing",K.TYPENAME_MULTILINESTRING="MultiLineString",K.TYPENAME_POLYGON="Polygon",K.TYPENAME_MULTIPOLYGON="MultiPolygon",K.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",K.geometryChangedFilter={interfaces_:function(){return[j]},filter:function(t){t.geometryChangedAction()}},e(Z.prototype,{filter:function(t){},interfaces_:function(){return[]},getClass:function(){return Z}}),e(Q.prototype,{isInBoundary:function(t){},interfaces_:function(){return[]},getClass:function(){return Q}}),e(J.prototype,{isInBoundary:function(t){return t%2==1},interfaces_:function(){return[Q]},getClass:function(){return J}}),e($.prototype,{isInBoundary:function(t){return t>0},interfaces_:function(){return[Q]},getClass:function(){return $}}),e(tt.prototype,{isInBoundary:function(t){return t>1},interfaces_:function(){return[Q]},getClass:function(){return tt}}),e(et.prototype,{isInBoundary:function(t){return 1===t},interfaces_:function(){return[Q]},getClass:function(){return et}}),Q.Mod2BoundaryNodeRule=J,Q.EndPointBoundaryNodeRule=$,Q.MultiValentEndPointBoundaryNodeRule=tt,Q.MonoValentEndPointBoundaryNodeRule=et,Q.MOD2_BOUNDARY_RULE=new J,Q.ENDPOINT_BOUNDARY_RULE=new $,Q.MULTIVALENT_ENDPOINT_BOUNDARY_RULE=new tt,Q.MONOVALENT_ENDPOINT_BOUNDARY_RULE=new et,Q.OGC_SFS_BOUNDARY_RULE=Q.MOD2_BOUNDARY_RULE,e(nt.prototype,{interfaces_:function(){return[]},getClass:function(){return nt}}),nt.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},nt.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(nt.indexOf(i,e)<0)return i}return null},nt.scroll=function(t,e){var n=nt.indexOf(e,t);if(n<0)return null;var i=new Array(t.length).fill(null);Y.arraycopy(t,n,i,0,t.length-n),Y.arraycopy(t,0,i,t.length-n,n),Y.arraycopy(i,0,t,0,t.length)},nt.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];if(i===r)return!0;if(null===i||null===r)return!1;if(i.length!==r.length)return!1;for(n=0;n<i.length;n++)if(0!==s.compare(i[n],r[n]))return!1;return!0}},nt.intersection=function(t,e){for(var n=new b,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()},nt.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},nt.removeRepeatedPoints=function(t){return nt.hasRepeatedPoints(t)?new b(t,!1).toCoordinateArray():t},nt.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var r=t[i];t[i]=t[e-i],t[e-i]=r}},nt.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var i=new Array(e).fill(null);if(0===e)return i;var r=0;for(n=0;n<t.length;n++)null!==t[n]&&(i[r++]=t[n]);return i},nt.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new E(t[n]);return e}if(5===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3],a=arguments[4];for(n=0;n<a;n++)s[o+n]=new E(i[r+n])}},nt.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=e[t.length-n-1];if(0!==i.compareTo(r))return!1}return!0},nt.envelope=function(t){for(var e=new M,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},nt.toCoordinateArray=function(t){return t.toArray(nt.coordArrayType)},nt.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},nt.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},nt.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(0!==i)return i}return 1},nt.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(0!==i)return i;n++}return n<e.length?-1:n<t.length?1:0},nt.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},nt.extract=function(t,e,n){e=U.clamp(e,0,t.length);var i=(n=U.clamp(n,-1,t.length))-e+1;n<0&&(i=0),e>=t.length&&(i=0),n<e&&(i=0);var r=new Array(i).fill(null);if(0===i)return r;for(var s=0,o=e;o<=n;o++)r[s++]=t[o];return r},e(it.prototype,{compare:function(t,e){var n=t,i=e;return nt.compare(n,i)},interfaces_:function(){return[_]},getClass:function(){return it}}),e(rt.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(0===n.length)return 0;var r=nt.compare(n,i);return nt.isEqualReversed(n,i)?0:r},OLDcompare:function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(0===n.length)return 0;for(var r=nt.increasingDirection(n),s=nt.increasingDirection(i),o=r>0?0:n.length-1,a=s>0?0:n.length-1,u=0;u<n.length;u++){var l=n[o].compareTo(i[a]);if(0!==l)return l;o+=r,a+=s}return 0},interfaces_:function(){return[_]},getClass:function(){return rt}}),nt.ForwardComparator=it,nt.BidirectionalComparator=rt,nt.coordArrayType=new Array(0).fill(null),st.prototype.get=function(){},st.prototype.put=function(){},st.prototype.size=function(){},st.prototype.values=function(){},st.prototype.entrySet=function(){},ot.prototype=new st,at.prototype=new S,at.prototype.contains=function(){},ut.prototype=new at,ut.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(this.array_[e]===t)return!0}return!1},ut.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},ut.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},ut.prototype.remove=function(t){throw new javascript.util.OperationNotSupported},ut.prototype.size=function(){return this.array_.length},ut.prototype.isEmpty=function(){return 0===this.array_.length},ut.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},ut.prototype.iterator=function(){return new lt(this)};var lt=function(t){this.hashSet_=t,this.position_=0};lt.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new R;return this.hashSet_.array_[this.position_++]},lt.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},lt.prototype.remove=function(){throw new T};var ht=0;function ct(t){return null==t?ht:t.color}function ft(t){return null==t?null:t.parent}function gt(t,e){null!==t&&(t.color=e)}function dt(t){return null==t?null:t.left}function _t(t){return null==t?null:t.right}function pt(){this.root_=null,this.size_=0}function mt(){}function vt(){}function yt(){this.array_=[],arguments[0]instanceof S&&this.addAll(arguments[0])}pt.prototype=new ot,pt.prototype.get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},pt.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ht,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,i,r=this.root_;do{if(n=r,(i=t.compareTo(r.key))<0)r=r.left;else{if(!(i>0)){var s=r.value;return r.value=e,s}r=r.right}}while(null!==r);var o={key:t,left:null,right:null,value:e,parent:n,color:ht,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=o:n.right=o,this.fixAfterInsertion(o),this.size_++,null},pt.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!=this.root_&&1==t.parent.color;){var e;if(ft(t)==dt(ft(ft(t))))1==ct(e=_t(ft(ft(t))))?(gt(ft(t),ht),gt(e,ht),gt(ft(ft(t)),1),t=ft(ft(t))):(t==_t(ft(t))&&(t=ft(t),this.rotateLeft(t)),gt(ft(t),ht),gt(ft(ft(t)),1),this.rotateRight(ft(ft(t))));else 1==ct(e=dt(ft(ft(t))))?(gt(ft(t),ht),gt(e,ht),gt(ft(ft(t)),1),t=ft(ft(t))):(t==dt(ft(t))&&(t=ft(t),this.rotateRight(t)),gt(ft(t),ht),gt(ft(ft(t)),1),this.rotateLeft(ft(ft(t))))}this.root_.color=ht},pt.prototype.values=function(){var t=new P,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=pt.successor(e));)t.add(e.value);return t},pt.prototype.entrySet=function(){var t=new ut,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=pt.successor(e));)t.add(e);return t},pt.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.left==t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},pt.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.right==t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},pt.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},pt.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}e=t.parent;for(var n=t;null!==e&&n===e.right;)n=e,e=e.parent;return e},pt.prototype.size=function(){return this.size_},e(mt.prototype,{interfaces_:function(){return[]},getClass:function(){return mt}}),vt.prototype=new at,yt.prototype=new vt,yt.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},yt.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},yt.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},yt.prototype.remove=function(t){throw new T},yt.prototype.size=function(){return this.array_.length},yt.prototype.isEmpty=function(){return 0===this.array_.length},yt.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},yt.prototype.iterator=function(){return new Et(this)};var xt,Et=function(t){this.treeSet_=t,this.position_=0};function It(){}function Nt(){}function Ct(){}function St(){}function Lt(){this._geometries=null;var t=arguments[0],e=arguments[1];if(K.call(this,e),null===t&&(t=[]),K.hasNullElements(t))throw new i("geometries must not contain null elements");this._geometries=t}function wt(){var t=arguments[0],e=arguments[1];Lt.call(this,t,e)}function Rt(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0];Rt.call(this,t,Q.MOD2_BOUNDARY_RULE)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._geom=e,this._geomFact=e.getFactory(),this._bnRule=n}}function Tt(){this.count=null}function Pt(){}function Ot(){}function bt(){}function Mt(t){this.str=t}function Dt(){}function At(){this._points=null;var t=arguments[0],e=arguments[1];K.call(this,e),this.init(t)}function Ft(){}function Gt(){this._coordinates=null;var t=arguments[0],e=arguments[1];K.call(this,e),this.init(t)}function qt(){}function Bt(){}function Vt(){this._shell=null,this._holes=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(K.call(this,n),null===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),K.hasNullElements(e))throw new i("holes must not contain null elements");if(t.isEmpty()&&K.hasNonEmptyElements(e))throw new i("shell is empty but holes are not");this._shell=t,this._holes=e}function zt(){var t=arguments[0],e=arguments[1];Lt.call(this,t,e)}function Yt(){if(arguments[0]instanceof Array&&arguments[1]instanceof se){var t=arguments[0],e=arguments[1];Yt.call(this,e.getCoordinateSequenceFactory().create(t),e)}else if(N(arguments[0],H)&&arguments[1]instanceof se){var n=arguments[0],i=arguments[1];At.call(this,n,i),this.validateConstruction()}}function kt(){var t=arguments[0],e=arguments[1];Lt.call(this,t,e)}function Ut(){if(this._factory=null,this._isUserDataCopied=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._factory=t}}function Xt(){}function Ht(){}function Wt(){}function jt(){}function Kt(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];Kt.call(this,t,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++)this._coordinates[n]=new E}else if(N(arguments[0],H)){var i=arguments[0];if(null===i)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._coordinates=new Array(i.size()).fill(null);for(n=0;n<this._coordinates.length;n++)this._coordinates[n]=i.getCoordinateCopy(n)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var r=arguments[0],s=arguments[1];this._coordinates=r,this._dimension=s,null===r&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var o=arguments[0],a=arguments[1];this._coordinates=new Array(o).fill(null),this._dimension=a;for(n=0;n<o;n++)this._coordinates[n]=new E}}function Zt(){}Et.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new R;return this.treeSet_.array_[this.position_++]},Et.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Et.prototype.remove=function(){throw new T},It.sort=function(){var t,e,n,i,r=arguments[0];if(1===arguments.length)return i=function(t,e){return t.compareTo(e)},void r.sort(i);if(2===arguments.length)n=arguments[1],i=function(t,e){return n.compare(t,e)},r.sort(i);else{if(3===arguments.length){(e=r.slice(arguments[1],arguments[2])).sort();var s=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length));for(r.splice(0,r.length),t=0;t<s.length;t++)r.push(s[t]);return}if(4===arguments.length){for(e=r.slice(arguments[1],arguments[2]),n=arguments[3],i=function(t,e){return n.compare(t,e)},e.sort(i),s=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length)),r.splice(0,r.length),t=0;t<s.length;t++)r.push(s[t]);return}}},It.asList=function(t){for(var e=new P,n=0,i=t.length;n<i;n++)e.add(t[n]);return e},e(Nt.prototype,{interfaces_:function(){return[]},getClass:function(){return Nt}}),Nt.toDimensionSymbol=function(t){switch(t){case Nt.FALSE:return Nt.SYM_FALSE;case Nt.TRUE:return Nt.SYM_TRUE;case Nt.DONTCARE:return Nt.SYM_DONTCARE;case Nt.P:return Nt.SYM_P;case Nt.L:return Nt.SYM_L;case Nt.A:return Nt.SYM_A}throw new i("Unknown dimension value: "+t)},Nt.toDimensionValue=function(t){switch(q.toUpperCase(t)){case Nt.SYM_FALSE:return Nt.FALSE;case Nt.SYM_TRUE:return Nt.TRUE;case Nt.SYM_DONTCARE:return Nt.DONTCARE;case Nt.SYM_P:return Nt.P;case Nt.SYM_L:return Nt.L;case Nt.SYM_A:return Nt.A}throw new i("Unknown dimension symbol: "+t)},Nt.P=0,Nt.L=1,Nt.A=2,Nt.FALSE=-1,Nt.TRUE=-2,Nt.DONTCARE=-3,Nt.SYM_FALSE="F",Nt.SYM_TRUE="T",Nt.SYM_DONTCARE="*",Nt.SYM_P="0",Nt.SYM_L="1",Nt.SYM_A="2",e(Ct.prototype,{filter:function(t){},interfaces_:function(){return[]},getClass:function(){return Ct}}),e(St.prototype,{filter:function(t,e){},isDone:function(){},isGeometryChanged:function(){},interfaces_:function(){return[]},getClass:function(){return St}}),v(Lt,K),e(Lt.prototype,{computeEnvelopeInternal:function(){for(var t=new M,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},getGeometryN:function(t){return this._geometries[t]},getCoordinates:function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var i=this._geometries[n].getCoordinates(),r=0;r<i.length;r++)t[++e]=i[r];return t},getArea:function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],e))return!1;return!0}return K.prototype.equalsExact.apply(this,arguments)},normalize:function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();It.sort(this._geometries)},getCoordinate:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},getBoundaryDimension:function(){for(var t=Nt.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},getTypeCode:function(){return K.TYPECODE_GEOMETRYCOLLECTION},getDimension:function(){for(var t=Nt.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},getLength:function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},getNumPoints:function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},getNumGeometries:function(){return this._geometries.length},reverse:function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},compareToSameClass:function(){if(1===arguments.length){var t=arguments[0],e=new yt(It.asList(this._geometries)),n=new yt(It.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var i=arguments[0],r=arguments[1],s=i,o=this.getNumGeometries(),a=s.getNumGeometries(),u=0;u<o&&u<a;){var l=this.getGeometryN(u),h=s.getGeometryN(u),c=l.compareToSameClass(h,r);if(0!==c)return c;u++}return u<o?1:u<a?-1:0}},apply:function(){if(N(arguments[0],Z))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(N(arguments[0],St)){var n=arguments[0];if(0===this._geometries.length)return null;for(e=0;e<this._geometries.length&&(this._geometries[e].apply(n),!n.isDone());e++);n.isGeometryChanged()&&this.geometryChanged()}else if(N(arguments[0],Ct)){var i=arguments[0];i.filter(this);for(e=0;e<this._geometries.length;e++)this._geometries[e].apply(i)}else if(N(arguments[0],j)){var r=arguments[0];r.filter(this);for(e=0;e<this._geometries.length;e++)this._geometries[e].apply(r)}},getBoundary:function(){return this.checkNotGeometryCollection(this),x.shouldNeverReachHere(),null},getGeometryType:function(){return K.TYPENAME_GEOMETRYCOLLECTION},copy:function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new Lt(t,this._factory)},isEmpty:function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},interfaces_:function(){return[]},getClass:function(){return Lt}}),Lt.serialVersionUID=-0x4f07bcb1f857d800,v(wt,Lt),e(wt.prototype,{equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&Lt.prototype.equalsExact.call(this,t,e)}return Lt.prototype.equalsExact.apply(this,arguments)},getBoundaryDimension:function(){return this.isClosed()?Nt.FALSE:0},isClosed:function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},getTypeCode:function(){return K.TYPECODE_MULTILINESTRING},getDimension:function(){return 1},reverse:function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},getBoundary:function(){return new Rt(this).getBoundary()},getGeometryType:function(){return K.TYPENAME_MULTILINESTRING},copy:function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new wt(t,this._factory)},interfaces_:function(){return[mt]},getClass:function(){return wt}}),wt.serialVersionUID=0x7155d2ab4afa8000,e(Rt.prototype,{boundaryMultiLineString:function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},getBoundary:function(){return this._geom instanceof At?this.boundaryLineString(this._geom):this._geom instanceof wt?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},boundaryLineString:function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},getEmptyMultiPoint:function(){return this._geomFact.createMultiPoint()},computeBoundaryCoordinates:function(t){var e=new P;this._endpointMap=new pt;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(this.addEndpoint(i.getCoordinateN(0)),this.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var r=this._endpointMap.entrySet().iterator();r.hasNext();){var s=r.next(),o=s.getValue().count;this._bnRule.isInBoundary(o)&&e.add(s.getKey())}return nt.toCoordinateArray(e)},addEndpoint:function(t){var e=this._endpointMap.get(t);null===e&&(e=new Tt,this._endpointMap.put(t,e)),e.count++},interfaces_:function(){return[]},getClass:function(){return Rt}}),Rt.getBoundary=function(){return 1===arguments.length?new Rt(arguments[0]).getBoundary():2===arguments.length?new Rt(arguments[0],arguments[1]).getBoundary():void 0},e(Tt.prototype,{interfaces_:function(){return[]},getClass:function(){return Tt}}),e(Pt.prototype,{interfaces_:function(){return[]},getClass:function(){return Pt}}),Pt.ofLine=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new E;t.getCoordinate(0,i);for(var r=i.x,s=i.y,o=1;o<e;o++){t.getCoordinate(o,i);var a=i.x,u=i.y,l=a-r,h=u-s;n+=Math.sqrt(l*l+h*h),r=a,s=u}return n},e(bt.prototype,{interfaces_:function(){return[]},getClass:function(){return bt}}),bt.chars=function(t,e){for(var n=new Array(e).fill(null),i=0;i<e;i++)n[i]=t;return new String(n)},bt.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new function(){},n=new function(){}(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var i=arguments[0],r=arguments[1],s="",o=new function(){}(new function(){}(bt.getStackTrace(i))),a=0;a<r;a++)try{s+=o.readLine()+bt.NEWLINE}catch(t){if(!(t instanceof Ot))throw t;x.shouldNeverReachHere()}return s}},bt.split=function(t,e){for(var n=e.length,i=new P,r=""+t,s=r.indexOf(e);s>=0;){var o=r.substring(0,s);i.add(o),s=(r=r.substring(s+n)).indexOf(e)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),u=0;u<a.length;u++)a[u]=i.get(u);return a},bt.toString=function(){if(1===arguments.length&&"number"==typeof arguments[0]){var t=arguments[0];return bt.SIMPLE_ORDINATE_FORMAT.format(t)}},bt.spaces=function(t){return bt.chars(" ",t)},bt.NEWLINE=Y.getProperty("line.separator"),bt.SIMPLE_ORDINATE_FORMAT=new function(){}("0.#"),Mt.prototype.append=function(t){this.str+=t},Mt.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},Mt.prototype.toString=function(t){return this.str},e(Dt.prototype,{interfaces_:function(){return[]},getClass:function(){return Dt}}),Dt.copyCoord=function(t,e,n,i){for(var r=Math.min(t.getDimension(),n.getDimension()),s=0;s<r;s++)n.setOrdinate(i,s,t.getOrdinate(e,s))},Dt.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,H.X)===t.getOrdinate(e-1,H.X)&&t.getOrdinate(0,H.Y)===t.getOrdinate(e-1,H.Y))},Dt.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var i=Math.min(t.getDimension(),e.getDimension()),r=0;r<n;r++)for(var o=0;o<i;o++){var a=t.getOrdinate(r,o),u=e.getOrdinate(r,o);if(t.getOrdinate(r,o)!==e.getOrdinate(r,o)&&(!s.isNaN(a)||!s.isNaN(u)))return!1}return!0},Dt.extend=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();if(Dt.copy(e,0,i,0,r),r>0)for(var s=r;s<n;s++)Dt.copy(e,r-1,i,s,1);return i},Dt.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),i=0;i<=n;i++)Dt.swap(t,i,e-i)},Dt.swap=function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var r=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,r)}},Dt.copy=function(t,e,n,i,r){for(var s=0;s<r;s++)Dt.copyCoord(t,e+s,n,i+s)},Dt.toString=function(){if(1===arguments.length&&N(arguments[0],H)){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),i=new Mt;i.append("(");for(var r=0;r<e;r++){r>0&&i.append(" ");for(var s=0;s<n;s++)s>0&&i.append(","),i.append(bt.toString(t.getOrdinate(r,s)))}return i.append(")"),i.toString()}},Dt.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Dt.createClosedRing(t,e,4):e.getOrdinate(0,H.X)===e.getOrdinate(n-1,H.X)&&e.getOrdinate(0,H.Y)===e.getOrdinate(n-1,H.Y)?e:Dt.createClosedRing(t,e,n+1)},Dt.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();Dt.copy(e,0,i,0,r);for(var s=r;s<n;s++)Dt.copy(e,0,i,s,1);return i},v(At,K),e(At.prototype,{computeEnvelopeInternal:function(){return this.isEmpty()?new M:this._points.expandEnvelope(new M)},isRing:function(){return this.isClosed()&&this.isSimple()},getCoordinates:function(){return this._points.toCoordinateArray()},equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),e))return!1;return!0}return K.prototype.equalsExact.apply(this,arguments)},normalize:function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e))){if(this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0){var n=this._points.copy();Dt.reverse(n),this._points=n}return null}}},getCoordinate:function(){return this.isEmpty()?null:this._points.getCoordinate(0)},getBoundaryDimension:function(){return this.isClosed()?Nt.FALSE:0},isClosed:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},getEndPoint:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},getTypeCode:function(){return K.TYPECODE_LINESTRING},getDimension:function(){return 1},getLength:function(){return Pt.ofLine(this._points)},getNumPoints:function(){return this._points.size()},reverse:function(){var t=this._points.copy();return Dt.reverse(t),this.getFactory().createLineString(t)},compareToSameClass:function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var i=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==i)return i;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){t=arguments[0];return arguments[1].compare(this._points,t._points)}},apply:function(){if(N(arguments[0],Z))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(N(arguments[0],St)){var n=arguments[0];if(0===this._points.size())return null;for(e=0;e<this._points.size()&&(n.filter(this._points,e),!n.isDone());e++);n.isGeometryChanged()&&this.geometryChanged()}else if(N(arguments[0],Ct)){arguments[0].filter(this)}else if(N(arguments[0],j)){arguments[0].filter(this)}},getBoundary:function(){return new Rt(this).getBoundary()},isEquivalentClass:function(t){return t instanceof At},getCoordinateN:function(t){return this._points.getCoordinate(t)},getGeometryType:function(){return K.TYPENAME_LINESTRING},copy:function(){return new At(this._points.copy(),this._factory)},getCoordinateSequence:function(){return this._points},isEmpty:function(){return 0===this._points.size()},init:function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new i("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},isCoordinate:function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},getStartPoint:function(){return this.isEmpty()?null:this.getPointN(0)},getPointN:function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},interfaces_:function(){return[mt]},getClass:function(){return At}}),At.serialVersionUID=0x2b2b51ba435c8e00,e(Ft.prototype,{interfaces_:function(){return[]},getClass:function(){return Ft}}),v(Gt,K),e(Gt.prototype,{computeEnvelopeInternal:function(){if(this.isEmpty())return new M;var t=new M;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},getCoordinates:function(){return this.isEmpty()?[]:[this.getCoordinate()]},equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))}return K.prototype.equalsExact.apply(this,arguments)},normalize:function(){},getCoordinate:function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},getBoundaryDimension:function(){return Nt.FALSE},getTypeCode:function(){return K.TYPECODE_POINT},getDimension:function(){return 0},getNumPoints:function(){return this.isEmpty()?0:1},reverse:function(){return this.copy()},getX:function(){if(null===this.getCoordinate())throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x},compareToSameClass:function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){t=arguments[0];return arguments[1].compare(this._coordinates,t._coordinates)}},apply:function(){if(N(arguments[0],Z)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(N(arguments[0],St)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(N(arguments[0],Ct)){arguments[0].filter(this)}else if(N(arguments[0],j)){arguments[0].filter(this)}},getBoundary:function(){return this.getFactory().createGeometryCollection()},getGeometryType:function(){return K.TYPENAME_POINT},copy:function(){return new Gt(this._coordinates.copy(),this._factory)},getCoordinateSequence:function(){return this._coordinates},getY:function(){if(null===this.getCoordinate())throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y},isEmpty:function(){return 0===this._coordinates.size()},init:function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),x.isTrue(t.size()<=1),this._coordinates=t},isSimple:function(){return!0},interfaces_:function(){return[Ft]},getClass:function(){return Gt}}),Gt.serialVersionUID=0x44077bad161cbc00,e(qt.prototype,{interfaces_:function(){return[]},getClass:function(){return qt}}),qt.ofRing=function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(qt.ofRingSigned(t))}if(N(arguments[0],H)){var e=arguments[0];return Math.abs(qt.ofRingSigned(e))}},qt.ofRingSigned=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 r=t[i].x-n,s=t[i+1].y;e+=r*(t[i-1].y-s)}return e/2}if(N(arguments[0],H)){var o=arguments[0],a=o.size();if(a<3)return 0;var u=new E,l=new E,h=new E;o.getCoordinate(0,l),o.getCoordinate(1,h);n=l.x;h.x-=n;for(e=0,i=1;i<a-1;i++)u.y=l.y,l.x=h.x,l.y=h.y,o.getCoordinate(i+1,h),h.x-=n,e+=l.x*(u.y-h.y);return e/2}},e(Bt.prototype,{interfaces_:function(){return[]},getClass:function(){return Bt}}),v(Vt,K),e(Vt.prototype,{computeEnvelopeInternal:function(){return this._shell.getEnvelopeInternal()},getCoordinates:function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];for(var r=0;r<this._holes.length;r++)for(var s=this._holes[r].getCoordinates(),o=0;o<s.length;o++)t[++e]=s[o];return t},getArea:function(){var t=0;t+=qt.ofRing(this._shell.getCoordinateSequence());for(var e=0;e<this._holes.length;e++)t-=qt.ofRing(this._holes[e].getCoordinateSequence());return t},isRectangle:function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){if((s=t.getX(n))!==e.getMinX()&&s!==e.getMaxX())return!1;if((o=t.getY(n))!==e.getMinY()&&o!==e.getMaxY())return!1}var i=t.getX(0),r=t.getY(0);for(n=1;n<=4;n++){var s,o;if((s=t.getX(n))!==i===((o=t.getY(n))!==r))return!1;i=s,r=o}return!0},equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t,i=this._shell,r=n._shell;if(!i.equalsExact(r,e))return!1;if(this._holes.length!==n._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(n._holes[s],e))return!1;return!0}return K.prototype.equalsExact.apply(this,arguments)},normalize:function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);It.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var i=new Array(e.getCoordinates().length-1).fill(null);Y.arraycopy(e.getCoordinates(),0,i,0,i.length);var r=nt.minCoordinate(e.getCoordinates());nt.scroll(i,r),Y.arraycopy(i,0,e.getCoordinates(),0,i.length),e.getCoordinates()[i.length]=i[0],z.isCCW(e.getCoordinates())===n&&nt.reverse(e.getCoordinates())}},getCoordinate:function(){return this._shell.getCoordinate()},getNumInteriorRing:function(){return this._holes.length},getBoundaryDimension:function(){return 1},getTypeCode:function(){return K.TYPECODE_POLYGON},getDimension:function(){return 2},getLength:function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},getNumPoints:function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},reverse:function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},convexHull:function(){return this.getExteriorRing().convexHull()},compareToSameClass:function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var i=arguments[0],r=arguments[1],s=i,o=(e=this._shell,n=s._shell,e.compareToSameClass(n,r));if(0!==o)return o;for(var a=this.getNumInteriorRing(),u=s.getNumInteriorRing(),l=0;l<a&&l<u;){var h=this.getInteriorRingN(l),c=s.getInteriorRingN(l),f=h.compareToSameClass(c,r);if(0!==f)return f;l++}return l<a?1:l<u?-1:0}},apply:function(){if(N(arguments[0],Z)){var t=arguments[0];this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(N(arguments[0],St)){var n=arguments[0];if(this._shell.apply(n),!n.isDone())for(e=0;e<this._holes.length&&(this._holes[e].apply(n),!n.isDone());e++);n.isGeometryChanged()&&this.geometryChanged()}else if(N(arguments[0],Ct)){arguments[0].filter(this)}else if(N(arguments[0],j)){var i=arguments[0];i.filter(this),this._shell.apply(i);for(e=0;e<this._holes.length;e++)this._holes[e].apply(i)}},getBoundary:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},getGeometryType:function(){return K.TYPENAME_POLYGON},copy:function(){for(var t=this._shell.copy(),e=new Array(this._holes.length).fill(null),n=0;n<this._holes.length;n++)e[n]=this._holes[n].copy();return new Vt(t,e,this._factory)},getExteriorRing:function(){return this._shell},isEmpty:function(){return this._shell.isEmpty()},getInteriorRingN:function(t){return this._holes[t]},interfaces_:function(){return[Bt]},getClass:function(){return Vt}}),Vt.serialVersionUID=-0x307ffefd8dc97200,v(zt,Lt),e(zt.prototype,{isValid:function(){return!0},equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&Lt.prototype.equalsExact.call(this,t,e)}return Lt.prototype.equalsExact.apply(this,arguments)},getCoordinate:function(){if(1===arguments.length&&Number.isInteger(arguments[0])){var t=arguments[0];return this._geometries[t].getCoordinate()}return Lt.prototype.getCoordinate.apply(this,arguments)},getBoundaryDimension:function(){return Nt.FALSE},getTypeCode:function(){return K.TYPECODE_MULTIPOINT},getDimension:function(){return 0},getBoundary:function(){return this.getFactory().createGeometryCollection()},getGeometryType:function(){return K.TYPENAME_MULTIPOINT},copy:function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new zt(t,this._factory)},interfaces_:function(){return[Ft]},getClass:function(){return zt}}),zt.serialVersionUID=-0x6fb1ed4162e0fc00,v(Yt,At),e(Yt.prototype,{getBoundaryDimension:function(){return Nt.FALSE},isClosed:function(){return!!this.isEmpty()||At.prototype.isClosed.call(this)},getTypeCode:function(){return K.TYPECODE_LINEARRING},reverse:function(){var t=this._points.copy();return Dt.reverse(t),this.getFactory().createLinearRing(t)},validateConstruction:function(){if(!this.isEmpty()&&!At.prototype.isClosed.call(this))throw new i("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<Yt.MINIMUM_VALID_SIZE)throw new i("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},getGeometryType:function(){return K.TYPENAME_LINEARRING},copy:function(){return new Yt(this._points.copy(),this._factory)},interfaces_:function(){return[]},getClass:function(){return Yt}}),Yt.MINIMUM_VALID_SIZE=4,Yt.serialVersionUID=-0x3b229e262367a600,v(kt,Lt),e(kt.prototype,{equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&Lt.prototype.equalsExact.call(this,t,e)}return Lt.prototype.equalsExact.apply(this,arguments)},getBoundaryDimension:function(){return 1},getTypeCode:function(){return K.TYPECODE_MULTIPOLYGON},getDimension:function(){return 2},reverse:function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},getBoundary:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new P,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),i=0;i<n.getNumGeometries();i++)t.add(n.getGeometryN(i));var r=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(r))},getGeometryType:function(){return K.TYPENAME_MULTIPOLYGON},copy:function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new kt(t,this._factory)},interfaces_:function(){return[Bt]},getClass:function(){return kt}}),kt.serialVersionUID=-0x7a5aa1369171980,e(Ut.prototype,{setCopyUserData:function(t){this._isUserDataCopied=t},edit:function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},editInternal:function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Lt?this.editGeometryCollection(t,e):t instanceof Vt?this.editPolygon(t,e):t instanceof Gt?e.edit(t,this._factory):t instanceof At?e.edit(t,this._factory):(x.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},editGeometryCollection:function(t,e){for(var n=e.edit(t,this._factory),i=new P,r=0;r<n.getNumGeometries();r++){var s=this.edit(n.getGeometryN(r),e);null===s||s.isEmpty()||i.add(s)}return n.getClass()===zt?this._factory.createMultiPoint(i.toArray([])):n.getClass()===wt?this._factory.createMultiLineString(i.toArray([])):n.getClass()===kt?this._factory.createMultiPolygon(i.toArray([])):this._factory.createGeometryCollection(i.toArray([]))},editPolygon:function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon()),n.isEmpty())return n;var i=this.edit(n.getExteriorRing(),e);if(null===i||i.isEmpty())return this._factory.createPolygon();for(var r=new P,s=0;s<n.getNumInteriorRing();s++){var o=this.edit(n.getInteriorRingN(s),e);null===o||o.isEmpty()||r.add(o)}return this._factory.createPolygon(i,r.toArray([]))},interfaces_:function(){return[]},getClass:function(){return Ut}}),Ut.GeometryEditorOperation=Xt,e(Ht.prototype,{edit:function(t,e){return t},interfaces_:function(){return[Xt]},getClass:function(){return Ht}}),e(Wt.prototype,{edit:function(t,e){var n=this.edit(t.getCoordinates(),t);return t instanceof Yt?null===n?e.createLinearRing():e.createLinearRing(n):t instanceof At?null===n?e.createLineString():e.createLineString(n):t instanceof Gt?null===n||0===n.length?e.createPoint():e.createPoint(n[0]):t},interfaces_:function(){return[Xt]},getClass:function(){return Wt}}),e(jt.prototype,{edit:function(t,e){return t instanceof Yt?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof At?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Gt?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},interfaces_:function(){return[Xt]},getClass:function(){return jt}}),Ut.NoOpGeometryOperation=Ht,Ut.CoordinateOperation=Wt,Ut.CoordinateSequenceOperation=jt,e(Kt.prototype,{setOrdinate:function(t,e,n){switch(e){case H.X:this._coordinates[t].x=n;break;case H.Y:this._coordinates[t].y=n;break;case H.Z:this._coordinates[t].z=n;break;default:throw new i("invalid ordinateIndex")}},size:function(){return this._coordinates.length},getOrdinate:function(t,e){switch(e){case H.X:return this._coordinates[t].x;case H.Y:return this._coordinates[t].y;case H.Z:return this._coordinates[t].z}return s.NaN},getCoordinate:function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){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}},getCoordinateCopy:function(t){return new E(this._coordinates[t])},getDimension:function(){return this._dimension},getX:function(t){return this._coordinates[t].x},expandEnvelope:function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},copy:function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new Kt(t,this._dimension)},toString:function(){if(this._coordinates.length>0){var t=new Mt(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},getY:function(t){return this._coordinates[t].y},toCoordinateArray:function(){return this._coordinates},interfaces_:function(){return[H,p]},getClass:function(){return Kt}}),Kt.serialVersionUID=-0xcb44a778db18e00,e(Zt.prototype,{readResolve:function(){return Zt.instance()},create:function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new Kt(arguments[0]);if(N(arguments[0],H))return new Kt(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new Kt(t):new Kt(t,e)}},interfaces_:function(){return[W,p]},getClass:function(){return Zt}}),Zt.instance=function(){return Zt.instanceObject},Zt.serialVersionUID=-0x38e49fa6cf6f2e00,Zt.instanceObject=new Zt;var Qt=Object.defineProperty;var Jt=function(t,e){function n(t){if(!this||this.constructor!==n)return new n(t);this._keys=[],this._values=[],this._itp=[],this.objectOnly=e,t&&function(t){this.add?t.forEach(this.add,this):t.forEach(function(t){this.set(t[0],t[1])},this)}.call(this,t)}e||Qt(t,"size",{get:te});return t.constructor=n,n.prototype=t,n}({delete:function(t){this.has(t)&&(this._keys.splice(xt,1),this._values.splice(xt,1),this._itp.forEach(function(t){xt<t[0]&&t[0]--}));return xt>-1},has:function(t){return function(t,e){if(this.objectOnly&&e!==Object(e))throw new TypeError("Invalid value used as weak collection key");if(e!=e||0===e)for(xt=t.length;xt--&&(n=t[xt],i=e,n!==i&&(n==n||i==i)););else xt=t.indexOf(e);var n,i;return xt>-1}.call(this,this._keys,t)},get:function(t){return this.has(t)?this._values[xt]:void 0},set:function(t,e){return this.has(t)?this._values[xt]=e:this._values[this._keys.push(t)-1]=e,this},keys:function(){return $t(this._itp,this._keys)},values:function(){return $t(this._itp,this._values)},entries:function(){return $t(this._itp,this._keys,this._values)},forEach:function(t,e){for(var n=this.entries();;){var i=n.next();if(i.done)break;t.call(e,i.value[1],i.value[0],this)}},clear:function(){(this._keys||0).length=this._values.length=0}});function $t(t,e,n){var i=[0],r=!1;return t.push(i),{next:function(){var s,o=i[0];return!r&&o<e.length?(s=n?[e[o],n[o]]:e[o],i[0]++):(r=!0,t.splice(t.indexOf(i),1)),{done:r,value:s}}}}function te(){return this._values.length}var ee="undefined"!=typeof Map&&Map.prototype.values?Map:Jt;function ne(){this.map_=new ee}function ie(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=ie.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof re){var t=arguments[0];this._modelType=t,t===ie.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var e=arguments[0];this._modelType=ie.FIXED,this.setScale(e)}else if(arguments[0]instanceof ie){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}function re(){this._name=null;var t=arguments[0];this._name=t,re.nameToTypeMap.put(t,this)}function se(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,0===arguments.length)se.call(this,new ie,0);else if(1===arguments.length){if(N(arguments[0],W)){var t=arguments[0];se.call(this,new ie,0,t)}else if(arguments[0]instanceof ie){var e=arguments[0];se.call(this,e,0,se.getDefaultCoordinateSequenceFactory())}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];se.call(this,n,i,se.getDefaultCoordinateSequenceFactory())}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this._precisionModel=r,this._coordinateSequenceFactory=o,this._SRID=s}}ne.prototype=new st,ne.prototype.get=function(t){return this.map_.get(t)||null},ne.prototype.put=function(t,e){return this.map_.set(t,e),e},ne.prototype.values=function(){for(var t=new P,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},ne.prototype.entrySet=function(){var t=new ut;return this.map_.entries().forEach(function(e){return t.add(e)}),t},ne.prototype.size=function(){return this.map_.size()},e(ie.prototype,{equals:function(t){if(!(t instanceof ie))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},compareTo:function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new G(n).compareTo(new G(i))},getScale:function(){return this._scale},isFloating:function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},getType:function(){return this._modelType},toString:function(){var t="UNKNOWN";return this._modelType===ie.FLOATING?t="Floating":this._modelType===ie.FLOATING_SINGLE?t="Floating-Single":this._modelType===ie.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},makePrecise:function(){if("number"==typeof arguments[0]){var t=arguments[0];return s.isNaN(t)?t:this._modelType===ie.FLOATING_SINGLE?t:this._modelType===ie.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof E){var e=arguments[0];if(this._modelType===ie.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},getMaximumSignificantDigits:function(){var t=16;return this._modelType===ie.FLOATING?t=16:this._modelType===ie.FLOATING_SINGLE?t=6:this._modelType===ie.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},setScale:function(t){this._scale=Math.abs(t)},interfaces_:function(){return[p,g]},getClass:function(){return ie}}),ie.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},e(re.prototype,{readResolve:function(){return re.nameToTypeMap.get(this._name)},toString:function(){return this._name},interfaces_:function(){return[p]},getClass:function(){return re}}),re.serialVersionUID=-552860263173159e4,re.nameToTypeMap=new ne,ie.Type=re,ie.serialVersionUID=0x6bee6404e9a25c00,ie.FIXED=new re("FIXED"),ie.FLOATING=new re("FLOATING"),ie.FLOATING_SINGLE=new re("FLOATING SINGLE"),ie.maximumPreciseValue=9007199254740992,e(se.prototype,{toGeometry:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new E(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new E(t.getMinX(),t.getMinY()),new E(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new E(t.getMinX(),t.getMinY()),new E(t.getMinX(),t.getMaxY()),new E(t.getMaxX(),t.getMaxY()),new E(t.getMaxX(),t.getMinY()),new E(t.getMinX(),t.getMinY())]),null)},createLineString:function(){if(0===arguments.length)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(N(arguments[0],H))return new At(arguments[0],this)}},createMultiLineString:function(){return 0===arguments.length?new wt(null,this):1===arguments.length?new wt(arguments[0],this):void 0},buildGeometry:function(t){for(var e=null,n=!1,i=!1,r=t.iterator();r.hasNext();){var s=r.next(),o=s.getClass();null===e&&(e=o),o!==e&&(n=!0),s instanceof Lt&&(i=!0)}if(null===e)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(se.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Vt)return this.createMultiPolygon(se.toPolygonArray(t));if(a instanceof At)return this.createMultiLineString(se.toLineStringArray(t));if(a instanceof Gt)return this.createMultiPoint(se.toPointArray(t));x.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},createMultiPointFromCoords:function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},createPoint:function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof E){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(N(arguments[0],H))return new Gt(arguments[0],this)}},getCoordinateSequenceFactory:function(){return this._coordinateSequenceFactory},createPolygon:function(){if(0===arguments.length)return this.createPolygon(null,null);if(1===arguments.length){if(N(arguments[0],H)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Yt){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){return new Vt(arguments[0],arguments[1],this)}},getSRID:function(){return this._SRID},createGeometryCollection:function(){return 0===arguments.length?new Lt(null,this):1===arguments.length?new Lt(arguments[0],this):void 0},createGeometry:function(t){return new Ut(this).edit(t,{edit:function(){if(2===arguments.length&&arguments[1]instanceof K&&N(arguments[0],H)){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},getPrecisionModel:function(){return this._precisionModel},createLinearRing:function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(N(arguments[0],H))return new Yt(arguments[0],this)}},createMultiPolygon:function(){return 0===arguments.length?new kt(null,this):1===arguments.length?new kt(arguments[0],this):void 0},createMultiPoint:function(){if(0===arguments.length)return new zt(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new zt(arguments[0],this);if(N(arguments[0],H)){var t=arguments[0];if(null===t)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),n=0;n<t.size();n++){var i=this.getCoordinateSequenceFactory().create(1,t.getDimension());Dt.copy(t,n,i,0,1),e[n]=this.createPoint(i)}return this.createMultiPoint(e)}}},interfaces_:function(){return[p]},getClass:function(){return se}}),se.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},se.getDefaultCoordinateSequenceFactory=function(){return Zt.instance()},se.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},se.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},se.serialVersionUID=-0x5ea75f2051eeb400;var oe={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*$/};function ae(t){this.geometryFactory=t||new se,this.precisionModel=this.geometryFactory.getPrecisionModel()}e(ae.prototype,{read:function(t){var e,n,i;t=t.replace(/[\n\r]/g," ");var r=oe.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((r=oe.emptyTypeStr.exec(t))[2]=void 0),r&&(n=r[1].toLowerCase(),i=r[2],le[n]&&(e=le[n].call(this,i))),void 0===e)throw new Error("Could not parse WKT "+t);return e},write:function(t){return this.extractGeometry(t)},extractGeometry:function(t){var e=t.getGeometryType().toLowerCase();if(!ue[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+ue[e].call(this,t)+")"}});var ue={coordinate:function(t){return t.x+" "+t.y},point:function(t){return ue.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push("("+ue.point.call(this,t._geometries[n])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,i=t._points._coordinates.length;n<i;++n)e.push(ue.coordinate.call(this,t._points._coordinates[n]));return e.join(",")},linearring:function(t){for(var e=[],n=0,i=t._points._coordinates.length;n<i;++n)e.push(ue.coordinate.call(this,t._points._coordinates[n]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push("("+ue.linestring.call(this,t._geometries[n])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+ue.linestring.call(this,t._shell)+")");for(var n=0,i=t._holes.length;n<i;++n)e.push("("+ue.linestring.call(this,t._holes[n])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push("("+ue.polygon.call(this,t._geometries[n])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},le={coord:function(t){var e=t.trim().split(oe.spaces),n=new E(Number.parseFloat(e[0]),Number.parseFloat(e[1]));return this.precisionModel.makePrecise(n),n},point:function(t){return void 0===t?this.geometryFactory.createPoint():this.geometryFactory.createPoint(le.coord.call(this,t))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint();for(var e,n=t.trim().split(","),i=[],r=0,s=n.length;r<s;++r)e=n[r].replace(oe.trimParens,"$1"),i.push(le.point.call(this,e));return this.geometryFactory.createMultiPoint(i)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e=t.trim().split(","),n=[],i=0,r=e.length;i<r;++i)n.push(le.coord.call(this,e[i]));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e=t.trim().split(","),n=[],i=0,r=e.length;i<r;++i)n.push(le.coord.call(this,e[i]));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(oe.parenComma),i=[],r=0,s=n.length;r<s;++r)e=n[r].replace(oe.trimParens,"$1"),i.push(le.linestring.call(this,e));return this.geometryFactory.createMultiLineString(i)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,i,r,s=t.trim().split(oe.parenComma),o=[],a=0,u=s.length;a<u;++a)e=s[a].replace(oe.trimParens,"$1"),n=le.linestring.call(this,e),i=this.geometryFactory.createLinearRing(n._points),0===a?r=i:o.push(i);return this.geometryFactory.createPolygon(r,o)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(oe.doubleParenComma),i=[],r=0,s=n.length;r<s;++r)e=n[r].replace(oe.trimParens,"$1"),i.push(le.polygon.call(this,e));return this.geometryFactory.createMultiPolygon(i)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],i=0,r=e.length;i<r;++i)n.push(this.read(e[i]));return this.geometryFactory.createGeometryCollection(n)}};function he(t){this.parser=new ae(t)}function ce(){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 E,this._intPt[1]=new E,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}function fe(){ce.apply(this)}function ge(){if(this.p0=null,this.p1=null,0===arguments.length)ge.call(this,new E,new E);else if(1===arguments.length){var t=arguments[0];ge.call(this,t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0=e,this.p1=n}else if(4===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];ge.call(this,new E(i,r),new E(s,o))}}function de(){}function _e(){if(this._matrix=null,0===arguments.length)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(Nt.FALSE);else if(1===arguments.length)if("string"==typeof arguments[0]){var t=arguments[0];_e.call(this),this.set(t)}else if(arguments[0]instanceof _e){var e=arguments[0];_e.call(this),this._matrix[de.INTERIOR][de.INTERIOR]=e._matrix[de.INTERIOR][de.INTERIOR],this._matrix[de.INTERIOR][de.BOUNDARY]=e._matrix[de.INTERIOR][de.BOUNDARY],this._matrix[de.INTERIOR][de.EXTERIOR]=e._matrix[de.INTERIOR][de.EXTERIOR],this._matrix[de.BOUNDARY][de.INTERIOR]=e._matrix[de.BOUNDARY][de.INTERIOR],this._matrix[de.BOUNDARY][de.BOUNDARY]=e._matrix[de.BOUNDARY][de.BOUNDARY],this._matrix[de.BOUNDARY][de.EXTERIOR]=e._matrix[de.BOUNDARY][de.EXTERIOR],this._matrix[de.EXTERIOR][de.INTERIOR]=e._matrix[de.EXTERIOR][de.INTERIOR],this._matrix[de.EXTERIOR][de.BOUNDARY]=e._matrix[de.EXTERIOR][de.BOUNDARY],this._matrix[de.EXTERIOR][de.EXTERIOR]=e._matrix[de.EXTERIOR][de.EXTERIOR]}}function pe(){}function me(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.p0=t,this.p1=e,this.p2=n}e(he.prototype,{write:function(t){return this.parser.write(t)}}),e(he,{toLineString:function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}),e(ce.prototype,{getIndexAlongSegment:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},getTopologySummary:function(){var t=new Mt;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},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)},getIntersectionNum:function(){return this._result},computeIntLineIndex:function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},isProper:function(){return this.hasIntersection()&&this._isProper},setPrecisionModel:function(t){this._precisionModel=t},isInteriorIntersection:function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}},getIntersection:function(t){return this._intPt[t]},isEndPoint:function(){return this.hasIntersection()&&!this._isProper},hasIntersection:function(){return this._result!==ce.NO_INTERSECTION},getEdgeDistance:function(t,e){return ce.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},isCollinear:function(){return this._result===ce.COLLINEAR_INTERSECTION},toString:function(){return he.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+he.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},getEndpoint:function(t,e){return this._inputLines[t][e]},isIntersection:function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},getIntersectionAlongSegment:function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},interfaces_:function(){return[]},getClass:function(){return ce}}),ce.computeEdgeDistance=function(t,e,n){var i=Math.abs(n.x-e.x),r=Math.abs(n.y-e.y),s=-1;if(t.equals(e))s=0;else if(t.equals(n))s=i>r?i:r;else{var o=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(s=i>r?o:a)||t.equals(e)||(s=Math.max(o,a))}return x.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s},ce.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,r=t.y-e.y,s=Math.sqrt(i*i+r*r);return x.isTrue(!(0===s&&!t.equals(e)),"Invalid distance calculation"),s},ce.DONT_INTERSECT=0,ce.DO_INTERSECT=1,ce.COLLINEAR=2,ce.NO_INTERSECTION=0,ce.POINT_INTERSECTION=1,ce.COLLINEAR_INTERSECTION=2,v(fe,ce),e(fe.prototype,{isInSegmentEnvelopes:function(t){var e=new M(this._inputLines[0][0],this._inputLines[0][1]),n=new M(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},computeIntersection:function(){if(3!==arguments.length)return ce.prototype.computeIntersection.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,M.intersects(e,n,t)&&0===z.index(e,n,t)&&0===z.index(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=ce.POINT_INTERSECTION,null;this._result=ce.NO_INTERSECTION},normalizeToMinimum:function(t,e,n,i,r){r.x=this.smallestInAbsValue(t.x,e.x,n.x,i.x),r.y=this.smallestInAbsValue(t.y,e.y,n.y,i.y),t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,i.x-=r.x,i.y-=r.y},safeHCoordinateIntersection:function(t,e,n,i){var r=null;try{r=k.intersection(t,e,n,i)}catch(s){if(!(s instanceof A))throw s;r=fe.nearestEndpoint(t,e,n,i)}return r},intersection:function(t,e,n,i){var r=this.intersectionWithNormalization(t,e,n,i);return this.isInSegmentEnvelopes(r)||(r=new E(fe.nearestEndpoint(t,e,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(r),r},smallestInAbsValue:function(t,e,n,i){var r=t,s=Math.abs(r);return Math.abs(e)<s&&(r=e,s=Math.abs(e)),Math.abs(n)<s&&(r=n,s=Math.abs(n)),Math.abs(i)<s&&(r=i),r},checkDD:function(t,e,n,i,r){var s=V.intersection(t,e,n,i),o=this.isInSegmentEnvelopes(s);Y.out.println("DD in env = "+o+" --------------------- "+s),r.distance(s)>1e-4&&Y.out.println("Distance = "+r.distance(s))},intersectionWithNormalization:function(t,e,n,i){var r=new E(t),s=new E(e),o=new E(n),a=new E(i),u=new E;this.normalizeToEnvCentre(r,s,o,a,u);var l=this.safeHCoordinateIntersection(r,s,o,a);return l.x+=u.x,l.y+=u.y,l},computeCollinearIntersection:function(t,e,n,i){var r=M.intersects(t,e,n),s=M.intersects(t,e,i),o=M.intersects(n,i,t),a=M.intersects(n,i,e);return r&&s?(this._intPt[0]=n,this._intPt[1]=i,ce.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=t,this._intPt[1]=e,ce.COLLINEAR_INTERSECTION):r&&o?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||s||a?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):r&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||o?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):s&&o?(this._intPt[0]=i,this._intPt[1]=t,!i.equals(t)||r||a?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||r||o?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):ce.NO_INTERSECTION},normalizeToEnvCentre:function(t,e,n,i,r){var s=t.x<e.x?t.x:e.x,o=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.x<i.x?n.x:i.x,h=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,g=((s>l?s:l)+(a<c?a:c))/2,d=((o>h?o:h)+(u<f?u:f))/2;r.x=g,r.y=d,t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,i.x-=r.x,i.y-=r.y},computeIntersect:function(t,e,n,i){if(this._isProper=!1,!M.intersects(t,e,n,i))return ce.NO_INTERSECTION;var r=z.index(t,e,n),s=z.index(t,e,i);if(r>0&&s>0||r<0&&s<0)return ce.NO_INTERSECTION;var o=z.index(n,i,t),a=z.index(n,i,e);return o>0&&a>0||o<0&&a<0?ce.NO_INTERSECTION:0===r&&0===s&&0===o&&0===a?this.computeCollinearIntersection(t,e,n,i):(0===r||0===s||0===o||0===a?(this._isProper=!1,t.equals2D(n)||t.equals2D(i)?this._intPt[0]=t:e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:0===r?this._intPt[0]=new E(n):0===s?this._intPt[0]=new E(i):0===o?this._intPt[0]=new E(t):0===a&&(this._intPt[0]=new E(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,i)),ce.POINT_INTERSECTION)},interfaces_:function(){return[]},getClass:function(){return fe}}),fe.nearestEndpoint=function(t,e,n,i){var r=t,s=X.pointToSegment(t,n,i),o=X.pointToSegment(e,n,i);return o<s&&(s=o,r=e),(o=X.pointToSegment(n,t,e))<s&&(s=o,r=n),(o=X.pointToSegment(i,t,e))<s&&(s=o,r=i),r},e(ge.prototype,{minX:function(){return Math.min(this.p0.x,this.p1.x)},orientationIndex:function(){if(arguments[0]instanceof ge){var t=arguments[0],e=z.index(this.p0,this.p1,t.p0),n=z.index(this.p0,this.p1,t.p1);return e>=0&&n>=0?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof E){var i=arguments[0];return z.index(this.p0,this.p1,i)}},toGeometry:function(t){return t.createLineString([this.p0,this.p1])},isVertical:function(){return this.p0.x===this.p1.x},equals:function(t){if(!(t instanceof ge))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},intersection:function(t){var e=new fe;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},project:function(){if(arguments[0]instanceof E){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new E(t);var e=this.projectionFactor(t),n=new E;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}if(arguments[0]instanceof ge){var i=arguments[0],r=this.projectionFactor(i.p0),s=this.projectionFactor(i.p1);if(r>=1&&s>=1)return null;if(r<=0&&s<=0)return null;var o=this.project(i.p0);r<0&&(o=this.p0),r>1&&(o=this.p1);var a=this.project(i.p1);return s<0&&(a=this.p0),s>1&&(a=this.p1),new ge(o,a)}},normalize:function(){this.p1.compareTo(this.p0)<0&&this.reverse()},angle:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},getCoordinate:function(t){return 0===t?this.p0:this.p1},distancePerpendicular:function(t){return X.pointToLinePerpendicular(t,this.p0,this.p1)},minY:function(){return Math.min(this.p0.y,this.p1.y)},midPoint:function(){return ge.midPoint(this.p0,this.p1)},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;return i<=0?s.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i},closestPoints:function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),i=s.MAX_VALUE,r=null,o=this.closestPoint(t.p0);i=o.distance(t.p0),n[0]=o,n[1]=t.p0;var a=this.closestPoint(t.p1);(r=a.distance(t.p1))<i&&(i=r,n[0]=a,n[1]=t.p1);var u=t.closestPoint(this.p0);(r=u.distance(this.p0))<i&&(i=r,n[0]=this.p0,n[1]=u);var l=t.closestPoint(this.p1);return(r=l.distance(this.p1))<i&&(i=r,n[0]=this.p1,n[1]=l),n},closestPoint:function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},maxX:function(){return Math.max(this.p0.x,this.p1.x)},getLength:function(){return this.p0.distance(this.p1)},compareTo:function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},reverse:function(){var t=this.p0;this.p0=this.p1,this.p1=t},equalsTopo:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)},lineIntersection:function(t){try{return k.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof A))throw t}return null},maxY:function(){return Math.max(this.p0.y,this.p1.y)},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),r=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,o=Math.sqrt(r*r+s*s),a=0,u=0;if(0!==e){if(o<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");a=e*r/o,u=e*s/o}return new E(n-u,i+a)},setCoordinates:function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){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}},segmentFraction:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||s.isNaN(e))&&(e=1),e},toString:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},isHorizontal:function(){return this.p0.y===this.p1.y},distance:function(){if(arguments[0]instanceof ge){var t=arguments[0];return X.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof E){var e=arguments[0];return X.pointToSegment(e,this.p0,this.p1)}},pointAlong:function(t){var e=new E;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},hashCode:function(){var t=java.lang.Double.doubleToLongBits(this.p0.x);t^=31*java.lang.Double.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=java.lang.Double.doubleToLongBits(this.p1.x);return n^=31*java.lang.Double.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},interfaces_:function(){return[g,p]},getClass:function(){return ge}}),ge.midPoint=function(t,e){return new E((t.x+e.x)/2,(t.y+e.y)/2)},ge.serialVersionUID=0x2d2172135f411c00,e(de.prototype,{interfaces_:function(){return[]},getClass:function(){return de}}),de.toLocationSymbol=function(t){switch(t){case de.EXTERIOR:return"e";case de.BOUNDARY:return"b";case de.INTERIOR:return"i";case de.NONE:return"-"}throw new i("Unknown location value: "+t)},de.INTERIOR=0,de.BOUNDARY=1,de.EXTERIOR=2,de.NONE=-1,e(_e.prototype,{isIntersects:function(){return!this.isDisjoint()},isCovers:function(){return(_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])||_e.isTrue(this._matrix[de.INTERIOR][de.BOUNDARY])||_e.isTrue(this._matrix[de.BOUNDARY][de.INTERIOR])||_e.isTrue(this._matrix[de.BOUNDARY][de.BOUNDARY]))&&this._matrix[de.EXTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.BOUNDARY]===Nt.FALSE},isCoveredBy:function(){return(_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])||_e.isTrue(this._matrix[de.INTERIOR][de.BOUNDARY])||_e.isTrue(this._matrix[de.BOUNDARY][de.INTERIOR])||_e.isTrue(this._matrix[de.BOUNDARY][de.BOUNDARY]))&&this._matrix[de.INTERIOR][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.EXTERIOR]===Nt.FALSE},set:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this._matrix[n][i]=Nt.toDimensionValue(t.charAt(e))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this._matrix[r][s]=o}},isContains:function(){return _e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&this._matrix[de.EXTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.BOUNDARY]===Nt.FALSE},setAtLeast:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this.setAtLeast(n,i,Nt.toDimensionValue(t.charAt(e)))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this._matrix[r][s]<o&&(this._matrix[r][s]=o)}},setAtLeastIfValid:function(t,e,n){t>=0&&e>=0&&this.setAtLeast(t,e,n)},isWithin:function(){return _e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&this._matrix[de.INTERIOR][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.EXTERIOR]===Nt.FALSE},isTouches:function(t,e){return t>e?this.isTouches(e,t):(t===Nt.A&&e===Nt.A||t===Nt.L&&e===Nt.L||t===Nt.L&&e===Nt.A||t===Nt.P&&e===Nt.A||t===Nt.P&&e===Nt.L)&&(this._matrix[de.INTERIOR][de.INTERIOR]===Nt.FALSE&&(_e.isTrue(this._matrix[de.INTERIOR][de.BOUNDARY])||_e.isTrue(this._matrix[de.BOUNDARY][de.INTERIOR])||_e.isTrue(this._matrix[de.BOUNDARY][de.BOUNDARY])))},isOverlaps:function(t,e){return t===Nt.P&&e===Nt.P||t===Nt.A&&e===Nt.A?_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&_e.isTrue(this._matrix[de.INTERIOR][de.EXTERIOR])&&_e.isTrue(this._matrix[de.EXTERIOR][de.INTERIOR]):t===Nt.L&&e===Nt.L&&(1===this._matrix[de.INTERIOR][de.INTERIOR]&&_e.isTrue(this._matrix[de.INTERIOR][de.EXTERIOR])&&_e.isTrue(this._matrix[de.EXTERIOR][de.INTERIOR]))},isEquals:function(t,e){return t===e&&(_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&this._matrix[de.INTERIOR][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.BOUNDARY]===Nt.FALSE)},toString:function(){for(var t=new Mt("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,Nt.toDimensionSymbol(this._matrix[e][n]));return t.toString()},setAll:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this._matrix[e][n]=t},get:function(t,e){return this._matrix[t][e]},transpose:function(){var t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this},matches:function(t){if(9!==t.length)throw new i("Should be length 9: "+t);for(var e=0;e<3;e++)for(var n=0;n<3;n++)if(!_e.matches(this._matrix[e][n],t.charAt(3*e+n)))return!1;return!0},add:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.setAtLeast(e,n,t.get(e,n))},isDisjoint:function(){return this._matrix[de.INTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.INTERIOR][de.BOUNDARY]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.INTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.BOUNDARY]===Nt.FALSE},isCrosses:function(t,e){return t===Nt.P&&e===Nt.L||t===Nt.P&&e===Nt.A||t===Nt.L&&e===Nt.A?_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&_e.isTrue(this._matrix[de.INTERIOR][de.EXTERIOR]):t===Nt.L&&e===Nt.P||t===Nt.A&&e===Nt.P||t===Nt.A&&e===Nt.L?_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&_e.isTrue(this._matrix[de.EXTERIOR][de.INTERIOR]):t===Nt.L&&e===Nt.L&&0===this._matrix[de.INTERIOR][de.INTERIOR]},interfaces_:function(){return[d]},getClass:function(){return _e}}),_e.matches=function(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){var t=arguments[0],e=arguments[1];return e===Nt.SYM_DONTCARE||(e===Nt.SYM_TRUE&&(t>=0||t===Nt.TRUE)||(e===Nt.SYM_FALSE&&t===Nt.FALSE||(e===Nt.SYM_P&&t===Nt.P||(e===Nt.SYM_L&&t===Nt.L||e===Nt.SYM_A&&t===Nt.A))))}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return new _e(n).matches(i)}},_e.isTrue=function(t){return t>=0||t===Nt.TRUE},e(pe.prototype,{interfaces_:function(){return[]},getClass:function(){return pe}}),pe.toDegrees=function(t){return 180*t/Math.PI},pe.normalize=function(t){for(;t>Math.PI;)t-=pe.PI_TIMES_2;for(;t<=-Math.PI;)t+=pe.PI_TIMES_2;return t},pe.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=n.x-e.x,r=n.y-e.y;return Math.atan2(r,i)}},pe.isAcute=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return i*(n.x-e.x)+r*(n.y-e.y)>0},pe.isObtuse=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return i*(n.x-e.x)+r*(n.y-e.y)<0},pe.interiorAngle=function(t,e,n){var i=pe.angle(e,t),r=pe.angle(e,n);return Math.abs(r-i)},pe.normalizePositive=function(t){if(t<0){for(;t<0;)t+=pe.PI_TIMES_2;t>=pe.PI_TIMES_2&&(t=0)}else{for(;t>=pe.PI_TIMES_2;)t-=pe.PI_TIMES_2;t<0&&(t=0)}return t},pe.angleBetween=function(t,e,n){var i=pe.angle(e,t),r=pe.angle(e,n);return pe.diff(i,r)},pe.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},pe.toRadians=function(t){return t*Math.PI/180},pe.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?pe.COUNTERCLOCKWISE:n<0?pe.CLOCKWISE:pe.NONE},pe.angleBetweenOriented=function(t,e,n){var i=pe.angle(e,t),r=pe.angle(e,n)-i;return r<=-Math.PI?r+pe.PI_TIMES_2:r>Math.PI?r-pe.PI_TIMES_2:r},pe.PI_TIMES_2=2*Math.PI,pe.PI_OVER_2=Math.PI/2,pe.PI_OVER_4=Math.PI/4,pe.COUNTERCLOCKWISE=z.COUNTERCLOCKWISE,pe.CLOCKWISE=z.CLOCKWISE,pe.NONE=z.COLLINEAR,e(me.prototype,{area:function(){return me.area(this.p0,this.p1,this.p2)},signedArea:function(){return me.signedArea(this.p0,this.p1,this.p2)},interpolateZ:function(t){if(null===t)throw new i("Supplied point is null.");return me.interpolateZ(t,this.p0,this.p1,this.p2)},longestSideLength:function(){return me.longestSideLength(this.p0,this.p1,this.p2)},isAcute:function(){return me.isAcute(this.p0,this.p1,this.p2)},circumcentre:function(){return me.circumcentre(this.p0,this.p1,this.p2)},area3D:function(){return me.area3D(this.p0,this.p1,this.p2)},centroid:function(){return me.centroid(this.p0,this.p1,this.p2)},inCentre:function(){return me.inCentre(this.p0,this.p1,this.p2)},interfaces_:function(){return[]},getClass:function(){return me}}),me.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)},me.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},me.det=function(t,e,n,i){return t*i-e*n},me.interpolateZ=function(t,e,n,i){var r=e.x,s=e.y,o=n.x-r,a=i.x-r,u=n.y-s,l=i.y-s,h=o*l-a*u,c=t.x-r,f=t.y-s,g=(l*c-a*f)/h,d=(-u*c+o*f)/h;return e.z+g*(n.z-e.z)+d*(i.z-e.z)},me.longestSideLength=function(t,e,n){var i=t.distance(e),r=e.distance(n),s=n.distance(t),o=i;return r>o&&(o=r),s>o&&(o=s),o},me.isAcute=function(t,e,n){return!!pe.isAcute(t,e,n)&&(!!pe.isAcute(e,n,t)&&!!pe.isAcute(n,t,e))},me.circumcentre=function(t,e,n){var i=n.x,r=n.y,s=t.x-i,o=t.y-r,a=e.x-i,u=e.y-r,l=2*me.det(s,o,a,u);return new E(i-me.det(o,s*s+o*o,u,a*a+u*u)/l,r+me.det(s,s*s+o*o,a,a*a+u*u)/l)},me.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y;return new k(new k(t.x+n/2,t.y+i/2,1),new k(t.x-i+n/2,t.y+n+i/2,1))},me.angleBisector=function(t,e,n){var i=e.distance(t),r=i/(i+e.distance(n)),s=n.x-t.x,o=n.y-t.y;return new E(t.x+r*s,t.y+r*o)},me.area3D=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=e.z-t.z,o=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=r*u-s*a,h=s*o-i*u,c=i*a-r*o,f=l*l+h*h+c*c;return Math.sqrt(f)/2},me.centroid=function(t,e,n){return new E((t.x+e.x+n.x)/3,(t.y+e.y+n.y)/3)},me.inCentre=function(t,e,n){var i=e.distance(n),r=t.distance(n),s=t.distance(e),o=i+r+s;return new E((i*t.x+r*e.x+s*n.x)/o,(i*t.y+r*e.y+s*n.y)/o)};var ve=Object.freeze({Coordinate:E,CoordinateList:b,Envelope:M,LineSegment:ge,GeometryFactory:se,Geometry:K,Point:Gt,LineString:At,LinearRing:Yt,Polygon:Vt,GeometryCollection:Lt,MultiPoint:zt,MultiLineString:wt,MultiPolygon:kt,Dimension:Nt,IntersectionMatrix:_e,PrecisionModel:ie,Location:de,Triangle:me});function ye(){this._pt=[new E,new E],this._distance=s.NaN,this._isNull=!0}function xe(){}function Ee(){this._g0=null,this._g1=null,this._ptDist=new ye,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e}function Ie(){this._maxPtDist=new ye,this._minPtDist=new ye,this._euclideanDist=new xe,this._geom=null;var t=arguments[0];this._geom=t}function Ne(){this._maxPtDist=new ye,this._minPtDist=new ye,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))}function Ce(){}function Se(){}function Le(){this._min=s.POSITIVE_INFINITY,this._max=s.NEGATIVE_INFINITY}function we(){}function Re(){Le.apply(this),this._item=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._min=t,this._max=e,this._item=n}e(ye.prototype,{getCoordinates:function(){return this._pt},getCoordinate:function(t){return this._pt[t]},setMinimum:function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){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)}},initialize:function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){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(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=r,this._isNull=!1}},toString:function(){return he.toLineString(this._pt[0],this._pt[1])},getDistance:function(){return this._distance},setMaximum:function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){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)}},interfaces_:function(){return[]},getClass:function(){return ye}}),e(xe.prototype,{interfaces_:function(){return[]},getClass:function(){return xe}}),xe.computeDistance=function(){if(arguments[2]instanceof ye&&arguments[0]instanceof At&&arguments[1]instanceof E)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new ge,r=t.getCoordinates(),s=0;s<r.length-1;s++){i.setCoordinates(r[s],r[s+1]);var o=i.closestPoint(e);n.setMinimum(o,e)}else if(arguments[2]instanceof ye&&arguments[0]instanceof Vt&&arguments[1]instanceof E){var a=arguments[0],u=arguments[1],l=arguments[2];xe.computeDistance(a.getExteriorRing(),u,l);for(s=0;s<a.getNumInteriorRing();s++)xe.computeDistance(a.getInteriorRingN(s),u,l)}else if(arguments[2]instanceof ye&&arguments[0]instanceof K&&arguments[1]instanceof E){var h=arguments[0],c=arguments[1],f=arguments[2];if(h instanceof At)xe.computeDistance(h,c,f);else if(h instanceof Vt)xe.computeDistance(h,c,f);else if(h instanceof Lt){var g=h;for(s=0;s<g.getNumGeometries();s++){var d=g.getGeometryN(s);xe.computeDistance(d,c,f)}}else f.setMinimum(h.getCoordinate(),c)}else if(arguments[2]instanceof ye&&arguments[0]instanceof ge&&arguments[1]instanceof E){var _=arguments[0],p=arguments[1],m=arguments[2];o=_.closestPoint(p);m.setMinimum(o,p)}},e(Ee.prototype,{getCoordinates:function(){return this._ptDist.getCoordinates()},setDensifyFraction:function(t){if(t>1||t<=0)throw new i("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},compute:function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},distance:function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},computeOrientedDistance:function(t,e,n){var i=new Ie(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new Ne(e,this._densifyFrac);t.apply(r),n.setMaximum(r.getMaxPointDistance())}},orientedDistance:function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},interfaces_:function(){return[]},getClass:function(){return Ee}}),Ee.distance=function(){if(2===arguments.length)return(t=new Ee(arguments[0],arguments[1])).distance();if(3===arguments.length){var t,e=arguments[0],n=arguments[1],i=arguments[2];return(t=new Ee(e,n)).setDensifyFraction(i),t.distance()}},e(Ie.prototype,{filter:function(t){this._minPtDist.initialize(),xe.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},getMaxPointDistance:function(){return this._maxPtDist},interfaces_:function(){return[Z]},getClass:function(){return Ie}}),e(Ne.prototype,{filter:function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),r=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,o=0;o<this._numSubSegs;o++){var a=new E(n.x+o*r,n.y+o*s);this._minPtDist.initialize(),xe.computeDistance(this._geom,a,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},isDone:function(){return!1},isGeometryChanged:function(){return!1},getMaxPointDistance:function(){return this._maxPtDist},interfaces_:function(){return[St]},getClass:function(){return Ne}}),Ee.MaxPointDistanceFilter=Ie,Ee.MaxDensifiedByFractionDistanceFilter=Ne,e(Ce.prototype,{visitItem:function(t){},interfaces_:function(){return[]},getClass:function(){return Ce}}),e(Se.prototype,{locate:function(t){},interfaces_:function(){return[]},getClass:function(){return Se}}),e(Le.prototype,{getMin:function(){return this._min},intersects:function(t,e){return!(this._min>e||this._max<t)},getMax:function(){return this._max},toString:function(){return he.toLineString(new E(this._min,0),new E(this._max,0))},interfaces_:function(){return[]},getClass:function(){return Le}}),e(we.prototype,{compare:function(t,e){var n=t,i=e,r=(n._min+n._max)/2,s=(i._min+i._max)/2;return r<s?-1:r>s?1:0},interfaces_:function(){return[_]},getClass:function(){return we}}),Le.NodeComparator=we,v(Re,Le),e(Re.prototype,{query:function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},interfaces_:function(){return[]},getClass:function(){return Re}});var Te={reverseOrder:function(){return{compare:function(t,e){return e.compareTo(t)}}},min:function(t){return Te.sort(t),t.get(0)},sort:function(t,e){var n=t.toArray();e?It.sort(n,e):It.sort(n);for(var i=t.iterator(),r=0,s=n.length;r<s;r++)i.next(),i.set(n[r])},singletonList:function(t){var e=new P;return e.add(t),e}};function Pe(){Le.apply(this),this._node1=null,this._node2=null;var t=arguments[0],e=arguments[1];this._node1=t,this._node2=e,this.buildExtent(this._node1,this._node2)}function Oe(){this._leaves=new P,this._root=null,this._level=0}function be(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}}function Me(){this._items=new P}function De(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t}function Ae(){this._index=null;var t=arguments[0];if(!(N(t,Bt)||t instanceof Yt))throw new i("Argument must be Polygonal or LinearRing");this._index=new Ge(t)}function Fe(){this._counter=null;var t=arguments[0];this._counter=t}function Ge(){this._index=new Oe;var t=arguments[0];this.init(t)}function qe(){}function Be(){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()}function Ve(){this._geom=null;var t=arguments[0];this._geom=t}function ze(){}function Ye(){}function ke(){}function Ue(){}function Xe(){this._areaBasePt=null,this._triangleCent3=new E,this._areasum2=0,this._cg3=new E,this._lineCentSum=new E,this._totalLength=0,this._ptCount=0,this._ptCentSum=new E;var t=arguments[0];this._areaBasePt=null,this.add(t)}function He(){}function We(t){this.message=t||""}function je(){this.array_=[]}function Ke(){this.treeSet=new yt,this.list=new P}function Ze(){if(this._geomFactory=null,this._inputPts=null,1===arguments.length){var t=arguments[0];Ze.call(this,Ze.extractCoordinates(t),t.getFactory())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._inputPts=Ke.filterCoordinates(e),this._geomFactory=n}}function Qe(){this._origin=null;var t=arguments[0];this._origin=t}function Je(){this._factory=null,this._interiorPoint=null,this._maxWidth=0;var t=arguments[0];this._factory=t.getFactory(),this.add(t)}function $e(){this._poly=null,this._centreY=null,this._hiY=s.MAX_VALUE,this._loY=-s.MAX_VALUE;var t=arguments[0];this._poly=t,this._hiY=t.getEnvelopeInternal().getMaxY(),this._loY=t.getEnvelopeInternal().getMinY(),this._centreY=Je.avg(this._loY,this._hiY)}function tn(){this._centroid=null,this._minDistance=s.MAX_VALUE,this._interiorPoint=null;var t=arguments[0];this._centroid=t.getCentroid().getCoordinate(),this.addInterior(t),null===this._interiorPoint&&this.addEndpoints(t)}function en(){this._centroid=null,this._minDistance=s.MAX_VALUE,this._interiorPoint=null;var t=arguments[0];this._centroid=t.getCentroid().getCoordinate(),this.add(t)}function nn(){this.selectedSegment=new ge}function rn(){this._items=new P,this._subnode=new Array(2).fill(null)}function sn(){if(this.min=null,this.max=null,0===arguments.length)this.min=0,this.max=0;else if(1===arguments.length){var t=arguments[0];this.init(t.min,t.max)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.init(e,n)}}function on(){}function an(){this._pt=0,this._level=0,this._interval=null;var t=arguments[0];this.computeKey(t)}function un(){rn.apply(this),this._interval=null,this._centre=null,this._level=null;var t=arguments[0],e=arguments[1];this._interval=t,this._level=e,this._centre=(t.getMin()+t.getMax())/2}function ln(){}function hn(){rn.apply(this)}function cn(){this._root=null,this._minExtent=1,this._root=new hn}function fn(){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}function gn(){}function dn(){}function _n(){}function pn(){}function mn(){this._ring=null,this._tree=null,this._crossings=0,this._interval=new sn;var t=arguments[0];this._ring=t,this.buildIndex()}function vn(){nn.apply(this),this.mcp=null,this.p=null;var t=arguments[0],e=arguments[1];this.mcp=t,this.p=e}function yn(){this._input=null,this._extremalPts=null,this._centre=null,this._radius=0;var t=arguments[0];this._input=t}function xn(){if(this._inputGeom=null,this._isConvex=null,this._convexHullPts=null,this._minBaseSeg=new ge,this._minWidthPt=null,this._minPtIndex=null,this._minWidth=0,1===arguments.length){var t=arguments[0];xn.call(this,t,!1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._inputGeom=e,this._isConvex=n}}v(Pe,Le),e(Pe.prototype,{buildExtent:function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},query:function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},interfaces_:function(){return[]},getClass:function(){return Pe}}),e(Oe.prototype,{buildTree:function(){Te.sort(this._leaves,new Le.NodeComparator);for(var t=this._leaves,e=null,n=new P;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},insert:function(t,e,n){if(null!==this._root)throw new IllegalStateException("Index cannot be added to once it has been queried");this._leaves.add(new Re(t,e,n))},query:function(t,e,n){this.init(),this._root.query(t,e,n)},buildRoot:function(){if(null!==this._root)return null;this._root=this.buildTree()},printNode:function(t){Y.out.println(he.toLineString(new E(t._min,this._level),new E(t._max,this._level)))},init:function(){if(null!==this._root)return null;this.buildRoot()},buildLevel:function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var i=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(i);else{var r=new Pe(t.get(n),t.get(n+1));e.add(r)}}},interfaces_:function(){return[]},getClass:function(){return Oe}}),e(be.prototype,{filter:function(t){if(this._isForcedToLineString&&t instanceof Yt){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof At&&this._lines.add(t)},setForceToLineString:function(t){this._isForcedToLineString=t},interfaces_:function(){return[j]},getClass:function(){return be}}),be.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(be.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(be.getLines(e,n))}},be.getLines=function(){if(1===arguments.length){var t=arguments[0];return be.getLines(t,!1)}if(2===arguments.length){if(N(arguments[0],S)&&N(arguments[1],S)){for(var e=arguments[0],n=arguments[1],i=e.iterator();i.hasNext();){var r=i.next();be.getLines(r,n)}return n}if(arguments[0]instanceof K&&"boolean"==typeof arguments[1]){var s=arguments[0],o=arguments[1],a=new P;return s.apply(new be(a,o)),a}if(arguments[0]instanceof K&&N(arguments[1],S)){var u=arguments[0],l=arguments[1];return u instanceof At?l.add(u):u.apply(new be(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&N(arguments[0],S)&&N(arguments[1],S)){var h=arguments[0],c=arguments[1],f=arguments[2];for(i=h.iterator();i.hasNext();){r=i.next();be.getLines(r,c,f)}return c}if("boolean"==typeof arguments[2]&&arguments[0]instanceof K&&N(arguments[1],S)){var g=arguments[0],d=arguments[1],_=arguments[2];return g.apply(new be(d,_)),d}}},e(Me.prototype,{visitItem:function(t){this._items.add(t)},getItems:function(){return this._items},interfaces_:function(){return[Ce]},getClass:function(){return Me}}),e(De.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 r=z.index(t,e,this._p);if(r===z.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(r=-r),r===z.LEFT&&this._crossingCount++}},isPointInPolygon:function(){return this.getLocation()!==de.EXTERIOR},getLocation:function(){return this._isPointOnSegment?de.BOUNDARY:this._crossingCount%2==1?de.INTERIOR:de.EXTERIOR},isOnSegment:function(){return this._isPointOnSegment},interfaces_:function(){return[]},getClass:function(){return De}}),De.locatePointInRing=function(){if(arguments[0]instanceof E&&N(arguments[1],H)){for(var t=arguments[0],e=arguments[1],n=new De(t),i=new E,r=new E,s=1;s<e.size();s++)if(e.getCoordinate(s,i),e.getCoordinate(s-1,r),n.countSegment(i,r),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof E&&arguments[1]instanceof Array){var o=arguments[0],a=arguments[1];for(n=new De(o),s=1;s<a.length;s++){i=a[s],r=a[s-1];if(n.countSegment(i,r),n.isOnSegment())return n.getLocation()}return n.getLocation()}},e(Ae.prototype,{locate:function(t){var e=new De(t),n=new Fe(e);return this._index.query(t.y,t.y,n),e.getLocation()},interfaces_:function(){return[Se]},getClass:function(){return Ae}}),e(Fe.prototype,{visitItem:function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},interfaces_:function(){return[Ce]},getClass:function(){return Fe}}),e(Ge.prototype,{init:function(t){for(var e=be.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},addLine:function(t){for(var e=1;e<t.length;e++){var n=new ge(t[e-1],t[e]),i=Math.min(n.p0.y,n.p1.y),r=Math.max(n.p0.y,n.p1.y);this._index.insert(i,r,n)}},query:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Me;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this._index.query(i,r,s)}},interfaces_:function(){return[]},getClass:function(){return Ge}}),Ae.SegmentVisitor=Fe,Ae.IntervalIndexedGeometry=Ge,e(qe.prototype,{interfaces_:function(){return[]},getClass:function(){return qe}}),qe.isOnLine=function(){if(arguments[0]instanceof E&&N(arguments[1],H)){for(var t=arguments[0],e=arguments[1],n=new fe,i=new E,r=new E,s=e.size(),o=1;o<s;o++)if(e.getCoordinate(o-1,i),e.getCoordinate(o,r),n.computeIntersection(t,i,r),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof E&&arguments[1]instanceof Array){var a=arguments[0],u=arguments[1];for(n=new fe,o=1;o<u.length;o++){i=u[o-1],r=u[o];if(n.computeIntersection(a,i,r),n.hasIntersection())return!0}return!1}},qe.locateInRing=function(t,e){return De.locatePointInRing(t,e)},qe.isInRing=function(t,e){return qe.locateInRing(t,e)!==de.EXTERIOR},e(Be.prototype,{next:function(){if(this._atStart)return this._atStart=!1,Be.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new R;var t=this._parent.getGeometryN(this._index++);return t instanceof Lt?(this._subcollectionIterator=new Be(t),this._subcollectionIterator.next()):t},remove:function(){throw new UnsupportedOperationException(this.getClass().getName())},hasNext:function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},interfaces_:function(){return[C]},getClass:function(){return Be}}),Be.isAtomic=function(t){return!(t instanceof Lt)},e(Ve.prototype,{locate:function(t){return Ve.locate(t,this._geom)},interfaces_:function(){return[Se]},getClass:function(){return Ve}}),Ve.locatePointInPolygon=function(t,e){if(e.isEmpty())return de.EXTERIOR;var n=e.getExteriorRing(),i=Ve.locatePointInRing(t,n);if(i!==de.INTERIOR)return i;for(var r=0;r<e.getNumInteriorRing();r++){var s=e.getInteriorRingN(r),o=Ve.locatePointInRing(t,s);if(o===de.BOUNDARY)return de.BOUNDARY;if(o===de.INTERIOR)return de.EXTERIOR}return de.INTERIOR},Ve.locatePointInRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?qe.locateInRing(t,e.getCoordinates()):de.EXTERIOR},Ve.containsPointInPolygon=function(t,e){return de.EXTERIOR!==Ve.locatePointInPolygon(t,e)},Ve.locateInGeometry=function(t,e){if(e instanceof Vt)return Ve.locatePointInPolygon(t,e);if(e instanceof Lt)for(var n=new Be(e);n.hasNext();){var i=n.next();if(i!==e){var r=Ve.locateInGeometry(t,i);if(r!==de.EXTERIOR)return r}}return de.EXTERIOR},Ve.locate=function(t,e){return e.isEmpty()?de.EXTERIOR:Ve.locateInGeometry(t,e)},e(ze.prototype,{measure:function(t,e){},interfaces_:function(){return[]},getClass:function(){return ze}}),e(Ye.prototype,{measure:function(t,e){return t.intersection(e).getArea()/t.union(e).getArea()},interfaces_:function(){return[ze]},getClass:function(){return Ye}}),e(ke.prototype,{measure:function(t,e){var n=Ee.distance(t,e,ke.DENSIFY_FRACTION),i=new M(t.getEnvelopeInternal());i.expandToInclude(e.getEnvelopeInternal());var r=1-n/ke.diagonalSize(i);return r},interfaces_:function(){return[ze]},getClass:function(){return ke}}),ke.diagonalSize=function(t){if(t.isNull())return 0;var e=t.getWidth(),n=t.getHeight();return Math.sqrt(e*e+n*n)},ke.DENSIFY_FRACTION=.25,e(Ue.prototype,{interfaces_:function(){return[]},getClass:function(){return Ue}}),Ue.combine=function(t,e){return Math.min(t,e)},e(Xe.prototype,{setAreaBasePoint:function(t){this._areaBasePt=t},addPoint:function(t){this._ptCount+=1,this._ptCentSum.x+=t.x,this._ptCentSum.y+=t.y},addLineSegments:function(t){for(var e=0,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);if(0!==i){e+=i;var r=(t[n].x+t[n+1].x)/2;this._lineCentSum.x+=i*r;var s=(t[n].y+t[n+1].y)/2;this._lineCentSum.y+=i*s}}this._totalLength+=e,0===e&&t.length>0&&this.addPoint(t[0])},addHole:function(t){for(var e=z.isCCW(t),n=0;n<t.length-1;n++)this.addTriangle(this._areaBasePt,t[n],t[n+1],e);this.addLineSegments(t)},getCentroid:function(){var t=new E;if(Math.abs(this._areasum2)>0)t.x=this._cg3.x/3/this._areasum2,t.y=this._cg3.y/3/this._areasum2;else if(this._totalLength>0)t.x=this._lineCentSum.x/this._totalLength,t.y=this._lineCentSum.y/this._totalLength;else{if(!(this._ptCount>0))return null;t.x=this._ptCentSum.x/this._ptCount,t.y=this._ptCentSum.y/this._ptCount}return t},addShell:function(t){t.length>0&&this.setAreaBasePoint(t[0]);for(var e=!z.isCCW(t),n=0;n<t.length-1;n++)this.addTriangle(this._areaBasePt,t[n],t[n+1],e);this.addLineSegments(t)},addTriangle:function(t,e,n,i){var r=i?1:-1;Xe.centroid3(t,e,n,this._triangleCent3);var s=Xe.area2(t,e,n);this._cg3.x+=r*s*this._triangleCent3.x,this._cg3.y+=r*s*this._triangleCent3.y,this._areasum2+=r*s},add:function(){if(arguments[0]instanceof Vt){var t=arguments[0];this.addShell(t.getExteriorRing().getCoordinates());for(var e=0;e<t.getNumInteriorRing();e++)this.addHole(t.getInteriorRingN(e).getCoordinates())}else if(arguments[0]instanceof K){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Gt)this.addPoint(n.getCoordinate());else if(n instanceof At)this.addLineSegments(n.getCoordinates());else if(n instanceof Vt){var i=n;this.add(i)}else if(n instanceof Lt){var r=n;for(e=0;e<r.getNumGeometries();e++)this.add(r.getGeometryN(e))}}},interfaces_:function(){return[]},getClass:function(){return Xe}}),Xe.area2=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)},Xe.centroid3=function(t,e,n,i){return i.x=t.x+e.x+n.x,i.y=t.y+e.y+n.y,null},Xe.getCentroid=function(t){return new Xe(t).getCentroid()},e(He.prototype,{interfaces_:function(){return[]},getClass:function(){return He}}),He.orientationIndex=function(t,e,n){return V.orientationIndex(t,e,n)},He.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 r=t[i].x-n,s=t[i+1].y;e+=r*(t[i-1].y-s)}return e/2}if(N(arguments[0],H)){var o=arguments[0],a=o.size();if(a<3)return 0;var u=new E,l=new E,h=new E;o.getCoordinate(0,l),o.getCoordinate(1,h);n=l.x;h.x-=n;for(e=0,i=1;i<a-1;i++)u.y=l.y,l.x=h.x,l.y=h.y,o.getCoordinate(i+1,h),h.x-=n,e+=l.x*(u.y-h.y);return e/2}},He.distanceLineLine=function(t,e,n,i){if(t.equals(e))return He.distancePointLine(t,n,i);if(n.equals(i))return He.distancePointLine(i,t,e);var r=!1;if(M.intersects(t,e,n,i)){var s=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(0===s)r=!0;else{var o=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/s,u=o/s;(u<0||u>1||a<0||a>1)&&(r=!0)}}else r=!0;return r?U.min(He.distancePointLine(t,n,i),He.distancePointLine(e,n,i),He.distancePointLine(n,t,e),He.distancePointLine(i,t,e)):0},He.isPointInRing=function(t,e){return He.locatePointInRing(t,e)!==de.EXTERIOR},He.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new E;t.getCoordinate(0,i);for(var r=i.x,s=i.y,o=1;o<e;o++){t.getCoordinate(o,i);var a=i.x,u=i.y,l=a-r,h=u-s;n+=Math.sqrt(l*l+h*h),r=a,s=u}return n},He.isCCW=function(t){var e=t.length-1;if(e<3)throw new i("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,s=1;s<=e;s++){var o=t[s];o.y>n.y&&(n=o,r=s)}var a=r;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(n)&&a!==r);var u=r;do{u=(u+1)%e}while(t[u].equals2D(n)&&u!==r);var l=t[a],h=t[u];if(l.equals2D(n)||h.equals2D(n)||l.equals2D(h))return!1;var c=He.computeOrientation(l,n,h);return 0===c?l.x>h.x:c>0},He.locatePointInRing=function(t,e){return De.locatePointInRing(t,e)},He.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),r=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(r)*Math.sqrt(i)},He.computeOrientation=function(t,e,n){return He.orientationIndex(t,e,n)},He.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new i("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var s=He.distancePointLine(t,e[r],e[r+1]);s<n&&(n=s)}return n}if(3===arguments.length){var o=arguments[0],a=arguments[1],u=arguments[2];if(a.x===u.x&&a.y===u.y)return o.distance(a);var l=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),h=((o.x-a.x)*(u.x-a.x)+(o.y-a.y)*(u.y-a.y))/l;if(h<=0)return o.distance(a);if(h>=1)return o.distance(u);var c=((a.y-o.y)*(u.x-a.x)-(a.x-o.x)*(u.y-a.y))/l;return Math.abs(c)*Math.sqrt(l)}},He.isOnLine=function(t,e){for(var n=new fe,i=1;i<e.length;i++){var r=e[i-1],s=e[i];if(n.computeIntersection(t,r,s),n.hasIntersection())return!0}return!1},He.CLOCKWISE=-1,He.RIGHT=He.CLOCKWISE,He.COUNTERCLOCKWISE=1,He.LEFT=He.COUNTERCLOCKWISE,He.COLLINEAR=0,He.STRAIGHT=He.COLLINEAR,We.prototype=new Error,We.prototype.name="EmptyStackException",je.prototype=new w,je.prototype.add=function(t){return this.array_.push(t),!0},je.prototype.get=function(t){if(t<0||t>=this.size())throw new IndexOutOfBoundsException;return this.array_[t]},je.prototype.push=function(t){return this.array_.push(t),t},je.prototype.pop=function(t){if(0===this.array_.length)throw new We;return this.array_.pop()},je.prototype.peek=function(){if(0===this.array_.length)throw new We;return this.array_[this.array_.length-1]},je.prototype.empty=function(){return 0===this.array_.length},je.prototype.isEmpty=function(){return this.empty()},je.prototype.search=function(t){return this.array_.indexOf(t)},je.prototype.size=function(){return this.array_.length},je.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e(Ke.prototype,{filter:function(t){this.treeSet.contains(t)||(this.list.add(t),this.treeSet.add(t))},getCoordinates:function(){var t=new Array(this.list.size()).fill(null);return this.list.toArray(t)},interfaces_:function(){return[Z]},getClass:function(){return Ke}}),Ke.filterCoordinates=function(t){for(var e=new Ke,n=0;n<t.length;n++)e.filter(t[n]);return e.getCoordinates()},e(Ze.prototype,{preSort:function(t){for(var e=null,n=1;n<t.length;n++)(t[n].y<t[0].y||t[n].y===t[0].y&&t[n].x<t[0].x)&&(e=t[0],t[0]=t[n],t[n]=e);return It.sort(t,1,t.length,new Qe(t[0])),t},computeOctRing:function(t){var e=this.computeOctPts(t),n=new b;return n.add(e,!1),n.size()<3?null:(n.closeRing(),n.toCoordinateArray())},lineOrPolygon:function(t){if(3===(t=this.cleanRing(t)).length)return this._geomFactory.createLineString([t[0],t[1]]);var e=this._geomFactory.createLinearRing(t);return this._geomFactory.createPolygon(e)},cleanRing:function(t){x.equals(t[0],t[t.length-1]);for(var e=new P,n=null,i=0;i<=t.length-2;i++){var r=t[i],s=t[i+1];r.equals(s)||(null!==n&&this.isBetween(n,r,s)||(e.add(r),n=r))}e.add(t[t.length-1]);var o=new Array(e.size()).fill(null);return e.toArray(o)},isBetween:function(t,e,n){if(0!==z.index(t,e,n))return!1;if(t.x!==n.x){if(t.x<=e.x&&e.x<=n.x)return!0;if(n.x<=e.x&&e.x<=t.x)return!0}if(t.y!==n.y){if(t.y<=e.y&&e.y<=n.y)return!0;if(n.y<=e.y&&e.y<=t.y)return!0}return!1},reduce:function(t){var e=this.computeOctRing(t);if(null===e)return t;for(var n=new yt,i=0;i<e.length;i++)n.add(e[i]);for(i=0;i<t.length;i++)qe.isInRing(t[i],e)||n.add(t[i]);var r=nt.toCoordinateArray(n);return r.length<3?this.padArray3(r):r},getConvexHull:function(){if(0===this._inputPts.length)return this._geomFactory.createGeometryCollection();if(1===this._inputPts.length)return this._geomFactory.createPoint(this._inputPts[0]);if(2===this._inputPts.length)return this._geomFactory.createLineString(this._inputPts);var t=this._inputPts;this._inputPts.length>50&&(t=this.reduce(this._inputPts));var e=this.preSort(t),n=this.grahamScan(e),i=this.toCoordinateArray(n);return this.lineOrPolygon(i)},padArray3:function(t){for(var e=new Array(3).fill(null),n=0;n<e.length;n++)n<t.length?e[n]=t[n]:e[n]=t[0];return e},computeOctPts:function(t){for(var e=new Array(8).fill(null),n=0;n<e.length;n++)e[n]=t[0];for(var i=1;i<t.length;i++)t[i].x<e[0].x&&(e[0]=t[i]),t[i].x-t[i].y<e[1].x-e[1].y&&(e[1]=t[i]),t[i].y>e[2].y&&(e[2]=t[i]),t[i].x+t[i].y>e[3].x+e[3].y&&(e[3]=t[i]),t[i].x>e[4].x&&(e[4]=t[i]),t[i].x-t[i].y>e[5].x-e[5].y&&(e[5]=t[i]),t[i].y<e[6].y&&(e[6]=t[i]),t[i].x+t[i].y<e[7].x+e[7].y&&(e[7]=t[i]);return e},toCoordinateArray:function(t){for(var e=new Array(t.size()).fill(null),n=0;n<t.size();n++){var i=t.get(n);e[n]=i}return e},grahamScan:function(t){var e=null,n=new je;n.push(t[0]),n.push(t[1]),n.push(t[2]);for(var i=3;i<t.length;i++){for(e=n.pop();!n.empty()&&z.index(n.peek(),e,t[i])>0;)e=n.pop();n.push(e),n.push(t[i])}return n.push(t[0]),n},interfaces_:function(){return[]},getClass:function(){return Ze}}),Ze.extractCoordinates=function(t){var e=new Ke;return t.apply(e),e.getCoordinates()},e(Qe.prototype,{compare:function(t,e){var n=t,i=e;return Qe.polarCompare(this._origin,n,i)},interfaces_:function(){return[_]},getClass:function(){return Qe}}),Qe.polarCompare=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=n.x-t.x,o=n.y-t.y,a=z.index(t,e,n);if(a===z.COUNTERCLOCKWISE)return 1;if(a===z.CLOCKWISE)return-1;var u=i*i+r*r,l=s*s+o*o;return u<l?-1:u>l?1:0},Ze.RadialComparator=Qe,e(Je.prototype,{addPolygon:function(t){if(t.isEmpty())return null;var e=null,n=null,i=this.horizontalBisector(t);if(0===i.getLength())n=0,e=i.getCoordinate();else{var r=i.intersection(t),s=this.widestGeometry(r);n=s.getEnvelopeInternal().getWidth(),e=Je.centre(s.getEnvelopeInternal())}(null===this._interiorPoint||n>this._maxWidth)&&(this._interiorPoint=e,this._maxWidth=n)},getInteriorPoint:function(){return this._interiorPoint},widestGeometry:function(){if(arguments[0]instanceof Lt){var t=arguments[0];if(t.isEmpty())return t;for(var e=t.getGeometryN(0),n=1;n<t.getNumGeometries();n++)t.getGeometryN(n).getEnvelopeInternal().getWidth()>e.getEnvelopeInternal().getWidth()&&(e=t.getGeometryN(n));return e}if(arguments[0]instanceof K){var i=arguments[0];return i instanceof Lt?this.widestGeometry(i):i}},horizontalBisector:function(t){var e=t.getEnvelopeInternal(),n=$e.getBisectorY(t);return this._factory.createLineString([new E(e.getMinX(),n),new E(e.getMaxX(),n)])},add:function(t){if(t instanceof Vt)this.addPolygon(t);else if(t instanceof Lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.add(e.getGeometryN(n))},interfaces_:function(){return[]},getClass:function(){return Je}}),Je.centre=function(t){return new E(Je.avg(t.getMinX(),t.getMaxX()),Je.avg(t.getMinY(),t.getMaxY()))},Je.avg=function(t,e){return(t+e)/2},e($e.prototype,{updateInterval:function(t){t<=this._centreY?t>this._loY&&(this._loY=t):t>this._centreY&&t<this._hiY&&(this._hiY=t)},getBisectorY:function(){this.process(this._poly.getExteriorRing());for(var t=0;t<this._poly.getNumInteriorRing();t++)this.process(this._poly.getInteriorRingN(t));return Je.avg(this._hiY,this._loY)},process:function(t){for(var e=t.getCoordinateSequence(),n=0;n<e.size();n++){var i=e.getY(n);this.updateInterval(i)}},interfaces_:function(){return[]},getClass:function(){return $e}}),$e.getBisectorY=function(t){return new $e(t).getBisectorY()},Je.SafeBisectorFinder=$e,e(tn.prototype,{addEndpoints:function(){if(arguments[0]instanceof K){var t=arguments[0];if(t instanceof At)this.addEndpoints(t.getCoordinates());else if(t instanceof Lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.addEndpoints(e.getGeometryN(n))}else if(arguments[0]instanceof Array){var i=arguments[0];this.add(i[0]),this.add(i[i.length-1])}},getInteriorPoint:function(){return this._interiorPoint},addInterior:function(){if(arguments[0]instanceof K){var t=arguments[0];if(t instanceof At)this.addInterior(t.getCoordinates());else if(t instanceof Lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.addInterior(e.getGeometryN(n))}else if(arguments[0]instanceof Array){var i=arguments[0];for(n=1;n<i.length-1;n++)this.add(i[n])}},add:function(t){var e=t.distance(this._centroid);e<this._minDistance&&(this._interiorPoint=new E(t),this._minDistance=e)},interfaces_:function(){return[]},getClass:function(){return tn}}),e(en.prototype,{getInteriorPoint:function(){return this._interiorPoint},add:function(){if(arguments[0]instanceof K){var t=arguments[0];if(t instanceof Gt)this.add(t.getCoordinate());else if(t instanceof Lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.add(e.getGeometryN(n))}else if(arguments[0]instanceof E){var i=arguments[0],r=i.distance(this._centroid);r<this._minDistance&&(this._interiorPoint=new E(i),this._minDistance=r)}},interfaces_:function(){return[]},getClass:function(){return en}}),e(nn.prototype,{select:function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},interfaces_:function(){return[]},getClass:function(){return nn}}),e(rn.prototype,{hasChildren:function(){for(var t=0;t<2;t++)if(null!==this._subnode[t])return!0;return!1},isPrunable:function(){return!(this.hasChildren()||this.hasItems())},addAllItems:function(t){t.addAll(this._items);for(var e=0;e<2;e++)null!==this._subnode[e]&&this._subnode[e].addAllItems(t);return t},size:function(){for(var t=0,e=0;e<2;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+this._items.size()},addAllItemsFromOverlapping:function(t,e){if(null!==t&&!this.isSearchMatch(t))return null;e.addAll(this._items),null!==this._subnode[0]&&this._subnode[0].addAllItemsFromOverlapping(t,e),null!==this._subnode[1]&&this._subnode[1].addAllItemsFromOverlapping(t,e)},hasItems:function(){return!this._items.isEmpty()},remove:function(t,e){if(!this.isSearchMatch(t))return!1;for(var n=!1,i=0;i<2;i++)if(null!==this._subnode[i]&&(n=this._subnode[i].remove(t,e))){this._subnode[i].isPrunable()&&(this._subnode[i]=null);break}return n||(n=this._items.remove(e))},getItems:function(){return this._items},depth:function(){for(var t=0,e=0;e<2;e++)if(null!==this._subnode[e]){var n=this._subnode[e].depth();n>t&&(t=n)}return t+1},nodeSize:function(){for(var t=0,e=0;e<2;e++)null!==this._subnode[e]&&(t+=this._subnode[e].nodeSize());return t+1},add:function(t){this._items.add(t)},interfaces_:function(){return[]},getClass:function(){return rn}}),rn.getSubnodeIndex=function(t,e){var n=-1;return t.min>=e&&(n=1),t.max<=e&&(n=0),n},e(sn.prototype,{expandToInclude:function(t){t.max>this.max&&(this.max=t.max),t.min<this.min&&(this.min=t.min)},getWidth:function(){return this.max-this.min},overlaps:function(){if(1===arguments.length){var t=arguments[0];return this.overlaps(t.min,t.max)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!(this.min>n||this.max<e)}},getMin:function(){return this.min},toString:function(){return"["+this.min+", "+this.max+"]"},contains:function(){if(1===arguments.length){if(arguments[0]instanceof sn){var t=arguments[0];return this.contains(t.min,t.max)}if("number"==typeof arguments[0]){var e=arguments[0];return e>=this.min&&e<=this.max}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return n>=this.min&&i<=this.max}},init:function(t,e){this.min=t,this.max=e,t>e&&(this.min=e,this.max=t)},getMax:function(){return this.max},interfaces_:function(){return[]},getClass:function(){return sn}}),on.exponent=function(t){return function(t,e){var n,i,r,s,o={32:8,64:11}[t];s||(n=e<0||1/e<0,isFinite(e)||(s={32:{d:127,c:128,b:0,a:0},64:{d:32752,c:0,b:0,a:0}}[t],n&&(s.d+=1<<t/4-1),i=Math.pow(2,o)-1,r=0));if(!s){for(i={32:127,64:1023}[t],r=Math.abs(e);r>=2;)i++,r/=2;for(;r<1&&i>0;)i--,r*=2;i<=0&&(r/=2),32===t&&i>254&&(s={d:n?255:127,c:128,b:0,a:0},i=Math.pow(2,o)-1,r=0)}return i}(64,t)-1023},on.powerOf2=function(t){return Math.pow(2,t)},e(an.prototype,{getInterval:function(){return this._interval},getLevel:function(){return this._level},computeKey:function(t){for(this._level=an.computeLevel(t),this._interval=new sn,this.computeInterval(this._level,t);!this._interval.contains(t);)this._level+=1,this.computeInterval(this._level,t)},computeInterval:function(t,e){var n=on.powerOf2(t);this._pt=Math.floor(e.getMin()/n)*n,this._interval.init(this._pt,this._pt+n)},getPoint:function(){return this._pt},interfaces_:function(){return[]},getClass:function(){return an}}),an.computeLevel=function(t){var e=t.getWidth();return on.exponent(e)+1},v(un,rn),e(un.prototype,{getInterval:function(){return this._interval},find:function(t){var e=rn.getSubnodeIndex(t,this._centre);return-1===e?this:null!==this._subnode[e]?this._subnode[e].find(t):this},insert:function(t){x.isTrue(null===this._interval||this._interval.contains(t._interval));var e=rn.getSubnodeIndex(t._interval,this._centre);if(t._level===this._level-1)this._subnode[e]=t;else{var n=this.createSubnode(e);n.insert(t),this._subnode[e]=n}},isSearchMatch:function(t){return t.overlaps(this._interval)},getSubnode:function(t){return null===this._subnode[t]&&(this._subnode[t]=this.createSubnode(t)),this._subnode[t]},getNode:function(t){var e=rn.getSubnodeIndex(t,this._centre);return-1!==e?this.getSubnode(e).getNode(t):this},createSubnode:function(t){var e=0,n=0;switch(t){case 0:e=this._interval.getMin(),n=this._centre;break;case 1:e=this._centre,n=this._interval.getMax()}return new un(new sn(e,n),this._level-1)},interfaces_:function(){return[]},getClass:function(){return un}}),un.createNode=function(t){var e=new an(t);return new un(e.getInterval(),e.getLevel())},un.createExpanded=function(t,e){var n=new sn(e);null!==t&&n.expandToInclude(t._interval);var i=un.createNode(n);return null!==t&&i.insert(t),i},e(ln.prototype,{interfaces_:function(){return[]},getClass:function(){return ln}}),ln.isZeroWidth=function(t,e){var n=e-t;if(0===n)return!0;var i=n/Math.max(Math.abs(t),Math.abs(e));return on.exponent(i)<=ln.MIN_BINARY_EXPONENT},ln.MIN_BINARY_EXPONENT=-50,v(hn,rn),e(hn.prototype,{insert:function(t,e){var n=rn.getSubnodeIndex(t,hn.origin);if(-1===n)return this.add(e),null;var i=this._subnode[n];if(null===i||!i.getInterval().contains(t)){var r=un.createExpanded(i,t);this._subnode[n]=r}this.insertContained(this._subnode[n],t,e)},isSearchMatch:function(t){return!0},insertContained:function(t,e,n){x.isTrue(t.getInterval().contains(e));(ln.isZeroWidth(e.getMin(),e.getMax())?t.find(e):t.getNode(e)).add(n)},interfaces_:function(){return[]},getClass:function(){return hn}}),hn.origin=0,e(cn.prototype,{size:function(){return null!==this._root?this._root.size():0},insert:function(t,e){this.collectStats(t);var n=cn.ensureExtent(t,this._minExtent);this._root.insert(n,e)},query:function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];return this.query(new sn(t,t))}if(arguments[0]instanceof sn){var e=arguments[0],n=new P;return this.query(e,n),n}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this._root.addAllItemsFromOverlapping(i,r)}},iterator:function(){var t=new P;return this._root.addAllItems(t),t.iterator()},remove:function(t,e){var n=cn.ensureExtent(t,this._minExtent);return this._root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e<this._minExtent&&e>0&&(this._minExtent=e)},depth:function(){return null!==this._root?this._root.depth():0},nodeSize:function(){return null!==this._root?this._root.nodeSize():0},interfaces_:function(){return[]},getClass:function(){return cn}}),cn.ensureExtent=function(t,e){var n=t.getMin(),i=t.getMax();return n!==i?t:(n===i&&(i=(n-=e/2)+e/2),new sn(n,i))},e(fn.prototype,{getLineSegment:function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},computeSelect:function(t,e,n,i){var r=this._pts[e],s=this._pts[n];if(n-e==1)return i.select(this,e),null;if(!t.intersects(r,s))return null;var o=Math.trunc((e+n)/2);e<o&&this.computeSelect(t,e,o,i),o<n&&this.computeSelect(t,o,n,i)},getCoordinates:function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},computeOverlaps:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.computeOverlaps(this._start,this._end,t,t._start,t._end,e)}else if(6===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3],o=arguments[4],a=arguments[5];if(i-n==1&&o-s==1)return a.overlap(this,n,r,s),null;if(!this.overlaps(n,i,r,s,o))return null;var u=Math.trunc((n+i)/2),l=Math.trunc((s+o)/2);n<u&&(s<l&&this.computeOverlaps(n,u,r,s,l,a),l<o&&this.computeOverlaps(n,u,r,l,o,a)),u<i&&(s<l&&this.computeOverlaps(u,i,r,s,l,a),l<o&&this.computeOverlaps(u,i,r,l,o,a))}},setId:function(t){this._id=t},select:function(t,e){this.computeSelect(t,this._start,this._end,e)},getEnvelope:function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new M(t,e)}return this._env},overlaps:function(t,e,n,i,r){return M.intersects(this._pts[t],this._pts[e],n._pts[i],n._pts[r])},getEndIndex:function(){return this._end},getStartIndex:function(){return this._start},getContext:function(){return this._context},getId:function(){return this._id},interfaces_:function(){return[]},getClass:function(){return fn}}),e(gn.prototype,{interfaces_:function(){return[]},getClass:function(){return gn}}),gn.isNorthern=function(t){return t===gn.NE||t===gn.NW},gn.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},gn.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},gn.isInHalfPlane=function(t,e){return e===gn.SE?t===gn.SE||t===gn.SW:t===e||t===e+1},gn.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new i("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?gn.NE:gn.SE:e>=0?gn.NW:gn.SW}if(arguments[0]instanceof E&&arguments[1]instanceof E){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new i("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?gn.NE:gn.SE:r.y>=n.y?gn.NW:gn.SW}},gn.NE=0,gn.NW=1,gn.SW=2,gn.SE=3,e(dn.prototype,{interfaces_:function(){return[]},getClass:function(){return dn}}),dn.getChainStartIndices=function(t){var e=0,n=new P;n.add(new G(e));do{var i=dn.findChainEnd(t,e);n.add(new G(i)),e=i}while(e<t.length-1);return dn.toIntArray(n)},dn.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=gn.quadrant(t[n],t[n+1]),r=e+1;r<t.length;){if(!t[r-1].equals2D(t[r]))if(gn.quadrant(t[r-1],t[r])!==i)break;r++}return r-1},dn.getChains=function(){if(1===arguments.length){var t=arguments[0];return dn.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],i=new P,r=dn.getChainStartIndices(e),s=0;s<r.length-1;s++){var o=new fn(e,r[s],r[s+1],n);i.add(o)}return i}},dn.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},e(_n.prototype,{interfaces_:function(){return[]},getClass:function(){return _n}}),_n.orientationIndex=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=n.x-e.x,o=n.y-e.y;return _n.signOfDet2x2(i,r,s,o)},_n.signOfDet2x2=function(t,e,n,i){var r=null,s=null,o=null;if(r=1,0===t||0===i)return 0===e||0===n?0:e>0?n>0?-r:r:n>0?r:-r;if(0===e||0===n)return i>0?t>0?r:-r:t>0?-r:r;if(0<e?0<i?e<=i||(r=-r,s=t,t=n,n=s,s=e,e=i,i=s):e<=-i?(r=-r,n=-n,i=-i):(s=t,t=-n,n=s,s=e,e=-i,i=s):0<i?-e<=i?(r=-r,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):(r=-r,s=-t,t=-n,n=s,s=-e,e=-i,i=s),0<t){if(!(0<n))return r;if(!(t<=n))return r}else{if(0<n)return-r;if(!(t>=n))return-r;r=-r,t=-t,n=-n}for(;;){if(n-=(o=Math.floor(n/t))*t,(i-=o*e)<0)return-r;if(i>e)return r;if(t>n+n){if(e<i+i)return r}else{if(e>i+i)return-r;n=t-n,i=e-i,r=-r}if(0===i)return 0===n?0:-r;if(0===n)return r;if(t-=(o=Math.floor(t/n))*n,(e-=o*i)<0)return r;if(e>i)return-r;if(n>t+t){if(i<e+e)return-r}else{if(i>e+e)return r;t=n-t,e=i-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}},e(pn.prototype,{isInside:function(t){},interfaces_:function(){return[]},getClass:function(){return pn}}),e(mn.prototype,{testLineSegment:function(t,e){var n,i,r,s,o=e.p0,a=e.p1;n=o.x-t.x,i=o.y-t.y,r=a.x-t.x,s=a.y-t.y,(i>0&&s<=0||s>0&&i<=0)&&0<_n.signOfDet2x2(n,i,r,s)/(s-i)&&this._crossings++},buildIndex:function(){this._tree=new cn;for(var t=nt.removeRepeatedPoints(this._ring.getCoordinates()),e=dn.getChains(t),n=0;n<e.size();n++){var i=e.get(n),r=i.getEnvelope();this._interval.min=r.getMinY(),this._interval.max=r.getMaxY(),this._tree.insert(this._interval,i)}},testMonotoneChain:function(t,e,n){n.select(t,e)},isInside:function(t){this._crossings=0;var e=new M(s.NEGATIVE_INFINITY,s.POSITIVE_INFINITY,t.y,t.y);this._interval.min=t.y,this._interval.max=t.y;for(var n=this._tree.query(this._interval),i=new vn(this,t),r=n.iterator();r.hasNext();){var o=r.next();this.testMonotoneChain(e,i,o)}return this._crossings%2==1},interfaces_:function(){return[pn]},getClass:function(){return mn}}),v(vn,nn),e(vn.prototype,{select:function(){if(1!==arguments.length)return nn.prototype.select.apply(this,arguments);var t=arguments[0];this.mcp.testLineSegment(this.p,t)},interfaces_:function(){return[]},getClass:function(){return vn}}),mn.MCSelecter=vn,e(yn.prototype,{getRadius:function(){return this.compute(),this._radius},getDiameter:function(){switch(this.compute(),this._extremalPts.length){case 0:return this._input.getFactory().createLineString();case 1:return this._input.getFactory().createPoint(this._centre)}var t=this._extremalPts[0],e=this._extremalPts[1];return this._input.getFactory().createLineString([t,e])},getExtremalPoints:function(){return this.compute(),this._extremalPts},computeCirclePoints:function(){if(this._input.isEmpty())return this._extremalPts=new Array(0).fill(null),null;if(1===this._input.getNumPoints()){var t=this._input.getCoordinates();return this._extremalPts=[new E(t[0])],null}var e=this._input.convexHull().getCoordinates();t=e;if(e[0].equals2D(e[e.length-1])&&(t=new Array(e.length-1).fill(null),nt.copyDeep(e,0,t,0,e.length-1)),t.length<=2)return this._extremalPts=nt.copyDeep(t),null;for(var n=yn.lowestPoint(t),i=yn.pointWitMinAngleWithX(t,n),r=0;r<t.length;r++){var s=yn.pointWithMinAngleWithSegment(t,n,i);if(pe.isObtuse(n,s,i))return this._extremalPts=[new E(n),new E(i)],null;if(pe.isObtuse(s,n,i))n=s;else{if(!pe.isObtuse(s,i,n))return this._extremalPts=[new E(n),new E(i),new E(s)],null;i=s}}x.shouldNeverReachHere("Logic failure in Minimum Bounding Circle algorithm!")},compute:function(){if(null!==this._extremalPts)return null;this.computeCirclePoints(),this.computeCentre(),null!==this._centre&&(this._radius=this._centre.distance(this._extremalPts[0]))},getFarthestPoints:function(){switch(this.compute(),this._extremalPts.length){case 0:return this._input.getFactory().createLineString();case 1:return this._input.getFactory().createPoint(this._centre)}var t=this._extremalPts[0],e=this._extremalPts[this._extremalPts.length-1];return this._input.getFactory().createLineString([t,e])},getCircle:function(){if(this.compute(),null===this._centre)return this._input.getFactory().createPolygon();var t=this._input.getFactory().createPoint(this._centre);return 0===this._radius?t:t.buffer(this._radius)},getCentre:function(){return this.compute(),this._centre},computeCentre:function(){switch(this._extremalPts.length){case 0:this._centre=null;break;case 1:this._centre=this._extremalPts[0];break;case 2:this._centre=new E((this._extremalPts[0].x+this._extremalPts[1].x)/2,(this._extremalPts[0].y+this._extremalPts[1].y)/2);break;case 3:this._centre=me.circumcentre(this._extremalPts[0],this._extremalPts[1],this._extremalPts[2])}},interfaces_:function(){return[]},getClass:function(){return yn}}),yn.pointWitMinAngleWithX=function(t,e){for(var n=s.MAX_VALUE,i=null,r=0;r<t.length;r++){var o=t[r];if(o!==e){var a=o.x-e.x,u=o.y-e.y;u<0&&(u=-u);var l=u/Math.sqrt(a*a+u*u);l<n&&(n=l,i=o)}}return i},yn.lowestPoint=function(t){for(var e=t[0],n=1;n<t.length;n++)t[n].y<e.y&&(e=t[n]);return e},yn.pointWithMinAngleWithSegment=function(t,e,n){for(var i=s.MAX_VALUE,r=null,o=0;o<t.length;o++){var a=t[o];if(a!==e&&a!==n){var u=pe.angleBetween(e,a,n);u<i&&(i=u,r=a)}}return r},e(xn.prototype,{getWidthCoordinate:function(){return this.computeMinimumDiameter(),this._minWidthPt},getSupportingSegment:function(){return this.computeMinimumDiameter(),this._inputGeom.getFactory().createLineString([this._minBaseSeg.p0,this._minBaseSeg.p1])},getDiameter:function(){if(this.computeMinimumDiameter(),null===this._minWidthPt)return this._inputGeom.getFactory().createLineString();var t=this._minBaseSeg.project(this._minWidthPt);return this._inputGeom.getFactory().createLineString([t,this._minWidthPt])},computeWidthConvex:function(t){this._convexHullPts=t instanceof Vt?t.getExteriorRing().getCoordinates():t.getCoordinates(),0===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=null,this._minBaseSeg=null):1===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[0]):2===this._convexHullPts.length||3===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[1]):this.computeConvexRingMinDiameter(this._convexHullPts)},computeConvexRingMinDiameter:function(t){this._minWidth=s.MAX_VALUE;for(var e=1,n=new ge,i=0;i<t.length-1;i++)n.p0=t[i],n.p1=t[i+1],e=this.findMaxPerpDistance(t,n,e)},computeMinimumDiameter:function(){if(null!==this._minWidthPt)return null;if(this._isConvex)this.computeWidthConvex(this._inputGeom);else{var t=new Ze(this._inputGeom).getConvexHull();this.computeWidthConvex(t)}},getLength:function(){return this.computeMinimumDiameter(),this._minWidth},findMaxPerpDistance:function(t,e,n){for(var i=e.distancePerpendicular(t[n]),r=i,s=n,o=s;r>=i;)i=r,s=o,o=xn.nextIndex(t,s),r=e.distancePerpendicular(t[o]);return i<this._minWidth&&(this._minPtIndex=s,this._minWidth=i,this._minWidthPt=t[this._minPtIndex],this._minBaseSeg=new ge(e)),s},getMinimumRectangle:function(){if(this.computeMinimumDiameter(),0===this._minWidth)return this._minBaseSeg.p0.equals2D(this._minBaseSeg.p1)?this._inputGeom.getFactory().createPoint(this._minBaseSeg.p0):this._minBaseSeg.toGeometry(this._inputGeom.getFactory());for(var t=this._minBaseSeg.p1.x-this._minBaseSeg.p0.x,e=this._minBaseSeg.p1.y-this._minBaseSeg.p0.y,n=s.MAX_VALUE,i=-s.MAX_VALUE,r=s.MAX_VALUE,o=-s.MAX_VALUE,a=0;a<this._convexHullPts.length;a++){var u=xn.computeC(t,e,this._convexHullPts[a]);u>i&&(i=u),u<n&&(n=u);var l=xn.computeC(-e,t,this._convexHullPts[a]);l>o&&(o=l),l<r&&(r=l)}var h=xn.computeSegmentForLine(-t,-e,o),c=xn.computeSegmentForLine(-t,-e,r),f=xn.computeSegmentForLine(-e,t,i),g=xn.computeSegmentForLine(-e,t,n),d=f.lineIntersection(h),_=g.lineIntersection(h),p=g.lineIntersection(c),m=f.lineIntersection(c),v=this._inputGeom.getFactory().createLinearRing([d,_,p,m,d]);return this._inputGeom.getFactory().createPolygon(v)},interfaces_:function(){return[]},getClass:function(){return xn}}),xn.nextIndex=function(t,e){return++e>=t.length&&(e=0),e},xn.computeC=function(t,e,n){return t*n.y-e*n.x},xn.getMinimumDiameter=function(t){return new xn(t).getDiameter()},xn.getMinimumRectangle=function(t){return new xn(t).getMinimumRectangle()},xn.computeSegmentForLine=function(t,e,n){var i=null,r=null;return Math.abs(e)>Math.abs(t)?(i=new E(0,n/e),r=new E(1,n/e-t/e)):(i=new E(n/t,0),r=new E(n/t-e/t,1)),new ge(i,r)};var En=Object.freeze({Angle:pe,Centroid:Xe,CGAlgorithms:He,ConvexHull:Ze,Distance:X,InteriorPointArea:Je,InteriorPointLine:tn,InteriorPointPoint:en,RobustLineIntersector:fe,MCPointInRing:mn,MinimumBoundingCircle:yn,MinimumDiameter:xn});function In(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}function Nn(){this._inputGeom=null,this._distanceTolerance=null;var t=arguments[0];this._inputGeom=t}function Cn(){In.apply(this),this.distanceTolerance=null;var t=arguments[0];this.distanceTolerance=t}e(In.prototype,{transformPoint:function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},transformPolygon:function(t,e){var n=!0,i=this.transformLinearRing(t.getExteriorRing(),t);null!==i&&i instanceof Yt&&!i.isEmpty()||(n=!1);for(var r=new P,s=0;s<t.getNumInteriorRing();s++){var o=this.transformLinearRing(t.getInteriorRingN(s),t);null===o||o.isEmpty()||(o instanceof Yt||(n=!1),r.add(o))}if(n)return this._factory.createPolygon(i,r.toArray([]));var a=new P;return null!==i&&a.add(i),a.addAll(r),this._factory.buildGeometry(a)},createCoordinateSequence:function(t){return this._factory.getCoordinateSequenceFactory().create(t)},getInputGeometry:function(){return this._inputGeom},transformMultiLineString:function(t,e){for(var n=new P,i=0;i<t.getNumGeometries();i++){var r=this.transformLineString(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this._factory.buildGeometry(n)},transformCoordinates:function(t,e){return this.copy(t)},transformLineString:function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},transformMultiPoint:function(t,e){for(var n=new P,i=0;i<t.getNumGeometries();i++){var r=this.transformPoint(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this._factory.buildGeometry(n)},transformMultiPolygon:function(t,e){for(var n=new P,i=0;i<t.getNumGeometries();i++){var r=this.transformPolygon(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this._factory.buildGeometry(n)},copy:function(t){return t.copy()},transformGeometryCollection:function(t,e){for(var n=new P,i=0;i<t.getNumGeometries();i++){var r=this.transform(t.getGeometryN(i));null!==r&&(this._pruneEmptyGeometry&&r.isEmpty()||n.add(r))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(se.toGeometryArray(n)):this._factory.buildGeometry(n)},transform:function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Gt)return this.transformPoint(t,null);if(t instanceof zt)return this.transformMultiPoint(t,null);if(t instanceof Yt)return this.transformLinearRing(t,null);if(t instanceof At)return this.transformLineString(t,null);if(t instanceof wt)return this.transformMultiLineString(t,null);if(t instanceof Vt)return this.transformPolygon(t,null);if(t instanceof kt)return this.transformMultiPolygon(t,null);if(t instanceof Lt)return this.transformGeometryCollection(t,null);throw new i("Unknown Geometry subtype: "+t.getClass().getName())},transformLinearRing:function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var i=n.size();return i>0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},interfaces_:function(){return[]},getClass:function(){return In}}),e(Nn.prototype,{getResultGeometry:function(){return new Cn(this._distanceTolerance).transform(this._inputGeom)},setDistanceTolerance:function(t){if(t<=0)throw new i("Tolerance must be positive");this._distanceTolerance=t},interfaces_:function(){return[]},getClass:function(){return Nn}}),Nn.densifyPoints=function(t,e,n){for(var i=new ge,r=new b,s=0;s<t.length-1;s++){i.p0=t[s],i.p1=t[s+1],r.add(i.p0,!1);var o=i.getLength(),a=Math.trunc(o/e)+1;if(a>1)for(var u=o/a,l=1;l<a;l++){var h=l*u/o,c=i.pointAlong(h);n.makePrecise(c),r.add(c,!1)}}return r.add(t[t.length-1],!1),r.toCoordinateArray()},Nn.densify=function(t,e){var n=new Nn(t);return n.setDistanceTolerance(e),n.getResultGeometry()},v(Cn,In),e(Cn.prototype,{transformMultiPolygon:function(t,e){var n=In.prototype.transformMultiPolygon.call(this,t,e);return this.createValidArea(n)},transformPolygon:function(t,e){var n=In.prototype.transformPolygon.call(this,t,e);return e instanceof kt?n:this.createValidArea(n)},transformCoordinates:function(t,e){var n=t.toCoordinateArray(),i=Nn.densifyPoints(n,this.distanceTolerance,e.getPrecisionModel());return e instanceof At&&1===i.length&&(i=new Array(0).fill(null)),this._factory.getCoordinateSequenceFactory().create(i)},createValidArea:function(t){return t.buffer(0)},interfaces_:function(){return[]},getClass:function(){return Cn}}),Nn.DensifyTransformer=Cn;var Sn=Object.freeze({Densifier:Nn});function Ln(){this._orig=null,this._sym=null,this._next=null;var t=arguments[0];this._orig=t}function wn(){this._isMarked=!1;var t=arguments[0];Ln.call(this,t)}function Rn(){this._vertexMap=new ne}function Tn(){this._isStart=!1;var t=arguments[0];wn.call(this,t)}function Pn(){Rn.apply(this)}function On(){this._result=null,this._factory=null,this._graph=null,this._lines=new P,this._nodeEdgeStack=new je,this._ringStartEdge=null,this._graph=new Pn}e(Ln.prototype,{find:function(t){var e=this;do{if(null===e)return null;if(e.dest().equals2D(t))return e;e=e.oNext()}while(e!==this);return null},dest:function(){return this._sym._orig},oNext:function(){return this._sym._next},insert:function(t){if(this.oNext()===this)return this.insertAfter(t),null;var e=this.compareTo(t),n=this;do{var i=n.oNext();if(i.compareTo(t)!==e||i===this)return n.insertAfter(t),null;n=i}while(n!==this);x.shouldNeverReachHere()},insertAfter:function(t){x.equals(this._orig,t.orig());var e=this.oNext();this._sym.setNext(t),t.sym().setNext(e)},degree:function(){var t=0,e=this;do{t++,e=e.oNext()}while(e!==this);return t},equals:function(){if(2===arguments.length&&arguments[1]instanceof E&&arguments[0]instanceof E){var t=arguments[0],e=arguments[1];return this._orig.equals2D(t)&&this._sym._orig.equals(e)}},deltaY:function(){return this._sym._orig.y-this._orig.y},sym:function(){return this._sym},prev:function(){return this._sym.next()._sym},compareAngularDirection:function(t){var e=this.deltaX(),n=this.deltaY(),i=t.deltaX(),r=t.deltaY();if(e===i&&n===r)return 0;var s=gn.quadrant(e,n),o=gn.quadrant(i,r);return s>o?1:s<o?-1:z.index(t._orig,t.dest(),this.dest())},prevNode:function(){for(var t=this;2===t.degree();)if((t=t.prev())===this)return null;return t},compareTo:function(t){var e=t;return this.compareAngularDirection(e)},next:function(){return this._next},setSym:function(t){this._sym=t},orig:function(){return this._orig},toString:function(){return"HE("+this._orig.x+" "+this._orig.y+", "+this._sym._orig.x+" "+this._sym._orig.y+")"},setNext:function(t){this._next=t},init:function(t){this.setSym(t),t.setSym(this),this.setNext(t),t.setNext(this)},deltaX:function(){return this._sym._orig.x-this._orig.x},interfaces_:function(){return[]},getClass:function(){return Ln}}),Ln.init=function(t,e){if(null!==t._sym||null!==e._sym||null!==t._next||null!==e._next)throw new IllegalStateException("Edges are already initialized");return t.init(e),t},Ln.create=function(t,e){var n=new Ln(t),i=new Ln(e);return n.init(i),n},v(wn,Ln),e(wn.prototype,{mark:function(){this._isMarked=!0},setMark:function(t){this._isMarked=t},isMarked:function(){return this._isMarked},interfaces_:function(){return[]},getClass:function(){return wn}}),wn.setMarkBoth=function(t,e){t.setMark(e),t.sym().setMark(e)},wn.isMarked=function(t){return t.isMarked()},wn.setMark=function(t,e){t.setMark(e)},wn.markBoth=function(t){t.mark(),t.sym().mark()},wn.mark=function(t){t.mark()},e(Rn.prototype,{insert:function(t,e,n){var i=this.create(t,e);null!==n?n.insert(i):this._vertexMap.put(t,i);var r=this._vertexMap.get(e);return null!==r?r.insert(i.sym()):this._vertexMap.put(e,i.sym()),i},create:function(t,e){var n=this.createEdge(t),i=this.createEdge(e);return Ln.init(n,i),n},createEdge:function(t){return new Ln(t)},addEdge:function(t,e){if(!Rn.isValidEdge(t,e))return null;var n=this._vertexMap.get(t),i=null;return null!==n&&(i=n.find(e)),null!==i?i:this.insert(t,e,n)},getVertexEdges:function(){return this._vertexMap.values()},findEdge:function(t,e){var n=this._vertexMap.get(t);return null===n?null:n.find(e)},interfaces_:function(){return[]},getClass:function(){return Rn}}),Rn.isValidEdge=function(t,e){return 0!==e.compareTo(t)},v(Tn,wn),e(Tn.prototype,{setStart:function(){this._isStart=!0},isStart:function(){return this._isStart},interfaces_:function(){return[]},getClass:function(){return Tn}}),v(Pn,Rn),e(Pn.prototype,{createEdge:function(t){return new Tn(t)},interfaces_:function(){return[]},getClass:function(){return Pn}}),e(On.prototype,{addLine:function(t){this._lines.add(this._factory.createLineString(t.toCoordinateArray()))},updateRingStartEdge:function(t){return t.isStart()||(t=t.sym()).isStart()?null===this._ringStartEdge?(this._ringStartEdge=t,null):void(t.orig().compareTo(this._ringStartEdge.orig())<0&&(this._ringStartEdge=t)):null},getResult:function(){return null===this._result&&this.computeResult(),this._result},process:function(t){var e=t.prevNode();null===e&&(e=t),this.stackEdges(e),this.buildLines()},buildRing:function(t){var e=new b,n=t;for(e.add(n.orig().copy(),!1);2===n.sym().degree();){var i=n.next();if(i===t)break;e.add(i.orig().copy(),!1),n=i}e.add(n.dest().copy(),!1),this.addLine(e)},buildLine:function(t){var e=new b,n=t;for(this._ringStartEdge=null,wn.markBoth(n),e.add(n.orig().copy(),!1);2===n.sym().degree();){this.updateRingStartEdge(n);var i=n.next();if(i===t)return this.buildRing(this._ringStartEdge),null;e.add(i.orig().copy(),!1),n=i,wn.markBoth(n)}e.add(n.dest().clone(),!1),this.stackEdges(n.sym()),this.addLine(e)},stackEdges:function(t){var e=t;do{wn.isMarked(e)||this._nodeEdgeStack.add(e),e=e.oNext()}while(e!==t)},computeResult:function(){for(var t=this._graph.getVertexEdges().iterator();t.hasNext();){var e=t.next();wn.isMarked(e)||this.process(e)}this._result=this._factory.buildGeometry(this._lines)},buildLines:function(){for(;!this._nodeEdgeStack.empty();){var t=this._nodeEdgeStack.pop();wn.isMarked(t)||this.buildLine(t)}},add:function(){if(arguments[0]instanceof K)arguments[0].apply({interfaces_:function(){return[j]},filter:function(t){t instanceof At&&this.add(t)}});else if(N(arguments[0],S))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.add(e)}else if(arguments[0]instanceof At){var n=arguments[0];null===this._factory&&(this._factory=n.getFactory());var i=n.getCoordinateSequence(),r=!1;for(t=1;t<i.size();t++){var s=this._graph.addEdge(i.getCoordinate(t-1),i.getCoordinate(t));null!==s&&(r||(s.setStart(),r=!0))}}},interfaces_:function(){return[]},getClass:function(){return On}}),On.dissolve=function(t){var e=new On;return e.add(t),e.getResult()};var bn=Object.freeze({LineDissolver:On});function Mn(){if(this._boundaryRule=Q.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new i("Rule must be non-null");this._boundaryRule=t}}function Dn(){}function An(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e}function Fn(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var t=arguments[0],e=arguments[1];this._eventType=Fn.DELETE,this._xValue=t,this._insertEvent=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._eventType=Fn.INSERT,this._label=n,this._xValue=i,this._obj=r}}function Gn(){}function qn(){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}function Bn(){Gn.apply(this),this.events=new P,this.nOverlaps=null}function Vn(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[Dn.ON]=e}else if(arguments[0]instanceof Vn){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.init(3),this.location[Dn.ON]=r,this.location[Dn.LEFT]=s,this.location[Dn.RIGHT]=o}}function zn(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new Vn(t),this.elt[1]=new Vn(t)}else if(arguments[0]instanceof zn){var e=arguments[0];this.elt[0]=new Vn(e.elt[0]),this.elt[1]=new Vn(e.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new Vn(de.NONE),this.elt[1]=new Vn(de.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.elt[0]=new Vn(r,s,o),this.elt[1]=new Vn(r,s,o)}else if(4===arguments.length){var a=arguments[0],u=arguments[1],l=arguments[2],h=arguments[3];this.elt[0]=new Vn(de.NONE,de.NONE,de.NONE),this.elt[1]=new Vn(de.NONE,de.NONE,de.NONE),this.elt[a].setLocations(u,l,h)}}function Yn(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new E(t),this.segmentIndex=e,this.dist=n}function kn(){this._nodeMap=new pt,this.edge=null;var t=arguments[0];this.edge=t}function Un(){}function Xn(){this.e=null,this.pts=null,this.startIndex=null;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Un;this.startIndex=e.getChainStartIndices(this.pts)}function Hn(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=Hn.NULL_VALUE}function Wn(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}}function jn(){if(Wn.apply(this),this.pts=null,this._env=null,this.eiList=new kn(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Hn,this._depthDelta=0,1===arguments.length){var t=arguments[0];jn.call(this,t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.pts=e,this._label=n}}function Kn(){Wn.apply(this),this._coord=null,this._edges=null;var t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new zn(0,de.NONE)}function Zn(){this.nodeMap=new pt,this.nodeFact=null;var t=arguments[0];this.nodeFact=t}function Qn(){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,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2];Qn.call(this,e,n,i,null)}else if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];Qn.call(this,r),this.init(s,o),this._label=a}}function Jn(){if(this.pt=null,1===arguments.length){var t=arguments[0];m.call(this,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];m.call(this,Jn.msgWithCoord(e,n)),this.name="TopologyException",this.pt=new E(n)}}function $n(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var t=arguments[0],e=arguments[1];if(Qn.call(this,t),this._isForward=e,e)this.init(t.getCoordinate(0),t.getCoordinate(1));else{var n=t.getNumPoints()-1;this.init(t.getCoordinate(n),t.getCoordinate(n-1))}this.computeDirectedLabel()}function ti(){}function ei(){if(this._edges=new P,this._nodes=null,this._edgeEndList=new P,0===arguments.length)this._nodes=new Zn(new ti);else if(1===arguments.length){var t=arguments[0];this._nodes=new Zn(t)}}function ni(){if(ei.apply(this),this._parentGeom=null,this._lineEdgeMap=new ne,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Mn,2===arguments.length){var t=arguments[0],e=arguments[1];ni.call(this,t,e,Q.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._argIndex=n,this._parentGeom=i,this._boundaryNodeRule=r,null!==i&&this.add(i)}}e(Mn.prototype,{locateInPolygonRing:function(t,e){return e.getEnvelopeInternal().intersects(t)?qe.locateInRing(t,e.getCoordinates()):de.EXTERIOR},intersects:function(t,e){return this.locate(t,e)!==de.EXTERIOR},updateLocationInfo:function(t){t===de.INTERIOR&&(this._isIn=!0),t===de.BOUNDARY&&this._numBoundaries++},computeLocation:function(t,e){if(e instanceof Gt&&this.updateLocationInfo(this.locateOnPoint(t,e)),e instanceof At)this.updateLocationInfo(this.locateOnLineString(t,e));else if(e instanceof Vt)this.updateLocationInfo(this.locateInPolygon(t,e));else if(e instanceof wt)for(var n=e,i=0;i<n.getNumGeometries();i++){var r=n.getGeometryN(i);this.updateLocationInfo(this.locateOnLineString(t,r))}else if(e instanceof kt){var s=e;for(i=0;i<s.getNumGeometries();i++){var o=s.getGeometryN(i);this.updateLocationInfo(this.locateInPolygon(t,o))}}else if(e instanceof Lt)for(var a=new Be(e);a.hasNext();){var u=a.next();u!==e&&this.computeLocation(t,u)}},locateOnPoint:function(t,e){return e.getCoordinate().equals2D(t)?de.INTERIOR:de.EXTERIOR},locateOnLineString:function(t,e){if(!e.getEnvelopeInternal().intersects(t))return de.EXTERIOR;var n=e.getCoordinateSequence();return e.isClosed()||!t.equals(n.getCoordinate(0))&&!t.equals(n.getCoordinate(n.size()-1))?qe.isOnLine(t,n)?de.INTERIOR:de.EXTERIOR:de.BOUNDARY},locateInPolygon:function(t,e){if(e.isEmpty())return de.EXTERIOR;var n=e.getExteriorRing(),i=this.locateInPolygonRing(t,n);if(i===de.EXTERIOR)return de.EXTERIOR;if(i===de.BOUNDARY)return de.BOUNDARY;for(var r=0;r<e.getNumInteriorRing();r++){var s=e.getInteriorRingN(r),o=this.locateInPolygonRing(t,s);if(o===de.INTERIOR)return de.EXTERIOR;if(o===de.BOUNDARY)return de.BOUNDARY}return de.INTERIOR},locate:function(t,e){return e.isEmpty()?de.EXTERIOR:e instanceof At?this.locateOnLineString(t,e):e instanceof Vt?this.locateInPolygon(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?de.BOUNDARY:this._numBoundaries>0||this._isIn?de.INTERIOR:de.EXTERIOR)},interfaces_:function(){return[]},getClass:function(){return Mn}}),e(Dn.prototype,{interfaces_:function(){return[]},getClass:function(){return Dn}}),Dn.opposite=function(t){return t===Dn.LEFT?Dn.RIGHT:t===Dn.RIGHT?Dn.LEFT:t},Dn.ON=0,Dn.LEFT=1,Dn.RIGHT=2,e(An.prototype,{computeIntersections:function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},interfaces_:function(){return[]},getClass:function(){return An}}),e(Fn.prototype,{isDelete:function(){return this._eventType===Fn.DELETE},setDeleteEventIndex:function(t){this._deleteEventIndex=t},getObject:function(){return this._obj},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},getInsertEvent:function(){return this._insertEvent},isInsert:function(){return this._eventType===Fn.INSERT},isSameLabel:function(t){return null!==this._label&&this._label===t._label},getDeleteEventIndex:function(){return this._deleteEventIndex},interfaces_:function(){return[g]},getClass:function(){return Fn}}),Fn.INSERT=1,Fn.DELETE=2,e(Gn.prototype,{interfaces_:function(){return[]},getClass:function(){return Gn}}),e(qn.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(qn.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.getNumPoints()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},getProperIntersectionPoint:function(){return this._properIntersectionPoint},setIsDoneIfProperInt:function(t){this._isDoneWhenProperInt=t},hasProperInteriorIntersection:function(){return this._hasProperInterior},isBoundaryPointInternal:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next().getCoordinate();if(t.isIntersection(i))return!0}return!1},hasProperIntersection:function(){return this._hasProper},hasIntersection:function(){return this._hasIntersection},isDone:function(){return this._isDone},isBoundaryPoint:function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},setBoundaryNodes:function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},addIntersections:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,s,o,a),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))))},interfaces_:function(){return[]},getClass:function(){return qn}}),qn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},v(Bn,Gn),e(Bn.prototype,{prepareEvents:function(){Te.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},computeIntersections:function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof qn&&N(arguments[0],w)&&N(arguments[1],w)){var i=arguments[0],r=arguments[1],s=arguments[2];this.addEdges(i,i),this.addEdges(r,r),this.computeIntersections(s)}else if("boolean"==typeof arguments[2]&&N(arguments[0],w)&&arguments[1]instanceof qn){var o=arguments[0],a=arguments[1];arguments[2]?this.addEdges(o,null):this.addEdges(o),this.computeIntersections(a)}},addEdge:function(t,e){for(var n=t.getMonotoneChainEdge(),i=n.getStartIndexes(),r=0;r<i.length-1;r++){var s=new An(n,r),o=new Fn(e,n.getMinX(r),s);this.events.add(o),this.events.add(new Fn(n.getMaxX(r),o))}},processOverlaps:function(t,e,n,i){for(var r=n.getObject(),s=t;s<e;s++){var o=this.events.get(s);if(o.isInsert()){var a=o.getObject();n.isSameLabel(o)||(r.computeIntersections(a,i),this.nOverlaps++)}}},addEdges:function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];for(t=n.iterator();t.hasNext();){e=t.next();this.addEdge(e,i)}}},interfaces_:function(){return[]},getClass:function(){return Bn}}),e(Vn.prototype,{setAllLocations:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},isNull:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==de.NONE)return!1;return!0},setAllLocationsIfNull:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===de.NONE&&(this.location[e]=t)},isLine:function(){return 1===this.location.length},merge:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[Dn.ON]=this.location[Dn.ON],e[Dn.LEFT]=de.NONE,e[Dn.RIGHT]=de.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===de.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},getLocations:function(){return this.location},flip:function(){if(this.location.length<=1)return null;var t=this.location[Dn.LEFT];this.location[Dn.LEFT]=this.location[Dn.RIGHT],this.location[Dn.RIGHT]=t},toString:function(){var t=new F;return this.location.length>1&&t.append(de.toLocationSymbol(this.location[Dn.LEFT])),t.append(de.toLocationSymbol(this.location[Dn.ON])),this.location.length>1&&t.append(de.toLocationSymbol(this.location[Dn.RIGHT])),t.toString()},setLocations:function(t,e,n){this.location[Dn.ON]=t,this.location[Dn.LEFT]=e,this.location[Dn.RIGHT]=n},get:function(t){return t<this.location.length?this.location[t]:de.NONE},isArea:function(){return this.location.length>1},isAnyNull:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===de.NONE)return!0;return!1},setLocation:function(){if(1===arguments.length){var t=arguments[0];this.setLocation(Dn.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},init:function(t){this.location=new Array(t).fill(null),this.setAllLocations(de.NONE)},isEqualOnSide:function(t,e){return this.location[e]===t.location[e]},allPositionsEqual:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},interfaces_:function(){return[]},getClass:function(){return Vn}}),e(zn.prototype,{getGeometryCount:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},setAllLocations:function(t,e){this.elt[t].setAllLocations(e)},isNull:function(t){return this.elt[t].isNull()},setAllLocationsIfNull:function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},isLine:function(t){return this.elt[t].isLine()},merge:function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new Vn(t.elt[e]):this.elt[e].merge(t.elt[e])},flip:function(){this.elt[0].flip(),this.elt[1].flip()},getLocation:function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(Dn.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},toString:function(){var t=new F;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},isArea:function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},isAnyNull:function(t){return this.elt[t].isAnyNull()},setLocation:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(Dn.ON,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.elt[n].setLocation(i,r)}},isEqualOnSide:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},allPositionsEqual:function(t,e){return this.elt[t].allPositionsEqual(e)},toLine:function(t){this.elt[t].isArea()&&(this.elt[t]=new Vn(this.elt[t].location[0]))},interfaces_:function(){return[]},getClass:function(){return zn}}),zn.toLineLabel=function(t){for(var e=new zn(de.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e},e(Yn.prototype,{getSegmentIndex:function(){return this.segmentIndex},getCoordinate:function(){return this.coord},print:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},compareTo:function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},isEndPoint:function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},toString:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},getDistance:function(){return this.dist},compare:function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},interfaces_:function(){return[g]},getClass:function(){return Yn}}),e(kn.prototype,{print:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},iterator:function(){return this._nodeMap.values().iterator()},addSplitEdges:function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}},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)},createSplitEdge:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this.edge.pts[e.segmentIndex],r=e.dist>0||!e.coord.equals2D(i);r||n--;var s=new Array(n).fill(null),o=0;s[o++]=new E(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)s[o++]=this.edge.pts[a];return r&&(s[o]=e.coord),new jn(s,new zn(this.edge._label))},add:function(t,e,n){var i=new Yn(t,e,n),r=this._nodeMap.get(i);return null!==r?r:(this._nodeMap.put(i,i),i)},isIntersection:function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},interfaces_:function(){return[]},getClass:function(){return kn}}),e(Un.prototype,{getChainStartIndices:function(t){var e=0,n=new P;n.add(new G(e));do{var i=this.findChainEnd(t,e);n.add(new G(i)),e=i}while(e<t.length-1);return Un.toIntArray(n)},findChainEnd:function(t,e){for(var n=gn.quadrant(t[e],t[e+1]),i=e+1;i<t.length;){if(gn.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},interfaces_:function(){return[]},getClass:function(){return Un}}),Un.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},e(Xn.prototype,{getCoordinates:function(){return this.pts},getMaxX:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},getMinX:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},computeIntersectsForChain:function(){if(4===arguments.length){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(6===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5];if(s-r==1&&u-a==1)return l.addIntersections(this.e,r,o.e,a),null;if(!this.overlaps(r,s,o,a,u))return null;var h=Math.trunc((r+s)/2),c=Math.trunc((a+u)/2);r<h&&(a<c&&this.computeIntersectsForChain(r,h,o,a,c,l),c<u&&this.computeIntersectsForChain(r,h,o,c,u,l)),h<s&&(a<c&&this.computeIntersectsForChain(h,s,o,a,c,l),c<u&&this.computeIntersectsForChain(h,s,o,c,u,l))}},overlaps:function(t,e,n,i,r){return M.intersects(this.pts[t],this.pts[e],n.pts[i],n.pts[r])},getStartIndexes:function(){return this.startIndex},computeIntersects:function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<t.startIndex.length-1;i++)this.computeIntersectsForChain(n,t,i,e)},interfaces_:function(){return[]},getClass:function(){return Xn}}),e(Hn.prototype,{getDepth:function(t,e){return this._depth[t][e]},setDepth:function(t,e,n){this._depth[t][e]=n},isNull:function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Hn.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===Hn.NULL_VALUE}if(2===arguments.length){var i=arguments[0],r=arguments[1];return this._depth[i][r]===Hn.NULL_VALUE}},normalize:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var i=0;this._depth[t][n]>e&&(i=1),this._depth[t][n]=i}}},getDelta:function(t){return this._depth[t][Dn.RIGHT]-this._depth[t][Dn.LEFT]},getLocation:function(t,e){return this._depth[t][e]<=0?de.EXTERIOR:de.INTERIOR},toString:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},add:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var i=t.getLocation(e,n);i!==de.EXTERIOR&&i!==de.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=Hn.depthAtLocation(i):this._depth[e][n]+=Hn.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],s=arguments[1];arguments[2]===de.INTERIOR&&this._depth[r][s]++}},interfaces_:function(){return[]},getClass:function(){return Hn}}),Hn.depthAtLocation=function(t){return t===de.EXTERIOR?0:t===de.INTERIOR?1:Hn.NULL_VALUE},Hn.NULL_VALUE=-1,e(Wn.prototype,{setVisited:function(t){this._isVisited=t},setInResult:function(t){this._isInResult=t},isCovered:function(){return this._isCovered},isCoveredSet:function(){return this._isCoveredSet},setLabel:function(t){this._label=t},getLabel:function(){return this._label},setCovered:function(t){this._isCovered=t,this._isCoveredSet=!0},updateIM:function(t){x.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},isInResult:function(){return this._isInResult},isVisited:function(){return this._isVisited},interfaces_:function(){return[]},getClass:function(){return Wn}}),v(jn,Wn),e(jn.prototype,{getDepth:function(){return this._depth},getCollapsedEdge:function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new jn(t,zn.toLineLabel(this._label))},isIsolated:function(){return this._isIsolated},getCoordinates:function(){return this.pts},setIsolated:function(t){this._isIsolated=t},setName:function(t){this._name=t},equals:function(t){if(!(t instanceof jn))return!1;var e=t;if(this.pts.length!==e.pts.length)return!1;for(var n=!0,i=!0,r=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(e.pts[s])||(n=!1),this.pts[s].equals2D(e.pts[--r])||(i=!1),!n&&!i)return!1;return!0},getCoordinate:function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},print:function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},computeIM:function(t){jn.updateIM(this._label,t)},isCollapsed:function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},isClosed:function(){return this.pts[0].equals(this.pts[this.pts.length-1])},getMaximumSegmentIndex:function(){return this.pts.length-1},getDepthDelta:function(){return this._depthDelta},getNumPoints:function(){return this.pts.length},printReverse:function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},getMonotoneChainEdge:function(){return null===this._mce&&(this._mce=new Xn(this)),this._mce},getEnvelope:function(){if(null===this._env){this._env=new M;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},addIntersection:function(t,e,n,i){var r=new E(t.getIntersection(i)),s=e,o=t.getEdgeDistance(n,i),a=s+1;if(a<this.pts.length){var u=this.pts[a];r.equals2D(u)&&(s=a,o=0)}this.eiList.add(r,s,o)},toString:function(){var t=new Mt;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},isPointwiseEqual:function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},setDepthDelta:function(t){this._depthDelta=t},getEdgeIntersectionList:function(){return this.eiList},addIntersections:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)},interfaces_:function(){return[]},getClass:function(){return jn}}),jn.updateIM=function(){if(!(2===arguments.length&&arguments[1]instanceof _e&&arguments[0]instanceof zn))return Wn.prototype.updateIM.apply(this,arguments);var t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,Dn.ON),t.getLocation(1,Dn.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,Dn.LEFT),t.getLocation(1,Dn.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,Dn.RIGHT),t.getLocation(1,Dn.RIGHT),2))},v(Kn,Wn),e(Kn.prototype,{isIncidentEdgeInResult:function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},isIsolated:function(){return 1===this._label.getGeometryCount()},getCoordinate:function(){return this._coord},print:function(t){t.println("node "+this._coord+" lbl: "+this._label)},computeIM:function(t){},computeMergedLocation:function(t,e){var n=de.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var i=t.getLocation(e);n!==de.BOUNDARY&&(n=i)}return n},setLabel:function(){if(2!==arguments.length||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return Wn.prototype.setLabel.apply(this,arguments);var t=arguments[0],e=arguments[1];null===this._label?this._label=new zn(t,e):this._label.setLocation(t,e)},getEdges:function(){return this._edges},mergeLabel:function(){if(arguments[0]instanceof Kn){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof zn)for(var e=arguments[0],n=0;n<2;n++){var i=this.computeMergedLocation(e,n);this._label.getLocation(n)===de.NONE&&this._label.setLocation(n,i)}},add:function(t){this._edges.insert(t),t.setNode(this)},setLabelBoundary:function(t){if(null===this._label)return null;var e=de.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case de.BOUNDARY:n=de.INTERIOR;break;case de.INTERIOR:default:n=de.BOUNDARY}this._label.setLocation(t,n)},interfaces_:function(){return[]},getClass:function(){return Kn}}),e(Zn.prototype,{find:function(t){return this.nodeMap.get(t)},addNode:function(){if(arguments[0]instanceof E){var t=arguments[0];return null===(e=this.nodeMap.get(t))&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof Kn){var e,n=arguments[0];return null===(e=this.nodeMap.get(n.getCoordinate()))?(this.nodeMap.put(n.getCoordinate(),n),n):(e.mergeLabel(n),e)}},print:function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},iterator:function(){return this.nodeMap.values().iterator()},values:function(){return this.nodeMap.values()},getBoundaryNodes:function(t){for(var e=new P,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===de.BOUNDARY&&e.add(i)}return e},add:function(t){var e=t.getCoordinate();this.addNode(e).add(t)},interfaces_:function(){return[]},getClass:function(){return Zn}}),e(Qn.prototype,{compareDirection:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:z.index(t._p0,t._p1,this._p1)},getDy:function(){return this._dy},getCoordinate:function(){return this._p0},setNode:function(t){this._node=t},print:function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),r=n.substring(i+1);t.print(" "+r+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},compareTo:function(t){var e=t;return this.compareDirection(e)},getDirectedCoordinate:function(){return this._p1},getDx:function(){return this._dx},getLabel:function(){return this._label},getEdge:function(){return this._edge},getQuadrant:function(){return this._quadrant},getNode:function(){return this._node},toString:function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},computeLabel:function(t){},init:function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=gn.quadrant(this._dx,this._dy),x.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},interfaces_:function(){return[g]},getClass:function(){return Qn}}),v(Jn,m),e(Jn.prototype,{getCoordinate:function(){return this.pt},interfaces_:function(){return[]},getClass:function(){return Jn}}),Jn.msgWithCoord=function(t,e){return null!==e?t+" [ "+e+" ]":t},v($n,Qn),e($n.prototype,{getNextMin:function(){return this._nextMin},getDepth:function(t){return this._depth[t]},setVisited:function(t){this._isVisited=t},computeDirectedLabel:function(){this._label=new zn(this._edge.getLabel()),this._isForward||this._label.flip()},getNext:function(){return this._next},setDepth:function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new Jn("assigned depths do not match",this.getCoordinate());this._depth[t]=e},isInteriorAreaEdge:function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,Dn.LEFT)===de.INTERIOR&&this._label.getLocation(e,Dn.RIGHT)===de.INTERIOR||(t=!1);return t},setNextMin:function(t){this._nextMin=t},print:function(t){Qn.prototype.print.call(this,t),t.print(" "+this._depth[Dn.LEFT]+"/"+this._depth[Dn.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")},setMinEdgeRing:function(t){this._minEdgeRing=t},isLineEdge:function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,de.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,de.EXTERIOR);return t&&e&&n},setEdgeRing:function(t){this._edgeRing=t},getMinEdgeRing:function(){return this._minEdgeRing},getDepthDelta:function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},setInResult:function(t){this._isInResult=t},getSym:function(){return this._sym},isForward:function(){return this._isForward},getEdge:function(){return this._edge},printEdge:function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},setSym:function(t){this._sym=t},setVisitedEdge:function(t){this.setVisited(t),this._sym.setVisited(t)},setEdgeDepths:function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var i=1;t===Dn.LEFT&&(i=-1);var r=Dn.opposite(t),s=e+n*i;this.setDepth(t,e),this.setDepth(r,s)},getEdgeRing:function(){return this._edgeRing},isInResult:function(){return this._isInResult},setNext:function(t){this._next=t},isVisited:function(){return this._isVisited},interfaces_:function(){return[]},getClass:function(){return $n}}),$n.depthFactor=function(t,e){return t===de.EXTERIOR&&e===de.INTERIOR?1:t===de.INTERIOR&&e===de.EXTERIOR?-1:0},e(ti.prototype,{createNode:function(t){return new Kn(t,null)},interfaces_:function(){return[]},getClass:function(){return ti}}),e(ei.prototype,{printEdges:function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},find:function(t){return this._nodes.find(t)},addNode:function(){if(arguments[0]instanceof Kn){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof E){var e=arguments[0];return this._nodes.addNode(e)}},getNodeIterator:function(){return this._nodes.iterator()},linkResultDirectedEdges:function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},debugPrintln:function(t){Y.out.println(t)},isBoundaryNode:function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var i=n.getLabel();return null!==i&&i.getLocation(t)===de.BOUNDARY},linkAllDirectedEdges:function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},matchInSameDirection:function(t,e,n,i){return!!t.equals(n)&&(z.index(t,e,i)===z.COLLINEAR&&gn.quadrant(t,e)===gn.quadrant(n,i))},getEdgeEnds:function(){return this._edgeEndList},debugPrint:function(t){Y.out.print(t)},getEdgeIterator:function(){return this._edges.iterator()},findEdgeInSameDirection:function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),r=i.getCoordinates();if(this.matchInSameDirection(t,e,r[0],r[1]))return i;if(this.matchInSameDirection(t,e,r[r.length-1],r[r.length-2]))return i}return null},insertEdge:function(t){this._edges.add(t)},findEdgeEnd:function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},addEdges:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var i=new $n(n,!0),r=new $n(n,!1);i.setSym(r),r.setSym(i),this.add(i),this.add(r)}},add:function(t){this._nodes.add(t),this._edgeEndList.add(t)},getNodes:function(){return this._nodes.values()},findEdge:function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),r=i.getCoordinates();if(t.equals(r[0])&&e.equals(r[1]))return i}return null},interfaces_:function(){return[]},getClass:function(){return ei}}),ei.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}},v(ni,ei),e(ni.prototype,{insertBoundaryPoint:function(t,e){var n=this._nodes.addNode(e).getLabel(),i=1;de.NONE;n.getLocation(t,Dn.ON)===de.BOUNDARY&&i++;var r=ni.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,r)},computeSelfNodes:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=new qn(n,!0,!1);s.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),a=this._parentGeom instanceof Yt||this._parentGeom instanceof Vt||this._parentGeom instanceof kt,u=i||!a;return o.computeIntersections(this._edges,s,u),this.addSelfIntersectionNodes(this._argIndex),s}},computeSplitEdges:function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},computeEdgeIntersections:function(t,e,n){var i=new qn(e,n,!0);return i.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,i),i},getGeometry:function(){return this._parentGeom},getBoundaryNodeRule:function(){return this._boundaryNodeRule},hasTooFewPoints:function(){return this._hasTooFewPoints},addPoint:function(){if(arguments[0]instanceof Gt){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,de.INTERIOR)}else if(arguments[0]instanceof E){var e=arguments[0];this.insertPoint(this._argIndex,e,de.INTERIOR)}},addPolygon:function(t){this.addPolygonRing(t.getExteriorRing(),de.EXTERIOR,de.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,de.INTERIOR,de.EXTERIOR)}},addEdge:function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],de.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],de.BOUNDARY)},addLineString:function(t){var e=nt.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new jn(e,new zn(this._argIndex,de.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),x.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},getInvalidPoint:function(){return this._invalidPoint},getBoundaryPoints:function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,i=t.iterator();i.hasNext();){var r=i.next();e[n++]=r.getCoordinate().copy()}return e},getBoundaryNodes:function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},addSelfIntersectionNode:function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===de.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},addPolygonRing:function(t,e,n){if(t.isEmpty())return null;var i=nt.removeRepeatedPoints(t.getCoordinates());if(i.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var r=e,s=n;z.isCCW(i)&&(r=n,s=e);var o=new jn(i,new zn(this._argIndex,de.BOUNDARY,r,s));this._lineEdgeMap.put(t,o),this.insertEdge(o),this.insertPoint(this._argIndex,i[0],de.BOUNDARY)},insertPoint:function(t,e,n){var i=this._nodes.addNode(e),r=i.getLabel();null===r?i._label=new zn(t,n):r.setLocation(t,n)},createEdgeSetIntersector:function(){return new Bn},addSelfIntersectionNodes:function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.eiList.iterator();r.hasNext();){var s=r.next();this.addSelfIntersectionNode(t,s.coord,i)}},add:function(){if(!(1===arguments.length&&arguments[0]instanceof K))return ei.prototype.add.apply(this,arguments);var t=arguments[0];if(t.isEmpty())return null;if(t instanceof kt&&(this._useBoundaryDeterminationRule=!1),t instanceof Vt)this.addPolygon(t);else if(t instanceof At)this.addLineString(t);else if(t instanceof Gt)this.addPoint(t);else if(t instanceof zt)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof kt)this.addCollection(t);else{if(!(t instanceof Lt))throw new UnsupportedOperationException(t.getClass().getName());this.addCollection(t)}},addCollection:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},locate:function(t){return N(this._parentGeom,Bt)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new Ae(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},findEdge:function(){if(1===arguments.length&&arguments[0]instanceof At){var t=arguments[0];return this._lineEdgeMap.get(t)}return ei.prototype.findEdge.apply(this,arguments)},interfaces_:function(){return[]},getClass:function(){return ni}}),ni.determineBoundary=function(t,e){return t.isInBoundary(e)?de.BOUNDARY:de.INTERIOR};var ii=Object.freeze({GeometryGraph:ni});function ri(){}function si(){if(this._p=null,this._data=null,this._left=null,this._right=null,this._count=null,2===arguments.length){var t=arguments[0],e=arguments[1];this._p=new E(t),this._left=null,this._right=null,this._count=1,this._data=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._p=new E(n,i),this._left=null,this._right=null,this._count=1,this._data=r}}function oi(){if(this._root=null,this._numberOfNodes=null,this._tolerance=null,0===arguments.length)oi.call(this,0);else if(1===arguments.length){var t=arguments[0];this._tolerance=t}}function ai(){this._tolerance=null,this._matchNode=null,this._matchDist=0,this._p=null;var t=arguments[0],e=arguments[1];this._p=t,this._tolerance=e}e(ri.prototype,{visit:function(t){},interfaces_:function(){return[]},getClass:function(){return ri}}),e(si.prototype,{isRepeated:function(){return this._count>1},getRight:function(){return this._right},getCoordinate:function(){return this._p},setLeft:function(t){this._left=t},getX:function(){return this._p.x},getData:function(){return this._data},getCount:function(){return this._count},getLeft:function(){return this._left},getY:function(){return this._p.y},increment:function(){this._count=this._count+1},setRight:function(t){this._right=t},interfaces_:function(){return[]},getClass:function(){return si}}),e(oi.prototype,{insert:function(){if(1===arguments.length){var t=arguments[0];return this.insert(t,null)}if(2===arguments.length){var e=arguments[0],n=arguments[1];if(null===this._root)return this._root=new si(e,n),this._root;if(this._tolerance>0){var i=this.findBestMatchNode(e);if(null!==i)return i.increment(),i}return this.insertExact(e,n)}},query:function(){if(1===arguments.length){var t=arguments[0],e=new P;return this.query(t,e),e}if(2===arguments.length)if(arguments[0]instanceof M&&N(arguments[1],w)){var n=arguments[0],i=arguments[1];this.queryNode(this._root,n,!0,{interfaces_:function(){return[ri]},visit:function(t){i.add(t)}})}else if(arguments[0]instanceof M&&N(arguments[1],ri)){var r=arguments[0],s=arguments[1];this.queryNode(this._root,r,!0,s)}},queryNode:function(t,e,n,i){if(null===t)return null;var r=null,s=null,o=null;n?(r=e.getMinX(),s=e.getMaxX(),o=t.getX()):(r=e.getMinY(),s=e.getMaxY(),o=t.getY());var a=o<=s;r<o&&this.queryNode(t.getLeft(),e,!n,i),e.contains(t.getCoordinate())&&i.visit(t),a&&this.queryNode(t.getRight(),e,!n,i)},findBestMatchNode:function(t){var e=new ai(t,this._tolerance);return this.query(e.queryEnvelope(),e),e.getNode()},isEmpty:function(){return null===this._root},insertExact:function(t,e){for(var n=this._root,i=this._root,r=!0,s=!0;null!==n;){if(null!==n)if(t.distance(n.getCoordinate())<=this._tolerance)return n.increment(),n;i=n,n=(s=r?t.x<n.getX():t.y<n.getY())?n.getLeft():n.getRight(),r=!r}this._numberOfNodes=this._numberOfNodes+1;var o=new si(t,e);return s?i.setLeft(o):i.setRight(o),o},interfaces_:function(){return[]},getClass:function(){return oi}}),oi.toCoordinates=function(){if(1===arguments.length){var t=arguments[0];return oi.toCoordinates(t,!1)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],i=new b,r=e.iterator();r.hasNext();)for(var s=r.next(),o=n?s.getCount():1,a=0;a<o;a++)i.add(s.getCoordinate(),!0);return i.toCoordinateArray()}},e(ai.prototype,{visit:function(t){var e=this._p.distance(t.getCoordinate());if(!(e<=this._tolerance))return null;var n=!1;(null===this._matchNode||e<this._matchDist||null!==this._matchNode&&e===this._matchDist&&t.getCoordinate().compareTo(this._matchNode.getCoordinate())<1)&&(n=!0),n&&(this._matchNode=t,this._matchDist=e)},queryEnvelope:function(){var t=new M(this._p);return t.expandBy(this._tolerance),t},getNode:function(){return this._matchNode},interfaces_:function(){return[ri]},getClass:function(){return ai}}),oi.BestMatchVisitor=ai;var ui=Object.freeze({KdTree:oi});function li(){this._items=new P,this._subnode=new Array(4).fill(null)}function hi(){this._pt=new E,this._level=0,this._env=null;var t=arguments[0];this.computeKey(t)}function ci(){li.apply(this),this._env=null,this._centrex=null,this._centrey=null,this._level=null;var t=arguments[0],e=arguments[1];this._env=t,this._level=e,this._centrex=(t.getMinX()+t.getMaxX())/2,this._centrey=(t.getMinY()+t.getMaxY())/2}function fi(){li.apply(this)}function gi(){}function di(){this._root=null,this._minExtent=1,this._root=new fi}e(li.prototype,{hasChildren:function(){for(var t=0;t<4;t++)if(null!==this._subnode[t])return!0;return!1},isPrunable:function(){return!(this.hasChildren()||this.hasItems())},addAllItems:function(t){t.addAll(this._items);for(var e=0;e<4;e++)null!==this._subnode[e]&&this._subnode[e].addAllItems(t);return t},getNodeCount:function(){for(var t=0,e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+1},size:function(){for(var t=0,e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+this._items.size()},addAllItemsFromOverlapping:function(t,e){if(!this.isSearchMatch(t))return null;e.addAll(this._items);for(var n=0;n<4;n++)null!==this._subnode[n]&&this._subnode[n].addAllItemsFromOverlapping(t,e)},visitItems:function(t,e){for(var n=this._items.iterator();n.hasNext();)e.visitItem(n.next())},hasItems:function(){return!this._items.isEmpty()},remove:function(t,e){if(!this.isSearchMatch(t))return!1;for(var n=!1,i=0;i<4;i++)if(null!==this._subnode[i]&&(n=this._subnode[i].remove(t,e))){this._subnode[i].isPrunable()&&(this._subnode[i]=null);break}return n||(n=this._items.remove(e))},visit:function(t,e){if(!this.isSearchMatch(t))return null;this.visitItems(t,e);for(var n=0;n<4;n++)null!==this._subnode[n]&&this._subnode[n].visit(t,e)},getItems:function(){return this._items},depth:function(){for(var t=0,e=0;e<4;e++)if(null!==this._subnode[e]){var n=this._subnode[e].depth();n>t&&(t=n)}return t+1},isEmpty:function(){var t=!0;if(this._items.isEmpty()){for(var e=0;e<4;e++)if(null!==this._subnode[e]&&!this._subnode[e].isEmpty()){t=!1;break}}else t=!1;return t},add:function(t){this._items.add(t)},interfaces_:function(){return[p]},getClass:function(){return li}}),li.getSubnodeIndex=function(t,e,n){var i=-1;return t.getMinX()>=e&&(t.getMinY()>=n&&(i=3),t.getMaxY()<=n&&(i=1)),t.getMaxX()<=e&&(t.getMinY()>=n&&(i=2),t.getMaxY()<=n&&(i=0)),i},e(hi.prototype,{getLevel:function(){return this._level},computeKey:function(){if(1===arguments.length){var t=arguments[0];for(this._level=hi.computeQuadLevel(t),this._env=new M,this.computeKey(this._level,t);!this._env.contains(t);)this._level+=1,this.computeKey(this._level,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=on.powerOf2(e);this._pt.x=Math.floor(n.getMinX()/i)*i,this._pt.y=Math.floor(n.getMinY()/i)*i,this._env.init(this._pt.x,this._pt.x+i,this._pt.y,this._pt.y+i)}},getEnvelope:function(){return this._env},getCentre:function(){return new E((this._env.getMinX()+this._env.getMaxX())/2,(this._env.getMinY()+this._env.getMaxY())/2)},getPoint:function(){return this._pt},interfaces_:function(){return[]},getClass:function(){return hi}}),hi.computeQuadLevel=function(t){var e=t.getWidth(),n=t.getHeight(),i=e>n?e:n;return on.exponent(i)+1},v(ci,li),e(ci.prototype,{find:function(t){var e=li.getSubnodeIndex(t,this._centrex,this._centrey);return-1===e?this:null!==this._subnode[e]?this._subnode[e].find(t):this},isSearchMatch:function(t){return null!==t&&this._env.intersects(t)},getSubnode:function(t){return null===this._subnode[t]&&(this._subnode[t]=this.createSubnode(t)),this._subnode[t]},getEnvelope:function(){return this._env},getNode:function(t){var e=li.getSubnodeIndex(t,this._centrex,this._centrey);return-1!==e?this.getSubnode(e).getNode(t):this},createSubnode:function(t){var e=0,n=0,i=0,r=0;switch(t){case 0:e=this._env.getMinX(),n=this._centrex,i=this._env.getMinY(),r=this._centrey;break;case 1:e=this._centrex,n=this._env.getMaxX(),i=this._env.getMinY(),r=this._centrey;break;case 2:e=this._env.getMinX(),n=this._centrex,i=this._centrey,r=this._env.getMaxY();break;case 3:e=this._centrex,n=this._env.getMaxX(),i=this._centrey,r=this._env.getMaxY()}return new ci(new M(e,n,i,r),this._level-1)},insertNode:function(t){x.isTrue(null===this._env||this._env.contains(t._env));var e=li.getSubnodeIndex(t._env,this._centrex,this._centrey);if(t._level===this._level-1)this._subnode[e]=t;else{var n=this.createSubnode(e);n.insertNode(t),this._subnode[e]=n}},interfaces_:function(){return[]},getClass:function(){return ci}}),ci.createNode=function(t){var e=new hi(t);return new ci(e.getEnvelope(),e.getLevel())},ci.createExpanded=function(t,e){var n=new M(e);null!==t&&n.expandToInclude(t._env);var i=ci.createNode(n);return null!==t&&i.insertNode(t),i},v(fi,li),e(fi.prototype,{insert:function(t,e){var n=li.getSubnodeIndex(t,fi.origin.x,fi.origin.y);if(-1===n)return this.add(e),null;var i=this._subnode[n];if(null===i||!i.getEnvelope().contains(t)){var r=ci.createExpanded(i,t);this._subnode[n]=r}this.insertContained(this._subnode[n],t,e)},isSearchMatch:function(t){return!0},insertContained:function(t,e,n){x.isTrue(t.getEnvelope().contains(e));var i=ln.isZeroWidth(e.getMinX(),e.getMaxX()),r=ln.isZeroWidth(e.getMinY(),e.getMaxY());(i||r?t.find(e):t.getNode(e)).add(n)},interfaces_:function(){return[]},getClass:function(){return fi}}),fi.origin=new E(0,0),e(gi.prototype,{insert:function(t,e){},remove:function(t,e){},query:function(){},interfaces_:function(){return[]},getClass:function(){return gi}}),e(di.prototype,{size:function(){return null!==this._root?this._root.size():0},insert:function(t,e){this.collectStats(t);var n=di.ensureExtent(t,this._minExtent);this._root.insert(n,e)},query:function(){if(1===arguments.length){var t=arguments[0],e=new Me;return this.query(t,e),e.getItems()}if(2===arguments.length){var n=arguments[0],i=arguments[1];this._root.visit(n,i)}},queryAll:function(){var t=new P;return this._root.addAllItems(t),t},remove:function(t,e){var n=di.ensureExtent(t,this._minExtent);return this._root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e<this._minExtent&&e>0&&(this._minExtent=e);var n=t.getHeight();n<this._minExtent&&n>0&&(this._minExtent=n)},depth:function(){return null!==this._root?this._root.depth():0},isEmpty:function(){return null===this._root||this._root.isEmpty()},interfaces_:function(){return[gi,p]},getClass:function(){return di}}),di.ensureExtent=function(t,e){var n=t.getMinX(),i=t.getMaxX(),r=t.getMinY(),s=t.getMaxY();return n!==i&&r!==s?t:(n===i&&(i=(n-=e/2)+e/2),r===s&&(s=(r-=e/2)+e/2),new M(n,i,r,s))},di.serialVersionUID=-0x678b60c967a25400;var _i=Object.freeze({Quadtree:di});function pi(){}function mi(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}function vi(){this._size=null,this._items=null,this._size=0,this._items=new P,this._items.add(null)}function yi(){this.normalOrder=null;var t=arguments[0];this.normalOrder=t}function xi(){if(this._childBoundables=new P,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}}function Ei(){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()}function Ii(){if(this._root=null,this._built=!1,this._itemBoundables=new P,this._nodeCapacity=null,0===arguments.length)Ii.call(this,Ii.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];x.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}function Ni(){}function Ci(){if(0===arguments.length)Ci.call(this,Ci.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];Ii.call(this,t)}}function Si(){var t=arguments[0];xi.call(this,t)}e(pi.prototype,{getBounds:function(){},interfaces_:function(){return[]},getClass:function(){return pi}}),e(mi.prototype,{getItem:function(){return this._item},getBounds:function(){return this._bounds},interfaces_:function(){return[pi,p]},getClass:function(){return mi}}),e(vi.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},size:function(){return this._size},reorder:function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(n)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)},clear:function(){this._size=0,this._items.clear()},isEmpty:function(){return 0===this._size},add:function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},interfaces_:function(){return[]},getClass:function(){return vi}}),e(yi.prototype,{compare:function(t,e){var n=t.getDistance(),i=e.getDistance();return this.normalOrder?n>i?1:n===i?0:-1:n>i?-1:n===i?0:1},interfaces_:function(){return[_,p]},getClass:function(){return yi}}),e(xi.prototype,{getLevel:function(){return this._level},size:function(){return this._childBoundables.size()},getChildBoundables:function(){return this._childBoundables},addChildBoundable:function(t){x.isTrue(null===this._bounds),this._childBoundables.add(t)},isEmpty:function(){return this._childBoundables.isEmpty()},getBounds:function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},interfaces_:function(){return[pi,p]},getClass:function(){return xi}}),xi.serialVersionUID=0x5a1e55ec41369800,e(Ei.prototype,{expandToQueue:function(t,e){var n=Ei.isComposite(this._boundable1),r=Ei.isComposite(this._boundable2);if(n&&r)return Ei.area(this._boundable1)>Ei.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(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new i("neither boundable is composite")},isLeaves:function(){return!(Ei.isComposite(this._boundable1)||Ei.isComposite(this._boundable2))},compareTo:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},expand:function(t,e,n,i){for(var r=t.getChildBoundables().iterator();r.hasNext();){var s=new Ei(r.next(),e,this._itemDistance);s.getDistance()<i&&n.add(s)}},getBoundable:function(t){return 0===t?this._boundable1:this._boundable2},getDistance:function(){return this._distance},distance:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},interfaces_:function(){return[g]},getClass:function(){return Ei}}),Ei.area=function(t){return t.getBounds().getArea()},Ei.isComposite=function(t){return t instanceof xi},e(Ii.prototype,{queryInternal:function(){if(N(arguments[2],Ce)&&arguments[0]instanceof Object&&arguments[1]instanceof xi)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=e.getChildBoundables(),r=0;r<i.size();r++){var s=i.get(r);this.getIntersectsOp().intersects(s.getBounds(),t)&&(s instanceof xi?this.queryInternal(t,s,n):s instanceof mi?n.visitItem(s.getItem()):x.shouldNeverReachHere())}else if(N(arguments[2],w)&&arguments[0]instanceof Object&&arguments[1]instanceof xi){var o=arguments[0],a=arguments[1],u=arguments[2];for(i=a.getChildBoundables(),r=0;r<i.size();r++){s=i.get(r);this.getIntersectsOp().intersects(s.getBounds(),o)&&(s instanceof xi?this.queryInternal(o,s,u):s instanceof mi?u.add(s.getItem()):x.shouldNeverReachHere())}}},getNodeCapacity:function(){return this._nodeCapacity},lastNode:function(t){return t.get(t.size()-1)},size:function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof xi?t+=this.size(n):n instanceof mi&&(t+=1)}return t}},removeItem:function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof mi&&r.getItem()===e&&(n=r)}return null!==n&&(t.getChildBoundables().remove(n),!0)},itemsTree:function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new P:t}if(1===arguments.length){for(var e=arguments[0],n=new P,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();if(r instanceof xi){var s=this.itemsTree(r);null!==s&&n.add(s)}else r instanceof mi?n.add(r.getItem()):x.shouldNeverReachHere()}return n.size()<=0?null:n}},insert:function(t,e){x.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new mi(t,e))},boundablesAtLevel:function(){if(1===arguments.length){var t=arguments[0],e=new P;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(x.isTrue(n>-2),i.getLevel()===n)return r.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var o=s.next();o instanceof xi?this.boundablesAtLevel(n,o,r):(x.isTrue(o instanceof mi),-1===n&&r.add(o))}return null}},query:function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new P;return this.isEmpty()?e:(this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e)}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,i)}},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},getRoot:function(){return this.build(),this._root},remove:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=this.removeItem(i,r);if(s)return!0;for(var o=null,a=i.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&(u instanceof xi&&(s=this.remove(n,u,r)))){o=u;break}}return null!==o&&o.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(o),s}},createHigherLevels:function(t,e){x.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},depth:function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof xi){var i=this.depth(n);i>t&&(t=i)}}return t+1}},createParentBoundables:function(t,e){x.isTrue(!t.isEmpty());var n=new P;n.add(this.createNode(e));var i=new P(t);Te.sort(i,this.getComparator());for(var r=i.iterator();r.hasNext();){var s=r.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(s)}return n},isEmpty:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},interfaces_:function(){return[p]},getClass:function(){return Ii}}),Ii.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Ii.IntersectsOp=function(){},Ii.serialVersionUID=-0x35ef64c82d4c5400,Ii.DEFAULT_NODE_CAPACITY=10,e(Ni.prototype,{distance:function(t,e){},interfaces_:function(){return[]},getClass:function(){return Ni}}),v(Ci,Ii),e(Ci.prototype,{createParentBoundablesFromVerticalSlices:function(t,e){x.isTrue(t.length>0);for(var n=new P,i=0;i<t.length;i++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[i],e));return n},createNode:function(t){return new Si(t)},size:function(){return 0===arguments.length?Ii.prototype.size.call(this):Ii.prototype.size.apply(this,arguments)},insert:function(){if(!(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof M))return Ii.prototype.insert.apply(this,arguments);var t=arguments[0],e=arguments[1];if(t.isNull())return null;Ii.prototype.insert.call(this,t,e)},getIntersectsOp:function(){return Ci.intersectsOp},verticalSlices:function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),i=new Array(e).fill(null),r=t.iterator(),s=0;s<e;s++){i[s]=new P;for(var o=0;r.hasNext()&&o<n;){var a=r.next();i[s].add(a),o++}}return i},query:function(){if(1===arguments.length){var t=arguments[0];return Ii.prototype.query.call(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];Ii.prototype.query.call(this,e,n)}},getComparator:function(){return Ci.yComparator},createParentBoundablesFromVerticalSlice:function(t,e){return Ii.prototype.createParentBoundables.call(this,t,e)},remove:function(){if(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof M){var t=arguments[0],e=arguments[1];return Ii.prototype.remove.call(this,t,e)}return Ii.prototype.remove.apply(this,arguments)},depth:function(){return 0===arguments.length?Ii.prototype.depth.call(this):Ii.prototype.depth.apply(this,arguments)},createParentBoundables:function(t,e){x.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new P(t);Te.sort(i,Ci.xComparator);var r=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(r,e)},nearestNeighbour:function(){if(1===arguments.length){if(N(arguments[0],Ni)){var t=arguments[0],e=new Ei(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof Ei){var n=arguments[0];return this.nearestNeighbour(n,s.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof Ci&&N(arguments[1],Ni)){var i=arguments[0],r=arguments[1];e=new Ei(this.getRoot(),i.getRoot(),r);return this.nearestNeighbour(e)}if(arguments[0]instanceof Ei&&"number"==typeof arguments[1]){var o=arguments[0],a=arguments[1],u=null;for((_=new vi).add(o);!_.isEmpty()&&a>0;){if((E=(x=_.poll()).getDistance())>=a)break;x.isLeaves()?(a=E,u=x):x.expandToQueue(_,a)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}if(arguments[0]instanceof Ei&&Number.isInteger(arguments[1])){var l=arguments[0],h=arguments[1];return this.nearestNeighbour(l,s.POSITIVE_INFINITY,h)}}else if(3===arguments.length){if(N(arguments[2],Ni)&&arguments[0]instanceof M&&arguments[1]instanceof Object){var c=arguments[0],f=arguments[1],g=arguments[2],d=new mi(c,f);e=new Ei(this.getRoot(),d,g);return this.nearestNeighbour(e)[0]}if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ei&&"number"==typeof arguments[1]){var _,p=arguments[0],m=arguments[1],v=arguments[2];a=m;(_=new vi).add(p);for(var y=new java.util.PriorityQueue<Ei>new yi(!1);!_.isEmpty()&&a>=0;){var x,E;if((E=(x=_.poll()).getDistance())>=a)break;x.isLeaves()?y.size()<v?y.add(x):(y.peek().getDistance()>E&&(y.poll(),y.add(x)),a=y.peek().getDistance()):x.expandToQueue(_,a)}return Ci.getItems(y)}}else if(4===arguments.length){var I=arguments[0],C=arguments[1],S=arguments[2],L=arguments[3];d=new mi(I,C),e=new Ei(this.getRoot(),d,S);return this.nearestNeighbour(e,L)}},interfaces_:function(){return[gi,p]},getClass:function(){return Ci}}),Ci.centreX=function(t){return Ci.avg(t.getMinX(),t.getMaxX())},Ci.avg=function(t,e){return(t+e)/2},Ci.getItems=function(t){for(var e=new Array(t.size()).fill(null),n=t.iterator(),i=0;n.hasNext();)e[i]=n.next().getBoundable(0).getItem(),i++;return e},Ci.centreY=function(t){return Ci.avg(t.getMinY(),t.getMaxY())},v(Si,xi),e(Si.prototype,{computeBounds:function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new M(n.getBounds()):t.expandToInclude(n.getBounds())}return t},interfaces_:function(){return[]},getClass:function(){return Si}}),Ci.STRtreeNode=Si,Ci.serialVersionUID=0x39920f7d5f261e0,Ci.xComparator={interfaces_:function(){return[_]},compare:function(t,e){return Ii.compareDoubles(Ci.centreX(t.getBounds()),Ci.centreX(e.getBounds()))}},Ci.yComparator={interfaces_:function(){return[_]},compare:function(t,e){return Ii.compareDoubles(Ci.centreY(t.getBounds()),Ci.centreY(e.getBounds()))}},Ci.intersectsOp={interfaces_:function(){return[IntersectsOp]},intersects:function(t,e){return t.intersects(e)}},Ci.DEFAULT_NODE_CAPACITY=10;var Li=Object.freeze({STRtree:Ci}),wi=Object.freeze({kdtree:ui,quadtree:_i,strtree:Li}),Ri=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];function Ti(t){this.geometryFactory=t||new se}e(Ti.prototype,{read:function(t){var e=void 0,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!Pi[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Ri.indexOf(n)?Pi[n].call(this,e.coordinates):"GeometryCollection"===n?Pi[n].call(this,e.geometries):Pi[n].call(this,e)},write:function(t){var e=t.getGeometryType();if(!Oi[e])throw new Error("Geometry is not supported");return Oi[e].call(this,t)}});var Pi={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var i=t.geometry.type;if(!Pi[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Pi.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.call(this,t.bbox)),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(new E(i[0],i[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new E(t[0],t[1]),new E(t[2],t[1]),new E(t[2],t[3]),new E(t[0],t[3]),new E(t[0],t[1])])},Point:function(t){var e=new E(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Pi.Point.call(this,t[n]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=Pi.coordinates.call(this,t);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Pi.LineString.call(this,t[n]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Pi.coordinates.call(this,t[0]),n=this.geometryFactory.createLinearRing(e),i=[],r=1;r<t.length;++r){var s=t[r],o=Pi.coordinates.call(this,s),a=this.geometryFactory.createLinearRing(o);i.push(a)}return this.geometryFactory.createPolygon(n,i)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(Pi.Polygon.call(this,i))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(this.read(i))}return this.geometryFactory.createGeometryCollection(e)}},Oi={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Oi.coordinate.call(this,t.getCoordinate())}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=Oi.Point.call(this,i);e.push(r.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),i=0;i<n.length;++i){var r=n[i];e.push(Oi.coordinate.call(this,r))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=Oi.LineString.call(this,i);e.push(r.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=Oi.LineString.call(this,t._shell);e.push(n.coordinates);for(var i=0;i<t._holes.length;++i){var r=t._holes[i],s=Oi.LineString.call(this,r);e.push(s.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=Oi.Polygon.call(this,i);e.push(r.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=i.getGeometryType();e.push(Oi[r].call(this,i))}return{type:"GeometryCollection",geometries:e}}};function bi(t){this.parser=new Ti(t||new se)}function Mi(){this.parser=new Ti(this.geometryFactory)}function Di(t){this.parser=new ae(t||new se)}function Ai(t){return[t.x,t.y]}function Fi(t,e){this.geometryFactory=t||new se,this.ol=e||"undefined"!=typeof ol&&ol}e(bi.prototype,{read:function(t){return this.parser.read(t)}}),e(Mi.prototype,{write:function(t){return this.parser.write(t)}}),e(Di.prototype,{read:function(t){return this.parser.read(t)}}),e(Fi.prototype,{inject:function(t,e,n,i,r,s,o,a){this.ol={geom:{Point:t,LineString:e,LinearRing:n,Polygon:i,MultiPoint:r,MultiLineString:s,MultiPolygon:o,GeometryCollection:a}}},read:function(t){var e=this.ol;return t instanceof e.geom.Point?this.convertFromPoint(t):t instanceof e.geom.LineString?this.convertFromLineString(t):t instanceof e.geom.LinearRing?this.convertFromLinearRing(t):t instanceof e.geom.Polygon?this.convertFromPolygon(t):t instanceof e.geom.MultiPoint?this.convertFromMultiPoint(t):t instanceof e.geom.MultiLineString?this.convertFromMultiLineString(t):t instanceof e.geom.MultiPolygon?this.convertFromMultiPolygon(t):t instanceof e.geom.GeometryCollection?this.convertFromCollection(t):void 0},convertFromPoint:function(t){var e=t.getCoordinates();return this.geometryFactory.createPoint(new E(e[0],e[1]))},convertFromLineString:function(t){return this.geometryFactory.createLineString(t.getCoordinates().map(function(t){return new E(t[0],t[1])}))},convertFromLinearRing:function(t){return this.geometryFactory.createLinearRing(t.getCoordinates().map(function(t){return new E(t[0],t[1])}))},convertFromPolygon:function(t){for(var e=t.getLinearRings(),n=null,i=[],r=0;r<e.length;r++){var s=this.convertFromLinearRing(e[r]);0===r?n=s:i.push(s)}return this.geometryFactory.createPolygon(n,i)},convertFromMultiPoint:function(t){var e=t.getPoints().map(function(t){return this.convertFromPoint(t)},this);return this.geometryFactory.createMultiPoint(e)},convertFromMultiLineString:function(t){var e=t.getLineStrings().map(function(t){return this.convertFromLineString(t)},this);return this.geometryFactory.createMultiLineString(e)},convertFromMultiPolygon:function(t){var e=t.getPolygons().map(function(t){return this.convertFromPolygon(t)},this);return this.geometryFactory.createMultiPolygon(e)},convertFromCollection:function(t){var e=t.getGeometries().map(function(t){return this.read(t)},this);return this.geometryFactory.createGeometryCollection(e)},write:function(t){return"Point"===t.getGeometryType()?this.convertToPoint(t.getCoordinate()):"LineString"===t.getGeometryType()?this.convertToLineString(t):"LinearRing"===t.getGeometryType()?this.convertToLinearRing(t):"Polygon"===t.getGeometryType()?this.convertToPolygon(t):"MultiPoint"===t.getGeometryType()?this.convertToMultiPoint(t):"MultiLineString"===t.getGeometryType()?this.convertToMultiLineString(t):"MultiPolygon"===t.getGeometryType()?this.convertToMultiPolygon(t):"GeometryCollection"===t.getGeometryType()?this.convertToCollection(t):void 0},convertToPoint:function(t){return new this.ol.geom.Point([t.x,t.y])},convertToLineString:function(t){var e=t._points._coordinates.map(Ai);return new this.ol.geom.LineString(e)},convertToLinearRing:function(t){var e=t._points._coordinates.map(Ai);return new this.ol.geom.LinearRing(e)},convertToPolygon:function(t){for(var e=[t._shell._points._coordinates.map(Ai)],n=0;n<t._holes.length;n++)e.push(t._holes[n]._points._coordinates.map(Ai));return new this.ol.geom.Polygon(e)},convertToMultiPoint:function(t){return new this.ol.geom.MultiPoint(t.getCoordinates().map(Ai))},convertToMultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;n++)e.push(this.convertToLineString(t._geometries[n]).getCoordinates());return new this.ol.geom.MultiLineString(e)},convertToMultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;n++)e.push(this.convertToPolygon(t._geometries[n]).getCoordinates());return new this.ol.geom.MultiPolygon(e)},convertToCollection:function(t){for(var e=[],n=0;n<t._geometries.length;n++){var i=t._geometries[n];e.push(this.write(i))}return new this.ol.geom.GeometryCollection(e)}});var Gi=Object.freeze({GeoJSONReader:bi,GeoJSONWriter:Mi,OL3Parser:Fi,WKTReader:Di,WKTWriter:he});function qi(){}function Bi(){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 E(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))}function Vi(){this._nodeMap=new pt,this._edge=null;var t=arguments[0];this._edge=t}function zi(){this._nodeList=null,this._edge=null,this._nodeIt=null,this._currNode=null,this._nextNode=null,this._currSegIndex=0;var t=arguments[0];this._nodeList=t,this._edge=t.getEdge(),this._nodeIt=t.iterator(),this.readNextNode()}function Yi(){}function ki(){}function Ui(){}function Xi(){this._nodeList=new Vi(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}function Hi(){this._overlapSeg1=new ge,this._overlapSeg2=new ge}function Wi(){}function ji(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}}function Ki(){if(this._monoChains=new P,this._index=new Ci,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,0===arguments.length);else if(1===arguments.length){var t=arguments[0];ji.call(this,t)}}function Zi(){Hi.apply(this),this._si=null;var t=arguments[0];this._si=t}function Qi(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];Qi.call(this,t,e,0,0)}else if(4===arguments.length){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._isScaled=!this.isIntegerPrecision()}}e(qi.prototype,{interfaces_:function(){return[]},getClass:function(){return qi}}),qi.relativeSign=function(t,e){return t<e?-1:t>e?1:0},qi.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=qi.relativeSign(e.x,n.x),r=qi.relativeSign(e.y,n.y);switch(t){case 0:return qi.compareValue(i,r);case 1:return qi.compareValue(r,i);case 2:return qi.compareValue(r,-i);case 3:return qi.compareValue(-i,r);case 4:return qi.compareValue(-i,-r);case 5:return qi.compareValue(-r,-i);case 6:return qi.compareValue(-r,i);case 7:return qi.compareValue(i,-r)}return x.shouldNeverReachHere("invalid octant value"),0},qi.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0},e(Bi.prototype,{getCoordinate:function(){return this.coord},print:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},compareTo:function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:qi.compare(this._segmentOctant,this.coord,e.coord)},isEndPoint:function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},isInterior:function(){return this._isInterior},interfaces_:function(){return[g]},getClass:function(){return Bi}}),e(Vi.prototype,{getSplitCoordinates:function(){var t=new b;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next();this.addEdgeCoordinates(n,i,t),n=i}return t.toCoordinateArray()},addCollapsedNodes:function(){var t=new P;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},print:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},findCollapsesFromExistingVertices:function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),i=(this._edge.getCoordinate(e+1),this._edge.getCoordinate(e+2));n.equals2D(i)&&t.add(new G(e+1))}},addEdgeCoordinates:function(t,e,n){e.segmentIndex,t.segmentIndex;var i=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(i);n.add(new E(t.coord),!1);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)n.add(this._edge.getCoordinate(s));r&&n.add(new E(e.coord))},iterator:function(){return this._nodeMap.values().iterator()},addSplitEdges:function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}},findCollapseIndex:function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,1===i&&(n[0]=t.segmentIndex+1,!0)},findCollapsesFromInsertedNodes:function(t){for(var e=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();this.findCollapseIndex(i,r,e)&&t.add(new G(e[0])),i=r}},getEdge:function(){return this._edge},addEndpoints:function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},createSplitEdge:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(i);r||n--;var s=new Array(n).fill(null),o=0;s[o++]=new E(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)s[o++]=this._edge.getCoordinate(a);return r&&(s[o]=new E(e.coord)),new Xi(s,this._edge.getData())},add:function(t,e){var n=new Bi(this._edge,t,e,this._edge.getSegmentOctant(e)),i=this._nodeMap.get(n);return null!==i?(x.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)},checkSplitEdgesCorrectness:function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new m("bad split edge start point at "+n);var i=t.get(t.size()-1).getCoordinates(),r=i[i.length-1];if(!r.equals2D(e[e.length-1]))throw new m("bad split edge end point at "+r)},interfaces_:function(){return[]},getClass:function(){return Vi}}),e(zi.prototype,{next:function(){return null===this._currNode?(this._currNode=this._nextNode,this._currSegIndex=this._currNode.segmentIndex,this.readNextNode(),this._currNode):null===this._nextNode?null:this._nextNode.segmentIndex===this._currNode.segmentIndex?(this._currNode=this._nextNode,this._currSegIndex=this._currNode.segmentIndex,this.readNextNode(),this._currNode):(this._nextNode.segmentIndex,this._currNode.segmentIndex,null)},remove:function(){throw new UnsupportedOperationException(this.getClass().getName())},hasNext:function(){return null!==this._nextNode},readNextNode:function(){this._nodeIt.hasNext()?this._nextNode=this._nodeIt.next():this._nextNode=null},interfaces_:function(){return[C]},getClass:function(){return zi}}),e(Yi.prototype,{interfaces_:function(){return[]},getClass:function(){return Yi}}),Yi.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new i("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof E&&arguments[1]instanceof E){var s=arguments[0],o=arguments[1],a=o.x-s.x,u=o.y-s.y;if(0===a&&0===u)throw new i("Cannot compute the octant for two identical points "+s);return Yi.octant(a,u)}},e(ki.prototype,{getCoordinates:function(){},size:function(){},getCoordinate:function(t){},isClosed:function(){},setData:function(t){},getData:function(){},interfaces_:function(){return[]},getClass:function(){return ki}}),e(Ui.prototype,{addIntersection:function(t,e){},interfaces_:function(){return[ki]},getClass:function(){return Ui}}),e(Xi.prototype,{getCoordinates:function(){return this._pts},size:function(){return this._pts.length},getCoordinate:function(t){return this._pts[t]},isClosed:function(){return this._pts[0].equals(this._pts[this._pts.length-1])},getSegmentOctant:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},setData:function(t){this._data=t},safeOctant:function(t,e){return t.equals2D(e)?0:Yi.octant(t,e)},getData:function(){return this._data},addIntersection:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=(arguments[2],arguments[3]),s=new E(n.getIntersection(r));this.addIntersection(s,i)}},toString:function(){return he.toLineString(new Kt(this._pts))},getNodeList:function(){return this._nodeList},addIntersectionNode:function(t,e){var n=e,i=n+1;if(i<this._pts.length){var r=this._pts[i];t.equals2D(r)&&(n=i)}return this._nodeList.add(t,n)},addIntersections:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)},interfaces_:function(){return[Ui]},getClass:function(){return Xi}}),Xi.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new P;return Xi.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[0],i=arguments[1],r=n.iterator();r.hasNext();){r.next().getNodeList().addSplitEdges(i)}},e(Hi.prototype,{overlap:function(){if(2===arguments.length);else if(4===arguments.length){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)}},interfaces_:function(){return[]},getClass:function(){return Hi}}),e(Wi.prototype,{computeNodes:function(t){},getNodedSubstrings:function(){},interfaces_:function(){return[]},getClass:function(){return Wi}}),e(ji.prototype,{setSegmentIntersector:function(t){this._segInt=t},interfaces_:function(){return[Wi]},getClass:function(){return ji}}),v(Ki,ji),e(Ki.prototype,{getMonotoneChains:function(){return this._monoChains},getNodedSubstrings:function(){return Xi.getNodedSubstrings(this._nodedSegStrings)},getIndex:function(){return this._index},add:function(t){for(var e=dn.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}},computeNodes:function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},intersectChains:function(){for(var t=new Zi(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),i=this._index.query(n.getEnvelope()).iterator();i.hasNext();){var r=i.next();if(r.getId()>n.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},interfaces_:function(){return[]},getClass:function(){return Ki}}),v(Zi,Hi),e(Zi.prototype,{overlap:function(){if(4!==arguments.length)return Hi.prototype.overlap.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3],r=t.getContext(),s=n.getContext();this._si.processIntersections(r,e,s,i)},interfaces_:function(){return[]},getClass:function(){return Zi}}),Ki.SegmentOverlapAction=Zi,e(Qi.prototype,{rescale:function(){if(N(arguments[0],S))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){var n=arguments[0];2===n.length&&(new E(n[0]),new E(n[1]));for(t=0;t<n.length;t++)n[t].x=n[t].x/this._scaleFactor+this._offsetX,n[t].y=n[t].y/this._scaleFactor+this._offsetY;2===n.length&&n[0].equals2D(n[1])&&Y.out.println(n)}},scale:function(){if(N(arguments[0],S)){for(var t=arguments[0],e=new P(t.size()),n=t.iterator();n.hasNext();){var i=n.next();e.add(new Xi(this.scale(i.getCoordinates()),i.getData()))}return e}if(arguments[0]instanceof Array){var r=arguments[0],s=new Array(r.length).fill(null);for(n=0;n<r.length;n++)s[n]=new E(Math.round((r[n].x-this._offsetX)*this._scaleFactor),Math.round((r[n].y-this._offsetY)*this._scaleFactor),r[n].z);return nt.removeRepeatedPoints(s)}},isIntegerPrecision:function(){return 1===this._scaleFactor},getNodedSubstrings:function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},computeNodes:function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},interfaces_:function(){return[Wi]},getClass:function(){return Qi}});var Ji=Object.freeze({MCIndexNoder:Ki,ScaledNoder:Qi,SegmentString:ki});function $i(){if(this._inputGeom=null,this._isClosedEndpointsInInterior=!0,this._nonSimpleLocation=null,1===arguments.length){var t=arguments[0];this._inputGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._inputGeom=e,this._isClosedEndpointsInInterior=!n.isInBoundary(2)}}function tr(){this.pt=null,this.isClosed=null,this.degree=null;var t=arguments[0];this.pt=t,this.isClosed=!1,this.degree=0}function er(){if(this._quadrantSegments=er.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=er.CAP_ROUND,this._joinStyle=er.JOIN_ROUND,this._mitreLimit=er.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=er.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setQuadrantSegments(t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(r),this.setJoinStyle(s),this.setMitreLimit(o)}}function nr(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}function ir(){this.array_=[]}function rr(){this._finder=null,this._dirEdgeList=new P,this._nodes=new P,this._rightMostCoord=null,this._env=null,this._finder=new nr}function sr(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new P,this._pts=new P,this._label=new zn(de.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new P,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()}function or(){var t=arguments[0],e=arguments[1];sr.call(this,t,e)}function ar(){var t=arguments[0],e=arguments[1];sr.call(this,t,e)}function ur(){this._geometryFactory=null,this._shellList=new P;var t=arguments[0];this._geometryFactory=t}function lr(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=z.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}function hr(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new P}function cr(){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 ge,this._seg1=new ge,this._offset0=new ge,this._offset1=new ge,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 fe,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===er.JOIN_ROUND&&(this._closingSegLengthFactor=cr.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}function fr(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}function gr(){this._subgraphs=null,this._seg=new ge;var t=arguments[0];this._subgraphs=t}function dr(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new ge(t),this._leftDepth=e}function _r(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new P;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n}function pr(){this._edgeMap=new pt,this._edgeList=null,this._ptInAreaLocation=[de.NONE,de.NONE]}function mr(){pr.apply(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}function vr(){ti.apply(this)}function yr(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=yr.orientation(t)}function xr(){this._edges=new P,this._ocaMap=new pt}function Er(){}function Ir(){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}function Nr(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new xr;var t=arguments[0];this._bufParams=t}function Cr(){this._li=new fe,this._segStrings=null;var t=arguments[0];this._segStrings=t}function Sr(){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 i("Scale factor must be non-zero");1!==e&&(this._pt=new E(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new E,this._p1Scaled=new E),this.initCorners(this._pt)}function Lr(){this._index=null;var t=arguments[0];this._index=t}function wr(){nn.apply(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._hotPixel=t,this._parentEdge=e,this._hotPixelVertexIndex=n}function Rr(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new P}function Tr(){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 fe,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()}function Pr(){if(this._argGeom=null,this._distance=null,this._bufParams=new er,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}}e($i.prototype,{isSimpleMultiPoint:function(t){if(t.isEmpty())return!0;for(var e=new yt,n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n).getCoordinate();if(e.contains(i))return this._nonSimpleLocation=i,!1;e.add(i)}return!0},isSimplePolygonal:function(t){for(var e=be.getLines(t).iterator();e.hasNext();){var n=e.next();if(!this.isSimpleLinearGeometry(n))return!1}return!0},hasClosedEndpointIntersection:function(t){for(var e=new pt,n=t.getEdgeIterator();n.hasNext();){var i=n.next(),r=(i.getMaximumSegmentIndex(),i.isClosed()),s=i.getCoordinate(0);this.addEndpoint(e,s,r);var o=i.getCoordinate(i.getNumPoints()-1);this.addEndpoint(e,o,r)}for(n=e.values().iterator();n.hasNext();){var a=n.next();if(a.isClosed&&2!==a.degree)return this._nonSimpleLocation=a.getCoordinate(),!0}return!1},getNonSimpleLocation:function(){return this._nonSimpleLocation},isSimpleLinearGeometry:function(t){if(t.isEmpty())return!0;var e=new ni(0,t),n=new fe,i=e.computeSelfNodes(n,!0);return!i.hasIntersection()||(i.hasProperIntersection()?(this._nonSimpleLocation=i.getProperIntersectionPoint(),!1):!this.hasNonEndpointIntersection(e)&&(!this._isClosedEndpointsInInterior||!this.hasClosedEndpointIntersection(e)))},hasNonEndpointIntersection:function(t){for(var e=t.getEdgeIterator();e.hasNext();)for(var n=e.next(),i=n.getMaximumSegmentIndex(),r=n.getEdgeIntersectionList().iterator();r.hasNext();){var s=r.next();if(!s.isEndPoint(i))return this._nonSimpleLocation=s.getCoordinate(),!0}return!1},addEndpoint:function(t,e,n){var i=t.get(e);null===i&&(i=new tr(e),t.put(e,i)),i.addEndpoint(n)},computeSimple:function(t){return this._nonSimpleLocation=null,!!t.isEmpty()||(t instanceof At?this.isSimpleLinearGeometry(t):t instanceof wt?this.isSimpleLinearGeometry(t):t instanceof zt?this.isSimpleMultiPoint(t):N(t,Bt)?this.isSimplePolygonal(t):!(t instanceof Lt)||this.isSimpleGeometryCollection(t))},isSimple:function(){return this._nonSimpleLocation=null,this.computeSimple(this._inputGeom)},isSimpleGeometryCollection:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);if(!this.computeSimple(n))return!1}return!0},interfaces_:function(){return[]},getClass:function(){return $i}}),$i.isSimple=function(){return 1===arguments.length?new $i(arguments[0]).isSimple():2===arguments.length?new $i(arguments[0],arguments[1]).isSimple():void 0},e(tr.prototype,{addEndpoint:function(t){this.degree++,this.isClosed|=t},getCoordinate:function(){return this.pt},interfaces_:function(){return[]},getClass:function(){return tr}}),$i.EndpointInfo=tr,e(er.prototype,{getEndCapStyle:function(){return this._endCapStyle},isSingleSided:function(){return this._isSingleSided},setQuadrantSegments:function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=er.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=er.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==er.JOIN_ROUND&&(this._quadrantSegments=er.DEFAULT_QUADRANT_SEGMENTS)},getJoinStyle:function(){return this._joinStyle},setJoinStyle:function(t){this._joinStyle=t},setSimplifyFactor:function(t){this._simplifyFactor=t<0?0:t},getSimplifyFactor:function(){return this._simplifyFactor},getQuadrantSegments:function(){return this._quadrantSegments},setEndCapStyle:function(t){this._endCapStyle=t},getMitreLimit:function(){return this._mitreLimit},setMitreLimit:function(t){this._mitreLimit=t},setSingleSided:function(t){this._isSingleSided=t},interfaces_:function(){return[]},getClass:function(){return er}}),er.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},er.CAP_ROUND=1,er.CAP_FLAT=2,er.CAP_SQUARE=3,er.JOIN_ROUND=1,er.JOIN_MITRE=2,er.JOIN_BEVEL=3,er.DEFAULT_QUADRANT_SEGMENTS=8,er.DEFAULT_MITRE_LIMIT=5,er.DEFAULT_SIMPLIFY_FACTOR=.01,e(nr.prototype,{getCoordinate:function(){return this._minCoord},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},findRightmostEdgeAtVertex:function(){var t=this._minDe.getEdge().getCoordinates();x.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=z.index(this._minCoord,n,e),r=!1;e.y<this._minCoord.y&&n.y<this._minCoord.y&&i===z.COUNTERCLOCKWISE?r=!0:e.y>this._minCoord.y&&n.y>this._minCoord.y&&i===z.CLOCKWISE&&(r=!0),r&&(this._minIndex=this._minIndex-1)},getRightmostSideOfSegment:function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var i=Dn.LEFT;return n[e].y<n[e+1].y&&(i=Dn.RIGHT),i},getEdge:function(){return this._orientedDe},checkForRightmostCoordinate:function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(null===this._minCoord||e[n].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},findRightmostEdgeAtNode:function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},findEdge:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}x.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===Dn.LEFT&&(this._orientedDe=this._minDe.getSym())},interfaces_:function(){return[]},getClass:function(){return nr}}),ir.prototype.addLast=function(t){this.array_.push(t)},ir.prototype.removeFirst=function(){return this.array_.shift()},ir.prototype.isEmpty=function(){return 0===this.array_.length},e(rr.prototype,{clearVisitedEdges:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},getRightmostCoordinate:function(){return this._rightMostCoord},computeNodeDepth:function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){if((i=n.next()).isVisited()||i.getSym().isVisited()){e=i;break}}if(null===e)throw new Jn("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(n=t.getEdges().iterator();n.hasNext();){var i;(i=n.next()).setVisited(!0),this.copySymDepths(i)}},computeDepth:function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.getNode(),e.getLabel();e.setEdgeDepths(Dn.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},create:function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},findResultEdges:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(Dn.RIGHT)>=1&&e.getDepth(Dn.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},computeDepths:function(t){var e=new ut,n=new ir,i=t.getNode();for(n.addLast(i),e.add(i),t.setVisited(!0);!n.isEmpty();){var r=n.removeFirst();e.add(r),this.computeNodeDepth(r);for(var s=r.getEdges().iterator();s.hasNext();){var o=s.next().getSym();if(!o.isVisited()){var a=o.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},compareTo:function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},getEnvelope:function(){if(null===this._env){for(var t=new M,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;i<n.length-1;i++)t.expandToInclude(n[i]);this._env=t}return this._env},addReachable:function(t){var e=new je;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},copySymDepths:function(t){var e=t.getSym();e.setDepth(Dn.LEFT,t.getDepth(Dn.RIGHT)),e.setDepth(Dn.RIGHT,t.getDepth(Dn.LEFT))},add:function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var r=i.getSym().getNode();r.isVisited()||e.push(r)}},getNodes:function(){return this._nodes},getDirectedEdges:function(){return this._dirEdgeList},interfaces_:function(){return[g]},getClass:function(){return rr}}),e(sr.prototype,{computeRing:function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=z.isCCW(this._ring.getCoordinates())},isIsolated:function(){return 1===this._label.getGeometryCount()},computePoints:function(t){this._startDe=t;var e=t,n=!0;do{if(null===e)throw new Jn("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new Jn("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var i=e.getLabel();x.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},getLinearRing:function(){return this._ring},getCoordinate:function(t){return this._pts.get(t)},computeMaxNodeDegree:function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},addPoints:function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var s=r;s<i.length;s++)this._pts.add(i[s])}else{r=i.length-2;n&&(r=i.length-1);for(s=r;s>=0;s--)this._pts.add(i[s])}},isHole:function(){return this._isHole},setInResult:function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},containsPoint:function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!qe.isInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},addHole:function(t){this._holes.add(t)},isShell:function(){return null===this._shell},getLabel:function(){return this._label},getEdges:function(){return this._edges},getMaxNodeDegree:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},getShell:function(){return this._shell},mergeLabel:function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=e.getLocation(n,Dn.RIGHT);if(i===de.NONE)return null;if(this._label.getLocation(n)===de.NONE)return this._label.setLocation(n,i),null}},setShell:function(t){this._shell=t,null!==t&&t.addHole(this)},toPolygon:function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},interfaces_:function(){return[]},getClass:function(){return sr}}),v(or,sr),e(or.prototype,{setEdgeRing:function(t,e){t.setMinEdgeRing(e)},getNext:function(t){return t.getNextMin()},interfaces_:function(){return[]},getClass:function(){return or}}),v(ar,sr),e(ar.prototype,{buildMinimalRings:function(){var t=new P,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new or(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},setEdgeRing:function(t,e){t.setEdgeRing(e)},linkDirectedEdgesForMinimalEdgeRings:function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},getNext:function(t){return t.getNext()},interfaces_:function(){return[]},getClass:function(){return ar}}),e(ur.prototype,{sortShellsAndHoles:function(t,e,n){for(var i=t.iterator();i.hasNext();){var r=i.next();r.isHole()?n.add(r):e.add(r)}},computePolygons:function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);e.add(i)}return e},placeFreeHoles:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(null===i.getShell()){var r=this.findEdgeRingContaining(i,t);if(null===r)throw new Jn("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(r)}}},buildMinimalEdgeRings:function(t,e,n){for(var i=new P,r=t.iterator();r.hasNext();){var s=r.next();if(s.getMaxNodeDegree()>2){s.linkDirectedEdgesForMinimalEdgeRings();var o=s.buildMinimalRings(),a=this.findShell(o);null!==a?(this.placePolygonHoles(a,o),e.add(a)):n.addAll(o)}else i.add(s)}return i},containsPoint:function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},buildMaximalEdgeRings:function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()){var r=new ar(i,this._geometryFactory);e.add(r),r.setInResult()}}return e},placePolygonHoles:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}},getPolygons:function(){return this.computePolygons(this._shellList)},findEdgeRingContaining:function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),s=null,o=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();null!==s&&(o=s.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(i)&&qe.isInRing(r,l.getCoordinates())&&(c=!0),c&&(null===s||o.contains(h))&&(s=u)}return s},findShell:function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,e++)}return x.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},add:function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];ei.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),r=new P,s=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(s,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},interfaces_:function(){return[]},getClass:function(){return ur}}),e(lr.prototype,{isDeletable:function(t,e,n,i){var r=this._inputLine[t],s=this._inputLine[e],o=this._inputLine[n];return!!this.isConcave(r,s,o)&&(!!this.isShallow(r,s,o,i)&&this.isShallowSampled(r,s,t,n,i))},deleteShallowConcavities:function(){for(var t=1,e=(this._inputLine.length,this.findNextNonDeletedIndex(t)),n=this.findNextNonDeletedIndex(e),i=!1;n<this._inputLine.length;){var r=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=lr.DELETE,r=!0,i=!0),t=r?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return i},isShallowConcavity:function(t,e,n,i){return z.index(t,e,n)===this._angleOrientation&&X.pointToSegment(e,t,n)<i},isShallowSampled:function(t,e,n,i,r){var s=Math.trunc((i-n)/lr.NUM_PTS_TO_CHECK);s<=0&&(s=1);for(var o=n;o<i;o+=s)if(!this.isShallow(t,e,this._inputLine[o],r))return!1;return!0},isConcave:function(t,e,n){var i=z.index(t,e,n)===this._angleOrientation;return i},simplify:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=z.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},findNextNonDeletedIndex:function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===lr.DELETE;)e++;return e},isShallow:function(t,e,n,i){return X.pointToSegment(e,t,n)<i},collapseLine:function(){for(var t=new b,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==lr.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},interfaces_:function(){return[]},getClass:function(){return lr}}),lr.simplify=function(t,e){return new lr(t).simplify(e)},lr.INIT=0,lr.DELETE=1,lr.KEEP=1,lr.NUM_PTS_TO_CHECK=10,e(hr.prototype,{getCoordinates:function(){return this._ptList.toArray(hr.COORDINATE_ARRAY_TYPE)},setPrecisionModel:function(t){this._precisionModel=t},addPt:function(t){var e=new E(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},reverse:function(){},addPts:function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(n=t.length-1;n>=0;n--)this.addPt(t[n])},isRedundant:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},toString:function(){return(new se).createLineString(this.getCoordinates()).toString()},closeRing:function(){if(this._ptList.size()<1)return null;var t=new E(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(this._ptList.size()>=2&&this._ptList.get(this._ptList.size()-2),t.equals(e))return null;this._ptList.add(t)},setMinimumVertexDistance:function(t){this._minimimVertexDistance=t},interfaces_:function(){return[]},getClass:function(){return hr}}),hr.COORDINATE_ARRAY_TYPE=new Array(0).fill(null),e(cr.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=z.index(this._s0,this._s1,this._s2),i=n===z.CLOCKWISE&&this._side===Dn.LEFT||n===z.COUNTERCLOCKWISE&&this._side===Dn.RIGHT;0===n?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},addLineEndCap:function(t,e){var n=new ge(t,e),i=new ge;this.computeOffsetSegment(n,Dn.LEFT,this._distance,i);var r=new ge;this.computeOffsetSegment(n,Dn.RIGHT,this._distance,r);var s=e.x-t.x,o=e.y-t.y,a=Math.atan2(o,s);switch(this._bufParams.getEndCapStyle()){case er.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(e,a+Math.PI/2,a-Math.PI/2,z.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case er.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case er.CAP_SQUARE:var u=new E;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new E(i.p1.x+u.x,i.p1.y+u.y),h=new E(r.p1.x+u.x,r.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(h)}},getCoordinates:function(){return this._segList.getCoordinates()},addMitreJoin:function(t,e,n,i){var r=!0,s=null;try{s=k.intersection(e.p0,e.p1,n.p0,n.p1),(i<=0?1:s.distance(t)/Math.abs(i))>this._bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof A))throw t;s=new E(0,0),r=!1}r?this._segList.addPt(s):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},addOutsideTurn:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*cr.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===er.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===er.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},createSquare:function(t){this._segList.addPt(new E(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new E(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new E(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new E(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},addSegments:function(t,e){this._segList.addPts(t,e)},addFirstSegment:function(){this._segList.addPt(this._offset1.p0)},addCornerFillet:function(t,e,n,i,r){var s=e.x-t.x,o=e.y-t.y,a=Math.atan2(o,s),u=n.x-t.x,l=n.y-t.y,h=Math.atan2(l,u);i===z.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,a,h,i,r),this._segList.addPt(n)},addLastSegment:function(){this._segList.addPt(this._offset1.p1)},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)},addLimitedMitreJoin:function(t,e,n,i){var r=this._seg0.p1,s=pe.angle(r,this._seg0.p0),o=(pe.angle(r,this._seg1.p1),pe.angleBetweenOriented(this._seg0.p0,r,this._seg1.p1)/2),a=pe.normalize(s+o),u=pe.normalize(a+Math.PI),l=i*n,h=n-l*Math.abs(Math.sin(o)),c=new ge(r,new E(r.x+l*Math.cos(u),r.y+l*Math.sin(u))),f=c.pointAlongOffset(1,h),g=c.pointAlongOffset(1,-h);this._side===Dn.LEFT?(this._segList.addPt(f),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(f))},addDirectedFillet:function(t,e,n,i,r){var s=i===z.CLOCKWISE?-1:1,o=Math.abs(e-n),a=Math.trunc(o/this._filletAngleQuantum+.5);if(a<1)return null;var u;u=o/a;for(var l=0,h=new E;l<o;){var c=e+s*l;h.x=t.x+r*Math.cos(c),h.y=t.y+r*Math.sin(c),this._segList.addPt(h),l+=u}},computeOffsetSegment:function(t,e,n,i){var r=e===Dn.LEFT?1:-1,s=t.p1.x-t.p0.x,o=t.p1.y-t.p0.y,a=Math.sqrt(s*s+o*o),u=r*n*s/a,l=r*n*o/a;i.p0.x=t.p0.x-l,i.p0.y=t.p0.y+u,i.p1.x=t.p1.x-l,i.p1.y=t.p1.y+u},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*cr.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 E((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 E((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)}},createCircle:function(t){var e=new E(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},addBevelJoin:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},init:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new hr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*cr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},addCollinear:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===er.JOIN_BEVEL||this._bufParams.getJoinStyle()===er.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,z.CLOCKWISE,this._distance))},closeRing:function(){this._segList.closeRing()},hasNarrowConcaveAngle:function(){return this._hasNarrowConcaveAngle},interfaces_:function(){return[]},getClass:function(){return cr}}),cr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,cr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,cr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,cr.MAX_CLOSING_SEG_LEN_FACTOR=80,e(fr.prototype,{getOffsetCurve:function(t,e){if(this._distance=e,0===e)return null;var n=e<0,i=Math.abs(e),r=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],r):this.computeOffsetCurve(t,n,r);var s=r.getCoordinates();return n&&nt.reverse(s),s},computeSingleSidedBufferCurve:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var r=lr.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],Dn.LEFT),n.addFirstSegment();for(var o=s-2;o>=0;o--)n.addNextSegment(r[o],!0)}else{n.addSegments(t,!1);var a=lr.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],Dn.LEFT),n.addFirstSegment();for(o=2;o<=u;o++)n.addNextSegment(a[o],!0)}n.addLastSegment(),n.closeRing()},computeRingBufferCurve:function(t,e,n){var i=this.simplifyTolerance(this._distance);e===Dn.RIGHT&&(i=-i);var r=lr.simplify(t,i),s=r.length-1;n.initSideSegments(r[s-1],r[0],e);for(var o=1;o<=s;o++){var a=1!==o;n.addNextSegment(r[o],a)}n.closeRing()},computeLineBufferCurve:function(t,e){var n=this.simplifyTolerance(this._distance),i=lr.simplify(t,n),r=i.length-1;e.initSideSegments(i[0],i[1],Dn.LEFT);for(var s=2;s<=r;s++)e.addNextSegment(i[s],!0);e.addLastSegment(),e.addLineEndCap(i[r-1],i[r]);var o=lr.simplify(t,-n),a=o.length-1;e.initSideSegments(o[a],o[a-1],Dn.LEFT);for(s=a-2;s>=0;s--)e.addNextSegment(o[s],!0);e.addLastSegment(),e.addLineEndCap(o[1],o[0]),e.closeRing()},computePointCurve:function(t,e){switch(this._bufParams.getEndCapStyle()){case er.CAP_ROUND:e.createCircle(t);break;case er.CAP_SQUARE:e.createSquare(t)}},getLineCurve:function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)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 r=e<0;this.computeSingleSidedBufferCurve(t,r,i)}else this.computeLineBufferCurve(t,i);return i.getCoordinates()},getBufferParameters:function(){return this._bufParams},simplifyTolerance:function(t){return t*this._bufParams.getSimplifyFactor()},getRingCurve:function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return fr.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()},computeOffsetCurve:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var r=lr.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],Dn.LEFT),n.addFirstSegment();for(var o=s-2;o>=0;o--)n.addNextSegment(r[o],!0)}else{var a=lr.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],Dn.LEFT),n.addFirstSegment();for(o=2;o<=u;o++)n.addNextSegment(a[o],!0)}n.addLastSegment()},getSegGen:function(t){return new cr(this._precisionModel,this._bufParams,t)},interfaces_:function(){return[]},getClass:function(){return fr}}),fr.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new E(t[n]);return e},e(gr.prototype,{findStabbedSegments:function(){if(1===arguments.length){for(var t=arguments[0],e=new P,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),r=i.getEnvelope();t.y<r.getMinY()||t.y>r.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(N(arguments[2],w)&&arguments[0]instanceof E&&arguments[1]instanceof $n){var s=arguments[0],o=arguments[1],a=arguments[2],u=o.getEdge().getCoordinates();for(n=0;n<u.length-1;n++){if(this._seg.p0=u[n],this._seg.p1=u[n+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<s.x||this._seg.isHorizontal()||s.y<this._seg.p0.y||s.y>this._seg.p1.y||z.index(this._seg.p0,this._seg.p1,s)===z.RIGHT)){var l=o.getDepth(Dn.LEFT);this._seg.p0.equals(u[n])||(l=o.getDepth(Dn.RIGHT));var h=new dr(this._seg,l);a.add(h)}}}else if(N(arguments[2],w)&&arguments[0]instanceof E&&N(arguments[1],w)){var c=arguments[0],f=arguments[1],g=arguments[2];for(n=f.iterator();n.hasNext();){var d=n.next();d.isForward()&&this.findStabbedSegments(c,d,g)}}},getDepth:function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Te.min(e)._leftDepth},interfaces_:function(){return[]},getClass:function(){return gr}}),e(dr.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 0!==n?n:0!==(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},compareX:function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},toString:function(){return this._upwardSeg.toString()},interfaces_:function(){return[g]},getClass:function(){return dr}}),gr.DepthSegment=dr,e(_r.prototype,{addPoint:function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,de.EXTERIOR,de.INTERIOR)},addPolygon:function(t){var e=this._distance,n=Dn.LEFT;this._distance<0&&(e=-this._distance,n=Dn.RIGHT);var i=t.getExteriorRing(),r=nt.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&r.length<3)return null;this.addPolygonRing(r,e,n,de.EXTERIOR,de.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var o=t.getInteriorRingN(s),a=nt.removeRepeatedPoints(o.getCoordinates());this._distance>0&&this.isErodedCompletely(o,-this._distance)||this.addPolygonRing(a,e,Dn.opposite(n),de.INTERIOR,de.EXTERIOR)}},isTriangleErodedCompletely:function(t,e){var n=new me(t[0],t[1],t[2]),i=n.inCentre();return X.pointToSegment(i,n.p0,n.p1)<Math.abs(e)},addLineString:function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=nt.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,de.EXTERIOR,de.INTERIOR)},addCurve:function(t,e,n){if(null===t||t.length<2)return null;var i=new Xi(t,new zn(0,de.BOUNDARY,e,n));this._curveList.add(i)},getCurves:function(){return this.add(this._inputGeom),this._curveList},addPolygonRing:function(t,e,n,i,r){if(0===e&&t.length<Yt.MINIMUM_VALID_SIZE)return null;var s=i,o=r;t.length>=Yt.MINIMUM_VALID_SIZE&&z.isCCW(t)&&(s=r,o=i,n=Dn.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,s,o)},add:function(t){if(t.isEmpty())return null;if(t instanceof Vt)this.addPolygon(t);else if(t instanceof At)this.addLineString(t);else if(t instanceof Gt)this.addPoint(t);else if(t instanceof zt)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof kt)this.addCollection(t);else{if(!(t instanceof Lt))throw new UnsupportedOperationException(t.getClass().getName());this.addCollection(t)}},isErodedCompletely:function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>r},addCollection:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},interfaces_:function(){return[]},getClass:function(){return _r}}),e(pr.prototype,{getNextCW:function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},propagateSideLabels:function(t){for(var e=de.NONE,n=this.iterator();n.hasNext();){(s=(r=n.next()).getLabel()).isArea(t)&&s.getLocation(t,Dn.LEFT)!==de.NONE&&(e=s.getLocation(t,Dn.LEFT))}if(e===de.NONE)return null;var i=e;for(n=this.iterator();n.hasNext();){var r,s;if((s=(r=n.next()).getLabel()).getLocation(t,Dn.ON)===de.NONE&&s.setLocation(t,Dn.ON,i),s.isArea(t)){var o=s.getLocation(t,Dn.LEFT),a=s.getLocation(t,Dn.RIGHT);if(a!==de.NONE){if(a!==i)throw new Jn("side location conflict",r.getCoordinate());o===de.NONE&&x.shouldNeverReachHere("found single null side (at "+r.getCoordinate()+")"),i=o}else x.isTrue(s.getLocation(t,Dn.LEFT)===de.NONE,"found single null side"),s.setLocation(t,Dn.RIGHT,i),s.setLocation(t,Dn.LEFT,i)}}},getCoordinate:function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},print:function(t){Y.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},isAreaLabelsConsistent:function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},checkAreaLabelsConsistent:function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,i=e.get(n).getLabel().getLocation(t,Dn.LEFT);x.isTrue(i!==de.NONE,"Found unlabelled area edge");for(var r=i,s=this.iterator();s.hasNext();){var o=s.next().getLabel();x.isTrue(o.isArea(t),"Found non-area edge");var a=o.getLocation(t,Dn.LEFT),u=o.getLocation(t,Dn.RIGHT);if(a===u)return!1;if(u!==r)return!1;r=a}return!0},findIndex:function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1},iterator:function(){return this.getEdges().iterator()},getEdges:function(){return null===this._edgeList&&(this._edgeList=new P(this._edgeMap.values())),this._edgeList},getLocation:function(t,e,n){return this._ptInAreaLocation[t]===de.NONE&&(this._ptInAreaLocation[t]=Ve.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},toString:function(){var t=new F;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},computeEdgeEndLabels:function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},computeLabelling:function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var i=(s=n.next()).getLabel(),r=0;r<2;r++)i.isLine(r)&&i.getLocation(r)===de.BOUNDARY&&(e[r]=!0);for(n=this.iterator();n.hasNext();){var s;for(i=(s=n.next()).getLabel(),r=0;r<2;r++)if(i.isAnyNull(r)){var o=de.NONE;if(e[r])o=de.EXTERIOR;else{var a=s.getCoordinate();o=this.getLocation(r,a,t)}i.setAllLocationsIfNull(r,o)}}},getDegree:function(){return this._edgeMap.size()},insertEdgeEnd:function(t,e){this._edgeMap.put(t,e),this._edgeList=null},interfaces_:function(){return[]},getClass:function(){return pr}}),v(mr,pr),e(mr.prototype,{linkResultDirectedEdges:function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var r=this._resultAreaEdgeList.get(i),s=r.getSym();if(r.getLabel().isArea())switch(null===t&&r.isInResult()&&(t=r),n){case this._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;e=s,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!r.isInResult())continue;e.setNext(r),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new Jn("no outgoing dirEdge found",this.getCoordinate());x.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},insert:function(t){var e=t;this.insertEdgeEnd(e,e)},getRightmostEdge:function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var i=t.get(e-1),r=n.getQuadrant(),s=i.getQuadrant();return gn.isNorthern(r)&&gn.isNorthern(s)?n:gn.isNorthern(r)||gn.isNorthern(s)?0!==n.getDy()?n:0!==i.getDy()?i:(x.shouldNeverReachHere("found two horizontal edges incident on node"),null):i},print:function(t){Y.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},getResultAreaEdges:function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new P;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},updateLabelling:function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},linkAllDirectedEdges:function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var i=this._edgeList.get(n),r=i.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=i}e.setNext(t)},computeDepths:function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=(t.getLabel(),t.getDepth(Dn.LEFT)),i=t.getDepth(Dn.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,r)!==i)throw new Jn("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var s=arguments[0],o=arguments[1],a=arguments[2],u=s;u<o;u++){var l=this._edgeList.get(u);l.getLabel();l.setEdgeDepths(Dn.RIGHT,a),a=l.getDepth(Dn.LEFT)}return a}},mergeSymLabels:function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},linkMinimalDirectedEdges:function(t){for(var e=null,n=null,i=this._SCANNING_FOR_INCOMING,r=this._resultAreaEdgeList.size()-1;r>=0;r--){var s=this._resultAreaEdgeList.get(r),o=s.getSym();switch(null===e&&s.getEdgeRing()===t&&(e=s),i){case this._SCANNING_FOR_INCOMING:if(o.getEdgeRing()!==t)continue;n=o,i=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=this._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(x.isTrue(null!==e,"found null for first outgoing dirEdge"),x.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},getOutgoingDegree:function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){var n=arguments[0];for(t=0,e=this.iterator();e.hasNext();){e.next().getEdgeRing()===n&&t++}return t}},getLabel:function(){return this._label},findCoveredLineEdges:function(){for(var t=de.NONE,e=this.iterator();e.hasNext();){var n=(r=e.next()).getSym();if(!r.isLineEdge()){if(r.isInResult()){t=de.INTERIOR;break}if(n.isInResult()){t=de.EXTERIOR;break}}}if(t===de.NONE)return null;var i=t;for(e=this.iterator();e.hasNext();){var r;n=(r=e.next()).getSym();r.isLineEdge()?r.getEdge().setCovered(i===de.INTERIOR):(r.isInResult()&&(i=de.EXTERIOR),n.isInResult()&&(i=de.INTERIOR))}},computeLabelling:function(t){pr.prototype.computeLabelling.call(this,t),this._label=new zn(de.NONE);for(var e=this.iterator();e.hasNext();)for(var n=e.next().getEdge().getLabel(),i=0;i<2;i++){var r=n.getLocation(i);r!==de.INTERIOR&&r!==de.BOUNDARY||this._label.setLocation(i,de.INTERIOR)}},interfaces_:function(){return[]},getClass:function(){return mr}}),v(vr,ti),e(vr.prototype,{createNode:function(t){return new Kn(t,new mr)},interfaces_:function(){return[]},getClass:function(){return vr}}),e(yr.prototype,{compareTo:function(t){var e=t;return yr.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},interfaces_:function(){return[g]},getClass:function(){return yr}}),yr.orientation=function(t){return 1===nt.increasingDirection(t)},yr.compareOriented=function(t,e,n,i){for(var r=e?1:-1,s=i?1:-1,o=e?t.length:-1,a=i?n.length:-1,u=e?0:t.length-1,l=i?0:n.length-1;;){var h=t[u].compareTo(n[l]);if(0!==h)return h;var c=(u+=r)===o,f=(l+=s)===a;if(c&&!f)return-1;if(!c&&f)return 1;if(c&&f)return 0}},e(xr.prototype,{print:function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),r=0;r<i.length;r++)r>0&&t.print(","),t.print(i[r].x+" "+i[r].y);t.println(")")}t.print(") ")},addAll:function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},findEdgeIndex:function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},iterator:function(){return this._edges.iterator()},getEdges:function(){return this._edges},get:function(t){return this._edges.get(t)},findEqualEdge:function(t){var e=new yr(t.getCoordinates());return this._ocaMap.get(e)},add:function(t){this._edges.add(t);var e=new yr(t.getCoordinates());this._ocaMap.put(e,t)},interfaces_:function(){return[]},getClass:function(){return xr}}),e(Er.prototype,{processIntersections:function(t,e,n,i){},isDone:function(){},interfaces_:function(){return[]},getClass:function(){return Er}}),e(Ir.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(Ir.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.size()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},getProperIntersectionPoint:function(){return this._properIntersectionPoint},hasProperInteriorIntersection:function(){return this._hasProperInterior},getLineIntersector:function(){return this._li},hasProperIntersection:function(){return this._hasProper},processIntersections:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,s,o,a),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)))},hasIntersection:function(){return this._hasIntersection},isDone:function(){return!1},hasInteriorIntersection:function(){return this._hasInterior},interfaces_:function(){return[Er]},getClass:function(){return Ir}}),Ir.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},e(Nr.prototype,{setWorkingPrecisionModel:function(t){this._workingPrecisionModel=t},insertUniqueEdge:function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new zn(t.getLabel())).flip(),n.merge(i);var r=Nr.depthDelta(i),s=e.getDepthDelta()+r;e.setDepthDelta(s)}else this._edgeList.add(t),t.setDepthDelta(Nr.depthDelta(t.getLabel()))},buildSubgraphs:function(t,e){for(var n=new P,i=t.iterator();i.hasNext();){var r=i.next(),s=r.getRightmostCoordinate(),o=new gr(n).getDepth(s);r.computeDepth(o),r.findResultEdges(),n.add(r),e.add(r.getDirectedEdges(),r.getNodes())}},createSubgraphs:function(t){for(var e=new P,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var r=new rr;r.create(i),e.add(r)}}return Te.sort(e,Te.reverseOrder()),e},createEmptyResultGeometry:function(){return this._geomFact.createPolygon()},getNoder:function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new Ki,n=new fe;return n.setPrecisionModel(t),e.setSegmentIntersector(new Ir(n)),e},buffer:function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new _r(t,e,new fr(n,this._bufParams)).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new ei(new vr),this._graph.addEdges(this._edgeList.getEdges());var r=this.createSubgraphs(this._graph),s=new ur(this._geomFact);this.buildSubgraphs(r,s);var o=s.getPolygons();return o.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(o)},computeNodedEdges:function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var i=n.getNodedSubstrings().iterator();i.hasNext();){var r=i.next(),s=r.getCoordinates();if(2!==s.length||!s[0].equals2D(s[1])){var o=r.getData(),a=new jn(r.getCoordinates(),new zn(o));this.insertUniqueEdge(a)}}},setNoder:function(t){this._workingNoder=t},interfaces_:function(){return[]},getClass:function(){return Nr}}),Nr.depthDelta=function(t){var e=t.getLocation(0,Dn.LEFT),n=t.getLocation(0,Dn.RIGHT);return e===de.INTERIOR&&n===de.EXTERIOR?1:e===de.EXTERIOR&&n===de.INTERIOR?-1:0},Nr.convertSegStrings=function(t){for(var e=new se,n=new P;t.hasNext();){var i=t.next(),r=e.createLineString(i.getCoordinates());n.add(r)}return e.buildGeometry(n)},e(Cr.prototype,{checkEndPtVertexIntersections:function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(2===arguments.length){var n=arguments[0];for(t=arguments[1].iterator();t.hasNext();){e=t.next().getCoordinates();for(var i=1;i<e.length-1;i++)if(e[i].equals(n))throw new m("found endpt/interior pt intersection at index "+i+" :pt "+n)}}},checkInteriorIntersections:function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(e,i)}else if(2===arguments.length)for(var r=arguments[0],s=arguments[1],o=r.getCoordinates(),a=s.getCoordinates(),u=0;u<o.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(r,u,s,l);else if(4===arguments.length){var h=arguments[0],c=arguments[1],f=arguments[2],g=arguments[3];if(h===f&&c===g)return null;var d=h.getCoordinates()[c],_=h.getCoordinates()[c+1],p=f.getCoordinates()[g],v=f.getCoordinates()[g+1];if(this._li.computeIntersection(d,_,p,v),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,_)||this.hasInteriorIntersection(this._li,p,v)))throw new m("found non-noded intersection at "+d+"-"+_+" and "+p+"-"+v)}},checkValid:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},checkCollapses:function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length){var n=arguments[0].getCoordinates();for(t=0;t<n.length-2;t++)this.checkCollapse(n[t],n[t+1],n[t+2])}},hasInteriorIntersection:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var r=t.getIntersection(i);if(!r.equals(e)&&!r.equals(n))return!0}return!1},checkCollapse:function(t,e,n){if(t.equals(n))throw new m("found non-noded collapse at "+Cr.fact.createLineString([t,e,n]))},interfaces_:function(){return[]},getClass:function(){return Cr}}),Cr.fact=new se,e(Sr.prototype,{intersectsScaled:function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y),o=this._maxx<n||this._minx>i||this._maxy<r||this._miny>s;if(o)return!1;var a=this.intersectsToleranceSquare(t,e);return x.isTrue(!(o&&a),"Found bad envelope test"),a},initCorners:function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new E(this._maxx,this._maxy),this._corner[1]=new E(this._minx,this._maxy),this._corner[2]=new E(this._minx,this._miny),this._corner[3]=new E(this._maxx,this._miny)},intersects:function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},scale:function(t){return Math.round(t*this._scaleFactor)},getCoordinate:function(){return this._originalPt},copyScaled:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},getSafeEnvelope:function(){if(null===this._safeEnv){var t=Sr.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},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())))},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))))))},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)},interfaces_:function(){return[]},getClass:function(){return Sr}}),Sr.SAFE_ENV_EXPANSION_FACTOR=.75,e(Lr.prototype,{snap:function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2],r=e.getSafeEnvelope(),s=new wr(e,n,i);return this._index.query(r,{interfaces_:function(){return[Ce]},visitItem:function(t){t.select(r,s)}}),s.isNodeAdded()}},interfaces_:function(){return[]},getClass:function(){return Lr}}),v(wr,nn),e(wr.prototype,{isNodeAdded:function(){return this._isNodeAdded},select:function(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof fn))return nn.prototype.select.apply(this,arguments);var t=arguments[0],e=arguments[1],n=t.getContext();if(null!==this._parentEdge&&n===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(n,e)},interfaces_:function(){return[]},getClass:function(){return wr}}),Lr.HotPixelSnapAction=wr,e(Rr.prototype,{processIntersections:function(t,e,n,i){if(t===n&&e===i)return null;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];if(this._li.computeIntersection(r,s,o,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}},isDone:function(){return!1},getInteriorIntersections:function(){return this._interiorIntersections},interfaces_:function(){return[Er]},getClass:function(){return Rr}}),e(Tr.prototype,{checkCorrectness:function(t){var e=new Cr(Xi.getNodedSubstrings(t));try{e.checkValid()}catch(t){if(!(t instanceof D))throw t;t.printStackTrace()}},getNodedSubstrings:function(){return Xi.getNodedSubstrings(this._nodedSegStrings)},snapRound:function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},findInteriorIntersections:function(t,e){var n=new Rr(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},computeVertexSnaps:function(){if(N(arguments[0],S))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof Xi)for(var n=arguments[0],i=n.getCoordinates(),r=0;r<i.length;r++){var s=new Sr(i[r],this._scaleFactor,this._li);this._pointSnapper.snap(s,n,r)&&n.addIntersection(i[r],r)}},computeNodes:function(t){this._nodedSegStrings=t,this._noder=new Ki,this._pointSnapper=new Lr(this._noder.getIndex()),this.snapRound(t,this._li)},computeIntersectionSnaps:function(t){for(var e=t.iterator();e.hasNext();){var n=new Sr(e.next(),this._scaleFactor,this._li);this._pointSnapper.snap(n)}},interfaces_:function(){return[Wi]},getClass:function(){return Tr}}),e(Pr.prototype,{bufferFixedPrecision:function(t){var e=new Qi(new Tr(new ie(1)),t.getScale()),n=new Nr(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},bufferReducedPrecision:function(){if(0===arguments.length){for(var t=Pr.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof Jn))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var e=arguments[0],n=new ie(Pr.precisionScaleFactor(this._argGeom,this._distance,e));this.bufferFixedPrecision(n)}},computeGeometry:function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ie.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},setQuadrantSegments:function(t){this._bufParams.setQuadrantSegments(t)},bufferOriginalPrecision:function(){try{var t=new Nr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof m))throw t;this._saveException=t}},getResultGeometry:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},setEndCapStyle:function(t){this._bufParams.setEndCapStyle(t)},interfaces_:function(){return[]},getClass:function(){return Pr}}),Pr.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Pr(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof K&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1],r=arguments[2];return(a=new Pr(n)).setQuadrantSegments(r),a.getResultGeometry(i)}if(arguments[2]instanceof er&&arguments[0]instanceof K&&"number"==typeof arguments[1]){var s=arguments[0],o=arguments[1];return(a=new Pr(s,arguments[2])).getResultGeometry(o)}}else if(4===arguments.length){var a,u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];return(a=new Pr(u)).setQuadrantSegments(h),a.setEndCapStyle(c),a.getResultGeometry(l)}},Pr.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),r=U.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(e>0?e:0),s=n-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,s)},Pr.CAP_ROUND=er.CAP_ROUND,Pr.CAP_BUTT=er.CAP_FLAT,Pr.CAP_FLAT=er.CAP_FLAT,Pr.CAP_SQUARE=er.CAP_SQUARE,Pr.MAX_PRECISION_DIGITS=12;var Or=Object.freeze({BufferOp:Pr,BufferParameters:er});function br(){this._comps=null;var t=arguments[0];this._comps=t}function Mr(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var t=arguments[0],e=arguments[1];Mr.call(this,t,Mr.INSIDE_AREA,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._component=n,this._segIndex=i,this._pt=r}}function Dr(){this._pts=null;var t=arguments[0];this._pts=t}function Ar(){this._locations=null;var t=arguments[0];this._locations=t}function Fr(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Mn,this._minDistanceLocation=null,this._minDistance=s.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];Fr.call(this,t,e,0)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}}e(br.prototype,{filter:function(t){t instanceof Vt&&this._comps.add(t)},interfaces_:function(){return[Ct]},getClass:function(){return br}}),br.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return br.getPolygons(t,new P)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Vt?n.add(e):e instanceof Lt&&e.apply(new br(n)),n}},e(Mr.prototype,{isInsideArea:function(){return this._segIndex===Mr.INSIDE_AREA},getCoordinate:function(){return this._pt},getGeometryComponent:function(){return this._component},getSegmentIndex:function(){return this._segIndex},interfaces_:function(){return[]},getClass:function(){return Mr}}),Mr.INSIDE_AREA=-1,e(Dr.prototype,{filter:function(t){t instanceof Gt&&this._pts.add(t)},interfaces_:function(){return[Ct]},getClass:function(){return Dr}}),Dr.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Gt?Te.singletonList(t):Dr.getPoints(t,new P)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Gt?n.add(e):e instanceof Lt&&e.apply(new Dr(n)),n}},e(Ar.prototype,{filter:function(t){(t instanceof Gt||t instanceof At||t instanceof Vt)&&this._locations.add(new Mr(t,0,t.getCoordinate()))},interfaces_:function(){return[Ct]},getClass:function(){return Ar}}),Ar.getLocations=function(t){var e=new P;return t.apply(new Ar(e)),e},e(Fr.prototype,{computeContainmentDistance:function(){if(0===arguments.length){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=this._geom[e];if(i.getDimension()<2)return null;var r=1-e,s=br.getPolygons(i);if(s.size()>0){var o=Ar.getLocations(this._geom[r]);if(this.computeContainmentDistance(o,s,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&N(arguments[0],w)&&N(arguments[1],w)){for(var a=arguments[0],u=arguments[1],l=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),f=0;f<u.size();f++)if(this.computeContainmentDistance(c,u.get(f),l),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Mr&&arguments[1]instanceof Vt){var g=arguments[0],d=arguments[1],_=arguments[2],p=g.getCoordinate();if(de.EXTERIOR!==this._ptLocator.locate(p,d))return this._minDistance=0,_[0]=g,_[1]=new Mr(d,p),null}},computeMinDistanceLinesPoints:function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),s=0;s<e.size();s++){var o=e.get(s);if(this.computeMinDistance(r,o,n),this._minDistance<=this._terminateDistance)return null}},computeFacetDistance:function(){var t=new Array(2).fill(null),e=be.getLines(this._geom[0]),n=be.getLines(this._geom[1]),i=Dr.getPoints(this._geom[0]),r=Dr.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,i,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(i,r,t),void this.updateMinDistance(t,!1))))},nearestLocations:function(){return this.computeMinDistance(),this._minDistanceLocation},updateMinDistance:function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},nearestPoints:function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},computeMinDistance:function(){if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof At&&arguments[1]instanceof Gt){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),s=0;s<i.length-1;s++){if((f=X.pointToSegment(r,i[s],i[s+1]))<this._minDistance){this._minDistance=f;var o=new ge(i[s],i[s+1]).closestPoint(r);n[0]=new Mr(t,s,o),n[1]=new Mr(e,0,r)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof At&&arguments[1]instanceof At){var a=arguments[0],u=arguments[1],l=arguments[2];if(a.getEnvelopeInternal().distance(u.getEnvelopeInternal())>this._minDistance)return null;i=a.getCoordinates();var h=u.getCoordinates();for(s=0;s<i.length-1;s++)for(var c=0;c<h.length-1;c++){var f;if((f=X.segmentToSegment(i[s],i[s+1],h[c],h[c+1]))<this._minDistance){this._minDistance=f;var g=new ge(i[s],i[s+1]),d=new ge(h[c],h[c+1]),_=g.closestPoints(d);l[0]=new Mr(a,s,_[0]),l[1]=new Mr(u,c,_[1])}if(this._minDistance<=this._terminateDistance)return null}}},computeMinDistancePoints:function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),s=0;s<e.size();s++){var o=e.get(s),a=r.getCoordinate().distance(o.getCoordinate());if(a<this._minDistance&&(this._minDistance=a,n[0]=new Mr(r,0,r.getCoordinate()),n[1]=new Mr(o,0,o.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},distance:function(){if(null===this._geom[0]||null===this._geom[1])throw new i("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},computeMinDistanceLines:function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),s=0;s<e.size();s++){var o=e.get(s);if(this.computeMinDistance(r,o,n),this._minDistance<=this._terminateDistance)return null}},interfaces_:function(){return[]},getClass:function(){return Fr}}),Fr.distance=function(t,e){return new Fr(t,e).distance()},Fr.isWithinDistance=function(t,e,n){return!(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>n)&&new Fr(t,e,n).distance()<=n},Fr.nearestPoints=function(t,e){return new Fr(t,e).nearestPoints()};var Gr=Object.freeze({DistanceOp:Fr});function qr(){this._factory=null,this._directedEdges=new P,this._coordinates=null;var t=arguments[0];this._factory=t}function Br(){this._isMarked=!1,this._isVisited=!1,this._data=null}function Vr(){Br.apply(this),this._parentEdge=null,this._from=null,this._to=null,this._p0=null,this._p1=null,this._sym=null,this._edgeDirection=null,this._quadrant=null,this._angle=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._from=t,this._to=e,this._edgeDirection=i,this._p0=t.getCoordinate(),this._p1=n;var r=this._p1.x-this._p0.x,s=this._p1.y-this._p0.y;this._quadrant=gn.quadrant(r,s),this._angle=Math.atan2(s,r)}function zr(){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];Vr.call(this,t,e,n,i)}function Yr(){if(Br.apply(this),this._dirEdge=null,0===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];this.setDirectedEdges(t,e)}}function kr(){this._outEdges=new P,this._sorted=!1}function Ur(){if(Br.apply(this),this._pt=null,this._deStar=null,1===arguments.length){var t=arguments[0];Ur.call(this,t,new kr)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._pt=e,this._deStar=n}}function Xr(){Yr.apply(this),this._line=null;var t=arguments[0];this._line=t}function Hr(){this._nodeMap=new pt}function Wr(){this._edges=new ut,this._dirEdges=new ut,this._nodeMap=new Hr}function jr(){Wr.apply(this)}function Kr(){this._graph=new jr,this._mergedLineStrings=null,this._factory=null,this._edgeStrings=null}e(qr.prototype,{getCoordinates:function(){if(null===this._coordinates){for(var t=0,e=0,n=new b,i=this._directedEdges.iterator();i.hasNext();){var r=i.next();r.getEdgeDirection()?t++:e++,n.add(r.getEdge().getLine().getCoordinates(),!1,r.getEdgeDirection())}this._coordinates=n.toCoordinateArray(),e>t&&nt.reverse(this._coordinates)}return this._coordinates},toLineString:function(){return this._factory.createLineString(this.getCoordinates())},add:function(t){this._directedEdges.add(t)},interfaces_:function(){return[]},getClass:function(){return qr}}),e(Br.prototype,{setVisited:function(t){this._isVisited=t},isMarked:function(){return this._isMarked},setData:function(t){this._data=t},getData:function(){return this._data},setMarked:function(t){this._isMarked=t},getContext:function(){return this._data},isVisited:function(){return this._isVisited},setContext:function(t){this._data=t},interfaces_:function(){return[]},getClass:function(){return Br}}),Br.getComponentWithVisitedState=function(t,e){for(;t.hasNext();){var n=t.next();if(n.isVisited()===e)return n}return null},Br.setVisited=function(t,e){for(;t.hasNext();){t.next().setVisited(e)}},Br.setMarked=function(t,e){for(;t.hasNext();){t.next().setMarked(e)}},v(Vr,Br),e(Vr.prototype,{isRemoved:function(){return null===this._parentEdge},compareDirection:function(t){return this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:z.index(t._p0,t._p1,this._p1)},getCoordinate:function(){return this._from.getCoordinate()},print:function(t){var e=this.getClass().getName(),n=e.lastIndexOf("."),i=e.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+this._angle)},getDirectionPt:function(){return this._p1},getAngle:function(){return this._angle},compareTo:function(t){var e=t;return this.compareDirection(e)},getFromNode:function(){return this._from},getSym:function(){return this._sym},setEdge:function(t){this._parentEdge=t},remove:function(){this._sym=null,this._parentEdge=null},getEdge:function(){return this._parentEdge},getQuadrant:function(){return this._quadrant},setSym:function(t){this._sym=t},getToNode:function(){return this._to},getEdgeDirection:function(){return this._edgeDirection},interfaces_:function(){return[g]},getClass:function(){return Vr}}),Vr.toEdges=function(t){for(var e=new P,n=t.iterator();n.hasNext();)e.add(n.next()._parentEdge);return e},v(zr,Vr),e(zr.prototype,{getNext:function(){return 2!==this.getToNode().getDegree()?null:this.getToNode().getOutEdges().getEdges().get(0)===this.getSym()?this.getToNode().getOutEdges().getEdges().get(1):(x.isTrue(this.getToNode().getOutEdges().getEdges().get(1)===this.getSym()),this.getToNode().getOutEdges().getEdges().get(0))},interfaces_:function(){return[]},getClass:function(){return zr}}),v(Yr,Br),e(Yr.prototype,{isRemoved:function(){return null===this._dirEdge},setDirectedEdges:function(t,e){this._dirEdge=[t,e],t.setEdge(this),e.setEdge(this),t.setSym(e),e.setSym(t),t.getFromNode().addOutEdge(t),e.getFromNode().addOutEdge(e)},getDirEdge:function(){if(Number.isInteger(arguments[0])){var t=arguments[0];return this._dirEdge[t]}if(arguments[0]instanceof Ur){var e=arguments[0];return this._dirEdge[0].getFromNode()===e?this._dirEdge[0]:this._dirEdge[1].getFromNode()===e?this._dirEdge[1]:null}},remove:function(){this._dirEdge=null},getOppositeNode:function(t){return this._dirEdge[0].getFromNode()===t?this._dirEdge[0].getToNode():this._dirEdge[1].getFromNode()===t?this._dirEdge[1].getToNode():null},interfaces_:function(){return[]},getClass:function(){return Yr}}),e(kr.prototype,{getNextEdge:function(t){var e=this.getIndex(t);return this._outEdges.get(this.getIndex(e+1))},getCoordinate:function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},iterator:function(){return this.sortEdges(),this._outEdges.iterator()},sortEdges:function(){this._sorted||(Te.sort(this._outEdges),this._sorted=!0)},remove:function(t){this._outEdges.remove(t)},getEdges:function(){return this.sortEdges(),this._outEdges},getNextCWEdge:function(t){var e=this.getIndex(t);return this._outEdges.get(this.getIndex(e-1))},getIndex:function(){if(arguments[0]instanceof Yr){var t=arguments[0];this.sortEdges();for(var e=0;e<this._outEdges.size();e++){if(this._outEdges.get(e).getEdge()===t)return e}return-1}if(arguments[0]instanceof Vr){var n=arguments[0];this.sortEdges();for(e=0;e<this._outEdges.size();e++){if(this._outEdges.get(e)===n)return e}return-1}if(Number.isInteger(arguments[0])){var i=arguments[0]%this._outEdges.size();return i<0&&(i+=this._outEdges.size()),i}},add:function(t){this._outEdges.add(t),this._sorted=!1},getDegree:function(){return this._outEdges.size()},interfaces_:function(){return[]},getClass:function(){return kr}}),v(Ur,Br),e(Ur.prototype,{isRemoved:function(){return null===this._pt},addOutEdge:function(t){this._deStar.add(t)},getCoordinate:function(){return this._pt},getOutEdges:function(){return this._deStar},remove:function(){if(0===arguments.length)this._pt=null;else if(1===arguments.length){var t=arguments[0];this._deStar.remove(t)}},getIndex:function(t){return this._deStar.getIndex(t)},getDegree:function(){return this._deStar.getDegree()},interfaces_:function(){return[]},getClass:function(){return Ur}}),Ur.getEdgesBetween=function(t,e){var n=new ut(Vr.toEdges(t.getOutEdges().getEdges())),i=Vr.toEdges(e.getOutEdges().getEdges());return n.retainAll(i),n},v(Xr,Yr),e(Xr.prototype,{getLine:function(){return this._line},interfaces_:function(){return[]},getClass:function(){return Xr}}),e(Hr.prototype,{find:function(t){return this._nodeMap.get(t)},iterator:function(){return this._nodeMap.values().iterator()},remove:function(t){return this._nodeMap.remove(t)},values:function(){return this._nodeMap.values()},add:function(t){return this._nodeMap.put(t.getCoordinate(),t),t},interfaces_:function(){return[]},getClass:function(){return Hr}}),e(Wr.prototype,{findNodesOfDegree:function(t){for(var e=new P,n=this.nodeIterator();n.hasNext();){var i=n.next();i.getDegree()===t&&e.add(i)}return e},dirEdgeIterator:function(){return this._dirEdges.iterator()},edgeIterator:function(){return this._edges.iterator()},remove:function(){if(arguments[0]instanceof Yr){var t=arguments[0];this.remove(t.getDirEdge(0)),this.remove(t.getDirEdge(1)),this._edges.remove(t),t.remove()}else if(arguments[0]instanceof Vr){var e=arguments[0];null!==(r=e.getSym())&&r.setSym(null),e.getFromNode().remove(e),e.remove(),this._dirEdges.remove(e)}else if(arguments[0]instanceof Ur){for(var n=arguments[0],i=n.getOutEdges().getEdges().iterator();i.hasNext();){var r,s=i.next();null!==(r=s.getSym())&&this.remove(r),this._dirEdges.remove(s);var o=s.getEdge();null!==o&&this._edges.remove(o)}this._nodeMap.remove(n.getCoordinate()),n.remove()}},findNode:function(t){return this._nodeMap.find(t)},getEdges:function(){return this._edges},nodeIterator:function(){return this._nodeMap.iterator()},contains:function(){if(arguments[0]instanceof Yr){var t=arguments[0];return this._edges.contains(t)}if(arguments[0]instanceof Vr){var e=arguments[0];return this._dirEdges.contains(e)}},add:function(){if(arguments[0]instanceof Ur){var t=arguments[0];this._nodeMap.add(t)}else if(arguments[0]instanceof Yr){var e=arguments[0];this._edges.add(e),this.add(e.getDirEdge(0)),this.add(e.getDirEdge(1))}else if(arguments[0]instanceof Vr){var n=arguments[0];this._dirEdges.add(n)}},getNodes:function(){return this._nodeMap.values()},interfaces_:function(){return[]},getClass:function(){return Wr}}),v(jr,Wr),e(jr.prototype,{addEdge:function(t){if(t.isEmpty())return null;var e=nt.removeRepeatedPoints(t.getCoordinates());if(e.length<=1)return null;var n=e[0],i=e[e.length-1],r=this.getNode(n),s=this.getNode(i),o=new zr(r,s,e[1],!0),a=new zr(s,r,e[e.length-2],!1),u=new Xr(t);u.setDirectedEdges(o,a),this.add(u)},getNode:function(t){var e=this.findNode(t);return null===e&&(e=new Ur(t),this.add(e)),e},interfaces_:function(){return[]},getClass:function(){return jr}}),e(Kr.prototype,{buildEdgeStringsForUnprocessedNodes:function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next();e.isMarked()||(x.isTrue(2===e.getDegree()),this.buildEdgeStringsStartingAt(e),e.setMarked(!0))}},buildEdgeStringsForNonDegree2Nodes:function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next();2!==e.getDegree()&&(this.buildEdgeStringsStartingAt(e),e.setMarked(!0))}},buildEdgeStringsForObviousStartNodes:function(){this.buildEdgeStringsForNonDegree2Nodes()},getMergedLineStrings:function(){return this.merge(),this._mergedLineStrings},buildEdgeStringsStartingAt:function(t){for(var e=t.getOutEdges().iterator();e.hasNext();){var n=e.next();n.getEdge().isMarked()||this._edgeStrings.add(this.buildEdgeStringStartingWith(n))}},merge:function(){if(null!==this._mergedLineStrings)return null;Br.setMarked(this._graph.nodeIterator(),!1),Br.setMarked(this._graph.edgeIterator(),!1),this._edgeStrings=new P,this.buildEdgeStringsForObviousStartNodes(),this.buildEdgeStringsForIsolatedLoops(),this._mergedLineStrings=new P;for(var t=this._edgeStrings.iterator();t.hasNext();){var e=t.next();this._mergedLineStrings.add(e.toLineString())}},buildEdgeStringStartingWith:function(t){var e=new qr(this._factory),n=t;do{e.add(n),n.getEdge().setMarked(!0),n=n.getNext()}while(null!==n&&n!==t);return e},add:function(){if(arguments[0]instanceof K)arguments[0].apply({interfaces_:function(){return[j]},filter:function(t){t instanceof At&&this.add(t)}});else if(N(arguments[0],S)){var t=arguments[0];this._mergedLineStrings=null;for(var e=t.iterator();e.hasNext();){var n=e.next();this.add(n)}}else if(arguments[0]instanceof At){var i=arguments[0];null===this._factory&&(this._factory=i.getFactory()),this._graph.addEdge(i)}},buildEdgeStringsForIsolatedLoops:function(){this.buildEdgeStringsForUnprocessedNodes()},interfaces_:function(){return[]},getClass:function(){return Kr}});var Zr=Object.freeze({LineMerger:Kr});function Qr(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}function Jr(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new P,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null}function $r(){this._li=new fe,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t}function ts(){this._nv=null;var t=arguments[0];this._nv=new $r(ts.toSegmentStrings(t))}function es(){this._mapOp=null;var t=arguments[0];this._mapOp=t}function ns(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new P,this._resultLineList=new P;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n}function is(){this._op=null,this._geometryFactory=null,this._resultPointList=new P;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e}function rs(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ge,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof At&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];rs.call(this,t.getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1];this._srcPts=n,this._isClosed=rs.isClosed(n),this._snapTolerance=i}}function ss(){this._srcGeom=null;var t=arguments[0];this._srcGeom=t}function os(){if(In.apply(this),this._snapTolerance=null,this._snapPts=null,this._isSelfSnap=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._snapTolerance=t,this._snapPts=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._snapTolerance=n,this._snapPts=i,this._isSelfSnap=r}}function as(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=new r,this._commonSignExp=null}function us(){this._commonCoord=null,this._ccFilter=new ls}function ls(){this._commonBitsX=new as,this._commonBitsY=new as}function hs(){this.trans=null;var t=arguments[0];this.trans=t}function cs(){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null;var t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()}function fs(){this._geom=new Array(2).fill(null);var t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e}function gs(){if(this._li=new fe,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ni(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];gs.call(this,e,n,Q.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ni(0,i,s),this._arg[1]=new ni(1,r,s)}}function ds(){this._ptLocator=new Mn,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new xr,this._resultPolyList=new P,this._resultLineList=new P,this._resultPointList=new P;var t=arguments[0],e=arguments[1];gs.call(this,t,e),this._graph=new ei(new vr),this._geomFact=t.getFactory()}e(Qr.prototype,{getCoordinates:function(){return this._pts},size:function(){return this._pts.length},getCoordinate:function(t){return this._pts[t]},isClosed:function(){return this._pts[0].equals(this._pts[this._pts.length-1])},getSegmentOctant:function(t){return t===this._pts.length-1?-1:Yi.octant(this.getCoordinate(t),this.getCoordinate(t+1))},setData:function(t){this._data=t},getData:function(){return this._data},toString:function(){return he.toLineString(new Kt(this._pts))},interfaces_:function(){return[ki]},getClass:function(){return Qr}}),e(Jr.prototype,{getInteriorIntersection:function(){return this._interiorIntersection},setCheckEndSegmentsOnly:function(t){this._isCheckEndSegmentsOnly=t},getIntersectionSegments:function(){return this._intSegments},count:function(){return this._intersectionCount},getIntersections:function(){return this._intersections},setFindAllIntersections:function(t){this._findAllIntersections=t},setKeepIntersections:function(t){this._keepIntersections=t},processIntersections:function(t,e,n,i){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===i)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(n,i)))return null;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,s,o,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=r,this._intSegments[1]=s,this._intSegments[2]=o,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},isEndSegment:function(t,e){return 0===e||e>=t.size()-2},hasIntersection:function(){return null!==this._interiorIntersection},isDone:function(){return!this._findAllIntersections&&null!==this._interiorIntersection},interfaces_:function(){return[Er]},getClass:function(){return Jr}}),Jr.createAllIntersectionsFinder=function(t){var e=new Jr(t);return e.setFindAllIntersections(!0),e},Jr.createAnyIntersectionFinder=function(t){return new Jr(t)},Jr.createIntersectionCounter=function(t){var e=new Jr(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e},e($r.prototype,{execute:function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},getIntersections:function(){return this._segInt.getIntersections()},isValid:function(){return this.execute(),this._isValid},setFindAllIntersections:function(t){this._findAllIntersections=t},checkInteriorIntersections:function(){this._isValid=!0,this._segInt=new Jr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ki;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},checkValid:function(){if(this.execute(),!this._isValid)throw new Jn(this.getErrorMessage(),this._segInt.getInteriorIntersection())},getErrorMessage:function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+he.toLineString(t[0],t[1])+" and "+he.toLineString(t[2],t[3])},interfaces_:function(){return[]},getClass:function(){return $r}}),$r.computeIntersections=function(t){var e=new $r(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()},e(ts.prototype,{checkValid:function(){this._nv.checkValid()},interfaces_:function(){return[]},getClass:function(){return ts}}),ts.toSegmentStrings=function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Qr(i.getCoordinates(),i))}return e},ts.checkValid=function(t){new ts(t).checkValid()},e(es.prototype,{map:function(t){for(var e=new P,n=0;n<t.getNumGeometries();n++){var i=this._mapOp.map(t.getGeometryN(n));i.isEmpty()||e.add(i)}return t.getFactory().createGeometryCollection(se.toGeometryArray(e))},interfaces_:function(){return[]},getClass:function(){return es}}),es.map=function(t,e){return new es(e).map(t)},e(ns.prototype,{collectLines:function(t){for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next();this.collectLineEdge(n,t,this._lineEdgesList),this.collectBoundaryTouchEdge(n,t,this._lineEdgesList)}},labelIsolatedLine:function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},build:function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},collectLineEdge:function(t,e,n){var i=t.getLabel(),r=t.getEdge();t.isLineEdge()&&(t.isVisited()||!ds.isResultOfOp(i,e)||r.isCovered()||(n.add(r),t.setVisitedEdge(!0)))},findCoveredLineEdges:function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),i=n.getEdge();if(n.isLineEdge()&&!i.isCoveredSet()){var r=this._op.isCoveredByA(n.getCoordinate());i.setCovered(r)}}},labelIsolatedLines:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getLabel();n.isIsolated()&&(i.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},buildLines:function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),i=(n.getLabel(),this._geometryFactory.createLineString(n.getCoordinates()));this._resultLineList.add(i),n.setInResult(!0)}},collectBoundaryTouchEdge:function(t,e,n){var i=t.getLabel();return t.isLineEdge()?null:t.isVisited()?null:t.isInteriorAreaEdge()?null:t.getEdge().isInResult()?null:(x.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(ds.isResultOfOp(i,e)&&e===ds.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},interfaces_:function(){return[]},getClass:function(){return ns}}),e(is.prototype,{filterCoveredNodeToPoint:function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},extractNonCoveredResultNodes:function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!n.isInResult()&&(!n.isIncidentEdgeInResult()&&(0===n.getEdges().getDegree()||t===ds.INTERSECTION))){var i=n.getLabel();ds.isResultOfOp(i,t)&&this.filterCoveredNodeToPoint(n)}}},build:function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},interfaces_:function(){return[]},getClass:function(){return is}}),e(rs.prototype,{snapVertices:function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),i=0;i<n;i++){var r=t.get(i),s=this.findSnapForVertex(r,e);null!==s&&(t.set(i,new E(s)),0===i&&this._isClosed&&t.set(t.size()-1,new E(s)))}},findSnapForVertex:function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},snapTo:function(t){var e=new b(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},snapSegments:function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var i=0;i<n;i++){var r=e[i],s=this.findSegmentIndexToSnap(r,t);s>=0&&t.add(s+1,new E(r),!1)}},findSegmentIndexToSnap:function(t,e){for(var n=s.MAX_VALUE,i=-1,r=0;r<e.size()-1;r++){if(this._seg.p0=e.get(r),this._seg.p1=e.get(r+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var o=this._seg.distance(t);o<this._snapTolerance&&o<n&&(n=o,i=r)}return i},setAllowSnappingToSourceVertices:function(t){this._allowSnappingToSourceVertices=t},interfaces_:function(){return[]},getClass:function(){return rs}}),rs.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])},e(ss.prototype,{snapTo:function(t,e){return new os(e,this.extractTargetCoordinates(t)).transform(this._srcGeom)},snapToSelf:function(t,e){var n=new os(t,this.extractTargetCoordinates(this._srcGeom),!0).transform(this._srcGeom),i=n;return e&&N(i,Bt)&&(i=n.buffer(0)),i},computeSnapTolerance:function(t){return this.computeMinimumSegmentLength(t)/10},extractTargetCoordinates:function(t){for(var e=new yt,n=t.getCoordinates(),i=0;i<n.length;i++)e.add(n[i]);return e.toArray(new Array(0).fill(null))},computeMinimumSegmentLength:function(t){for(var e=s.MAX_VALUE,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);i<e&&(e=i)}return e},interfaces_:function(){return[]},getClass:function(){return ss}}),ss.snap=function(t,e,n){var i=new Array(2).fill(null),r=new ss(t);i[0]=r.snapTo(e,n);var s=new ss(e);return i[1]=s.snapTo(i[0],n),i},ss.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=ss.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===ie.FIXED){var i=1/n.getScale()*2/1.415;i>e&&(e=i)}return e}if(2===arguments.length){var r=arguments[0],s=arguments[1];return Math.min(ss.computeOverlaySnapTolerance(r),ss.computeOverlaySnapTolerance(s))}},ss.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*ss.SNAP_PRECISION_FACTOR},ss.snapToSelf=function(t,e,n){return new ss(t).snapToSelf(e,n)},ss.SNAP_PRECISION_FACTOR=1e-9,v(os,In),e(os.prototype,{snapLine:function(t,e){var n=new rs(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},transformCoordinates:function(t,e){var n=t.toCoordinateArray(),i=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(i)},interfaces_:function(){return[]},getClass:function(){return os}}),e(as.prototype,{getCommon:function(){return s.longBitsToDouble(this._commonBits)},add:function(t){var e=s.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=as.signExpBits(this._commonBits),this._isFirst=!1,null):as.signExpBits(e)!==this._commonSignExp?(this._commonBits.high=0,this._commonBits.low=0,null):(this._commonMantissaBitsCount=as.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=as.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},toString:function(){if(1===arguments.length){var t=arguments[0],e=s.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+r.toBinaryString(t),i=n.substring(n.length-64);return i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]"}},interfaces_:function(){return[]},getClass:function(){return as}}),as.getBit=function(t,e){var n=1<<e%32;return e<32?0!=(t.low&n)?1:0:0!=(t.high&n)?1:0},as.signExpBits=function(t){return t.high>>>20},as.zeroLowerBits=function(t,e){var n="low";if(e>32&&(t.low=0,e%=32,n="high"),e>0){var i=e<32?~((1<<e)-1):0;t[n]&=i}return t},as.numCommonMostSigMantissaBits=function(t,e){for(var n=0,i=52;i>=0;i--){if(as.getBit(t,i)!==as.getBit(e,i))return n;n++}return 52},e(us.prototype,{addCommonBits:function(t){var e=new hs(this._commonCoord);t.apply(e),t.geometryChanged()},removeCommonBits:function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new E(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new hs(e);return t.apply(n),t.geometryChanged(),t},getCommonCoordinate:function(){return this._commonCoord},add:function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},interfaces_:function(){return[]},getClass:function(){return us}}),e(ls.prototype,{filter:function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},getCommonCoordinate:function(){return new E(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},interfaces_:function(){return[Z]},getClass:function(){return ls}}),e(hs.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)},isDone:function(){return!1},isGeometryChanged:function(){return!0},interfaces_:function(){return[St]},getClass:function(){return hs}}),us.CommonCoordinateFilter=ls,us.Translater=hs,e(cs.prototype,{selfSnap:function(t){return new ss(t).snapTo(t,this._snapTolerance)},removeCommonBits:function(t){this._cbr=new us,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},prepareResult:function(t){return this._cbr.addCommonBits(t),t},getResultGeometry:function(t){var e=this.snap(this._geom),n=ds.overlayOp(e[0],e[1],t);return this.prepareResult(n)},checkValid:function(t){t.isValid()||Y.out.println("Snapped geometry is invalid")},computeSnapTolerance:function(){this._snapTolerance=ss.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},snap:function(t){var e=this.removeCommonBits(t);return ss.snap(e[0],e[1],this._snapTolerance)},interfaces_:function(){return[]},getClass:function(){return cs}}),cs.overlayOp=function(t,e,n){return new cs(t,e).getResultGeometry(n)},cs.union=function(t,e){return cs.overlayOp(t,e,ds.UNION)},cs.intersection=function(t,e){return cs.overlayOp(t,e,ds.INTERSECTION)},cs.symDifference=function(t,e){return cs.overlayOp(t,e,ds.SYMDIFFERENCE)},cs.difference=function(t,e){return cs.overlayOp(t,e,ds.DIFFERENCE)},e(fs.prototype,{getResultGeometry:function(t){var e=null,n=!1,i=null;try{e=ds.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof m))throw t;i=t}if(!n)try{e=cs.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof m?i:t}return e},interfaces_:function(){return[]},getClass:function(){return fs}}),fs.overlayOp=function(t,e,n){return new fs(t,e).getResultGeometry(n)},fs.union=function(t,e){return fs.overlayOp(t,e,ds.UNION)},fs.intersection=function(t,e){return fs.overlayOp(t,e,ds.INTERSECTION)},fs.symDifference=function(t,e){return fs.overlayOp(t,e,ds.SYMDIFFERENCE)},fs.difference=function(t,e){return fs.overlayOp(t,e,ds.DIFFERENCE)},e(gs.prototype,{getArgGeometry:function(t){return this._arg[t].getGeometry()},setComputationPrecision:function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},interfaces_:function(){return[]},getClass:function(){return gs}}),v(ds,gs),e(ds.prototype,{insertUniqueEdge:function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new zn(t.getLabel())).flip();var r=e.getDepth();r.isNull()&&r.add(n),r.add(i),n.merge(i)}else this._edgeList.add(t)},getGraph:function(){return this._graph},cancelDuplicateResultEdges:function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},isCoveredByLA:function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},computeGeometry:function(t,e,n,i){var r=new P;return r.addAll(t),r.addAll(e),r.addAll(n),r.isEmpty()?ds.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(r)},mergeSymLabels:function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},isCovered:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(this._ptLocator.locate(t,i)!==de.EXTERIOR)return!0}return!1},replaceCollapsedEdges:function(){for(var t=new P,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},updateNodeLabelling:function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},getResultGeometry:function(t){return this.computeOverlay(t),this._resultGeom},insertUniqueEdges:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},computeOverlay:function(t){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 e=new P;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ts.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new ur(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var i=new ns(this,this._geomFact,this._ptLocator);this._resultLineList=i.build(t);var r=new is(this,this._geomFact,this._ptLocator);this._resultPointList=r.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},labelIncompleteNode:function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},copyPoints:function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},findResultAreaEdges:function(t){for(var e=this._graph.getEdgeEnds().iterator();e.hasNext();){var n=e.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&ds.isResultOfOp(i.getLocation(0,Dn.RIGHT),i.getLocation(1,Dn.RIGHT),t)&&n.setInResult(!0)}},computeLabelsFromDepths:function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),i=e.getDepth();if(!i.isNull()){i.normalize();for(var r=0;r<2;r++)n.isNull(r)||!n.isArea()||i.isNull(r)||(0===i.getDelta(r)?n.toLine(r):(x.isTrue(!i.isNull(r,Dn.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(r,Dn.LEFT,i.getLocation(r,Dn.LEFT)),x.isTrue(!i.isNull(r,Dn.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(r,Dn.RIGHT,i.getLocation(r,Dn.RIGHT))))}}},computeLabelling:function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},labelIncompleteNodes:function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},isCoveredByA:function(t){return!!this.isCovered(t,this._resultPolyList)},interfaces_:function(){return[]},getClass:function(){return ds}}),ds.overlayOp=function(t,e,n){return new ds(t,e).getResultGeometry(n)},ds.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ds.createEmptyResult(ds.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.UNION)},ds.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return ds.createEmptyResult(ds.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return es.map(t,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(n)}})}if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.INTERSECTION)},ds.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ds.createEmptyResult(ds.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.SYMDIFFERENCE)},ds.resultDimension=function(t,e,n){var i=e.getDimension(),r=n.getDimension(),s=-1;switch(t){case ds.INTERSECTION:s=Math.min(i,r);break;case ds.UNION:s=Math.max(i,r);break;case ds.DIFFERENCE:s=i;break;case ds.SYMDIFFERENCE:s=Math.max(i,r)}return s},ds.createEmptyResult=function(t,e,n,i){var r=null;switch(ds.resultDimension(t,e,n)){case-1:r=i.createGeometryCollection();break;case 0:r=i.createPoint();break;case 1:r=i.createLineString();break;case 2:r=i.createPolygon()}return r},ds.difference=function(t,e){if(t.isEmpty())return ds.createEmptyResult(ds.DIFFERENCE,t,e,t.getFactory());if(e.isEmpty())return t.copy();if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.DIFFERENCE)},ds.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),i=t.getLocation(1);return ds.isResultOfOp(n,i,e)}if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];switch(r===de.BOUNDARY&&(r=de.INTERIOR),s===de.BOUNDARY&&(s=de.INTERIOR),o){case ds.INTERSECTION:return r===de.INTERIOR&&s===de.INTERIOR;case ds.UNION:return r===de.INTERIOR||s===de.INTERIOR;case ds.DIFFERENCE:return r===de.INTERIOR&&s!==de.INTERIOR;case ds.SYMDIFFERENCE:return r===de.INTERIOR&&s!==de.INTERIOR||r!==de.INTERIOR&&s===de.INTERIOR}return!1}},ds.INTERSECTION=1,ds.UNION=2,ds.DIFFERENCE=3,ds.SYMDIFFERENCE=4;var _s=Object.freeze({OverlayOp:ds});function ps(){this._edgeRing=null,this._next=null,this._label=-1;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];Vr.call(this,t,e,n,i)}function ms(){Yr.apply(this),this._line=null;var t=arguments[0];this._line=t}function vs(){this._factory=null,this._deList=new P,this._lowestEdge=null,this._ring=null,this._ringPts=null,this._holes=null,this._shell=null,this._isHole=null,this._isProcessed=!1,this._isIncludedSet=!1,this._isIncluded=!1;var t=arguments[0];this._factory=t}function ys(){}function xs(){Wr.apply(this),this._factory=null;var t=arguments[0];this._factory=t}function Es(){if(this._lineStringAdder=new Is(this),this._graph=null,this._dangles=new P,this._cutEdges=new P,this._invalidRingLines=new P,this._holeList=null,this._shellList=null,this._polyList=null,this._isCheckingRingsValid=!0,this._extractOnlyPolygonal=null,this._geomFactory=null,0===arguments.length)Es.call(this,!1);else if(1===arguments.length){var t=arguments[0];this._extractOnlyPolygonal=t}}function Is(){this.p=null;var t=arguments[0];this.p=t}v(ps,Vr),e(ps.prototype,{getNext:function(){return this._next},isInRing:function(){return null!==this._edgeRing},setRing:function(t){this._edgeRing=t},setLabel:function(t){this._label=t},getLabel:function(){return this._label},setNext:function(t){this._next=t},getRing:function(){return this._edgeRing},interfaces_:function(){return[]},getClass:function(){return ps}}),v(ms,Yr),e(ms.prototype,{getLine:function(){return this._line},interfaces_:function(){return[]},getClass:function(){return ms}}),e(vs.prototype,{isIncluded:function(){return this._isIncluded},getCoordinates:function(){if(null===this._ringPts){for(var t=new b,e=this._deList.iterator();e.hasNext();){var n=e.next(),i=n.getEdge();vs.addEdge(i.getLine().getCoordinates(),n.getEdgeDirection(),t)}this._ringPts=t.toCoordinateArray()}return this._ringPts},isIncludedSet:function(){return this._isIncludedSet},isValid:function(){return this.getCoordinates(),!(this._ringPts.length<=3)&&(this.getRing(),this._ring.isValid())},build:function(t){var e=t;do{this.add(e),e.setRing(this),e=e.getNext(),x.isTrue(null!==e,"found null DE in ring"),x.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t)},isOuterHole:function(){return!!this._isHole&&!this.hasShell()},getPolygon:function(){var t=null;if(null!==this._holes){t=new Array(this._holes.size()).fill(null);for(var e=0;e<this._holes.size();e++)t[e]=this._holes.get(e)}return this._factory.createPolygon(this._ring,t)},isHole:function(){return this._isHole},isProcessed:function(){return this._isProcessed},addHole:function(){if(arguments[0]instanceof Yt){var t=arguments[0];null===this._holes&&(this._holes=new P),this._holes.add(t)}else if(arguments[0]instanceof vs){var e=arguments[0];e.setShell(this);var n=e.getRing();null===this._holes&&(this._holes=new P),this._holes.add(n)}},setIncluded:function(t){this._isIncluded=t,this._isIncludedSet=!0},getOuterHole:function(){if(this.isHole())return null;for(var t=0;t<this._deList.size();t++){var e=this._deList.get(t).getSym().getRing();if(e.isOuterHole())return e}return null},computeHole:function(){var t=this.getRing();this._isHole=z.isCCW(t.getCoordinates())},hasShell:function(){return null!==this._shell},isOuterShell:function(){return null!==this.getOuterHole()},getLineString:function(){return this.getCoordinates(),this._factory.createLineString(this._ringPts)},toString:function(){return he.toLineString(new Kt(this.getCoordinates()))},getShell:function(){return this.isHole()?this._shell:this},add:function(t){this._deList.add(t)},getRing:function(){if(null!==this._ring)return this._ring;this.getCoordinates(),this._ringPts.length<3&&Y.out.println(this._ringPts);try{this._ring=this._factory.createLinearRing(this._ringPts)}catch(t){if(!(t instanceof D))throw t;Y.out.println(this._ringPts)}return this._ring},updateIncluded:function(){if(this.isHole())return null;for(var t=0;t<this._deList.size();t++){var e=this._deList.get(t).getSym().getRing().getShell();if(null!==e&&e.isIncludedSet())return this.setIncluded(!e.isIncluded()),null}},setShell:function(t){this._shell=t},setProcessed:function(t){this._isProcessed=t},interfaces_:function(){return[]},getClass:function(){return vs}}),vs.findDirEdgesInRing=function(t){var e=t,n=new P;do{n.add(e),e=e.getNext(),x.isTrue(null!==e,"found null DE in ring"),x.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t);return n},vs.addEdge=function(t,e,n){if(e)for(var i=0;i<t.length;i++)n.add(t[i],!1);else for(i=t.length-1;i>=0;i--)n.add(t[i],!1)},vs.findEdgeRingContaining=function(t,e){for(var n=t.getRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),s=null,o=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getRing(),h=l.getEnvelopeInternal();if(!h.equals(i)&&h.contains(i)){r=nt.ptNotInList(n.getCoordinates(),l.getCoordinates());var c=!1;qe.isInRing(r,l.getCoordinates())&&(c=!0),c&&(null===s||o.contains(h))&&(o=(s=u).getRing().getEnvelopeInternal())}}return s},e(ys.prototype,{compare:function(t,e){var n=e;return t.getRing().getEnvelope().compareTo(n.getRing().getEnvelope())},interfaces_:function(){return[_]},getClass:function(){return ys}}),vs.EnvelopeComparator=ys,v(xs,Wr),e(xs.prototype,{findEdgeRing:function(t){var e=new vs(this._factory);return e.build(t),e},computeDepthParity:function(){if(0===arguments.length)for(;;){return null}else arguments.length},computeNextCWEdges:function(){for(var t=this.nodeIterator();t.hasNext();){var e=t.next();xs.computeNextCWEdges(e)}},addEdge:function(t){if(t.isEmpty())return null;var e=nt.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return null;var n=e[0],i=e[e.length-1],r=this.getNode(n),s=this.getNode(i),o=new ps(r,s,e[1],!0),a=new ps(s,r,e[e.length-2],!1),u=new ms(t);u.setDirectedEdges(o,a),this.add(u)},deleteCutEdges:function(){this.computeNextCWEdges(),xs.findLabeledEdgeRings(this._dirEdges);for(var t=new P,e=this._dirEdges.iterator();e.hasNext();){var n=e.next();if(!n.isMarked()){var i=n.getSym();if(n.getLabel()===i.getLabel()){n.setMarked(!0),i.setMarked(!0);var r=n.getEdge();t.add(r.getLine())}}}return t},getEdgeRings:function(){this.computeNextCWEdges(),xs.label(this._dirEdges,-1);var t=xs.findLabeledEdgeRings(this._dirEdges);this.convertMaximalToMinimalEdgeRings(t);for(var e=new P,n=this._dirEdges.iterator();n.hasNext();){var i=n.next();if(!i.isMarked()&&!i.isInRing()){var r=this.findEdgeRing(i);e.add(r)}}return e},getNode:function(t){var e=this.findNode(t);return null===e&&(e=new Ur(t),this.add(e)),e},convertMaximalToMinimalEdgeRings:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getLabel(),r=xs.findIntersectionNodes(n,i);if(null!==r)for(var s=r.iterator();s.hasNext();){var o=s.next();xs.computeNextCCWEdges(o,i)}}},deleteDangles:function(){for(var t=this.findNodesOfDegree(1),e=new ut,n=new je,i=t.iterator();i.hasNext();)n.push(i.next());for(;!n.isEmpty();){var r=n.pop();xs.deleteAllEdges(r);for(i=r.getOutEdges().getEdges().iterator();i.hasNext();){var s=i.next();s.setMarked(!0);var o=s.getSym();null!==o&&o.setMarked(!0);var a=s.getEdge();e.add(a.getLine());var u=s.getToNode();1===xs.getDegreeNonDeleted(u)&&n.push(u)}}return e},interfaces_:function(){return[]},getClass:function(){return xs}}),xs.findLabeledEdgeRings=function(t){for(var e=new P,n=1,i=t.iterator();i.hasNext();){var r=i.next();if(!r.isMarked()&&!(r.getLabel()>=0)){e.add(r);var s=vs.findDirEdgesInRing(r);xs.label(s,n),n++}}return e},xs.getDegreeNonDeleted=function(t){for(var e=0,n=t.getOutEdges().getEdges().iterator();n.hasNext();){n.next().isMarked()||e++}return e},xs.deleteAllEdges=function(t){for(var e=t.getOutEdges().getEdges().iterator();e.hasNext();){var n=e.next();n.setMarked(!0);var i=n.getSym();null!==i&&i.setMarked(!0)}},xs.label=function(t,e){for(var n=t.iterator();n.hasNext();){n.next().setLabel(e)}},xs.computeNextCWEdges=function(t){for(var e=null,n=null,i=t.getOutEdges().getEdges().iterator();i.hasNext();){var r=i.next();if(!r.isMarked()){if(null===e&&(e=r),null!==n)n.getSym().setNext(r);n=r}}null!==n&&n.getSym().setNext(e)},xs.computeNextCCWEdges=function(t,e){for(var n=null,i=null,r=t.getOutEdges().getEdges(),s=r.size()-1;s>=0;s--){var o=r.get(s),a=o.getSym(),u=null;o.getLabel()===e&&(u=o);var l=null;a.getLabel()===e&&(l=a),null===u&&null===l||(null!==l&&(i=l),null!==u&&(null!==i&&(i.setNext(u),i=null),null===n&&(n=u)))}null!==i&&(x.isTrue(null!==n),i.setNext(n))},xs.getDegree=function(t,e){for(var n=0,i=t.getOutEdges().getEdges().iterator();i.hasNext();){i.next().getLabel()===e&&n++}return n},xs.findIntersectionNodes=function(t,e){var n=t,i=null;do{var r=n.getFromNode();xs.getDegree(r,e)>1&&(null===i&&(i=new P),i.add(r)),n=n.getNext(),x.isTrue(null!==n,"found null DE in ring"),x.isTrue(n===t||!n.isInRing(),"found DE already in ring")}while(n!==t);return i},e(Es.prototype,{getGeometry:function(){return null===this._geomFactory&&(this._geomFactory=new se),this.polygonize(),this._extractOnlyPolygonal?this._geomFactory.buildGeometry(this._polyList):this._geomFactory.createGeometryCollection(se.toGeometryArray(this._polyList))},getInvalidRingLines:function(){return this.polygonize(),this._invalidRingLines},findValidRings:function(t,e,n){for(var i=t.iterator();i.hasNext();){var r=i.next();r.isValid()?e.add(r):n.add(r.getLineString())}},polygonize:function(){if(null!==this._polyList)return null;if(this._polyList=new P,null===this._graph)return null;this._dangles=this._graph.deleteDangles(),this._cutEdges=this._graph.deleteCutEdges();var t=this._graph.getEdgeRings(),e=new P;this._invalidRingLines=new P,this._isCheckingRingsValid?this.findValidRings(t,e,this._invalidRingLines):e=t,this.findShellsAndHoles(e),Es.assignHolesToShells(this._holeList,this._shellList),Te.sort(this._shellList,new vs.EnvelopeComparator);var n=!0;this._extractOnlyPolygonal&&(Es.findDisjointShells(this._shellList),n=!1),this._polyList=Es.extractPolygons(this._shellList,n)},getDangles:function(){return this.polygonize(),this._dangles},getCutEdges:function(){return this.polygonize(),this._cutEdges},getPolygons:function(){return this.polygonize(),this._polyList},add:function(){if(N(arguments[0],S))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.add(e)}else if(arguments[0]instanceof At){var n=arguments[0];this._geomFactory=n.getFactory(),null===this._graph&&(this._graph=new xs(this._geomFactory)),this._graph.addEdge(n)}else if(arguments[0]instanceof K){arguments[0].apply(this._lineStringAdder)}},setCheckRingsValid:function(t){this._isCheckingRingsValid=t},findShellsAndHoles:function(t){this._holeList=new P,this._shellList=new P;for(var e=t.iterator();e.hasNext();){var n=e.next();n.computeHole(),n.isHole()?this._holeList.add(n):this._shellList.add(n)}},interfaces_:function(){return[]},getClass:function(){return Es}}),Es.findOuterShells=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getOuterHole();null===i||i.isProcessed()||(n.setIncluded(!0),i.setProcessed(!0))}},Es.extractPolygons=function(t,e){for(var n=new P,i=t.iterator();i.hasNext();){var r=i.next();(e||r.isIncluded())&&n.add(r.getPolygon())}return n},Es.assignHolesToShells=function(t,e){for(var n=t.iterator();n.hasNext();){var i=n.next();Es.assignHoleToShell(i,e)}},Es.assignHoleToShell=function(t,e){var n=vs.findEdgeRingContaining(t,e);null!==n&&n.addHole(t)},Es.findDisjointShells=function(t){Es.findOuterShells(t);var e=null;do{e=!1;for(var n=t.iterator();n.hasNext();){var i=n.next();i.isIncludedSet()||(i.updateIncluded(),i.isIncludedSet()||(e=!0))}}while(e)},e(Is.prototype,{filter:function(t){t instanceof At&&this.p.add(t)},interfaces_:function(){return[j]},getClass:function(){return Is}}),Es.LineStringAdder=Is;var Ns=Object.freeze({Polygonizer:Es});function Cs(){}function Ss(){if(this._edgeEnds=new P,1===arguments.length){var t=arguments[0];Ss.call(this,null,t)}else if(2===arguments.length){arguments[0];var e=arguments[1];Qn.call(this,e.getEdge(),e.getCoordinate(),e.getDirectedCoordinate(),new zn(e.getLabel())),this.insert(e)}}function Ls(){pr.apply(this)}function ws(){var t=arguments[0],e=arguments[1];Kn.call(this,t,e)}function Rs(){ti.apply(this)}function Ts(){this._li=new fe,this._ptLocator=new Mn,this._arg=null,this._nodes=new Zn(new Rs),this._im=null,this._isolatedEdges=new P,this._invalidPoint=null;var t=arguments[0];this._arg=t}function Ps(){this._rectEnv=null;var t=arguments[0];this._rectEnv=t.getEnvelopeInternal()}function Os(){this._li=new fe,this._rectEnv=null,this._diagUp0=null,this._diagUp1=null,this._diagDown0=null,this._diagDown1=null;var t=arguments[0];this._rectEnv=t,this._diagUp0=new E(t.getMinX(),t.getMinY()),this._diagUp1=new E(t.getMaxX(),t.getMaxY()),this._diagDown0=new E(t.getMinX(),t.getMaxY()),this._diagDown1=new E(t.getMaxX(),t.getMinY())}function bs(){this._isDone=!1}function Ms(){this._rectangle=null,this._rectEnv=null;var t=arguments[0];this._rectangle=t,this._rectEnv=t.getEnvelopeInternal()}function Ds(){bs.apply(this),this._rectEnv=null,this._intersects=!1;var t=arguments[0];this._rectEnv=t}function As(){bs.apply(this),this._rectSeq=null,this._rectEnv=null,this._containsPoint=!1;var t=arguments[0];this._rectSeq=t.getExteriorRing().getCoordinateSequence(),this._rectEnv=t.getEnvelopeInternal()}function Fs(){bs.apply(this),this._rectEnv=null,this._rectIntersector=null,this._hasIntersection=!1,this._p0=new E,this._p1=new E;var t=arguments[0];this._rectEnv=t.getEnvelopeInternal(),this._rectIntersector=new Os(this._rectEnv)}function Gs(){if(this._relate=null,2===arguments.length){var t=arguments[0],e=arguments[1];gs.call(this,t,e),this._relate=new Ts(this._arg)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];gs.call(this,n,i,r),this._relate=new Ts(this._arg)}}e(Cs.prototype,{createEdgeEndForNext:function(t,e,n,i){var r=n.segmentIndex+1;if(r>=t.getNumPoints()&&null===i)return null;var s=t.getCoordinate(r);null!==i&&i.segmentIndex===n.segmentIndex&&(s=i.coord);var o=new Qn(t,n.coord,s,new zn(t.getLabel()));e.add(o)},createEdgeEndForPrev:function(t,e,n,i){var r=n.segmentIndex;if(0===n.dist){if(0===r)return null;r--}var s=t.getCoordinate(r);null!==i&&i.segmentIndex>=r&&(s=i.coord);var o=new zn(t.getLabel());o.flip();var a=new Qn(t,n.coord,s,o);e.add(a)},computeEdgeEnds:function(){if(1===arguments.length){for(var t=arguments[0],e=new P,n=t;n.hasNext();){var i=n.next();this.computeEdgeEnds(i,e)}return e}if(2===arguments.length){var r=arguments[0],s=arguments[1],o=r.getEdgeIntersectionList();o.addEndpoints();var a=o.iterator(),u=null,l=null;if(!a.hasNext())return null;var h=a.next();do{u=l,l=h,h=null,a.hasNext()&&(h=a.next()),null!==l&&(this.createEdgeEndForPrev(r,s,l,u),this.createEdgeEndForNext(r,s,l,h))}while(null!==l)}},interfaces_:function(){return[]},getClass:function(){return Cs}}),v(Ss,Qn),e(Ss.prototype,{insert:function(t){this._edgeEnds.add(t)},print:function(t){t.println("EdgeEndBundle--\x3e Label: "+this._label);for(var e=this.iterator();e.hasNext();){e.next().print(t),t.println()}},iterator:function(){return this._edgeEnds.iterator()},getEdgeEnds:function(){return this._edgeEnds},computeLabelOn:function(t,e){for(var n=0,i=!1,r=this.iterator();r.hasNext();){(s=r.next().getLabel().getLocation(t))===de.BOUNDARY&&n++,s===de.INTERIOR&&(i=!0)}var s=de.NONE;i&&(s=de.INTERIOR),n>0&&(s=ni.determineBoundary(e,n)),this._label.setLocation(t,s)},computeLabelSide:function(t,e){for(var n=this.iterator();n.hasNext();){var i=n.next();if(i.getLabel().isArea()){var r=i.getLabel().getLocation(t,e);if(r===de.INTERIOR)return this._label.setLocation(t,e,de.INTERIOR),null;r===de.EXTERIOR&&this._label.setLocation(t,e,de.EXTERIOR)}}},getLabel:function(){return this._label},computeLabelSides:function(t){this.computeLabelSide(t,Dn.LEFT),this.computeLabelSide(t,Dn.RIGHT)},updateIM:function(t){jn.updateIM(this._label,t)},computeLabel:function(t){for(var e=!1,n=this.iterator();n.hasNext();){n.next().getLabel().isArea()&&(e=!0)}this._label=e?new zn(de.NONE,de.NONE,de.NONE):new zn(de.NONE);for(var i=0;i<2;i++)this.computeLabelOn(i,t),e&&this.computeLabelSides(i)},interfaces_:function(){return[]},getClass:function(){return Ss}}),v(Ls,pr),e(Ls.prototype,{updateIM:function(t){for(var e=this.iterator();e.hasNext();){e.next().updateIM(t)}},insert:function(t){var e=this._edgeMap.get(t);null===e?(e=new Ss(t),this.insertEdgeEnd(t,e)):e.insert(t)},interfaces_:function(){return[]},getClass:function(){return Ls}}),v(ws,Kn),e(ws.prototype,{updateIMFromEdges:function(t){this._edges.updateIM(t)},computeIM:function(t){t.setAtLeastIfValid(this._label.getLocation(0),this._label.getLocation(1),0)},interfaces_:function(){return[]},getClass:function(){return ws}}),v(Rs,ti),e(Rs.prototype,{createNode:function(t){return new ws(t,new Ls)},interfaces_:function(){return[]},getClass:function(){return Rs}}),e(Ts.prototype,{insertEdgeEnds:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._nodes.add(n)}},computeProperIntersectionIM:function(t,e){var n=this._arg[0].getGeometry().getDimension(),i=this._arg[1].getGeometry().getDimension(),r=t.hasProperIntersection(),s=t.hasProperInteriorIntersection();2===n&&2===i?r&&e.setAtLeast("212101212"):2===n&&1===i?(r&&e.setAtLeast("FFF0FFFF2"),s&&e.setAtLeast("1FFFFF1FF")):1===n&&2===i?(r&&e.setAtLeast("F0FFFFFF2"),s&&e.setAtLeast("1F1FFFFFF")):1===n&&1===i&&s&&e.setAtLeast("0FFFFFFFF")},labelIsolatedEdges:function(t,e){for(var n=this._arg[t].getEdgeIterator();n.hasNext();){var i=n.next();i.isIsolated()&&(this.labelIsolatedEdge(i,e,this._arg[e].getGeometry()),this._isolatedEdges.add(i))}},labelIsolatedEdge:function(t,e,n){if(n.getDimension()>0){var i=this._ptLocator.locate(t.getCoordinate(),n);t.getLabel().setAllLocations(e,i)}else t.getLabel().setAllLocations(e,de.EXTERIOR)},computeIM:function(){var t=new _e;if(t.set(de.EXTERIOR,de.EXTERIOR,2),!this._arg[0].getGeometry().getEnvelopeInternal().intersects(this._arg[1].getGeometry().getEnvelopeInternal()))return this.computeDisjointIM(t),t;this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1);var e=this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!1);this.computeIntersectionNodes(0),this.computeIntersectionNodes(1),this.copyNodesAndLabels(0),this.copyNodesAndLabels(1),this.labelIsolatedNodes(),this.computeProperIntersectionIM(e,t);var n=new Cs,i=n.computeEdgeEnds(this._arg[0].getEdgeIterator());this.insertEdgeEnds(i);var r=n.computeEdgeEnds(this._arg[1].getEdgeIterator());return this.insertEdgeEnds(r),this.labelNodeEdges(),this.labelIsolatedEdges(0,1),this.labelIsolatedEdges(1,0),this.updateIM(t),t},labelNodeEdges:function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}},copyNodesAndLabels:function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._nodes.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},labelIntersectionNodes:function(t){for(var e=this._arg[t].getEdgeIterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.getEdgeIntersectionList().iterator();r.hasNext();){var s=r.next(),o=this._nodes.find(s.coord);o.getLabel().isNull(t)&&(i===de.BOUNDARY?o.setLabelBoundary(t):o.setLabel(t,de.INTERIOR))}},labelIsolatedNode:function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setAllLocations(e,n)},computeIntersectionNodes:function(t){for(var e=this._arg[t].getEdgeIterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.getEdgeIntersectionList().iterator();r.hasNext();){var s=r.next(),o=this._nodes.addNode(s.coord);i===de.BOUNDARY?o.setLabelBoundary(t):o.getLabel().isNull(t)&&o.setLabel(t,de.INTERIOR)}},labelIsolatedNodes:function(){for(var t=this._nodes.iterator();t.hasNext();){var e=t.next(),n=e.getLabel();x.isTrue(n.getGeometryCount()>0,"node with empty label found"),e.isIsolated()&&(n.isNull(0)?this.labelIsolatedNode(e,0):this.labelIsolatedNode(e,1))}},updateIM:function(t){for(var e=this._isolatedEdges.iterator();e.hasNext();){e.next().updateIM(t)}for(var n=this._nodes.iterator();n.hasNext();){var i=n.next();i.updateIM(t),i.updateIMFromEdges(t)}},computeDisjointIM:function(t){var e=this._arg[0].getGeometry();e.isEmpty()||(t.set(de.INTERIOR,de.EXTERIOR,e.getDimension()),t.set(de.BOUNDARY,de.EXTERIOR,e.getBoundaryDimension()));var n=this._arg[1].getGeometry();n.isEmpty()||(t.set(de.EXTERIOR,de.INTERIOR,n.getDimension()),t.set(de.EXTERIOR,de.BOUNDARY,n.getBoundaryDimension()))},interfaces_:function(){return[]},getClass:function(){return Ts}}),e(Ps.prototype,{isContainedInBoundary:function(t){if(t instanceof Vt)return!1;if(t instanceof Gt)return this.isPointContainedInBoundary(t);if(t instanceof At)return this.isLineStringContainedInBoundary(t);for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);if(!this.isContainedInBoundary(n))return!1}return!0},isLineSegmentContainedInBoundary:function(t,e){if(t.equals(e))return this.isPointContainedInBoundary(t);if(t.x===e.x){if(t.x===this._rectEnv.getMinX()||t.x===this._rectEnv.getMaxX())return!0}else if(t.y===e.y&&(t.y===this._rectEnv.getMinY()||t.y===this._rectEnv.getMaxY()))return!0;return!1},isLineStringContainedInBoundary:function(t){for(var e=t.getCoordinateSequence(),n=new E,i=new E,r=0;r<e.size()-1;r++)if(e.getCoordinate(r,n),e.getCoordinate(r+1,i),!this.isLineSegmentContainedInBoundary(n,i))return!1;return!0},isPointContainedInBoundary:function(){if(arguments[0]instanceof Gt){var t=arguments[0];return this.isPointContainedInBoundary(t.getCoordinate())}if(arguments[0]instanceof E){var e=arguments[0];return e.x===this._rectEnv.getMinX()||e.x===this._rectEnv.getMaxX()||e.y===this._rectEnv.getMinY()||e.y===this._rectEnv.getMaxY()}},contains:function(t){return!!this._rectEnv.contains(t.getEnvelopeInternal())&&!this.isContainedInBoundary(t)},interfaces_:function(){return[]},getClass:function(){return Ps}}),Ps.contains=function(t,e){return new Ps(t).contains(e)},e(Os.prototype,{intersects:function(t,e){var n=new M(t,e);if(!this._rectEnv.intersects(n))return!1;if(this._rectEnv.intersects(t))return!0;if(this._rectEnv.intersects(e))return!0;if(t.compareTo(e)>0){var i=t;t=e,e=i}var r=!1;return e.y>t.y&&(r=!0),r?this._li.computeIntersection(t,e,this._diagDown0,this._diagDown1):this._li.computeIntersection(t,e,this._diagUp0,this._diagUp1),!!this._li.hasIntersection()},interfaces_:function(){return[]},getClass:function(){return Os}}),e(bs.prototype,{applyTo:function(t){for(var e=0;e<t.getNumGeometries()&&!this._isDone;e++){var n=t.getGeometryN(e);if(n instanceof Lt)this.applyTo(n);else if(this.visit(n),this.isDone())return this._isDone=!0,null}},interfaces_:function(){return[]},getClass:function(){return bs}}),e(Ms.prototype,{intersects:function(t){if(!this._rectEnv.intersects(t.getEnvelopeInternal()))return!1;var e=new Ds(this._rectEnv);if(e.applyTo(t),e.intersects())return!0;var n=new As(this._rectangle);if(n.applyTo(t),n.containsPoint())return!0;var i=new Fs(this._rectangle);return i.applyTo(t),!!i.intersects()},interfaces_:function(){return[]},getClass:function(){return Ms}}),Ms.intersects=function(t,e){return new Ms(t).intersects(e)},v(Ds,bs),e(Ds.prototype,{isDone:function(){return!0===this._intersects},visit:function(t){var e=t.getEnvelopeInternal();return this._rectEnv.intersects(e)?this._rectEnv.contains(e)?(this._intersects=!0,null):e.getMinX()>=this._rectEnv.getMinX()&&e.getMaxX()<=this._rectEnv.getMaxX()?(this._intersects=!0,null):e.getMinY()>=this._rectEnv.getMinY()&&e.getMaxY()<=this._rectEnv.getMaxY()?(this._intersects=!0,null):void 0:null},intersects:function(){return this._intersects},interfaces_:function(){return[]},getClass:function(){return Ds}}),v(As,bs),e(As.prototype,{isDone:function(){return!0===this._containsPoint},visit:function(t){if(!(t instanceof Vt))return null;var e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;for(var n=new E,i=0;i<4;i++)if(this._rectSeq.getCoordinate(i,n),e.contains(n)&&Ve.containsPointInPolygon(n,t))return this._containsPoint=!0,null},containsPoint:function(){return this._containsPoint},interfaces_:function(){return[]},getClass:function(){return As}}),v(Fs,bs),e(Fs.prototype,{intersects:function(){return this._hasIntersection},isDone:function(){return!0===this._hasIntersection},visit:function(t){var e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;var n=be.getLines(t);this.checkIntersectionWithLineStrings(n)},checkIntersectionWithLineStrings:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();if(this.checkIntersectionWithSegments(n),this._hasIntersection)return null}},checkIntersectionWithSegments:function(t){for(var e=t.getCoordinateSequence(),n=1;n<e.size();n++)if(e.getCoordinate(n-1,this._p0),e.getCoordinate(n,this._p1),this._rectIntersector.intersects(this._p0,this._p1))return this._hasIntersection=!0,null},interfaces_:function(){return[]},getClass:function(){return Fs}}),v(Gs,gs),e(Gs.prototype,{getIntersectionMatrix:function(){return this._relate.computeIM()},interfaces_:function(){return[]},getClass:function(){return Gs}}),Gs.covers=function(t,e){return!(2===e.getDimension()&&t.getDimension()<2)&&(!(1===e.getDimension()&&t.getDimension()<1&&e.getLength()>0)&&(!!t.getEnvelopeInternal().covers(e.getEnvelopeInternal())&&(!!t.isRectangle()||new Gs(t,e).getIntersectionMatrix().isCovers())))},Gs.intersects=function(t,e){if(!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal()))return!1;if(t.isRectangle())return Ms.intersects(t,e);if(e.isRectangle())return Ms.intersects(e,t);if(t.isGeometryCollection()||e.isGeometryCollection()){for(var n=0;n<t.getNumGeometries();n++)for(var i=0;i<e.getNumGeometries();i++)if(t.getGeometryN(n).intersects(e.getGeometryN(i)))return!0;return!1}return new Gs(t,e).getIntersectionMatrix().isIntersects()},Gs.touches=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&new Gs(t,e).getIntersectionMatrix().isTouches(t.getDimension(),e.getDimension())},Gs.relate=function(){return 2===arguments.length?new Gs(arguments[0],arguments[1]).getIntersectionMatrix():3===arguments.length?new Gs(arguments[0],arguments[1],arguments[2]).getIntersectionMatrix():void 0},Gs.overlaps=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&new Gs(t,e).getIntersectionMatrix().isOverlaps(t.getDimension(),e.getDimension())},Gs.crosses=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&new Gs(t,e).getIntersectionMatrix().isCrosses(t.getDimension(),e.getDimension())},Gs.contains=function(t,e){return!(2===e.getDimension()&&t.getDimension()<2)&&(!(1===e.getDimension()&&t.getDimension()<1&&e.getLength()>0)&&(!!t.getEnvelopeInternal().contains(e.getEnvelopeInternal())&&(t.isRectangle()?Ps.contains(t,e):new Gs(t,e).getIntersectionMatrix().isContains())))};var qs=Object.freeze({RelateOp:Gs});function Bs(){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null;var t=arguments[0];this._geomFactory=Bs.extractFactory(t),this._inputGeoms=t}function Vs(){this._pointGeom=null,this._otherGeom=null,this._geomFact=null;var t=arguments[0],e=arguments[1];this._pointGeom=t,this._otherGeom=e,this._geomFact=e.getFactory()}function zs(){this._geometryType=null,this._comps=null;var t=arguments[0],e=arguments[1];this._geometryType=t,this._comps=e}function Ys(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new P)}function ks(){if(this._polygons=new P,this._lines=new P,this._points=new P,this._geomFact=null,1===arguments.length){if(N(arguments[0],S)){var t=arguments[0];this.extract(t)}else if(arguments[0]instanceof K){var e=arguments[0];this.extract(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this._geomFact=i,this.extract(n)}}e(Bs.prototype,{extractElements:function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this._skipEmpty&&i.isEmpty()||e.add(i)}},combine:function(){for(var t=new P,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection():null:this._geomFactory.buildGeometry(t)},interfaces_:function(){return[]},getClass:function(){return Bs}}),Bs.combine=function(){if(1===arguments.length)return new Bs(arguments[0]).combine();if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Bs(Bs.createList(t,e)).combine()}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];return new Bs(Bs.createList(n,i,r)).combine()}},Bs.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Bs.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return(n=new P).add(t),n.add(e),n}if(3===arguments.length){var n,i=arguments[0],r=arguments[1],s=arguments[2];return(n=new P).add(i),n.add(r),n.add(s),n}},e(Vs.prototype,{union:function(){for(var t=new Mn,e=new yt,n=0;n<this._pointGeom.getNumGeometries();n++){var i=this._pointGeom.getGeometryN(n).getCoordinate();t.locate(i,this._otherGeom)===de.EXTERIOR&&e.add(i)}if(0===e.size())return this._otherGeom;var r=null,s=nt.toCoordinateArray(e);return r=1===s.length?this._geomFact.createPoint(s[0]):this._geomFact.createMultiPointFromCoords(s),Bs.combine(r,this._otherGeom)},interfaces_:function(){return[]},getClass:function(){return Vs}}),Vs.union=function(t,e){return new Vs(t,e).union()},e(zs.prototype,{filter:function(t){(null===this._geometryType||zs.isOfType(t,this._geometryType))&&this._comps.add(t)},interfaces_:function(){return[Ct]},getClass:function(){return zs}}),zs.isOfType=function(t,e){return t.getGeometryType()===e||e===K.TYPENAME_LINESTRING&&t.getGeometryType()===K.TYPENAME_LINEARRING},zs.extract=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return zs.extract(t,e,new P)}if(3===arguments.length){if(N(arguments[2],w)&&arguments[0]instanceof K&&"string"==typeof arguments[1]){var n=arguments[0],i=arguments[1],r=arguments[2];return n.getGeometryType()===i?r.add(n):n instanceof Lt&&n.apply(new zs(i,r)),r}if(N(arguments[2],w)&&arguments[0]instanceof K&&arguments[1]instanceof Class){var s=arguments[0],o=arguments[1],a=arguments[2];return zs.extract(s,zs.toGeometryType(o),a)}}},e(Ys.prototype,{reduceToGeometries:function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next(),r=null;N(i,w)?r=this.unionTree(i):i instanceof K&&(r=i),e.add(r)}return e},extractByEnvelope:function(t,e,n){for(var i=new P,r=0;r<e.getNumGeometries();r++){var s=e.getGeometryN(r);s.getEnvelopeInternal().intersects(t)?i.add(s):n.add(s)}return this._geomFactory.buildGeometry(i)},unionOptimized:function(t,e){var n=t.getEnvelopeInternal(),i=e.getEnvelopeInternal();if(!n.intersects(i))return Bs.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var r=n.intersection(i);return this.unionUsingEnvelopeIntersection(t,e,r)},union:function(){if(null===this._inputPolys)throw new IllegalStateException("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new Ci(Ys.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();return this.unionTree(i)},binaryUnion:function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2];if(i-n<=1){var r=Ys.getGeometry(e,n);return this.unionSafe(r,null)}if(i-n==2)return this.unionSafe(Ys.getGeometry(e,n),Ys.getGeometry(e,n+1));var s=Math.trunc((i+n)/2),o=(r=this.binaryUnion(e,n,s),this.binaryUnion(e,s,i));return this.unionSafe(r,o)}},repeatedUnion:function(t){for(var e=null,n=t.iterator();n.hasNext();){var i=n.next();e=null===e?i.copy():e.union(i)}return e},unionSafe:function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},unionActual:function(t,e){return Ys.restrictToPolygons(t.union(e))},unionTree:function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},unionUsingEnvelopeIntersection:function(t,e,n){var i=new P,r=this.extractByEnvelope(n,t,i),s=this.extractByEnvelope(n,e,i),o=this.unionActual(r,s);return i.add(o),Bs.combine(i)},bufferUnion:function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},interfaces_:function(){return[]},getClass:function(){return Ys}}),Ys.restrictToPolygons=function(t){if(N(t,Bt))return t;var e=br.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(se.toPolygonArray(e))},Ys.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Ys.union=function(t){return new Ys(t).union()},Ys.STRTREE_NODE_CAPACITY=4,e(ks.prototype,{unionNoOpt:function(t){var e=this._geomFact.createPoint();return fs.overlayOp(t,e,ds.UNION)},unionWithNull:function(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)},extract:function(){if(N(arguments[0],S))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.extract(e)}else if(arguments[0]instanceof K){var n=arguments[0];null===this._geomFact&&(this._geomFact=n.getFactory()),zs.extract(n,K.TYPENAME_POLYGON,this._polygons),zs.extract(n,K.TYPENAME_LINESTRING,this._lines),zs.extract(n,K.TYPENAME_POINT,this._points)}},union:function(){if(null===this._geomFact)return null;var t=null;if(this._points.size()>0){var e=this._geomFact.buildGeometry(this._points);t=this.unionNoOpt(e)}var n=null;if(this._lines.size()>0){var i=this._geomFact.buildGeometry(this._lines);n=this.unionNoOpt(i)}var r=null;this._polygons.size()>0&&(r=Ys.union(this._polygons));var s=this.unionWithNull(n,r),o=null;return o=null===t?s:null===s?t:Vs.union(t,s),null===o?this._geomFact.createGeometryCollection():o},interfaces_:function(){return[]},getClass:function(){return ks}}),ks.union=function(){if(1===arguments.length){if(N(arguments[0],S))return new ks(arguments[0]).union();if(arguments[0]instanceof K)return new ks(arguments[0]).union()}else if(2===arguments.length){return new ks(arguments[0],arguments[1]).union()}};var Us=Object.freeze({UnaryUnionOp:ks});function Xs(){this._geometryFactory=new se,this._geomGraph=null,this._disconnectedRingcoord=null;var t=arguments[0];this._geomGraph=t}function Hs(){this._nodes=new Zn(new Rs)}function Ws(){this._li=new fe,this._geomGraph=null,this._nodeGraph=new Hs,this._invalidPoint=null;var t=arguments[0];this._geomGraph=t}function js(){this._graph=null,this._rings=new P,this._totalEnv=new M,this._index=null,this._nestedPt=null;var t=arguments[0];this._graph=t}function Ks(){if(this._errorType=null,this._pt=null,1===arguments.length){var t=arguments[0];Ks.call(this,t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._errorType=e,null!==n&&(this._pt=n.copy())}}function Zs(){this._parentGeometry=null,this._isSelfTouchingRingFormingHoleValid=!1,this._validErr=null;var t=arguments[0];this._parentGeometry=t}e(Xs.prototype,{visitInteriorRing:function(t,e){var n=t.getCoordinates(),i=n[0],r=Xs.findDifferentPoint(n,i),s=e.findEdgeInSameDirection(i,r),o=e.findEdgeEnd(s),a=null;o.getLabel().getLocation(0,Dn.RIGHT)===de.INTERIOR?a=o:o.getSym().getLabel().getLocation(0,Dn.RIGHT)===de.INTERIOR&&(a=o.getSym()),x.isTrue(null!==a,"unable to find dirEdge with Interior on RHS"),this.visitLinkedDirectedEdges(a)},visitShellInteriors:function(t,e){if(t instanceof Vt){var n=t;this.visitInteriorRing(n.getExteriorRing(),e)}if(t instanceof kt)for(var i=t,r=0;r<i.getNumGeometries();r++){n=i.getGeometryN(r);this.visitInteriorRing(n.getExteriorRing(),e)}},getCoordinate:function(){return this._disconnectedRingcoord},setInteriorEdgesInResult:function(t){for(var e=t.getEdgeEnds().iterator();e.hasNext();){var n=e.next();n.getLabel().getLocation(0,Dn.RIGHT)===de.INTERIOR&&n.setInResult(!0)}},visitLinkedDirectedEdges:function(t){var e=t,n=t;do{x.isTrue(null!==n,"found null Directed Edge"),n.setVisited(!0),n=n.getNext()}while(n!==e)},buildEdgeRings:function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&null===i.getEdgeRing()){var r=new ar(i,this._geometryFactory);r.linkDirectedEdgesForMinimalEdgeRings();var s=r.buildMinimalRings();e.addAll(s)}}return e},hasUnvisitedShellEdge:function(t){for(var e=0;e<t.size();e++){var n=t.get(e);if(!n.isHole()){var i=n.getEdges(),r=i.get(0);if(r.getLabel().getLocation(0,Dn.RIGHT)===de.INTERIOR)for(var s=0;s<i.size();s++)if(!(r=i.get(s)).isVisited())return this._disconnectedRingcoord=r.getCoordinate(),!0}}return!1},isInteriorsConnected:function(){var t=new P;this._geomGraph.computeSplitEdges(t);var e=new ei(new vr);e.addEdges(t),this.setInteriorEdgesInResult(e),e.linkResultDirectedEdges();var n=this.buildEdgeRings(e.getEdgeEnds());return this.visitShellInteriors(this._geomGraph.getGeometry(),e),!this.hasUnvisitedShellEdge(n)},interfaces_:function(){return[]},getClass:function(){return Xs}}),Xs.findDifferentPoint=function(t,e){for(var n=0;n<t.length;n++)if(!t[n].equals(e))return t[n];return null},e(Hs.prototype,{insertEdgeEnds:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._nodes.add(n)}},getNodeIterator:function(){return this._nodes.iterator()},copyNodesAndLabels:function(t,e){for(var n=t.getNodeIterator();n.hasNext();){var i=n.next();this._nodes.addNode(i.getCoordinate()).setLabel(e,i.getLabel().getLocation(e))}},build:function(t){this.computeIntersectionNodes(t,0),this.copyNodesAndLabels(t,0);var e=(new Cs).computeEdgeEnds(t.getEdgeIterator());this.insertEdgeEnds(e)},computeIntersectionNodes:function(t,e){for(var n=t.getEdgeIterator();n.hasNext();)for(var i=n.next(),r=i.getLabel().getLocation(e),s=i.getEdgeIntersectionList().iterator();s.hasNext();){var o=s.next(),a=this._nodes.addNode(o.coord);r===de.BOUNDARY?a.setLabelBoundary(e):a.getLabel().isNull(e)&&a.setLabel(e,de.INTERIOR)}},interfaces_:function(){return[]},getClass:function(){return Hs}}),e(Ws.prototype,{isNodeEdgeAreaLabelsConsistent:function(){for(var t=this._nodeGraph.getNodeIterator();t.hasNext();){var e=t.next();if(!e.getEdges().isAreaLabelsConsistent(this._geomGraph))return this._invalidPoint=e.getCoordinate().copy(),!1}return!0},getInvalidPoint:function(){return this._invalidPoint},hasDuplicateRings:function(){for(var t=this._nodeGraph.getNodeIterator();t.hasNext();)for(var e=t.next().getEdges().iterator();e.hasNext();){var n=e.next();if(n.getEdgeEnds().size()>1)return this._invalidPoint=n.getEdge().getCoordinate(0),!0}return!1},isNodeConsistentArea:function(){var t=this._geomGraph.computeSelfNodes(this._li,!0,!0);return t.hasProperIntersection()?(this._invalidPoint=t.getProperIntersectionPoint(),!1):(this._nodeGraph.build(this._geomGraph),this.isNodeEdgeAreaLabelsConsistent())},interfaces_:function(){return[]},getClass:function(){return Ws}}),e(js.prototype,{buildIndex:function(){this._index=new Ci;for(var t=0;t<this._rings.size();t++){var e=this._rings.get(t),n=e.getEnvelopeInternal();this._index.insert(n,e)}},getNestedPoint:function(){return this._nestedPt},isNonNested:function(){this.buildIndex();for(var t=0;t<this._rings.size();t++)for(var e=this._rings.get(t),n=e.getCoordinates(),i=this._index.query(e.getEnvelopeInternal()),r=0;r<i.size();r++){var s=i.get(r),o=s.getCoordinates();if(e!==s&&e.getEnvelopeInternal().intersects(s.getEnvelopeInternal())){var a=Zs.findPtNotNode(n,s,this._graph);if(null!==a)if(qe.isInRing(a,o))return this._nestedPt=a,!1}}return!0},add:function(t){this._rings.add(t),this._totalEnv.expandToInclude(t.getEnvelopeInternal())},interfaces_:function(){return[]},getClass:function(){return js}}),e(Ks.prototype,{getErrorType:function(){return this._errorType},getMessage:function(){return Ks.errMsg[this._errorType]},getCoordinate:function(){return this._pt},toString:function(){var t="";return null!==this._pt&&(t=" at or near point "+this._pt),this.getMessage()+t},interfaces_:function(){return[]},getClass:function(){return Ks}}),Ks.ERROR=0,Ks.REPEATED_POINT=1,Ks.HOLE_OUTSIDE_SHELL=2,Ks.NESTED_HOLES=3,Ks.DISCONNECTED_INTERIOR=4,Ks.SELF_INTERSECTION=5,Ks.RING_SELF_INTERSECTION=6,Ks.NESTED_SHELLS=7,Ks.DUPLICATE_RINGS=8,Ks.TOO_FEW_POINTS=9,Ks.INVALID_COORDINATE=10,Ks.RING_NOT_CLOSED=11,Ks.errMsg=["Topology Validation Error","Repeated Point","Hole lies outside shell","Holes are nested","Interior is disconnected","Self-intersection","Ring Self-intersection","Nested shells","Duplicate Rings","Too few distinct points in geometry component","Invalid Coordinate","Ring is not closed"],e(Zs.prototype,{checkInvalidCoordinates:function(){if(arguments[0]instanceof Array){for(var t=arguments[0],e=0;e<t.length;e++)if(!Zs.isValid(t[e]))return this._validErr=new Ks(Ks.INVALID_COORDINATE,t[e]),null}else if(arguments[0]instanceof Vt){var n=arguments[0];if(this.checkInvalidCoordinates(n.getExteriorRing().getCoordinates()),null!==this._validErr)return null;for(e=0;e<n.getNumInteriorRing();e++)if(this.checkInvalidCoordinates(n.getInteriorRingN(e).getCoordinates()),null!==this._validErr)return null}},checkHolesNotNested:function(t,e){for(var n=new js(e),i=0;i<t.getNumInteriorRing();i++){var r=t.getInteriorRingN(i);n.add(r)}n.isNonNested()||(this._validErr=new Ks(Ks.NESTED_HOLES,n.getNestedPoint()))},checkConsistentArea:function(t){var e=new Ws(t);if(!e.isNodeConsistentArea())return this._validErr=new Ks(Ks.SELF_INTERSECTION,e.getInvalidPoint()),null;e.hasDuplicateRings()&&(this._validErr=new Ks(Ks.DUPLICATE_RINGS,e.getInvalidPoint()))},isValid:function(){return this.checkValid(this._parentGeometry),null===this._validErr},checkShellInsideHole:function(t,e,n){var i=t.getCoordinates(),r=e.getCoordinates(),s=Zs.findPtNotNode(i,e,n);if(null!==s&&!qe.isInRing(s,r))return s;var o=Zs.findPtNotNode(r,t,n);return null!==o?qe.isInRing(o,i)?o:null:(x.shouldNeverReachHere("points in shell and hole appear to be equal"),null)},checkNoSelfIntersectingRings:function(t){for(var e=t.getEdgeIterator();e.hasNext();){var n=e.next();if(this.checkNoSelfIntersectingRing(n.getEdgeIntersectionList()),null!==this._validErr)return null}},checkConnectedInteriors:function(t){var e=new Xs(t);e.isInteriorsConnected()||(this._validErr=new Ks(Ks.DISCONNECTED_INTERIOR,e.getCoordinate()))},checkNoSelfIntersectingRing:function(t){for(var e=new yt,n=!0,i=t.iterator();i.hasNext();){var r=i.next();if(n)n=!1;else{if(e.contains(r.coord))return this._validErr=new Ks(Ks.RING_SELF_INTERSECTION,r.coord),null;e.add(r.coord)}}},checkHolesInShell:function(t,e){for(var n=t.getExteriorRing(),i=new Ae(n),r=0;r<t.getNumInteriorRing();r++){var s=t.getInteriorRingN(r),o=Zs.findPtNotNode(s.getCoordinates(),n,e);if(null===o)return null;if(de.EXTERIOR===i.locate(o))return this._validErr=new Ks(Ks.HOLE_OUTSIDE_SHELL,o),null}},checkTooFewPoints:function(t){if(t.hasTooFewPoints())return this._validErr=new Ks(Ks.TOO_FEW_POINTS,t.getInvalidPoint()),null},getValidationError:function(){return this.checkValid(this._parentGeometry),this._validErr},checkValid:function(){if(arguments[0]instanceof Gt){var t=arguments[0];this.checkInvalidCoordinates(t.getCoordinates())}else if(arguments[0]instanceof zt){var e=arguments[0];this.checkInvalidCoordinates(e.getCoordinates())}else if(arguments[0]instanceof Yt){var n=arguments[0];if(this.checkInvalidCoordinates(n.getCoordinates()),null!==this._validErr)return null;if(this.checkClosedRing(n),null!==this._validErr)return null;var i=new ni(0,n);if(this.checkTooFewPoints(i),null!==this._validErr)return null;var r=new fe;i.computeSelfNodes(r,!0,!0),this.checkNoSelfIntersectingRings(i)}else if(arguments[0]instanceof At){var s=arguments[0];if(this.checkInvalidCoordinates(s.getCoordinates()),null!==this._validErr)return null;i=new ni(0,s);this.checkTooFewPoints(i)}else if(arguments[0]instanceof Vt){var o=arguments[0];if(this.checkInvalidCoordinates(o),null!==this._validErr)return null;if(this.checkClosedRings(o),null!==this._validErr)return null;i=new ni(0,o);if(this.checkTooFewPoints(i),null!==this._validErr)return null;if(this.checkConsistentArea(i),null!==this._validErr)return null;if(!this._isSelfTouchingRingFormingHoleValid&&(this.checkNoSelfIntersectingRings(i),null!==this._validErr))return null;if(this.checkHolesInShell(o,i),null!==this._validErr)return null;if(this.checkHolesNotNested(o,i),null!==this._validErr)return null;this.checkConnectedInteriors(i)}else if(arguments[0]instanceof kt){for(var a=arguments[0],u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);if(this.checkInvalidCoordinates(l),null!==this._validErr)return null;if(this.checkClosedRings(l),null!==this._validErr)return null}i=new ni(0,a);if(this.checkTooFewPoints(i),null!==this._validErr)return null;if(this.checkConsistentArea(i),null!==this._validErr)return null;if(!this._isSelfTouchingRingFormingHoleValid&&(this.checkNoSelfIntersectingRings(i),null!==this._validErr))return null;for(u=0;u<a.getNumGeometries();u++){l=a.getGeometryN(u);if(this.checkHolesInShell(l,i),null!==this._validErr)return null}for(u=0;u<a.getNumGeometries();u++){l=a.getGeometryN(u);if(this.checkHolesNotNested(l,i),null!==this._validErr)return null}if(this.checkShellsNotNested(a,i),null!==this._validErr)return null;this.checkConnectedInteriors(i)}else if(arguments[0]instanceof Lt){var h=arguments[0];for(u=0;u<h.getNumGeometries();u++){var c=h.getGeometryN(u);if(this.checkValid(c),null!==this._validErr)return null}}else if(arguments[0]instanceof K){var f=arguments[0];if(this._validErr=null,f.isEmpty())return null;if(f instanceof Gt)this.checkValid(f);else if(f instanceof zt)this.checkValid(f);else if(f instanceof Yt)this.checkValid(f);else if(f instanceof At)this.checkValid(f);else if(f instanceof Vt)this.checkValid(f);else if(f instanceof kt)this.checkValid(f);else{if(!(f instanceof Lt))throw new UnsupportedOperationException(f.getClass().getName());this.checkValid(f)}}},setSelfTouchingRingFormingHoleValid:function(t){this._isSelfTouchingRingFormingHoleValid=t},checkShellNotNested:function(t,e,n){var i=t.getCoordinates(),r=e.getExteriorRing(),s=r.getCoordinates(),o=Zs.findPtNotNode(i,r,n);if(null===o)return null;if(!qe.isInRing(o,s))return null;if(e.getNumInteriorRing()<=0)return this._validErr=new Ks(Ks.NESTED_SHELLS,o),null;for(var a=null,u=0;u<e.getNumInteriorRing();u++){var l=e.getInteriorRingN(u);if(null===(a=this.checkShellInsideHole(t,l,n)))return null}this._validErr=new Ks(Ks.NESTED_SHELLS,a)},checkClosedRings:function(t){if(this.checkClosedRing(t.getExteriorRing()),null!==this._validErr)return null;for(var e=0;e<t.getNumInteriorRing();e++)if(this.checkClosedRing(t.getInteriorRingN(e)),null!==this._validErr)return null},checkClosedRing:function(t){if(!t.isClosed()){var e=null;t.getNumPoints()>=1&&(e=t.getCoordinateN(0)),this._validErr=new Ks(Ks.RING_NOT_CLOSED,e)}},checkShellsNotNested:function(t,e){for(var n=0;n<t.getNumGeometries();n++)for(var i=t.getGeometryN(n).getExteriorRing(),r=0;r<t.getNumGeometries();r++)if(n!==r){var s=t.getGeometryN(r);if(this.checkShellNotNested(i,s,e),null!==this._validErr)return null}},interfaces_:function(){return[]},getClass:function(){return Zs}}),Zs.findPtNotNode=function(t,e,n){for(var i=n.findEdge(e).getEdgeIntersectionList(),r=0;r<t.length;r++){var s=t[r];if(!i.isIntersection(s))return s}return null},Zs.isValid=function(){if(arguments[0]instanceof K)return new Zs(arguments[0]).isValid();if(arguments[0]instanceof E){var t=arguments[0];return!s.isNaN(t.x)&&(!s.isInfinite(t.x)&&(!s.isNaN(t.y)&&!s.isInfinite(t.y)))}};var Qs=Object.freeze({IsValidOp:Zs,ConsistentAreaTester:Ws}),Js=Object.freeze({BoundaryOp:Rt,IsSimpleOp:$i,buffer:Or,distance:Gr,linemerge:Zr,overlay:_s,polygonize:Ns,relate:qs,union:Us,valid:Qs});function $s(){Ut.CoordinateOperation.apply(this),this._targetPM=null,this._removeCollapsed=!0;var t=arguments[0],e=arguments[1];this._targetPM=t,this._removeCollapsed=e}function to(){this._targetPM=null,this._removeCollapsed=!0,this._changePrecisionModel=!1,this._isPointwise=!1;var t=arguments[0];this._targetPM=t}v($s,Ut.CoordinateOperation),e($s.prototype,{edit:function(){if(2===arguments.length&&arguments[1]instanceof K&&arguments[0]instanceof Array){var t=arguments[0],e=arguments[1];if(0===t.length)return null;for(var n=new Array(t.length).fill(null),i=0;i<t.length;i++){var r=new E(t[i]);this._targetPM.makePrecise(r),n[i]=r}var s=new b(n,!1).toCoordinateArray(),o=0;e instanceof At&&(o=2),e instanceof Yt&&(o=4);var a=n;return this._removeCollapsed&&(a=null),s.length<o?a:s}return Ut.CoordinateOperation.prototype.edit.apply(this,arguments)},interfaces_:function(){return[]},getClass:function(){return $s}}),e(to.prototype,{fixPolygonalTopology:function(t){var e=t;this._changePrecisionModel||(e=this.changePM(t,this._targetPM));var n=Pr.bufferOp(e,0),i=n;return this._changePrecisionModel||(i=n.copy(),this.changePM(i,t.getPrecisionModel())),i},reducePointwise:function(t){var e=null;this._changePrecisionModel?e=new Ut(this.createFactory(t.getFactory(),this._targetPM)):e=new Ut;var n=this._removeCollapsed;return t.getDimension()>=2&&(n=!0),e.edit(t,new $s(this._targetPM,n))},changePM:function(t,e){return this.createEditor(t.getFactory(),e).edit(t,new Ut.NoOpGeometryOperation)},setRemoveCollapsedComponents:function(t){this._removeCollapsed=t},createFactory:function(t,e){return new se(e,t.getSRID(),t.getCoordinateSequenceFactory())},setChangePrecisionModel:function(t){this._changePrecisionModel=t},reduce:function(t){var e=this.reducePointwise(t);return this._isPointwise?e:N(e,Bt)?Zs.isValid(e)?e:this.fixPolygonalTopology(e):e},setPointwise:function(t){this._isPointwise=t},createEditor:function(t,e){return t.getPrecisionModel()===e?new Ut:new Ut(this.createFactory(t,e))},interfaces_:function(){return[]},getClass:function(){return to}}),to.reduce=function(t,e){return new to(e).reduce(t)},to.reducePointwise=function(t,e){var n=new to(e);return n.setPointwise(!0),n.reduce(t)};var eo=Object.freeze({GeometryPrecisionReducer:to});function no(){this._pts=null,this._usePt=null,this._distanceTolerance=null,this._seg=new ge;var t=arguments[0];this._pts=t}function io(){this._inputGeom=null,this._distanceTolerance=null,this._isEnsureValidTopology=!0;var t=arguments[0];this._inputGeom=t}function ro(){In.apply(this),this._isEnsureValidTopology=!0,this._distanceTolerance=null;var t=arguments[0],e=arguments[1];this._isEnsureValidTopology=t,this._distanceTolerance=e}function so(){if(this._parent=null,this._index=null,2===arguments.length){var t=arguments[0],e=arguments[1];so.call(this,t,e,null,-1)}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3];ge.call(this,n,i),this._parent=r,this._index=s}}function oo(){if(this._parentLine=null,this._segs=null,this._resultSegs=new P,this._minimumSize=null,1===arguments.length){var t=arguments[0];oo.call(this,t,2)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._parentLine=e,this._minimumSize=n,this.init()}}function ao(){this._index=new di}function uo(){this._querySeg=null,this._items=new P;var t=arguments[0];this._querySeg=t}function lo(){this._li=new fe,this._inputIndex=new ao,this._outputIndex=new ao,this._line=null,this._linePts=null,this._distanceTolerance=0;var t=arguments[0],e=arguments[1];this._inputIndex=t,this._outputIndex=e}function ho(){this._inputIndex=new ao,this._outputIndex=new ao,this._distanceTolerance=0}function co(){this._inputGeom=null,this._lineSimplifier=new ho,this._linestringMap=null;var t=arguments[0];this._inputGeom=t}function fo(){In.apply(this),this._linestringMap=null;var t=arguments[0];this._linestringMap=t}function go(){this.tps=null;var t=arguments[0];this.tps=t}e(no.prototype,{simplifySection:function(t,e){if(t+1===e)return null;this._seg.p0=this._pts[t],this._seg.p1=this._pts[e];for(var n=-1,i=t,r=t+1;r<e;r++){var s=this._seg.distance(this._pts[r]);s>n&&(n=s,i=r)}if(n<=this._distanceTolerance)for(r=t+1;r<e;r++)this._usePt[r]=!1;else this.simplifySection(t,i),this.simplifySection(i,e)},setDistanceTolerance:function(t){this._distanceTolerance=t},simplify:function(){this._usePt=new Array(this._pts.length).fill(null);for(var t=0;t<this._pts.length;t++)this._usePt[t]=!0;this.simplifySection(0,this._pts.length-1);var e=new b;for(t=0;t<this._pts.length;t++)this._usePt[t]&&e.add(new E(this._pts[t]));return e.toCoordinateArray()},interfaces_:function(){return[]},getClass:function(){return no}}),no.simplify=function(t,e){var n=new no(t);return n.setDistanceTolerance(e),n.simplify()},e(io.prototype,{setEnsureValid:function(t){this._isEnsureValidTopology=t},getResultGeometry:function(){return this._inputGeom.isEmpty()?this._inputGeom.copy():new ro(this._isEnsureValidTopology,this._distanceTolerance).transform(this._inputGeom)},setDistanceTolerance:function(t){if(t<0)throw new i("Tolerance must be non-negative");this._distanceTolerance=t},interfaces_:function(){return[]},getClass:function(){return io}}),io.simplify=function(t,e){var n=new io(t);return n.setDistanceTolerance(e),n.getResultGeometry()},v(ro,In),e(ro.prototype,{transformPolygon:function(t,e){if(t.isEmpty())return null;var n=In.prototype.transformPolygon.call(this,t,e);return e instanceof kt?n:this.createValidArea(n)},createValidArea:function(t){return this._isEnsureValidTopology?t.buffer(0):t},transformCoordinates:function(t,e){var n=t.toCoordinateArray(),i=null;return i=0===n.length?new Array(0).fill(null):no.simplify(n,this._distanceTolerance),this._factory.getCoordinateSequenceFactory().create(i)},transformMultiPolygon:function(t,e){var n=In.prototype.transformMultiPolygon.call(this,t,e);return this.createValidArea(n)},transformLinearRing:function(t,e){var n=e instanceof Vt,i=In.prototype.transformLinearRing.call(this,t,e);return!n||i instanceof Yt?i:null},interfaces_:function(){return[]},getClass:function(){return ro}}),io.DPTransformer=ro,v(so,ge),e(so.prototype,{getIndex:function(){return this._index},getParent:function(){return this._parent},interfaces_:function(){return[]},getClass:function(){return so}}),e(oo.prototype,{addToResult:function(t){this._resultSegs.add(t)},asLineString:function(){return this._parentLine.getFactory().createLineString(oo.extractCoordinates(this._resultSegs))},getResultSize:function(){var t=this._resultSegs.size();return 0===t?0:t+1},getParent:function(){return this._parentLine},getSegment:function(t){return this._segs[t]},getParentCoordinates:function(){return this._parentLine.getCoordinates()},getMinimumSize:function(){return this._minimumSize},asLinearRing:function(){return this._parentLine.getFactory().createLinearRing(oo.extractCoordinates(this._resultSegs))},getSegments:function(){return this._segs},init:function(){var t=this._parentLine.getCoordinates();this._segs=new Array(t.length-1).fill(null);for(var e=0;e<t.length-1;e++){var n=new so(t[e],t[e+1],this._parentLine,e);this._segs[e]=n}},getResultCoordinates:function(){return oo.extractCoordinates(this._resultSegs)},interfaces_:function(){return[]},getClass:function(){return oo}}),oo.extractCoordinates=function(t){for(var e=new Array(t.size()+1).fill(null),n=null,i=0;i<t.size();i++)n=t.get(i),e[i]=n.p0;return e[e.length-1]=n.p1,e},e(ao.prototype,{remove:function(t){this._index.remove(new M(t.p0,t.p1),t)},add:function(){if(arguments[0]instanceof oo)for(var t=arguments[0].getSegments(),e=0;e<t.length;e++){var n=t[e];this.add(n)}else if(arguments[0]instanceof ge){var i=arguments[0];this._index.insert(new M(i.p0,i.p1),i)}},query:function(t){var e=new M(t.p0,t.p1),n=new uo(t);return this._index.query(e,n),n.getItems()},interfaces_:function(){return[]},getClass:function(){return ao}}),e(uo.prototype,{visitItem:function(t){var e=t;M.intersects(e.p0,e.p1,this._querySeg.p0,this._querySeg.p1)&&this._items.add(t)},getItems:function(){return this._items},interfaces_:function(){return[Ce]},getClass:function(){return uo}}),e(lo.prototype,{flatten:function(t,e){var n=new ge(this._linePts[t],this._linePts[e]);return this.remove(this._line,t,e),this._outputIndex.add(n),n},hasBadIntersection:function(t,e,n){return!!this.hasBadOutputIntersection(n)||!!this.hasBadInputIntersection(t,e,n)},setDistanceTolerance:function(t){this._distanceTolerance=t},simplifySection:function(t,e,n){n+=1;var i=new Array(2).fill(null);if(t+1===e){var r=this._line.getSegment(t);return this._line.addToResult(r),null}var s=!0;this._line.getResultSize()<this._line.getMinimumSize()&&(n+1<this._line.getMinimumSize()&&(s=!1));var o=new Array(1).fill(null),a=this.findFurthestPoint(this._linePts,t,e,o);o[0]>this._distanceTolerance&&(s=!1);var u=new ge;if(u.p0=this._linePts[t],u.p1=this._linePts[e],i[0]=t,i[1]=e,this.hasBadIntersection(this._line,i,u)&&(s=!1),s){r=this.flatten(t,e);return this._line.addToResult(r),null}this.simplifySection(t,a,n),this.simplifySection(a,e,n)},hasBadOutputIntersection:function(t){for(var e=this._outputIndex.query(t).iterator();e.hasNext();){var n=e.next();if(this.hasInteriorIntersection(n,t))return!0}return!1},findFurthestPoint:function(t,e,n,i){var r=new ge;r.p0=t[e],r.p1=t[n];for(var s=-1,o=e,a=e+1;a<n;a++){var u=t[a],l=r.distance(u);l>s&&(s=l,o=a)}return i[0]=s,o},simplify:function(t){this._line=t,this._linePts=t.getParentCoordinates(),this.simplifySection(0,this._linePts.length-1,0)},remove:function(t,e,n){for(var i=e;i<n;i++){var r=t.getSegment(i);this._inputIndex.remove(r)}},hasInteriorIntersection:function(t,e){return this._li.computeIntersection(t.p0,t.p1,e.p0,e.p1),this._li.isInteriorIntersection()},hasBadInputIntersection:function(t,e,n){for(var i=this._inputIndex.query(n).iterator();i.hasNext();){var r=i.next();if(this.hasInteriorIntersection(r,n)){if(lo.isInLineSection(t,e,r))continue;return!0}}return!1},interfaces_:function(){return[]},getClass:function(){return lo}}),lo.isInLineSection=function(t,e,n){if(n.getParent()!==t.getParent())return!1;var i=n.getIndex();return i>=e[0]&&i<e[1]},e(ho.prototype,{setDistanceTolerance:function(t){this._distanceTolerance=t},simplify:function(t){for(var e=t.iterator();e.hasNext();)this._inputIndex.add(e.next());for(e=t.iterator();e.hasNext();){var n=new lo(this._inputIndex,this._outputIndex);n.setDistanceTolerance(this._distanceTolerance),n.simplify(e.next())}},interfaces_:function(){return[]},getClass:function(){return ho}}),e(co.prototype,{getResultGeometry:function(){return this._inputGeom.isEmpty()?this._inputGeom.copy():(this._linestringMap=new ne,this._inputGeom.apply(new go(this)),this._lineSimplifier.simplify(this._linestringMap.values()),new fo(this._linestringMap).transform(this._inputGeom))},setDistanceTolerance:function(t){if(t<0)throw new i("Tolerance must be non-negative");this._lineSimplifier.setDistanceTolerance(t)},interfaces_:function(){return[]},getClass:function(){return co}}),co.simplify=function(t,e){var n=new co(t);return n.setDistanceTolerance(e),n.getResultGeometry()},v(fo,In),e(fo.prototype,{transformCoordinates:function(t,e){if(0===t.size())return null;if(e instanceof At){var n=this._linestringMap.get(e);return this.createCoordinateSequence(n.getResultCoordinates())}return In.prototype.transformCoordinates.call(this,t,e)},interfaces_:function(){return[]},getClass:function(){return fo}}),e(go.prototype,{filter:function(t){if(t instanceof At){var e=t;if(e.isEmpty())return null;var n=new oo(e,e.isClosed()?4:2);this.tps._linestringMap.put(e,n)}},interfaces_:function(){return[j]},getClass:function(){return go}}),co.LineStringTransformer=fo,co.LineStringMapBuilderFilter=go;var _o=Object.freeze({DouglasPeuckerSimplifier:io,TopologyPreservingSimplifier:co});function po(){this._seg=null,this._segLen=null,this._splitPt=null,this._minimumLen=0;var t=arguments[0];this._seg=t,this._segLen=t.getLength()}function mo(){}function vo(){}function yo(){}function xo(){if(this._p=null,1===arguments.length){var t=arguments[0];this._p=new E(t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._p=new E(e,n)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this._p=new E(i,r,s)}}function Eo(){this._isOnConstraint=null,this._constraint=null;var t=arguments[0];xo.call(this,t)}function Io(){this._rot=null,this._vertex=null,this._next=null,this._data=null}function No(){this._subdiv=null,this._isUsingTolerance=!1;var t=arguments[0];this._subdiv=t,this._isUsingTolerance=t.getTolerance()>0}function Co(){}function So(){this._subdiv=null,this._lastEdge=null;var t=arguments[0];this._subdiv=t,this.init()}function Lo(){if(this._seg=null,1===arguments.length){if("string"==typeof arguments[0]){var t=arguments[0];m.call(this,t)}else if(arguments[0]instanceof ge){var e=arguments[0];m.call(this,"Locate failed to converge (at edge: "+e+"). Possible causes include invalid Subdivision topology or very close sites"),this._seg=new ge(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];m.call(this,Lo.msgWithSpatial(n,i)),this._seg=new ge(i)}}function wo(){}function Ro(){this._visitedKey=0,this._quadEdges=new P,this._startingEdge=null,this._tolerance=null,this._edgeCoincidenceTolerance=null,this._frameVertex=new Array(3).fill(null),this._frameEnv=null,this._locator=null,this._seg=new ge,this._triEdges=new Array(3).fill(null);var t=arguments[0],e=arguments[1];this._tolerance=e,this._edgeCoincidenceTolerance=e/Ro.EDGE_COINCIDENCE_TOL_FACTOR,this.createFrame(t),this._startingEdge=this.initSubdiv(),this._locator=new So(this)}function To(){}function Po(){this._triList=new P}function Oo(){this._triList=new P}function bo(){this._coordList=new b,this._triCoords=new P}function Mo(){if(this._ls=null,this._data=null,2===arguments.length){var t=arguments[0],e=arguments[1];this._ls=new ge(t,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._ls=new ge(n,i),this._data=r}else if(6===arguments.length){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3],l=arguments[4],h=arguments[5];Mo.call(this,new E(s,o,a),new E(u,l,h))}else if(7===arguments.length){var c=arguments[0],f=arguments[1],g=arguments[2],d=arguments[3],_=arguments[4],p=arguments[5],m=arguments[6];Mo.call(this,new E(c,f,g),new E(d,_,p),m)}}function Do(){this._initialVertices=null,this._segVertices=null,this._segments=new P,this._subdiv=null,this._incDel=null,this._convexHull=null,this._splitFinder=new vo,this._kdt=null,this._vertexFactory=null,this._computeAreaEnv=null,this._splitPt=null,this._tolerance=null;var t=arguments[0],e=arguments[1];this._initialVertices=new P(t),this._tolerance=e,this._kdt=new oi(e)}function Ao(){this._siteCoords=null,this._tolerance=0,this._subdiv=null}function Fo(){this._siteCoords=null,this._constraintLines=null,this._tolerance=0,this._subdiv=null,this._constraintVertexMap=new pt}function Go(){this._siteCoords=null,this._tolerance=0,this._subdiv=null,this._clipEnv=null,this._diagramEnv=null}e(po.prototype,{splitAt:function(){if(1===arguments.length){var t=arguments[0],e=this._minimumLen/this._segLen;if(t.distance(this._seg.p0)<this._minimumLen)return this._splitPt=this._seg.pointAlong(e),null;if(t.distance(this._seg.p1)<this._minimumLen)return this._splitPt=po.pointAlongReverse(this._seg,e),null;this._splitPt=t}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=this.getConstrainedLength(n)/this._segLen;i.equals2D(this._seg.p0)?this._splitPt=this._seg.pointAlong(r):this._splitPt=po.pointAlongReverse(this._seg,r)}},setMinimumLength:function(t){this._minimumLen=t},getConstrainedLength:function(t){return t<this._minimumLen?this._minimumLen:t},getSplitPoint:function(){return this._splitPt},interfaces_:function(){return[]},getClass:function(){return po}}),po.pointAlongReverse=function(t,e){var n=new E;return n.x=t.p1.x-e*(t.p1.x-t.p0.x),n.y=t.p1.y-e*(t.p1.y-t.p0.y),n},e(mo.prototype,{findSplitPoint:function(t,e){},interfaces_:function(){return[]},getClass:function(){return mo}}),e(vo.prototype,{findSplitPoint:function(t,e){var n=t.getLineSegment(),i=n.getLength()/2,r=new po(n),s=vo.projectedSplitPoint(t,e),o=2*s.distance(e)*.8;return o>i&&(o=i),r.setMinimumLength(o),r.splitAt(s),r.getSplitPoint()},interfaces_:function(){return[mo]},getClass:function(){return vo}}),vo.projectedSplitPoint=function(t,e){return t.getLineSegment().project(e)},e(yo.prototype,{interfaces_:function(){return[]},getClass:function(){return yo}}),yo.triArea=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(e.y-t.y)*(n.x-t.x)},yo.isInCircleDDNormalized=function(t,e,n,i){var r=B.valueOf(t.x).selfSubtract(i.x),s=B.valueOf(t.y).selfSubtract(i.y),o=B.valueOf(e.x).selfSubtract(i.x),a=B.valueOf(e.y).selfSubtract(i.y),u=B.valueOf(n.x).selfSubtract(i.x),l=B.valueOf(n.y).selfSubtract(i.y),h=r.multiply(a).selfSubtract(o.multiply(s)),c=o.multiply(l).selfSubtract(u.multiply(a)),f=u.multiply(s).selfSubtract(r.multiply(l)),g=r.multiply(r).selfAdd(s.multiply(s)),d=o.multiply(o).selfAdd(a.multiply(a)),_=u.multiply(u).selfAdd(l.multiply(l));return g.selfMultiply(c).selfAdd(d.selfMultiply(f)).selfAdd(_.selfMultiply(h)).doubleValue()>0},yo.checkRobustInCircle=function(t,e,n,i){var r=yo.isInCircleNonRobust(t,e,n,i),s=yo.isInCircleDDSlow(t,e,n,i),o=yo.isInCircleCC(t,e,n,i),a=me.circumcentre(t,e,n);Y.out.println("p radius diff a = "+Math.abs(i.distance(a)-t.distance(a))/t.distance(a)),r===s&&r===o||(Y.out.println("inCircle robustness failure (double result = "+r+", DD result = "+s+", CC result = "+o+")"),Y.out.println(he.toLineString(new Kt([t,e,n,i]))),Y.out.println("Circumcentre = "+he.toPoint(a)+" radius = "+t.distance(a)),Y.out.println("p radius diff a = "+Math.abs(i.distance(a)/t.distance(a)-1)),Y.out.println("p radius diff b = "+Math.abs(i.distance(a)/e.distance(a)-1)),Y.out.println("p radius diff c = "+Math.abs(i.distance(a)/n.distance(a)-1)),Y.out.println())},yo.isInCircleDDFast=function(t,e,n,i){var r=B.sqr(t.x).selfAdd(B.sqr(t.y)).selfMultiply(yo.triAreaDDFast(e,n,i)),s=B.sqr(e.x).selfAdd(B.sqr(e.y)).selfMultiply(yo.triAreaDDFast(t,n,i)),o=B.sqr(n.x).selfAdd(B.sqr(n.y)).selfMultiply(yo.triAreaDDFast(t,e,i)),a=B.sqr(i.x).selfAdd(B.sqr(i.y)).selfMultiply(yo.triAreaDDFast(t,e,n));return r.selfSubtract(s).selfAdd(o).selfSubtract(a).doubleValue()>0},yo.isInCircleCC=function(t,e,n,i){var r=me.circumcentre(t,e,n),s=t.distance(r);return i.distance(r)-s<=0},yo.isInCircleNormalized=function(t,e,n,i){var r=t.x-i.x,s=t.y-i.y,o=e.x-i.x,a=e.y-i.y,u=n.x-i.x,l=n.y-i.y;return(r*r+s*s)*(o*l-u*a)+(o*o+a*a)*(u*s-r*l)+(u*u+l*l)*(r*a-o*s)>0},yo.isInCircleDDSlow=function(t,e,n,i){var r=B.valueOf(i.x),s=B.valueOf(i.y),o=B.valueOf(t.x),a=B.valueOf(t.y),u=B.valueOf(e.x),l=B.valueOf(e.y),h=B.valueOf(n.x),c=B.valueOf(n.y),f=o.multiply(o).add(a.multiply(a)).multiply(yo.triAreaDDSlow(u,l,h,c,r,s)),g=u.multiply(u).add(l.multiply(l)).multiply(yo.triAreaDDSlow(o,a,h,c,r,s)),d=h.multiply(h).add(c.multiply(c)).multiply(yo.triAreaDDSlow(o,a,u,l,r,s)),_=r.multiply(r).add(s.multiply(s)).multiply(yo.triAreaDDSlow(o,a,u,l,h,c));return f.subtract(g).add(d).subtract(_).doubleValue()>0},yo.isInCircleNonRobust=function(t,e,n,i){return(t.x*t.x+t.y*t.y)*yo.triArea(e,n,i)-(e.x*e.x+e.y*e.y)*yo.triArea(t,n,i)+(n.x*n.x+n.y*n.y)*yo.triArea(t,e,i)-(i.x*i.x+i.y*i.y)*yo.triArea(t,e,n)>0},yo.isInCircleRobust=function(t,e,n,i){return yo.isInCircleNormalized(t,e,n,i)},yo.triAreaDDSlow=function(t,e,n,i,r,s){return n.subtract(t).multiply(s.subtract(e)).subtract(i.subtract(e).multiply(r.subtract(t)))},yo.triAreaDDFast=function(t,e,n){var i=B.valueOf(e.x).selfSubtract(t.x).selfMultiply(B.valueOf(n.y).selfSubtract(t.y)),r=B.valueOf(e.y).selfSubtract(t.y).selfMultiply(B.valueOf(n.x).selfSubtract(t.x));return i.selfSubtract(r)},e(xo.prototype,{circleCenter:function(t,e){var n=new xo(this.getX(),this.getY()),i=new k(this.bisector(n,t),this.bisector(t,e)),r=null;try{r=new xo(i.getX(),i.getY())}catch(i){if(!(i instanceof A))throw i;Y.err.println("a: "+n+" b: "+t+" c: "+e),Y.err.println(i)}return r},dot:function(t){return this._p.x*t.getX()+this._p.y*t.getY()},magn:function(){return Math.sqrt(this._p.x*this._p.x+this._p.y*this._p.y)},getZ:function(){return this._p.z},bisector:function(t,e){var n=e.getX()-t.getX(),i=e.getY()-t.getY();return new k(new k(t.getX()+n/2,t.getY()+i/2,1),new k(t.getX()-i+n/2,t.getY()+n+i/2,1))},equals:function(){if(1===arguments.length){var t=arguments[0];return this._p.x===t.getX()&&this._p.y===t.getY()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this._p.distance(e.getCoordinate())<n}},getCoordinate:function(){return this._p},isInCircle:function(t,e,n){return yo.isInCircleRobust(t._p,e._p,n._p,this._p)},interpolateZValue:function(t,e,n){var i=t.getX(),r=t.getY(),s=e.getX()-i,o=n.getX()-i,a=e.getY()-r,u=n.getY()-r,l=s*u-o*a,h=this.getX()-i,c=this.getY()-r,f=(u*h-o*c)/l,g=(-a*h+s*c)/l;return t.getZ()+f*(e.getZ()-t.getZ())+g*(n.getZ()-t.getZ())},midPoint:function(t){return new xo((this._p.x+t.getX())/2,(this._p.y+t.getY())/2,(this._p.z+t.getZ())/2)},rightOf:function(t){return this.isCCW(t.dest(),t.orig())},isCCW:function(t,e){return(t._p.x-this._p.x)*(e._p.y-this._p.y)-(t._p.y-this._p.y)*(e._p.x-this._p.x)>0},getX:function(){return this._p.x},crossProduct:function(t){return this._p.x*t.getY()-this._p.y*t.getX()},setZ:function(t){this._p.z=t},times:function(t){return new xo(t*this._p.x,t*this._p.y)},cross:function(){return new xo(this._p.y,-this._p.x)},leftOf:function(t){return this.isCCW(t.orig(),t.dest())},toString:function(){return"POINT ("+this._p.x+" "+this._p.y+")"},sub:function(t){return new xo(this._p.x-t.getX(),this._p.y-t.getY())},getY:function(){return this._p.y},classify:function(t,e){var n=e.sub(t),i=this.sub(t),r=n.crossProduct(i);return r>0?xo.LEFT:r<0?xo.RIGHT:n.getX()*i.getX()<0||n.getY()*i.getY()<0?xo.BEHIND:n.magn()<i.magn()?xo.BEYOND:t.equals(this)?xo.ORIGIN:e.equals(this)?xo.DESTINATION:xo.BETWEEN},sum:function(t){return new xo(this._p.x+t.getX(),this._p.y+t.getY())},distance:function(t,e){return Math.sqrt(Math.pow(e.getX()-t.getX(),2)+Math.pow(e.getY()-t.getY(),2))},circumRadiusRatio:function(t,e){var n=this.circleCenter(t,e),i=this.distance(n,t),r=this.distance(this,t),s=this.distance(t,e);return s<r&&(r=s),(s=this.distance(e,this))<r&&(r=s),i/r},interfaces_:function(){return[]},getClass:function(){return xo}}),xo.interpolateZ=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=e.distance(n),r=t.distance(e),s=n.z-e.z;return e.z+s*(r/i)}if(4===arguments.length){var o=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3],h=a.x,c=a.y,f=u.x-h,g=l.x-h,d=u.y-c,_=l.y-c,p=f*_-g*d,m=o.x-h,v=o.y-c,y=(_*m-g*v)/p,x=(-d*m+f*v)/p;return a.z+y*(u.z-a.z)+x*(l.z-a.z)}},xo.LEFT=0,xo.RIGHT=1,xo.BEYOND=2,xo.BEHIND=3,xo.BETWEEN=4,xo.ORIGIN=5,xo.DESTINATION=6,v(Eo,xo),e(Eo.prototype,{getConstraint:function(){return this._constraint},setOnConstraint:function(t){this._isOnConstraint=t},merge:function(t){t._isOnConstraint&&(this._isOnConstraint=!0,this._constraint=t._constraint)},isOnConstraint:function(){return this._isOnConstraint},setConstraint:function(t){this._isOnConstraint=!0,this._constraint=t},interfaces_:function(){return[]},getClass:function(){return Eo}}),e(Io.prototype,{equalsNonOriented:function(t){return!!this.equalsOriented(t)||!!this.equalsOriented(t.sym())},toLineSegment:function(){return new ge(this._vertex.getCoordinate(),this.dest().getCoordinate())},dest:function(){return this.sym().orig()},oNext:function(){return this._next},equalsOriented:function(t){return!(!this.orig().getCoordinate().equals2D(t.orig().getCoordinate())||!this.dest().getCoordinate().equals2D(t.dest().getCoordinate()))},dNext:function(){return this.sym().oNext().sym()},lPrev:function(){return this._next.sym()},rPrev:function(){return this.sym().oNext()},rot:function(){return this._rot},oPrev:function(){return this._rot._next._rot},sym:function(){return this._rot._rot},setOrig:function(t){this._vertex=t},lNext:function(){return this.invRot().oNext().rot()},getLength:function(){return this.orig().getCoordinate().distance(this.dest().getCoordinate())},invRot:function(){return this._rot.sym()},setDest:function(t){this.sym().setOrig(t)},setData:function(t){this._data=t},getData:function(){return this._data},delete:function(){this._rot=null},orig:function(){return this._vertex},rNext:function(){return this._rot._next.invRot()},toString:function(){var t=this._vertex.getCoordinate(),e=this.dest().getCoordinate();return he.toLineString(t,e)},isLive:function(){return null!==this._rot},getPrimary:function(){return this.orig().getCoordinate().compareTo(this.dest().getCoordinate())<=0?this:this.sym()},dPrev:function(){return this.invRot().oNext().invRot()},setNext:function(t){this._next=t},interfaces_:function(){return[]},getClass:function(){return Io}}),Io.makeEdge=function(t,e){var n=new Io,i=new Io,r=new Io,s=new Io;n._rot=i,i._rot=r,r._rot=s,s._rot=n,n.setNext(n),i.setNext(s),r.setNext(r),s.setNext(i);var o=n;return o.setOrig(t),o.setDest(e),o},Io.swap=function(t){var e=t.oPrev(),n=t.sym().oPrev();Io.splice(t,e),Io.splice(t.sym(),n),Io.splice(t,e.lNext()),Io.splice(t.sym(),n.lNext()),t.setOrig(e.dest()),t.setDest(n.dest())},Io.splice=function(t,e){var n=t.oNext().rot(),i=e.oNext().rot(),r=e.oNext(),s=t.oNext(),o=i.oNext(),a=n.oNext();t.setNext(r),e.setNext(s),n.setNext(o),i.setNext(a)},Io.connect=function(t,e){var n=Io.makeEdge(t.dest(),e.orig());return Io.splice(n,t.lNext()),Io.splice(n.sym(),e),n},e(No.prototype,{insertSite:function(t){var e=this._subdiv.locate(t);if(this._subdiv.isVertexOfEdge(e,t))return e;this._subdiv.isOnEdge(e,t.getCoordinate())&&(e=e.oPrev(),this._subdiv.delete(e.oNext()));var n=this._subdiv.makeEdge(e.orig(),t);Io.splice(n,e);var i=n;do{e=(n=this._subdiv.connect(e,n.sym())).oPrev()}while(e.lNext()!==i);for(;;){var r=e.oPrev();if(r.dest().rightOf(e)&&t.isInCircle(e.orig(),r.dest(),e.dest()))Io.swap(e),e=e.oPrev();else{if(e.oNext()===i)return n;e=e.oNext().lPrev()}}},insertSites:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertSite(n)}},interfaces_:function(){return[]},getClass:function(){return No}}),e(Co.prototype,{locate:function(t){},interfaces_:function(){return[]},getClass:function(){return Co}}),e(So.prototype,{init:function(){this._lastEdge=this.findEdge()},locate:function(t){this._lastEdge.isLive()||this.init();var e=this._subdiv.locateFromEdge(t,this._lastEdge);return this._lastEdge=e,e},findEdge:function(){return this._subdiv.getEdges().iterator().next()},interfaces_:function(){return[Co]},getClass:function(){return So}}),v(Lo,m),e(Lo.prototype,{getSegment:function(){return this._seg},interfaces_:function(){return[]},getClass:function(){return Lo}}),Lo.msgWithSpatial=function(t,e){return null!==e?t+" [ "+e+" ]":t},e(wo.prototype,{visit:function(t){},interfaces_:function(){return[]},getClass:function(){return wo}}),e(Ro.prototype,{getTriangleVertices:function(t){var e=new Oo;return this.visitTriangles(e,t),e.getTriangleVertices()},isFrameVertex:function(t){return!!t.equals(this._frameVertex[0])||(!!t.equals(this._frameVertex[1])||!!t.equals(this._frameVertex[2]))},isVertexOfEdge:function(t,e){return!(!e.equals(t.orig(),this._tolerance)&&!e.equals(t.dest(),this._tolerance))},connect:function(t,e){var n=Io.connect(t,e);return this._quadEdges.add(n),n},getVoronoiCellPolygon:function(t,e){var n=new P,i=t;do{var r=t.rot().orig().getCoordinate();n.add(r),t=t.oPrev()}while(t!==i);var s=new b;s.addAll(n,!1),s.closeRing(),s.size()<4&&(Y.out.println(s),s.add(s.get(s.size()-1),!0));var o=s.toCoordinateArray(),a=e.createPolygon(e.createLinearRing(o)),u=i.orig();return a.setUserData(u.getCoordinate()),a},setLocator:function(t){this._locator=t},initSubdiv:function(){var t=this.makeEdge(this._frameVertex[0],this._frameVertex[1]),e=this.makeEdge(this._frameVertex[1],this._frameVertex[2]);Io.splice(t.sym(),e);var n=this.makeEdge(this._frameVertex[2],this._frameVertex[0]);return Io.splice(e.sym(),n),Io.splice(n.sym(),t),t},isFrameBorderEdge:function(t){var e=new Array(3).fill(null);Ro.getTriangleEdges(t,e);var n=new Array(3).fill(null);Ro.getTriangleEdges(t.sym(),n);var i=t.lNext().dest();if(this.isFrameVertex(i))return!0;var r=t.sym().lNext().dest();return!!this.isFrameVertex(r)},makeEdge:function(t,e){var n=Io.makeEdge(t,e);return this._quadEdges.add(n),n},visitTriangles:function(t,e){this._visitedKey++;var n=new je;n.push(this._startingEdge);for(var i=new ut;!n.empty();){var r=n.pop();if(!i.contains(r)){var s=this.fetchTriangleToVisit(r,n,e,i);null!==s&&t.visit(s)}}},isFrameEdge:function(t){return!(!this.isFrameVertex(t.orig())&&!this.isFrameVertex(t.dest()))},isOnEdge:function(t,e){return this._seg.setCoordinates(t.orig().getCoordinate(),t.dest().getCoordinate()),this._seg.distance(e)<this._edgeCoincidenceTolerance},getEnvelope:function(){return new M(this._frameEnv)},createFrame:function(t){var e=t.getWidth(),n=t.getHeight(),i=0;i=e>n?10*e:10*n,this._frameVertex[0]=new xo((t.getMaxX()+t.getMinX())/2,t.getMaxY()+i),this._frameVertex[1]=new xo(t.getMinX()-i,t.getMinY()-i),this._frameVertex[2]=new xo(t.getMaxX()+i,t.getMinY()-i),this._frameEnv=new M(this._frameVertex[0].getCoordinate(),this._frameVertex[1].getCoordinate()),this._frameEnv.expandToInclude(this._frameVertex[2].getCoordinate())},getTriangleCoordinates:function(t){var e=new bo;return this.visitTriangles(e,t),e.getTriangles()},getVertices:function(t){for(var e=new ut,n=this._quadEdges.iterator();n.hasNext();){var i=n.next(),r=i.orig();!t&&this.isFrameVertex(r)||e.add(r);var s=i.dest();!t&&this.isFrameVertex(s)||e.add(s)}return e},fetchTriangleToVisit:function(t,e,n,i){var r=t,s=0,o=!1;do{this._triEdges[s]=r,this.isFrameEdge(r)&&(o=!0);var a=r.sym();i.contains(a)||e.push(a),i.add(r),s++,r=r.lNext()}while(r!==t);return o&&!n?null:this._triEdges},getEdges:function(){if(0===arguments.length)return this._quadEdges;if(1===arguments.length){for(var t=arguments[0],e=this.getPrimaryEdges(!1),n=new Array(e.size()).fill(null),i=0,r=e.iterator();r.hasNext();){var s=r.next();n[i++]=t.createLineString([s.orig().getCoordinate(),s.dest().getCoordinate()])}return t.createMultiLineString(n)}},getVertexUniqueEdges:function(t){for(var e=new P,n=new ut,i=this._quadEdges.iterator();i.hasNext();){var r=i.next(),s=r.orig();n.contains(s)||(n.add(s),!t&&this.isFrameVertex(s)||e.add(r));var o=r.sym(),a=o.orig();n.contains(a)||(n.add(a),!t&&this.isFrameVertex(a)||e.add(o))}return e},getTriangleEdges:function(t){var e=new Po;return this.visitTriangles(e,t),e.getTriangleEdges()},getPrimaryEdges:function(t){this._visitedKey++;var e=new P,n=new je;n.push(this._startingEdge);for(var i=new ut;!n.empty();){var r=n.pop();if(!i.contains(r)){var s=r.getPrimary();!t&&this.isFrameEdge(s)||e.add(s),n.push(r.oNext()),n.push(r.sym().oNext()),i.add(r),i.add(r.sym())}}return e},delete:function(t){Io.splice(t,t.oPrev()),Io.splice(t.sym(),t.sym().oPrev());var e=t.sym(),n=t.rot(),i=t.rot().sym();this._quadEdges.remove(t),this._quadEdges.remove(e),this._quadEdges.remove(n),this._quadEdges.remove(i),t.delete(),e.delete(),n.delete(),i.delete()},locateFromEdge:function(t,e){for(var n=0,i=this._quadEdges.size(),r=e;;){if(++n>i)throw new Lo(r.toLineSegment());if(t.equals(r.orig())||t.equals(r.dest()))break;if(t.rightOf(r))r=r.sym();else if(t.rightOf(r.oNext())){if(t.rightOf(r.dPrev()))break;r=r.dPrev()}else r=r.oNext()}return r},getTolerance:function(){return this._tolerance},getVoronoiCellPolygons:function(t){this.visitTriangles(new To,!0);for(var e=new P,n=this.getVertexUniqueEdges(!1).iterator();n.hasNext();){var i=n.next();e.add(this.getVoronoiCellPolygon(i,t))}return e},getVoronoiDiagram:function(t){var e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection(se.toGeometryArray(e))},getTriangles:function(t){for(var e=this.getTriangleCoordinates(!1),n=new Array(e.size()).fill(null),i=0,r=e.iterator();r.hasNext();){var s=r.next();n[i++]=t.createPolygon(t.createLinearRing(s))}return t.createGeometryCollection(n)},insertSite:function(t){var e=this.locate(t);if(t.equals(e.orig(),this._tolerance)||t.equals(e.dest(),this._tolerance))return e;var n=this.makeEdge(e.orig(),t);Io.splice(n,e);var i=n;do{e=(n=this.connect(e,n.sym())).oPrev()}while(e.lNext()!==i);return i},locate:function(){if(1===arguments.length){if(arguments[0]instanceof xo){var t=arguments[0];return this._locator.locate(t)}if(arguments[0]instanceof E){var e=arguments[0];return this._locator.locate(new xo(e))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=this._locator.locate(new xo(n));if(null===r)return null;var s=r;r.dest().getCoordinate().equals2D(n)&&(s=r.sym());var o=s;do{if(o.dest().getCoordinate().equals2D(i))return o;o=o.oNext()}while(o!==s);return null}},interfaces_:function(){return[]},getClass:function(){return Ro}}),Ro.getTriangleEdges=function(t,e){if(e[0]=t,e[1]=e[0].lNext(),e[2]=e[1].lNext(),e[2].lNext()!==e[0])throw new i("Edges do not form a triangle")},e(To.prototype,{visit:function(t){for(var e=t[0].orig().getCoordinate(),n=t[1].orig().getCoordinate(),i=t[2].orig().getCoordinate(),r=new xo(me.circumcentre(e,n,i)),s=0;s<3;s++)t[s].rot().setOrig(r)},interfaces_:function(){return[wo]},getClass:function(){return To}}),e(Po.prototype,{getTriangleEdges:function(){return this._triList},visit:function(t){this._triList.add(t)},interfaces_:function(){return[wo]},getClass:function(){return Po}}),e(Oo.prototype,{visit:function(t){this._triList.add([t[0].orig(),t[1].orig(),t[2].orig()])},getTriangleVertices:function(){return this._triList},interfaces_:function(){return[wo]},getClass:function(){return Oo}}),e(bo.prototype,{checkTriangleSize:function(t){t.length>=2?he.toLineString(t[0],t[1]):t.length>=1&&he.toPoint(t[0])},visit:function(t){this._coordList.clear();for(var e=0;e<3;e++){var n=t[e].orig();this._coordList.add(n.getCoordinate())}if(this._coordList.size()>0){this._coordList.closeRing();var i=this._coordList.toCoordinateArray();if(4!==i.length)return null;this._triCoords.add(i)}},getTriangles:function(){return this._triCoords},interfaces_:function(){return[wo]},getClass:function(){return bo}}),Ro.TriangleCircumcentreVisitor=To,Ro.TriangleEdgesListVisitor=Po,Ro.TriangleVertexListVisitor=Oo,Ro.TriangleCoordinatesVisitor=bo,Ro.EDGE_COINCIDENCE_TOL_FACTOR=1e3,e(Mo.prototype,{getLineSegment:function(){return this._ls},getEndZ:function(){return this._ls.getCoordinate(1).z},getStartZ:function(){return this._ls.getCoordinate(0).z},intersection:function(t){return this._ls.intersection(t.getLineSegment())},getStart:function(){return this._ls.getCoordinate(0)},getEnd:function(){return this._ls.getCoordinate(1)},getEndY:function(){return this._ls.getCoordinate(1).y},getStartX:function(){return this._ls.getCoordinate(0).x},equalsTopo:function(t){return this._ls.equalsTopo(t.getLineSegment())},getStartY:function(){return this._ls.getCoordinate(0).y},setData:function(t){this._data=t},getData:function(){return this._data},getEndX:function(){return this._ls.getCoordinate(1).x},toString:function(){return this._ls.toString()},interfaces_:function(){return[]},getClass:function(){return Mo}}),e(Do.prototype,{getInitialVertices:function(){return this._initialVertices},getKDT:function(){return this._kdt},enforceConstraints:function(){this.addConstraintVertices();var t=0,e=0;do{e=this.enforceGabriel(this._segments),t++}while(e>0&&t<Do.MAX_SPLIT_ITER)},insertSites:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertSite(n)}},getVertexFactory:function(){return this._vertexFactory},getPointArray:function(){for(var t=new Array(this._initialVertices.size()+this._segVertices.size()).fill(null),e=0,n=this._initialVertices.iterator();n.hasNext();){var i=n.next();t[e++]=i.getCoordinate()}for(var r=this._segVertices.iterator();r.hasNext();){i=r.next();t[e++]=i.getCoordinate()}return t},setConstraints:function(t,e){this._segments=t,this._segVertices=e},computeConvexHull:function(){var t=new se,e=new Ze(this.getPointArray(),t);this._convexHull=e.getConvexHull()},addConstraintVertices:function(){this.computeConvexHull(),this.insertSites(this._segVertices)},findNonGabrielPoint:function(t){var e=t.getStart(),n=t.getEnd(),i=new E((e.x+n.x)/2,(e.y+n.y)/2),r=e.distance(i),o=new M(i);o.expandBy(r);for(var a=this._kdt.query(o),u=null,l=s.MAX_VALUE,h=a.iterator();h.hasNext();){var c=h.next().getCoordinate();if(!c.equals2D(e)&&!c.equals2D(n)){var f=i.distance(c);if(f<r){(null===u||f<l)&&(u=c,l=f)}}}return u},getConstraintSegments:function(){return this._segments},setSplitPointFinder:function(t){this._splitFinder=t},getConvexHull:function(){return this._convexHull},getTolerance:function(){return this._tolerance},enforceGabriel:function(t){for(var e=new P,n=0,i=new P,r=t.iterator();r.hasNext();){var s=r.next(),o=this.findNonGabrielPoint(s);if(null!==o){this._splitPt=this._splitFinder.findSplitPoint(s,o);var a=this.createVertex(this._splitPt,s);this.insertSite(a).getCoordinate().equals2D(this._splitPt);var u=new Mo(s.getStartX(),s.getStartY(),s.getStartZ(),a.getX(),a.getY(),a.getZ(),s.getData()),l=new Mo(a.getX(),a.getY(),a.getZ(),s.getEndX(),s.getEndY(),s.getEndZ(),s.getData());e.add(u),e.add(l),i.add(s),n+=1}}return t.removeAll(i),t.addAll(e),n},createVertex:function(){if(1===arguments.length){var t=arguments[0],e=null;return e=null!==this._vertexFactory?this._vertexFactory.createVertex(t,null):new Eo(t)}if(2===arguments.length){var n=arguments[0],i=arguments[1];e=null;return(e=null!==this._vertexFactory?this._vertexFactory.createVertex(n,i):new Eo(n)).setOnConstraint(!0),e}},getSubdivision:function(){return this._subdiv},computeBoundingBox:function(){var t=Do.computeVertexEnvelope(this._initialVertices),e=Do.computeVertexEnvelope(this._segVertices),n=new M(t);n.expandToInclude(e);var i=.2*n.getWidth(),r=.2*n.getHeight(),s=Math.max(i,r);this._computeAreaEnv=new M(n),this._computeAreaEnv.expandBy(s)},setVertexFactory:function(t){this._vertexFactory=t},formInitialDelaunay:function(){this.computeBoundingBox(),this._subdiv=new Ro(this._computeAreaEnv,this._tolerance),this._subdiv.setLocator(new So(this._subdiv)),this._incDel=new No(this._subdiv),this.insertSites(this._initialVertices)},insertSite:function(){if(arguments[0]instanceof Eo){var t=arguments[0],e=this._kdt.insert(t.getCoordinate(),t);if(e.isRepeated()){var n=e.getData();return n.merge(t),n}return this._incDel.insertSite(t),t}if(arguments[0]instanceof E){var i=arguments[0];this.insertSite(this.createVertex(i))}},interfaces_:function(){return[]},getClass:function(){return Do}}),Do.computeVertexEnvelope=function(t){for(var e=new M,n=t.iterator();n.hasNext();){var i=n.next();e.expandToInclude(i.getCoordinate())}return e},Do.MAX_SPLIT_ITER=99,e(Ao.prototype,{create:function(){if(null!==this._subdiv)return null;var t=Ao.envelope(this._siteCoords),e=Ao.toVertices(this._siteCoords);this._subdiv=new Ro(t,this._tolerance),new No(this._subdiv).insertSites(e)},setTolerance:function(t){this._tolerance=t},setSites:function(){if(arguments[0]instanceof K){var t=arguments[0];this._siteCoords=Ao.extractUniqueCoordinates(t)}else if(N(arguments[0],S)){var e=arguments[0];this._siteCoords=Ao.unique(nt.toCoordinateArray(e))}},getEdges:function(t){return this.create(),this._subdiv.getEdges(t)},getSubdivision:function(){return this.create(),this._subdiv},getTriangles:function(t){return this.create(),this._subdiv.getTriangles(t)},interfaces_:function(){return[]},getClass:function(){return Ao}}),Ao.extractUniqueCoordinates=function(t){if(null===t)return new b;var e=t.getCoordinates();return Ao.unique(e)},Ao.envelope=function(t){for(var e=new M,n=t.iterator();n.hasNext();){var i=n.next();e.expandToInclude(i)}return e},Ao.unique=function(t){var e=nt.copyDeep(t);return It.sort(e),new b(e,!1)},Ao.toVertices=function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();e.add(new xo(i))}return e},e(Fo.prototype,{createSiteVertices:function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();this._constraintVertexMap.containsKey(i)||e.add(new Eo(i))}return e},create:function(){if(null!==this._subdiv)return null;var t=Ao.envelope(this._siteCoords),e=new P;null!==this._constraintLines&&(t.expandToInclude(this._constraintLines.getEnvelopeInternal()),this.createVertices(this._constraintLines),e=Fo.createConstraintSegments(this._constraintLines));var n=new Do(this.createSiteVertices(this._siteCoords),this._tolerance);n.setConstraints(e,new P(this._constraintVertexMap.values())),n.formInitialDelaunay(),n.enforceConstraints(),this._subdiv=n.getSubdivision()},setTolerance:function(t){this._tolerance=t},setConstraints:function(t){this._constraintLines=t},setSites:function(t){this._siteCoords=Ao.extractUniqueCoordinates(t)},getEdges:function(t){return this.create(),this._subdiv.getEdges(t)},getSubdivision:function(){return this.create(),this._subdiv},getTriangles:function(t){return this.create(),this._subdiv.getTriangles(t)},createVertices:function(t){for(var e=t.getCoordinates(),n=0;n<e.length;n++){var i=new Eo(e[n]);this._constraintVertexMap.put(e[n],i)}},interfaces_:function(){return[]},getClass:function(){return Fo}}),Fo.createConstraintSegments=function(){if(1===arguments.length){for(var t=arguments[0],e=be.getLines(t),n=new P,i=e.iterator();i.hasNext();){var r=i.next();Fo.createConstraintSegments(r,n)}return n}if(2===arguments.length){var s=arguments[0],o=arguments[1],a=s.getCoordinates();for(i=1;i<a.length;i++)o.add(new Mo(a[i-1],a[i]))}},e(Go.prototype,{create:function(){if(null!==this._subdiv)return null;var t=Ao.envelope(this._siteCoords);this._diagramEnv=t;var e=Math.max(this._diagramEnv.getWidth(),this._diagramEnv.getHeight());this._diagramEnv.expandBy(e),null!==this._clipEnv&&this._diagramEnv.expandToInclude(this._clipEnv);var n=Ao.toVertices(this._siteCoords);this._subdiv=new Ro(t,this._tolerance),new No(this._subdiv).insertSites(n)},getDiagram:function(t){this.create();var e=this._subdiv.getVoronoiDiagram(t);return Go.clipGeometryCollection(e,this._diagramEnv)},setTolerance:function(t){this._tolerance=t},setSites:function(){if(arguments[0]instanceof K){var t=arguments[0];this._siteCoords=Ao.extractUniqueCoordinates(t)}else if(N(arguments[0],S)){var e=arguments[0];this._siteCoords=Ao.unique(nt.toCoordinateArray(e))}},setClipEnvelope:function(t){this._clipEnv=t},getSubdivision:function(){return this.create(),this._subdiv},interfaces_:function(){return[]},getClass:function(){return Go}}),Go.clipGeometryCollection=function(t,e){for(var n=t.getFactory().toGeometry(e),i=new P,r=0;r<t.getNumGeometries();r++){var s=t.getGeometryN(r),o=null;e.contains(s.getEnvelopeInternal())?o=s:e.intersects(s.getEnvelopeInternal())&&(o=n.intersection(s)).setUserData(s.getUserData()),null===o||o.isEmpty()||i.add(o)}return t.getFactory().createGeometryCollection(se.toGeometryArray(i))};var qo=Object.freeze({Vertex:xo}),Bo=Object.freeze({ConformingDelaunayTriangulationBuilder:Fo,DelaunayTriangulationBuilder:Ao,VoronoiDiagramBuilder:Go,quadedge:qo});function Vo(){if(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._componentIndex=t._componentIndex,this._segmentIndex=t._segmentIndex,this._segmentFraction=t._segmentFraction}else if(2===arguments.length){var e=arguments[0],n=arguments[1];Vo.call(this,0,e,n)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this._componentIndex=i,this._segmentIndex=r,this._segmentFraction=s,this.normalize()}else if(4===arguments.length){var o=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3];this._componentIndex=o,this._segmentIndex=a,this._segmentFraction=u,l&&this.normalize()}}function zo(){if(this._linearGeom=null,this._numLines=null,this._currentLine=null,this._componentIndex=0,this._vertexIndex=0,1===arguments.length){var t=arguments[0];zo.call(this,t,0,0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];zo.call(this,e,n.getComponentIndex(),zo.segmentEndVertexIndex(n))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];if(!N(r,mt))throw new i("Lineal geometry is required");this._linearGeom=r,this._numLines=r.getNumGeometries(),this._componentIndex=s,this._vertexIndex=o,this.loadCurrentLine()}}function Yo(){this._linearGeom=null;var t=arguments[0];this._linearGeom=t}function ko(){this._linearGeom=null;var t=arguments[0];this._linearGeom=t}function Uo(){this._geomFact=null,this._lines=new P,this._coordList=null,this._ignoreInvalidLines=!1,this._fixInvalidLines=!1,this._lastPt=null;var t=arguments[0];this._geomFact=t}function Xo(){this._line=null;var t=arguments[0];this._line=t}function Ho(){this._linearGeom=null;var t=arguments[0];this._linearGeom=t,this.checkGeometryType()}function Wo(){this._linearGeom=null;var t=arguments[0];this._linearGeom=t}function jo(){this._linearGeom=null;var t=arguments[0];this._linearGeom=t}function Ko(){this._linearGeom=null;var t=arguments[0];this._linearGeom=t}e(Vo.prototype,{getSegmentIndex:function(){return this._segmentIndex},getComponentIndex:function(){return this._componentIndex},isEndpoint:function(t){var e=t.getGeometryN(this._componentIndex).getNumPoints()-1;return this._segmentIndex>=e||this._segmentIndex===e&&this._segmentFraction>=1},isValid:function(t){if(this._componentIndex<0||this._componentIndex>=t.getNumGeometries())return!1;var e=t.getGeometryN(this._componentIndex);return!(this._segmentIndex<0||this._segmentIndex>e.getNumPoints())&&((this._segmentIndex!==e.getNumPoints()||0===this._segmentFraction)&&!(this._segmentFraction<0||this._segmentFraction>1))},normalize:function(){this._segmentFraction<0&&(this._segmentFraction=0),this._segmentFraction>1&&(this._segmentFraction=1),this._componentIndex<0&&(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0),this._segmentIndex<0&&(this._segmentIndex=0,this._segmentFraction=0),1===this._segmentFraction&&(this._segmentFraction=0,this._segmentIndex+=1)},toLowest:function(t){var e=t.getGeometryN(this._componentIndex).getNumPoints()-1;return this._segmentIndex<e?this:new Vo(this._componentIndex,e,1,!1)},getCoordinate:function(t){var e=t.getGeometryN(this._componentIndex),n=e.getCoordinateN(this._segmentIndex);if(this._segmentIndex>=e.getNumPoints()-1)return n;var i=e.getCoordinateN(this._segmentIndex+1);return Vo.pointAlongSegmentByFraction(n,i,this._segmentFraction)},getSegmentFraction:function(){return this._segmentFraction},getSegment:function(t){var e=t.getGeometryN(this._componentIndex),n=e.getCoordinateN(this._segmentIndex);return this._segmentIndex>=e.getNumPoints()-1?new ge(e.getCoordinateN(e.getNumPoints()-2),n):new ge(n,e.getCoordinateN(this._segmentIndex+1))},clamp:function(t){if(this._componentIndex>=t.getNumGeometries())return this.setToEnd(t),null;if(this._segmentIndex>=t.getNumPoints()){var e=t.getGeometryN(this._componentIndex);this._segmentIndex=e.getNumPoints()-1,this._segmentFraction=1}},setToEnd:function(t){this._componentIndex=t.getNumGeometries()-1;var e=t.getGeometryN(this._componentIndex);this._segmentIndex=e.getNumPoints()-1,this._segmentFraction=1},compareTo:function(t){var e=t;return this._componentIndex<e._componentIndex?-1:this._componentIndex>e._componentIndex?1:this._segmentIndex<e._segmentIndex?-1:this._segmentIndex>e._segmentIndex?1:this._segmentFraction<e._segmentFraction?-1:this._segmentFraction>e._segmentFraction?1:0},copy:function(){return new Vo(this._componentIndex,this._segmentIndex,this._segmentFraction)},toString:function(){return"LinearLoc["+this._componentIndex+", "+this._segmentIndex+", "+this._segmentFraction+"]"},isOnSameSegment:function(t){return this._componentIndex===t._componentIndex&&(this._segmentIndex===t._segmentIndex||(t._segmentIndex-this._segmentIndex==1&&0===t._segmentFraction||this._segmentIndex-t._segmentIndex==1&&0===this._segmentFraction))},snapToVertex:function(t,e){if(this._segmentFraction<=0||this._segmentFraction>=1)return null;var n=this.getSegmentLength(t),i=this._segmentFraction*n,r=n-i;i<=r&&i<e?this._segmentFraction=0:r<=i&&r<e&&(this._segmentFraction=1)},compareLocationValues:function(t,e,n){return this._componentIndex<t?-1:this._componentIndex>t?1:this._segmentIndex<e?-1:this._segmentIndex>e?1:this._segmentFraction<n?-1:this._segmentFraction>n?1:0},getSegmentLength:function(t){var e=t.getGeometryN(this._componentIndex),n=this._segmentIndex;this._segmentIndex>=e.getNumPoints()-1&&(n=e.getNumPoints()-2);var i=e.getCoordinateN(n),r=e.getCoordinateN(n+1);return i.distance(r)},isVertex:function(){return this._segmentFraction<=0||this._segmentFraction>=1},interfaces_:function(){return[g]},getClass:function(){return Vo}}),Vo.getEndLocation=function(t){var e=new Vo;return e.setToEnd(t),e},Vo.pointAlongSegmentByFraction=function(t,e,n){return n<=0?t:n>=1?e:new E((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y,(e.z-t.z)*n+t.z)},Vo.compareLocationValues=function(t,e,n,i,r,s){return t<i?-1:t>i?1:e<r?-1:e>r?1:n<s?-1:n>s?1:0},e(zo.prototype,{getComponentIndex:function(){return this._componentIndex},getLine:function(){return this._currentLine},getVertexIndex:function(){return this._vertexIndex},getSegmentEnd:function(){return this._vertexIndex<this.getLine().getNumPoints()-1?this._currentLine.getCoordinateN(this._vertexIndex+1):null},next:function(){if(!this.hasNext())return null;this._vertexIndex++,this._vertexIndex>=this._currentLine.getNumPoints()&&(this._componentIndex++,this.loadCurrentLine(),this._vertexIndex=0)},loadCurrentLine:function(){if(this._componentIndex>=this._numLines)return this._currentLine=null,null;this._currentLine=this._linearGeom.getGeometryN(this._componentIndex)},getSegmentStart:function(){return this._currentLine.getCoordinateN(this._vertexIndex)},isEndOfLine:function(){return!(this._componentIndex>=this._numLines)&&!(this._vertexIndex<this._currentLine.getNumPoints()-1)},hasNext:function(){return!(this._componentIndex>=this._numLines)&&!(this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())},interfaces_:function(){return[]},getClass:function(){return zo}}),zo.segmentEndVertexIndex=function(t){return t.getSegmentFraction()>0?t.getSegmentIndex()+1:t.getSegmentIndex()},e(Yo.prototype,{indexOf:function(t){return this.indexOfFromStart(t,null)},indexOfFromStart:function(t,e){for(var n=s.MAX_VALUE,i=0,r=0,o=-1,a=new ge,u=new zo(this._linearGeom);u.hasNext();u.next())if(!u.isEndOfLine()){a.p0=u.getSegmentStart(),a.p1=u.getSegmentEnd();var l=a.distance(t),h=a.segmentFraction(t),c=u.getComponentIndex(),f=u.getVertexIndex();l<n&&(null===e||e.compareLocationValues(c,f,h)<0)&&(i=c,r=f,o=h,n=l)}return n===s.MAX_VALUE?new Vo(e):new Vo(i,r,o)},indexOfAfter:function(t,e){if(null===e)return this.indexOf(t);var n=Vo.getEndLocation(this._linearGeom);if(n.compareTo(e)<=0)return n;var i=this.indexOfFromStart(t,e);return x.isTrue(i.compareTo(e)>=0,"computed location is before specified minimum location"),i},interfaces_:function(){return[]},getClass:function(){return Yo}}),Yo.indexOf=function(t,e){return new Yo(t).indexOf(e)},Yo.indexOfAfter=function(t,e,n){return new Yo(t).indexOfAfter(e,n)},e(ko.prototype,{indicesOf:function(t){var e=t.getGeometryN(0).getCoordinateN(0),n=t.getGeometryN(t.getNumGeometries()-1),i=n.getCoordinateN(n.getNumPoints()-1),r=new Yo(this._linearGeom),s=new Array(2).fill(null);return s[0]=r.indexOf(e),0===t.getLength()?s[1]=s[0].copy():s[1]=r.indexOfAfter(i,s[0]),s},interfaces_:function(){return[]},getClass:function(){return ko}}),ko.indicesOf=function(t,e){return new ko(t).indicesOf(e)},e(Uo.prototype,{getGeometry:function(){return this.endLine(),this._geomFact.buildGeometry(this._lines)},getLastCoordinate:function(){return this._lastPt},endLine:function(){if(null===this._coordList)return null;if(this._ignoreInvalidLines&&this._coordList.size()<2)return this._coordList=null,null;var t=this._coordList.toCoordinateArray(),e=t;this._fixInvalidLines&&(e=this.validCoordinateSequence(t)),this._coordList=null;var n=null;try{n=this._geomFact.createLineString(e)}catch(t){if(!(t instanceof i))throw t;if(!this._ignoreInvalidLines)throw t}null!==n&&this._lines.add(n)},setFixInvalidLines:function(t){this._fixInvalidLines=t},add:function(){if(1===arguments.length){var t=arguments[0];this.add(t,!0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];null===this._coordList&&(this._coordList=new b),this._coordList.add(e,n),this._lastPt=e}},setIgnoreInvalidLines:function(t){this._ignoreInvalidLines=t},validCoordinateSequence:function(t){return t.length>=2?t:[t[0],t[0]]},interfaces_:function(){return[]},getClass:function(){return Uo}}),e(Xo.prototype,{computeLinear:function(t,e){var n=new Uo(this._line.getFactory());n.setFixInvalidLines(!0),t.isVertex()||n.add(t.getCoordinate(this._line));for(var i=new zo(this._line,t);i.hasNext()&&!(e.compareLocationValues(i.getComponentIndex(),i.getVertexIndex(),0)<0);i.next()){var r=i.getSegmentStart();n.add(r),i.isEndOfLine()&&n.endLine()}return e.isVertex()||n.add(e.getCoordinate(this._line)),n.getGeometry()},computeLine:function(t,e){var n=this._line.getCoordinates(),i=new b,r=t.getSegmentIndex();t.getSegmentFraction()>0&&(r+=1);var s=e.getSegmentIndex();1===e.getSegmentFraction()&&(s+=1),s>=n.length&&(s=n.length-1),t.isVertex()||i.add(t.getCoordinate(this._line));for(var o=r;o<=s;o++)i.add(n[o]);e.isVertex()||i.add(e.getCoordinate(this._line)),i.size()<=0&&i.add(t.getCoordinate(this._line));var a=i.toCoordinateArray();return a.length<=1&&(a=[a[0],a[0]]),this._line.getFactory().createLineString(a)},extract:function(t,e){return e.compareTo(t)<0?this.reverse(this.computeLinear(e,t)):this.computeLinear(t,e)},reverse:function(t){return t instanceof At?t.reverse():t instanceof wt?t.reverse():(x.shouldNeverReachHere("non-linear geometry encountered"),null)},interfaces_:function(){return[]},getClass:function(){return Xo}}),Xo.extract=function(t,e,n){return new Xo(t).extract(e,n)},e(Ho.prototype,{clampIndex:function(t){var e=t.copy();return e.clamp(this._linearGeom),e},project:function(t){return Yo.indexOf(this._linearGeom,t)},checkGeometryType:function(){if(!(this._linearGeom instanceof At||this._linearGeom instanceof wt))throw new i("Input geometry must be linear")},extractPoint:function(){if(1===arguments.length)return arguments[0].getCoordinate(this._linearGeom);if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.toLowest(this._linearGeom);return n.getSegment(this._linearGeom).pointAlongOffset(n.getSegmentFraction(),e)}},isValidIndex:function(t){return t.isValid(this._linearGeom)},getEndIndex:function(){return Vo.getEndLocation(this._linearGeom)},getStartIndex:function(){return new Vo},indexOfAfter:function(t,e){return Yo.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){return Xo.extract(this._linearGeom,t,e)},indexOf:function(t){return Yo.indexOf(this._linearGeom,t)},indicesOf:function(t){return ko.indicesOf(this._linearGeom,t)},interfaces_:function(){return[]},getClass:function(){return Ho}}),e(Wo.prototype,{indexOf:function(t){return this.indexOfFromStart(t,-1)},indexOfFromStart:function(t,e){for(var n=s.MAX_VALUE,i=e,r=0,o=new ge,a=new zo(this._linearGeom);a.hasNext();){if(!a.isEndOfLine()){o.p0=a.getSegmentStart(),o.p1=a.getSegmentEnd();var u=o.distance(t),l=this.segmentNearestMeasure(o,t,r);u<n&&l>e&&(i=l,n=u),r+=o.getLength()}a.next()}return i},indexOfAfter:function(t,e){if(e<0)return this.indexOf(t);var n=this._linearGeom.getLength();if(n<e)return n;var i=this.indexOfFromStart(t,e);return x.isTrue(i>=e,"computed index is before specified minimum index"),i},segmentNearestMeasure:function(t,e,n){var i=t.projectionFactor(e);return i<=0?n:i<=1?n+i*t.getLength():n+t.getLength()},interfaces_:function(){return[]},getClass:function(){return Wo}}),Wo.indexOf=function(t,e){return new Wo(t).indexOf(e)},Wo.indexOfAfter=function(t,e,n){return new Wo(t).indexOfAfter(e,n)},e(jo.prototype,{getLength:function(t){for(var e=0,n=new zo(this._linearGeom);n.hasNext();){if(!n.isEndOfLine()){var i=n.getSegmentStart(),r=n.getSegmentEnd().distance(i);if(t.getComponentIndex()===n.getComponentIndex()&&t.getSegmentIndex()===n.getVertexIndex())return e+r*t.getSegmentFraction();e+=r}n.next()}return e},resolveHigher:function(t){if(!t.isEndpoint(this._linearGeom))return t;var e=t.getComponentIndex();if(e>=this._linearGeom.getNumGeometries()-1)return t;do{e++}while(e<this._linearGeom.getNumGeometries()-1&&0===this._linearGeom.getGeometryN(e).getLength());return new Vo(e,0,0)},getLocation:function(){if(1===arguments.length){var t=arguments[0];return this.getLocation(t,!0)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=e;if(e<0)i=this._linearGeom.getLength()+e;var r=this.getLocationForward(i);return n?r:this.resolveHigher(r)}},getLocationForward:function(t){if(t<=0)return new Vo;for(var e=0,n=new zo(this._linearGeom);n.hasNext();){if(n.isEndOfLine()){if(e===t)return new Vo(n.getComponentIndex(),n.getVertexIndex(),0)}else{var i=n.getSegmentStart(),r=n.getSegmentEnd().distance(i);if(e+r>t){var s=(t-e)/r;return new Vo(n.getComponentIndex(),n.getVertexIndex(),s)}e+=r}n.next()}return Vo.getEndLocation(this._linearGeom)},interfaces_:function(){return[]},getClass:function(){return jo}}),jo.getLength=function(t,e){return new jo(t).getLength(e)},jo.getLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new jo(t).getLocation(e)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];return new jo(n).getLocation(i,r)}},e(Ko.prototype,{clampIndex:function(t){var e=this.positiveIndex(t),n=this.getStartIndex();if(e<n)return n;var i=this.getEndIndex();return e>i?i:e},locationOf:function(){if(1===arguments.length){var t=arguments[0];return jo.getLocation(this._linearGeom,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return jo.getLocation(this._linearGeom,e,n)}},project:function(t){return Wo.indexOf(this._linearGeom,t)},positiveIndex:function(t){return t>=0?t:this._linearGeom.getLength()+t},extractPoint:function(){if(1===arguments.length){var t=arguments[0];return jo.getLocation(this._linearGeom,t).getCoordinate(this._linearGeom)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=jo.getLocation(this._linearGeom,e).toLowest(this._linearGeom);return i.getSegment(this._linearGeom).pointAlongOffset(i.getSegmentFraction(),n)}},isValidIndex:function(t){return t>=this.getStartIndex()&&t<=this.getEndIndex()},getEndIndex:function(){return this._linearGeom.getLength()},getStartIndex:function(){return 0},indexOfAfter:function(t,e){return Wo.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){new Ho(this._linearGeom);var n=this.clampIndex(t),i=this.clampIndex(e),r=n===i,s=this.locationOf(n,r),o=this.locationOf(i);return Xo.extract(this._linearGeom,s,o)},indexOf:function(t){return Wo.indexOf(this._linearGeom,t)},indicesOf:function(t){var e=ko.indicesOf(this._linearGeom,t);return[jo.getLength(this._linearGeom,e[0]),jo.getLength(this._linearGeom,e[1])]},interfaces_:function(){return[]},getClass:function(){return Ko}});var Zo=Object.freeze({LengthIndexedLine:Ko,LengthLocationMap:jo,LinearGeometryBuilder:Uo,LinearIterator:zo,LinearLocation:Vo,LocationIndexedLine:Ho});function Qo(){}e(Qo.prototype,{interfaces_:function(){return[]},getClass:function(){return Qo}}),Qo.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ds.createEmptyResult(ds.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),fs.overlayOp(t,e,ds.UNION)},e(K.prototype,{equalsTopo:function(t){return!!this.getEnvelopeInternal().equals(t.getEnvelopeInternal())&&Gs.relate(this,t).isEquals(this.getDimension(),t.getDimension())},union:function(){if(0===arguments.length)return ks.union(this);if(1===arguments.length){var t=arguments[0];return Qo.union(this,t)}},isValid:function(){return Zs.isValid(this)},intersection:function(t){if(this.isEmpty()||t.isEmpty())return ds.createEmptyResult(ds.INTERSECTION,this,t,this._factory);if(this.isGeometryCollection()){var e=t;return es.map(this,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(e)}})}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),fs.overlayOp(this,t,ds.INTERSECTION)},covers:function(t){return Gs.covers(this,t)},coveredBy:function(t){return Gs.covers(t,this)},touches:function(t){return Gs.touches(this,t)},intersects:function(t){return Gs.intersects(this,t)},within:function(t){return Gs.within(this,t)},overlaps:function(t){return Gs.overlaps(this,t)},disjoint:function(t){return Gs.disjoint(this,t)},crosses:function(t){return Gs.crosses(this,t)},buffer:function(){if(1===arguments.length){var t=arguments[0];return Pr.bufferOp(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return Pr.bufferOp(this,e,n)}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];return Pr.bufferOp(this,i,r,s)}},convexHull:function(){return new Ze(this).getConvexHull()},relate:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(1===arguments.length){var i=arguments[0];return Gs.relate(this,i)}if(2===arguments.length){var r=arguments[0],s=arguments[1];return Gs.relate(this,r).matches(s)}},getCentroid:function(){if(this.isEmpty())return this._factory.createPoint();var t=Xe.getCentroid(this);return this.createPointFromInternalCoord(t,this)},getInteriorPoint:function(){if(this.isEmpty())return this._factory.createPoint();var t=null,e=this.getDimension();if(0===e)t=new en(this).getInteriorPoint();else if(1===e){t=new tn(this).getInteriorPoint()}else{t=new Je(this).getInteriorPoint()}return this.createPointFromInternalCoord(t,this)},symDifference:function(t){if(this.isEmpty()||t.isEmpty()){if(this.isEmpty()&&t.isEmpty())return ds.createEmptyResult(ds.SYMDIFFERENCE,this,t,this._factory);if(this.isEmpty())return t.copy();if(t.isEmpty())return this.copy()}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),fs.overlayOp(this,t,ds.SYMDIFFERENCE)},createPointFromInternalCoord:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},toText:function(){return(new he).write(this)},toString:function(){this.toText()},contains:function(t){return Gs.contains(this,t)},difference:function(t){return this.isEmpty()?ds.createEmptyResult(ds.DIFFERENCE,this,t,this._factory):t.isEmpty()?this.copy():(this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),fs.overlayOp(this,t,ds.DIFFERENCE))},isSimple:function(){return new $i(this).isSimple()},isWithinDistance:function(t,e){return!(this.getEnvelopeInternal().distance(t.getEnvelopeInternal())>e)&&Fr.isWithinDistance(this,t,e)},distance:function(t){return Fr.distance(this,t)},isEquivalentClass:function(t){return this.getClass()===t.getClass()}});t.version="1.6.0 (ac4d0f6)",t.algorithm=En,t.densify=Sn,t.dissolve=bn,t.geom=ve,t.geomgraph=ii,t.index=wi,t.io=Gi,t.noding=Ji,t.operation=Js,t.precision=eo,t.simplify=_o,t.triangulate=Bo,t.linearref=Zo,Object.defineProperty(t,"__esModule",{value:!0})});
  9. //# sourceMappingURL=jsts.min.js.map