/*! * Copyright (c) 2017 Sumit Kumar * leaflet.pm.(https://github.com/codeofsumit/leaflet.pm) * license: MIT * version: v0.25.0 */ !function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(5)),r=L.Class.extend({includes:[i["default"]],options:{snappable:!0,snapDistance:20,cursorMarker:!0,finishOnDoubleClick:!1,finishOn:null,allowSelfIntersection:!0,templineStyle:{},hintlineStyle:{dashArray:[5,5]},markerStyle:{draggable:!0}},initialize:function(t){var e=this;this._map=t,this.shapes=["Marker","Line","Poly","Rectangle","Circle","Cut"],this.shapes.forEach(function(t){e[t]=new L.PM.Draw[t](e._map)})},setPathOptions:function(t){this.options.pathOptions=t},getShapes:function(){return this.shapes},enable:function(t,e){if(!t)throw new Error("Error: Please pass a shape as a parameter. Possible shapes are: ".concat(this.getShapes().join(",")));this.disable(),this[t].enable(e)},disable:function(){var t=this;this.shapes.forEach(function(e){t[e].disable()})},addControls:function(){var t=this;this.shapes.forEach(function(e){t[e].addButton()})}});e["default"]=r},function(t,e,n){"use strict";function i(t,e,n){if(n=n||{},!u(n))throw new Error("options is invalid");var i=n.bbox,r=n.id;if(t===undefined)throw new Error("geometry is required");if(e&&e.constructor!==Object)throw new Error("properties must be an Object");i&&l(i),r&&h(r);var o={type:"Feature"};return r&&(o.id=r),i&&(o.bbox=i),o.properties=e||{},o.geometry=t,o}function r(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!a(t[0])||!a(t[1]))throw new Error("coordinates must contain numbers");return i({type:"Point",coordinates:t},e,n)}function o(t,e,n){if(!t)throw new Error("coordinates is required");for(var r=0;r1&&Object(a.b)(t[0])&&Object(a.b)(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return r(t[0]);throw new Error("coordinates must only contain numbers")}function o(t){if(!t)throw new Error("geojson is required");if(t.geometry!==undefined)return t.geometry;if(t.coordinates||t.geometries)return t;throw new Error("geojson must be a valid Feature or Geometry Object")}function s(t,e){if(!t)throw new Error((e||"geojson")+" is required");if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error((e||"geojson")+" is invalid")}n.d(e,"a",function(){return i}),n.d(e,"b",function(){return o}),n.d(e,"c",function(){return s});var a=n(1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i={_initSnappableMarkers:function(){this.options.snapDistance=this.options.snapDistance||30,this.isPolygon()?this._markers.map(this._assignEvents,this):this._assignEvents(this._markers),this._layer.off("pm:dragstart",this._unsnap,this),this._layer.on("pm:dragstart",this._unsnap,this)},_assignEvents:function(t){var e=this;t.forEach(function(t){t.off("drag",e._handleSnapping,e),t.on("drag",e._handleSnapping,e),t.off("dragend",e._cleanupSnapping,e),t.on("dragend",e._cleanupSnapping,e)})},_unsnap:function(){delete this._snapLatLng},_cleanupSnapping:function(){delete this._snapList,this._map.off("pm:remove",this._handleSnapLayerRemoval,this),this.debugIndicatorLines&&this.debugIndicatorLines.forEach(function(t){t.remove()})},_handleSnapLayerRemoval:function(t){var e=t.layer,n=this._snapList.findIndex(function(t){return t._leaflet_id===e._leaflet_id});this._snapList.splice(n,1)},_handleSnapping:function(t){var e=this;if(t.originalEvent.altKey)return!1;if(this._snapList===undefined&&this._createSnapList(t),this._snapList.length<=0)return!1;var n,i=t.target,r=this._calcClosestLayer(i.getLatLng(),this._snapList),o=r.layer instanceof L.Marker||r.layer instanceof L.CircleMarker;n=o?r.latlng:this._checkPrioritiySnapping(r);var s=this.options.snapDistance,a={marker:i,snapLatLng:n,segment:r.segment,layer:this._layer,layerInteractedWith:r.layer};if(r.distance0})).filter(function(t){return!t._pmTempLayer}),this._otherSnapLayers?this._snapList=e.concat(this._otherSnapLayers):this._snapList=e,this.debugIndicatorLines=n},_calcClosestLayer:function(t,e){var n=this,i={};return e.forEach(function(e,r){var o=n._calcLayerDistances(t,e);n.debugIndicatorLines[r].setLatLngs([t,o.latlng]),(i.distance===undefined||o.distance=0&&l<=1&&(f.onLine1=!0),h>=0&&h<=1&&(f.onLine2=!0),!(!f.onLine1||!f.onLine2)&&[f.x,f.y])}(t[n][0],t[n][1],t[n+1][0],t[n+1][1],e[o][0],e[o][1],e[o+1][0],e[o+1][1]);s&&r.features.push(Object(i.e)([s[0],s[1]]))}})}),r}},function(t,e,n){!function(t,n){n(e)}(0,function(t){"use strict";function e(){}function n(t){this.message=t||""}function i(t){this.message=t||""}function r(){}function o(t){return null===t?Dt:t.color}function s(t){return null===t?null:t.parent}function a(t,e){null!==t&&(t.color=e)}function u(t){return null===t?null:t.left}function l(t){return null===t?null:t.right}function h(){this.root_=null,this.size_=0}function c(){}function p(){this.array_=[],arguments[0]instanceof vt&&this.addAll(arguments[0])}function f(){}function g(t){this.message=t||""}function d(){this.array_=[]}"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: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);ie.x?1:this.ye.y?1:0},x.prototype.clone=function(){},x.prototype.copy=function(){return new x(this)},x.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},x.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)},x.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},x.prototype.hashCode=function(){var t=17;return t=37*t+x.hashCode(this.x),t=37*t+x.hashCode(this.y)},x.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},x.prototype.interfaces_=function(){return[I,E,e]},x.prototype.getClass=function(){return x},x.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=m.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},N.DimensionalComparator.get=function(){return b},N.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},N.NULL_ORDINATE.get=function(){return m.NaN},N.X.get=function(){return 0},N.Y.get=function(){return 1},N.Z.get=function(){return 2},Object.defineProperties(x,N);var b=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new y("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};b.prototype.compare=function(t,e){var n=t,i=e,r=b.compare(n.x,i.x);if(0!==r)return r;var o=b.compare(n.y,i.y);return 0!==o?o:this._dimensionsToTest<=2?0:b.compare(n.z,i.z)},b.prototype.interfaces_=function(){return[L]},b.prototype.getClass=function(){return b},b.compare=function(t,e){return te?1:m.isNaN(t)?m.isNaN(e)?0:-1:m.isNaN(e)?1:0};var C=function(){};C.prototype.create=function(){},C.prototype.interfaces_=function(){return[]},C.prototype.getClass=function(){return C};var S=function(){},w={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};S.prototype.interfaces_=function(){return[]},S.prototype.getClass=function(){return S},S.toLocationSymbol=function(t){switch(t){case S.EXTERIOR:return"e";case S.BOUNDARY:return"b";case S.INTERIOR:return"i";case S.NONE:return"-"}throw new y("Unknown location value: "+t)},w.INTERIOR.get=function(){return 0},w.BOUNDARY.get=function(){return 1},w.EXTERIOR.get=function(){return 2},w.NONE.get=function(){return-1},Object.defineProperties(S,w);var M=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},O=function(){},P={LOG_10:{configurable:!0}};O.prototype.interfaces_=function(){return[]},O.prototype.getClass=function(){return O},O.log10=function(t){var e=Math.log(t);return m.isInfinite(e)?e:m.isNaN(e)?e:e/O.LOG_10},O.min=function(t,e,n,i){var r=t;return en?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],o=arguments[2];return io?o:i}},O.wrap=function(t,e){return t<0?e- -t%e:t%e},O.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=r;return o>u&&(u=o),s>u&&(u=s),a>u&&(u=a),u}},O.average=function(t,e){return(t+e)/2},P.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(O,P);var T=function(t){this.str=t};T.prototype.append=function(t){this.str+=t},T.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},T.prototype.toString=function(t){return this.str};var R=function(t){this.value=t};R.prototype.intValue=function(){return this.value},R.prototype.compareTo=function(t){return this.valuet?1:0},R.isNaN=function(t){return Number.isNaN(t)};var D=function(){};D.isWhitespace=function(t){return t<=32&&t>=0||127===t},D.toUpperCase=function(t){return t.toUpperCase()};var A=function Fr(){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 Fr){var e=arguments[0];this.init(e)}else if("string"==typeof arguments[0]){var n=arguments[0];Fr.call(this,Fr.parse(n))}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this.init(i,r)}},k={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};A.prototype.le=function(t){return(this._hi9?(h=!0,c="9"):c="0"+l,s.append(c),n=n.subtract(A.valueOf(l)).multiply(A.TEN),h&&n.selfAdd(A.TEN);var p=!0,f=A.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=i,s.toString()},A.prototype.sqr=function(){return this.multiply(this)},A.prototype.doubleValue=function(){return this._hi+this._lo},A.prototype.subtract=function(){if(arguments[0]instanceof A){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},A.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},A.prototype.isZero=function(){return 0===this._hi&&0===this._lo},A.prototype.selfSubtract=function(){if(arguments[0]instanceof A){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)}},A.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},A.prototype.min=function(t){return this.le(t)?this:t},A.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof A){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=arguments[0],i=arguments[1],r=null,o=null,s=null,a=null,u=null,l=null,h=null,c=null;return u=this._hi/n,l=A.SPLIT*u,r=l-u,c=A.SPLIT*n,r=l-r,o=u-r,s=c-n,h=u*n,s=c-s,a=n-s,c=r*s-h+r*a+o*s+o*a,l=(this._hi-h-c+this._lo-u*i)/n,c=u+l,this._hi=c,this._lo=u-c+l,this}},A.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},A.prototype.divide=function(){if(arguments[0]instanceof A){var t=arguments[0],e=null,n=null,i=null,r=null,o=null,s=null,a=null,u=null;return n=(o=this._hi/t._hi)-(e=(s=A.SPLIT*o)-(e=s-o)),u=e*(i=(u=A.SPLIT*t._hi)-(i=u-t._hi))-(a=o*t._hi)+e*(r=t._hi-i)+n*i+n*r,s=(this._hi-a-u+this._lo-o*t._lo)/t._hi,new A(u=o+s,o-u+s)}if("number"==typeof arguments[0]){var l=arguments[0];return m.isNaN(l)?A.createNaN():A.copy(this).selfDivide(l,0)}},A.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},A.prototype.pow=function(t){if(0===t)return A.valueOf(1);var e=new A(this),n=A.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},A.prototype.ceil=function(){if(this.isNaN())return A.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new A(t,e)},A.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0},A.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},A.prototype.setValue=function(){if(arguments[0]instanceof A){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},A.prototype.max=function(t){return this.ge(t)?this:t},A.prototype.sqrt=function(){if(this.isZero())return A.valueOf(0);if(this.isNegative())return A.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=A.valueOf(e),i=this.subtract(n.sqr())._hi*(.5*t);return n.add(i)},A.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof A){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,o=null,s=null,a=null;return r=this._hi+e,s=r-this._hi,o=r-s,o=e-s+(this._hi-o),a=o+this._lo,n=r+a,i=a+(r-n),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(2===arguments.length){var u=arguments[0],l=arguments[1],h=null,c=null,p=null,f=null,g=null,d=null,_=null;f=this._hi+u,c=this._lo+l,g=f-(d=f-this._hi),p=c-(_=c-this._lo);var y=(h=f+(d=(g=u-d+(this._hi-g))+c))+(d=(p=l-_+(this._lo-p))+(d+(f-h))),m=d+(h-y);return this._hi=y,this._lo=m,this}},A.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof A){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=arguments[0],i=arguments[1],r=null,o=null,s=null,a=null,u=null,l=null;r=(u=A.SPLIT*this._hi)-this._hi,l=A.SPLIT*n,r=u-r,o=this._hi-r,s=l-n;var h=(u=this._hi*n)+(l=r*(s=l-s)-u+r*(a=n-s)+o*s+o*a+(this._hi*i+this._lo*n)),c=l+(r=u-h);return this._hi=h,this._lo=c,this}},A.prototype.selfSqr=function(){return this.selfMultiply(this)},A.prototype.floor=function(){if(this.isNaN())return A.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new A(t,e)},A.prototype.negate=function(){return this.isNaN()?this:new A(-this._hi,-this._lo)},A.prototype.clone=function(){},A.prototype.multiply=function(){if(arguments[0]instanceof A){var t=arguments[0];return t.isNaN()?A.createNaN():A.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return m.isNaN(e)?A.createNaN():A.copy(this).selfMultiply(e,0)}},A.prototype.isNaN=function(){return m.isNaN(this._hi)},A.prototype.intValue=function(){return Math.trunc(this._hi)},A.prototype.toString=function(){var t=A.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},A.prototype.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."+A.stringOfChar("0",-i)+n;else if(-1===n.indexOf(".")){var o=i-n.length;r=n+A.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+r:r},A.prototype.reciprocal=function(){var t=null,e=null,n=null,i=null,r=null,o=null,s=null,a=null;e=(r=1/this._hi)-(t=(o=A.SPLIT*r)-(t=o-r)),n=(a=A.SPLIT*this._hi)-this._hi;var u=r+(o=(1-(s=r*this._hi)-(a=t*(n=a-n)-s+t*(i=this._hi-n)+e*n+e*i)-r*this._lo)/this._hi);return new A(u,r-u+o)},A.prototype.toSciNotation=function(){if(this.isZero())return A.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=A.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var o=n.charAt(0)+"."+r;return this.isNegative()?"-"+o+i:o+i},A.prototype.abs=function(){return this.isNaN()?A.NaN:this.isNegative()?this.negate():new A(this)},A.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},A.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo},A.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},A.prototype.trunc=function(){return this.isNaN()?A.NaN:this.isPositive()?this.floor():this.ceil()},A.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},A.prototype.interfaces_=function(){return[e,I,E]},A.prototype.getClass=function(){return A},A.sqr=function(t){return A.valueOf(t).selfMultiply(t)},A.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return A.parse(t)}if("number"==typeof arguments[0]){var e=arguments[0];return new A(e)}},A.sqrt=function(t){return A.valueOf(t).sqrt()},A.parse=function(t){for(var e=0,n=t.length;D.isWhitespace(t.charAt(e));)e++;var i=!1;if(e=n);){var l=t.charAt(e);if(e++,D.isDigit(l)){var h=l-"0";o.selfMultiply(A.TEN),o.selfAdd(h),s++}else{if("."!==l){if("e"===l||"E"===l){var c=t.substring(e);try{u=R.parseInt(c)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+c+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var p=o,f=s-a-u;if(0===f)p=o;else if(f>0){var g=A.TEN.pow(f);p=o.divide(g)}else if(f<0){var d=A.TEN.pow(-f);p=o.multiply(d)}return i?p.negate():p},A.createNaN=function(){return new A(m.NaN,m.NaN)},A.copy=function(t){return new A(t)},A.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},A.stringOfChar=function(t,e){for(var n=new T,i=0;i0){if(o<=0)return F.signum(s);i=r+o}else{if(!(r<0))return F.signum(s);if(o>=0)return F.signum(s);i=-r-o}var a=F.DP_SAFE_EPSILON*i;return s>=a||-s>=a?F.signum(s):2},F.signum=function(t){return t>0?1:t<0?-1:0},G.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(F,G);var B=function(){},q={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};q.X.get=function(){return 0},q.Y.get=function(){return 1},q.Z.get=function(){return 2},q.M.get=function(){return 3},B.prototype.setOrdinate=function(t,e,n){},B.prototype.size=function(){},B.prototype.getOrdinate=function(t,e){},B.prototype.getCoordinate=function(){},B.prototype.getCoordinateCopy=function(t){},B.prototype.getDimension=function(){},B.prototype.getX=function(t){},B.prototype.clone=function(){},B.prototype.expandEnvelope=function(t){},B.prototype.copy=function(){},B.prototype.getY=function(t){},B.prototype.toCoordinateArray=function(){},B.prototype.interfaces_=function(){return[E]},B.prototype.getClass=function(){return B},Object.defineProperties(B,q);var U=function(){},V=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(U),z=function(){};z.arraycopy=function(t,e,n,i,r){for(var o=0,s=e;st._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx=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}},X.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof X){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||nthis._maxy||ithis._maxx&&(this._maxx=e._maxx),e._minythis._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):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}},X.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0},X.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},X.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},X.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},X.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},X.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},X.prototype.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()}},X.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof X){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof x){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)}},X.prototype.centre=function(){return this.isNull()?null:new x((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},X.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof x){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof X){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],o=arguments[1],s=arguments[2],a=arguments[3];rt._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},X.prototype.hashCode=function(){var t=17;return t=37*t+x.hashCode(this._minx),t=37*t+x.hashCode(this._maxx),t=37*t+x.hashCode(this._miny),t=37*t+x.hashCode(this._maxy)},X.prototype.interfaces_=function(){return[I,e]},X.prototype.getClass=function(){return X},X.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(i.x,r.x),h=Math.max(i.x,r.x);return!(l>u||hu||hthis.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},et.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},et.prototype.setPrecisionModel=function(t){this._precisionModel=t},et.prototype.isInteriorIntersection=function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;er?i:r;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=i>r?s:a)||t.equals(e)||(o=Math.max(s,a))}return tt.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},et.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,r=t.y-e.y,o=Math.sqrt(i*i+r*r);return tt.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},nt.DONT_INTERSECT.get=function(){return 0},nt.DO_INTERSECT.get=function(){return 1},nt.COLLINEAR.get=function(){return 2},nt.NO_INTERSECTION.get=function(){return 0},nt.POINT_INTERSECTION.get=function(){return 1},nt.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(et,nt);var it=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new X(this._inputLines[0][0],this._inputLines[0][1]),n=new X(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],i=arguments[2];if(this._isProper=!1,X.intersects(n,i,e)&&0===st.orientationIndex(n,i,e)&&0===st.orientationIndex(i,n,e))return this._isProper=!0,(e.equals(n)||e.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.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},e.prototype.safeHCoordinateIntersection=function(t,n,i,r){var o=null;try{o=j.intersection(t,n,i,r)}catch(s){if(!(s instanceof V))throw s;o=e.nearestEndpoint(t,n,i,r)}return o},e.prototype.intersection=function(t,n,i,r){var o=this.intersectionWithNormalization(t,n,i,r);return this.isInSegmentEnvelopes(o)||(o=new x(e.nearestEndpoint(t,n,i,r))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,i){var r=t,o=Math.abs(r);return Math.abs(e)1e-4&&z.out.println("Distance = "+r.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,i){var r=new x(t),o=new x(e),s=new x(n),a=new x(i),u=new x;this.normalizeToEnvCentre(r,o,s,a,u);var l=this.safeHCoordinateIntersection(r,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,n,i,r){var o=X.intersects(e,n,i),s=X.intersects(e,n,r),a=X.intersects(i,r,e),u=X.intersects(i,r,n);return o&&s?(this._intPt[0]=i,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,i,r){var o=t.xe.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.xi.x?n.x:i.x,p=n.y>i.y?n.y:i.y,f=((o>l?o:l)+(ah?s:h)+(u0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=st.orientationIndex(i,r,e),u=st.orientationIndex(i,r,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,i,r):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(i)||e.equals2D(r)?this._intPt[0]=e:n.equals2D(i)||n.equals2D(r)?this._intPt[0]=n:0===o?this._intPt[0]=new x(i):0===s?this._intPt[0]=new x(r):0===a?this._intPt[0]=new x(e):0===u&&(this._intPt[0]=new x(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,i,r)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,i){var r=t,o=st.distancePointLine(t,n,i),s=st.distancePointLine(e,n,i);return s0?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(e>0?i>0?e<=i||(r=-r,o=t,t=n,n=o,o=e,e=i,i=o):e<=-i?(r=-r,n=-n,i=-i):(o=t,t=-n,n=o,o=e,e=-i,i=o):i>0?-e<=i?(r=-r,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=i,i=o):e>=i?(t=-t,e=-e,n=-n,i=-i):(r=-r,o=-t,t=-n,n=o,o=-e,e=-i,i=o),t>0){if(!(n>0))return r;if(!(t<=n))return r}else{if(n>0)return-r;if(!(t>=n))return-r;r=-r,t=-t,n=-n}for(;;){if(s=Math.floor(n/t),n-=s*t,(i-=s*e)<0)return-r;if(i>e)return r;if(t>n+n){if(ei+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(s=Math.floor(t/n),t-=s*n,(e-=s*i)<0)return r;if(e>i)return-r;if(n>t+t){if(ie+e)return r;t=n-t,e=i-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}};var ot=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ot.prototype.countSegment=function(t,e){if(t.xi&&(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=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=rt.signOfDet2x2(r,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a0&&this._crossingCount++}},ot.prototype.isPointInPolygon=function(){return this.getLocation()!==S.EXTERIOR},ot.prototype.getLocation=function(){return this._isPointOnSegment?S.BOUNDARY:this._crossingCount%2==1?S.INTERIOR:S.EXTERIOR},ot.prototype.isOnSegment=function(){return this._isPointOnSegment},ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.locatePointInRing=function(){if(arguments[0]instanceof x&&M(arguments[1],B)){for(var t=arguments[0],e=arguments[1],n=new ot(t),i=new x,r=new x,o=1;o1||a<0||a>1)&&(r=!0)}}else r=!0;return r?O.min(st.distancePointLine(t,n,i),st.distancePointLine(e,n,i),st.distancePointLine(n,t,e),st.distancePointLine(i,t,e)):0},st.isPointInRing=function(t,e){return st.locatePointInRing(t,e)!==S.EXTERIOR},st.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new x;t.getCoordinate(0,i);for(var r=i.x,o=i.y,s=1;sn.y&&(n=o,i=r)}var s=i;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==i);var a=i;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==i);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var h=st.computeOrientation(u,n,l);return 0===h?u.x>l.x:h>0},st.locatePointInRing=function(t,e){return ot.locatePointInRing(t,e)},st.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)},st.computeOrientation=function(t,e,n){return st.orientationIndex(t,e,n)},st.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new y("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},st.isOnLine=function(t,e){for(var n=new it,i=1;i0},_t.prototype.interfaces_=function(){return[ft]},_t.prototype.getClass=function(){return _t};var yt=function(){};yt.prototype.isInBoundary=function(t){return t>1},yt.prototype.interfaces_=function(){return[ft]},yt.prototype.getClass=function(){return yt};var mt=function(){};mt.prototype.isInBoundary=function(t){return 1===t},mt.prototype.interfaces_=function(){return[ft]},mt.prototype.getClass=function(){return mt};var vt=function(){};vt.prototype.add=function(){},vt.prototype.addAll=function(){},vt.prototype.isEmpty=function(){},vt.prototype.iterator=function(){},vt.prototype.size=function(){},vt.prototype.toArray=function(){},vt.prototype.remove=function(){};var It=function(t){function e(e){t.call(this),this.message=e||""}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={name:{configurable:!0}};return n.name.get=function(){return"IndexOutOfBoundsException"},Object.defineProperties(e,n),e}(Error),Et=function(){};Et.prototype.hasNext=function(){},Et.prototype.next=function(){},Et.prototype.remove=function(){};var Lt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(vt);(n.prototype=new Error).name="NoSuchElementException";var xt=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof vt&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,vt]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new Nt(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new It;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e=1&&this.get(this.size()-1).equals2D(r))return null;t.prototype.add.call(this,r)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1];return this.add(o,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var a=arguments[0],u=arguments[1];if(arguments[2])for(var l=0;l=0;h--)this.add(a[h],u);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof x){var c=arguments[0],p=arguments[1];if(!arguments[2]){var f=this.size();if(f>0){if(c>0&&this.get(c-1).equals2D(p))return null;if(cy&&(m=-1);for(var v=_;v!==y;v+=m)this.add(g[v],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new x(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(xt),Ct=function(){},St={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};St.ForwardComparator.get=function(){return wt},St.BidirectionalComparator.get=function(){return Mt},St.coordArrayType.get=function(){return new Array(0).fill(null)},Ct.prototype.interfaces_=function(){return[]},Ct.prototype.getClass=function(){return Ct},Ct.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},Ct.ptNotInList=function(t,e){for(var n=0;n=t?e:[]},Ct.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e},Ct.extract=function(t,e,n){e=O.clamp(e,0,t.length);var i=(n=O.clamp(n,-1,t.length))-e+1;n<0&&(i=0),e>=t.length&&(i=0),ni.length)return 1;if(0===n.length)return 0;var r=Ct.compare(n,i);return Ct.isEqualReversed(n,i)?0:r},Mt.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.lengthi.length)return 1;if(0===n.length)return 0;for(var r=Ct.increasingDirection(n),o=Ct.increasingDirection(i),s=r>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u0))return e.value;e=e.right}}return null},h.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:Dt,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 o=r.value;return r.value=e,o}r=r.right}}while(null!==r);var s={key:t,left:null,right:null,value:e,parent:n,color:Dt,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},h.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(s(t)===u(s(s(t)))){var e=l(s(s(t)));1===o(e)?(a(s(t),Dt),a(e,Dt),a(s(s(t)),1),t=s(s(t))):(t===l(s(t))&&(t=s(t),this.rotateLeft(t)),a(s(t),Dt),a(s(s(t)),1),this.rotateRight(s(s(t))))}else{var n=u(s(s(t)));1===o(n)?(a(s(t),Dt),a(n,Dt),a(s(s(t)),1),t=s(s(t))):(t===u(s(t))&&(t=s(t),this.rotateRight(t)),a(s(t),Dt),a(s(s(t)),1),this.rotateLeft(s(s(t))))}this.root_.color=Dt},h.prototype.values=function(){var t=new xt,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=h.successor(e));)t.add(e.value);return t},h.prototype.entrySet=function(){var t=new Tt,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=h.successor(e));)t.add(e);return t},h.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}},h.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}},h.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},h.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}for(var n=t.parent,i=t;null!==n&&i===n.right;)i=n,n=n.parent;return n},h.prototype.size=function(){return this.size_};var At=function(){};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},c.prototype=new r,(p.prototype=new c).contains=function(t){for(var e=0,n=this.array_.length;e=0;){var s=r.substring(0,o);i.add(s),o=(r=r.substring(o+n)).indexOf(e)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),u=0;u0)for(var o=r;o0&&i.append(" ");for(var o=0;o0&&i.append(","),i.append(Yt.toString(t.getOrdinate(r,o)))}return i.append(")"),i.toString()}},Wt.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Wt.createClosedRing(t,e,4):e.getOrdinate(0,B.X)===e.getOrdinate(n-1,B.X)&&e.getOrdinate(0,B.Y)===e.getOrdinate(n-1,B.Y)?e:Wt.createClosedRing(t,e,n+1)},Wt.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();Wt.copy(e,0,i,0,r);for(var o=r;o0&&Wt.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Gt.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return st.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Wt.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(Jt),ne=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return lt.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n0?e.createPoint(n[0]):e.createPoint():t},se.prototype.interfaces_=function(){return[ie.GeometryEditorOperation]},se.prototype.getClass=function(){return se};var ae=function(){};ae.prototype.edit=function(t,e){return t instanceof ee?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Jt?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Zt?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},ae.prototype.interfaces_=function(){return[ie.GeometryEditorOperation]},ae.prototype.getClass=function(){return ae};var ue=function(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var e=0;e0){var t=new T(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(i=3),i<2?new ue(n):new ue(n,i)}},he.prototype.interfaces_=function(){return[C,e]},he.prototype.getClass=function(){return he},he.instance=function(){return he.instanceObject},ce.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},ce.instanceObject.get=function(){return new he},Object.defineProperties(he,ce);var pe=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new xt,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new Tt;return this.map_.entries().forEach(function(e){return t.add(e)}),t},e.prototype.size=function(){return this.map_.size()},e}(Ot),fe=function qr(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=qr.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof de){var t=arguments[0];this._modelType=t,t===qr.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var e=arguments[0];this._modelType=qr.FIXED,this.setScale(e)}else if(arguments[0]instanceof qr){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},ge={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};fe.prototype.equals=function(t){if(!(t instanceof fe))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},fe.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new R(n).compareTo(new R(i))},fe.prototype.getScale=function(){return this._scale},fe.prototype.isFloating=function(){return this._modelType===fe.FLOATING||this._modelType===fe.FLOATING_SINGLE},fe.prototype.getType=function(){return this._modelType},fe.prototype.toString=function(){var t="UNKNOWN";return this._modelType===fe.FLOATING?t="Floating":this._modelType===fe.FLOATING_SINGLE?t="Floating-Single":this._modelType===fe.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},fe.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return m.isNaN(t)?t:this._modelType===fe.FLOATING_SINGLE?t:this._modelType===fe.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof x){var e=arguments[0];if(this._modelType===fe.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},fe.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===fe.FLOATING?t=16:this._modelType===fe.FLOATING_SINGLE?t=6:this._modelType===fe.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},fe.prototype.setScale=function(t){this._scale=Math.abs(t)},fe.prototype.interfaces_=function(){return[e,I]},fe.prototype.getClass=function(){return fe},fe.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},ge.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},ge.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(fe,ge);var de=function Ur(t){this._name=t||null,Ur.nameToTypeMap.put(t,this)},_e={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};de.prototype.readResolve=function(){return de.nameToTypeMap.get(this._name)},de.prototype.toString=function(){return this._name},de.prototype.interfaces_=function(){return[e]},de.prototype.getClass=function(){return de},_e.serialVersionUID.get=function(){return-552860263173159e4},_e.nameToTypeMap.get=function(){return new pe},Object.defineProperties(de,_e),fe.Type=de,fe.FIXED=new de("FIXED"),fe.FLOATING=new de("FLOATING"),fe.FLOATING_SINGLE=new de("FLOATING SINGLE");var ye=function Vr(){this._precisionModel=new fe,this._SRID=0,this._coordinateSequenceFactory=Vr.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?M(arguments[0],C)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof fe&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},me={serialVersionUID:{configurable:!0}};ye.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new x(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new x(t.getMinX(),t.getMinY()),new x(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new x(t.getMinX(),t.getMinY()),new x(t.getMinX(),t.getMaxY()),new x(t.getMaxX(),t.getMaxY()),new x(t.getMaxX(),t.getMinY()),new x(t.getMinX(),t.getMinY())]),null)},ye.prototype.createLineString=function(t){return t?t instanceof Array?new Jt(this.getCoordinateSequenceFactory().create(t),this):M(t,B)?new Jt(t,this):void 0:new Jt(this.getCoordinateSequenceFactory().create([]),this)},ye.prototype.createMultiLineString=function(){if(0===arguments.length)return new zt(null,this);if(1===arguments.length){var t=arguments[0];return new zt(t,this)}},ye.prototype.buildGeometry=function(t){for(var e=null,n=!1,i=!1,r=t.iterator();r.hasNext();){var o=r.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(i=!0)}if(null===e)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(ye.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof $t)return this.createMultiPolygon(ye.toPolygonArray(t));if(a instanceof Jt)return this.createMultiLineString(ye.toLineStringArray(t));if(a instanceof Zt)return this.createMultiPoint(ye.toPointArray(t));tt.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},ye.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},ye.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof x){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(M(arguments[0],B)){var e=arguments[0];return new Zt(e,this)}}},ye.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ye.prototype.createPolygon=function(){if(0===arguments.length)return new $t(null,null,this);if(1===arguments.length){if(M(arguments[0],B)){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 ee){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];return new $t(i,r,this)}},ye.prototype.getSRID=function(){return this._SRID},ye.prototype.createGeometryCollection=function(){if(0===arguments.length)return new Vt(null,this);if(1===arguments.length){var t=arguments[0];return new Vt(t,this)}},ye.prototype.createGeometry=function(t){return new ie(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},ye.prototype.getPrecisionModel=function(){return this._precisionModel},ye.prototype.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(M(arguments[0],B)){var e=arguments[0];return new ee(e,this)}}},ye.prototype.createMultiPolygon=function(){if(0===arguments.length)return new ne(null,this);if(1===arguments.length){var t=arguments[0];return new ne(t,this)}},ye.prototype.createMultiPoint=function(){if(0===arguments.length)return new te(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new te(t,this)}if(arguments[0]instanceof Array){var e=arguments[0];return this.createMultiPoint(null!==e?this.getCoordinateSequenceFactory().create(e):null)}if(M(arguments[0],B)){var n=arguments[0];if(null===n)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(n.size()).fill(null),r=0;r=this.size())throw new Error;return this.array_[t]},d.prototype.push=function(t){return this.array_.push(t),t},d.prototype.pop=function(t){if(0===this.array_.length)throw new g;return this.array_.pop()},d.prototype.peek=function(){if(0===this.array_.length)throw new g;return this.array_[this.array_.length-1]},d.prototype.empty=function(){return 0===this.array_.length},d.prototype.isEmpty=function(){return this.empty()},d.prototype.search=function(t){return this.array_.indexOf(t)},d.prototype.size=function(){return this.array_.length},d.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===st.CLOCKWISE&&(r=!0),r&&(this._minIndex=this._minIndex-1)},Se.prototype.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=be.LEFT;return n[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},Se.prototype.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)},Se.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}tt.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)===be.LEFT&&(this._orientedDe=this._minDe.getSym())},Se.prototype.interfaces_=function(){return[]},Se.prototype.getClass=function(){return Se};var we=function(t){function e(n,i){t.call(this,e.msgWithCoord(n,i)),this.pt=i?new x(i):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(Q),Me=function(){this.array_=[]};Me.prototype.addLast=function(t){this.array_.push(t)},Me.prototype.removeFirst=function(){return this.array_.shift()},Me.prototype.isEmpty=function(){return 0===this.array_.length};var Oe=function(){this._finder=null,this._dirEdgeList=new xt,this._nodes=new xt,this._rightMostCoord=null,this._env=null,this._finder=new Se};Oe.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Oe.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Oe.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){e=i;break}}if(null===e)throw new we("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var r=t.getEdges().iterator();r.hasNext();){var o=r.next();o.setVisited(!0),this.copySymDepths(o)}},Oe.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(be.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Oe.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Oe.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(be.RIGHT)>=1&&e.getDepth(be.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Oe.prototype.computeDepths=function(t){var e=new Tt,n=new Me,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 o=r.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},Oe.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},Oe.prototype.getEnvelope=function(){if(null===this._env){for(var t=new X,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;ithis.location.length){var e=new Array(3).fill(null);e[be.ON]=this.location[be.ON],e[be.LEFT]=S.NONE,e[be.RIGHT]=S.NONE,this.location=e}for(var n=0;n1&&t.append(S.toLocationSymbol(this.location[be.LEFT])),t.append(S.toLocationSymbol(this.location[be.ON])),this.location.length>1&&t.append(S.toLocationSymbol(this.location[be.RIGHT])),t.toString()},Pe.prototype.setLocations=function(t,e,n){this.location[be.ON]=t,this.location[be.LEFT]=e,this.location[be.RIGHT]=n},Pe.prototype.get=function(t){return t1},Pe.prototype.isAnyNull=function(){for(var t=0;tthis._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},Re.prototype.addPoints=function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var o=r;o=0;a--)this._pts.add(i[a])}},Re.prototype.isHole=function(){return this._isHole},Re.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},Re.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!st.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},Re.prototype.addHole=function(t){this._holes.add(t)},Re.prototype.isShell=function(){return null===this._shell},Re.prototype.getLabel=function(){return this._label},Re.prototype.getEdges=function(){return this._edges},Re.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Re.prototype.getShell=function(){return this._shell},Re.prototype.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,be.RIGHT);if(i===S.NONE)return null;if(this._label.getLocation(n)===S.NONE)return this._label.setLocation(n,i),null}},Re.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},Re.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n=2,"found partial label"),this.computeIM(t)},ke.prototype.isInResult=function(){return this._isInResult},ke.prototype.isVisited=function(){return this._isVisited},ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke};var Fe=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new Te(0,S.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=S.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var i=t.getLocation(e);n!==S.BOUNDARY&&(n=i)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new Te(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){if(arguments[0]instanceof e){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof Te)for(var n=arguments[0],i=0;i<2;i++){var r=this.computeMergedLocation(n,i);this._label.getLocation(i)===S.NONE&&this._label.setLocation(i,r)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=S.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case S.BOUNDARY:n=S.INTERIOR;break;case S.INTERIOR:default:n=S.BOUNDARY}this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ke),Ge=function(){this.nodeMap=new h,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Ge.prototype.find=function(t){return this.nodeMap.get(t)},Ge.prototype.addNode=function(){if(arguments[0]instanceof x){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof Fe){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return null===i?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}},Ge.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},Ge.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ge.prototype.values=function(){return this.nodeMap.values()},Ge.prototype.getBoundaryNodes=function(t){for(var e=new xt,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===S.BOUNDARY&&e.add(i)}return e},Ge.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge};var Be=function(){},qe={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.isNorthern=function(t){return t===Be.NE||t===Be.NW},Be.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},Be.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=te?t:e)?3:n},Be.isInHalfPlane=function(t,e){return e===Be.SE?t===Be.SE||t===Be.SW:t===e||t===e+1},Be.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 y("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?Be.NE:Be.SE:e>=0?Be.NW:Be.SW}if(arguments[0]instanceof x&&arguments[1]instanceof x){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new y("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?Be.NE:Be.SE:i.y>=n.y?Be.NW:Be.SW}},qe.NE.get=function(){return 0},qe.NW.get=function(){return 1},qe.SW.get=function(){return 2},qe.SE.get=function(){return 3},Object.defineProperties(Be,qe);var Ue=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,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];this._edge=e,this.init(n,i),this._label=null}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=r,this.init(o,s),this._label=a}};Ue.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else i.add(o)}return i},Xe.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Xe.prototype.buildMaximalEdgeRings=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()){var r=new Ae(i,this._geometryFactory);e.add(r),r.setInResult()}}return e},Xe.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}},Xe.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Xe.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(i)&&st.isPointInRing(r,l.getCoordinates())&&(c=!0),c&&(null===o||s.contains(h))&&(o=u)}return o},Xe.prototype.findShell=function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,e++)}return tt.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},Xe.prototype.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];je.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),r=new xt,o=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(o,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},Xe.prototype.interfaces_=function(){return[]},Xe.prototype.getClass=function(){return Xe};var Ye=function(){};Ye.prototype.getBounds=function(){},Ye.prototype.interfaces_=function(){return[]},Ye.prototype.getClass=function(){return Ye};var He=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};He.prototype.getItem=function(){return this._item},He.prototype.getBounds=function(){return this._bounds},He.prototype.interfaces_=function(){return[Ye,e]},He.prototype.getClass=function(){return He};var We=function(){this._size=null,this._items=null,this._size=0,this._items=new xt,this._items.add(null)};We.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},We.prototype.size=function(){return this._size},We.prototype.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)},We.prototype.clear=function(){this._size=0,this._items.clear()},We.prototype.isEmpty=function(){return 0===this._size},We.prototype.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)},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We};var Je=function(){};Je.prototype.visitItem=function(t){},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je};var Ke=function(){};Ke.prototype.insert=function(t,e){},Ke.prototype.remove=function(t,e){},Ke.prototype.query=function(){},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke};var Ze=function(){if(this._childBoundables=new xt,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},Qe={serialVersionUID:{configurable:!0}};Ze.prototype.getLevel=function(){return this._level},Ze.prototype.size=function(){return this._childBoundables.size()},Ze.prototype.getChildBoundables=function(){return this._childBoundables},Ze.prototype.addChildBoundable=function(t){tt.isTrue(null===this._bounds),this._childBoundables.add(t)},Ze.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ze.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ze.prototype.interfaces_=function(){return[Ye,e]},Ze.prototype.getClass=function(){return Ze},Qe.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ze,Qe);var $e=function(){};$e.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},$e.min=function(t){return $e.sort(t),t.get(0)},$e.sort=function(t,e){var n=t.toArray();e?Ft.sort(n,e):Ft.sort(n);for(var i=t.iterator(),r=0,o=n.length;rtn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new y("neither boundable is composite")},tn.prototype.isLeaves=function(){return!(tn.isComposite(this._boundable1)||tn.isComposite(this._boundable2))},tn.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0},tn.prototype.expand=function(t,e,n,i){for(var r=t.getChildBoundables().iterator();r.hasNext();){var o=r.next(),s=new tn(o,e,this._itemDistance);s.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=e}},nn={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};en.prototype.getNodeCapacity=function(){return this._nodeCapacity},en.prototype.lastNode=function(t){return t.get(t.size()-1)},en.prototype.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 Ze?t+=this.size(n):n instanceof He&&(t+=1)}return t}},en.prototype.removeItem=function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof He&&r.getItem()===e&&(n=r)}return null!==n&&(t.getChildBoundables().remove(n),!0)},en.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new xt:t}if(1===arguments.length){for(var e=arguments[0],n=new xt,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();if(r instanceof Ze){var o=this.itemsTree(r);null!==o&&n.add(o)}else r instanceof He?n.add(r.getItem()):tt.shouldNeverReachHere()}return n.size()<=0?null:n}},en.prototype.insert=function(t,e){tt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new He(t,e))},en.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new xt;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(tt.isTrue(n>-2),i.getLevel()===n)return r.add(i),null;for(var o=i.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof Ze?this.boundablesAtLevel(n,s,r):(tt.isTrue(s instanceof He),-1===n&&r.add(s))}return null}},en.prototype.query=function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new xt;return this.isEmpty()?e:(this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(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.query(n,this._root,i)}else if(3===arguments.length)if(M(arguments[2],Je)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze)for(var r=arguments[0],o=arguments[1],s=arguments[2],a=o.getChildBoundables(),u=0;ut&&(t=i)}}return t+1}},en.prototype.createParentBoundables=function(t,e){tt.isTrue(!t.isEmpty());var n=new xt;n.add(this.createNode(e));var i=new xt(t);$e.sort(i,this.getComparator());for(var r=i.iterator();r.hasNext();){var o=r.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n},en.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},en.prototype.interfaces_=function(){return[e]},en.prototype.getClass=function(){return en},en.compareDoubles=function(t,e){return t>e?1:t0);for(var n=new xt,i=0;i0;){var c=h.poll(),p=c.getDistance();if(p>=u)break;c.isLeaves()?(u=p,l=c):c.expandToQueue(h,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],_=new He(f,g),y=new tn(this.getRoot(),_,d);return this.nearestNeighbour(y)[0]}},n.prototype.interfaces_=function(){return[Ke,e]},n.prototype.getClass=function(){return n},n.centreX=function(t){return n.avg(t.getMinX(),t.getMaxX())},n.avg=function(t,e){return(t+e)/2},n.centreY=function(t){return n.avg(t.getMinY(),t.getMaxY())},i.STRtreeNode.get=function(){return an},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[L]},compare:function(e,i){return t.compareDoubles(n.centreX(e.getBounds()),n.centreX(i.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[L]},compare:function(e,i){return t.compareDoubles(n.centreY(e.getBounds()),n.centreY(i.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,i),n}(en),an=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new X(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ze),un=function(){};un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un},un.relativeSign=function(t,e){return te?1:0},un.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=un.relativeSign(e.x,n.x),r=un.relativeSign(e.y,n.y);switch(t){case 0:return un.compareValue(i,r);case 1:return un.compareValue(r,i);case 2:return un.compareValue(r,-i);case 3:return un.compareValue(-i,r);case 4:return un.compareValue(-i,-r);case 5:return un.compareValue(-r,-i);case 6:return un.compareValue(-r,i);case 7:return un.compareValue(i,-r)}return tt.shouldNeverReachHere("invalid octant value"),0},un.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var ln=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new x(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))};ln.prototype.getCoordinate=function(){return this.coord},ln.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},ln.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:un.compare(this._segmentOctant,this.coord,e.coord)},ln.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},ln.prototype.isInterior=function(){return this._isInterior},ln.prototype.interfaces_=function(){return[I]},ln.prototype.getClass=function(){return ln};var hn=function(){this._nodeMap=new h,this._edge=null;var t=arguments[0];this._edge=t};hn.prototype.getSplitCoordinates=function(){var t=new bt;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()},hn.prototype.addCollapsedNodes=function(){var t=new xt;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)}},hn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},hn.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}if(arguments[0]instanceof x&&arguments[1]instanceof x){var r=arguments[0],o=arguments[1],s=o.x-r.x,a=o.y-r.y;if(0===s&&0===a)throw new y("Cannot compute the octant for two identical points "+r);return cn.octant(s,a)}};var pn=function(){};pn.prototype.getCoordinates=function(){},pn.prototype.size=function(){},pn.prototype.getCoordinate=function(t){},pn.prototype.isClosed=function(){},pn.prototype.setData=function(t){},pn.prototype.getData=function(){},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn};var fn=function(){};fn.prototype.addIntersection=function(t,e){},fn.prototype.interfaces_=function(){return[pn]},fn.prototype.getClass=function(){return fn};var gn=function(){this._nodeList=new hn(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};gn.prototype.getCoordinates=function(){return this._pts},gn.prototype.size=function(){return this._pts.length},gn.prototype.getCoordinate=function(t){return this._pts[t]},gn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},gn.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},gn.prototype.setData=function(t){this._data=t},gn.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:cn.octant(t,e)},gn.prototype.getData=function(){return this._data},gn.prototype.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[3],o=new x(n.getIntersection(r));this.addIntersection(o,i)}},gn.prototype.toString=function(){return Z.toLineString(new ue(this._pts))},gn.prototype.getNodeList=function(){return this._nodeList},gn.prototype.addIntersectionNode=function(t,e){var n=e,i=n+1;if(i=0&&n>=0?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof x){var i=arguments[0];return st.orientationIndex(this.p0,this.p1,i)}},dn.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},dn.prototype.isVertical=function(){return this.p0.x===this.p1.x},dn.prototype.equals=function(t){if(!(t instanceof dn))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},dn.prototype.intersection=function(t){var e=new it;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},dn.prototype.project=function(){if(arguments[0]instanceof x){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new x(t);var e=this.projectionFactor(t),n=new x;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 dn){var i=arguments[0],r=this.projectionFactor(i.p0),o=this.projectionFactor(i.p1);if(r>=1&&o>=1)return null;if(r<=0&&o<=0)return null;var s=this.project(i.p0);r<0&&(s=this.p0),r>1&&(s=this.p1);var a=this.project(i.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new dn(s,a)}},dn.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},dn.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},dn.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},dn.prototype.distancePerpendicular=function(t){return st.distancePointLinePerpendicular(t,this.p0,this.p1)},dn.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},dn.prototype.midPoint=function(){return dn.midPoint(this.p0,this.p1)},dn.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;return i<=0?m.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i},dn.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),i=m.MAX_VALUE,r=null,o=this.closestPoint(t.p0);i=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(r=s.distance(t.p1))0&&e<1?this.project(t):this.p0.distance(t)1||m.isNaN(e))&&(e=1),e},dn.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},dn.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},dn.prototype.distance=function(){if(arguments[0]instanceof dn){var t=arguments[0];return st.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof x){var e=arguments[0];return st.distancePointLine(e,this.p0,this.p1)}},dn.prototype.pointAlong=function(t){var e=new x;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},dn.prototype.hashCode=function(){var t=m.doubleToLongBits(this.p0.x);t^=31*m.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=m.doubleToLongBits(this.p1.x);return n^=31*m.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},dn.prototype.interfaces_=function(){return[I,e]},dn.prototype.getClass=function(){return dn},dn.midPoint=function(t,e){return new x((t.x+e.x)/2,(t.y+e.y)/2)},_n.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(dn,_n);var yn=function(){this.tempEnv1=new X,this.tempEnv2=new X,this._overlapSeg1=new dn,this._overlapSeg2=new dn};yn.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)}},yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn};var mn=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i};mn.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},mn.prototype.computeSelect=function(t,e,n,i){var r=this._pts[e],o=this._pts[n];if(i.tempEnv1.init(r,o),n-e==1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var s=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var i=Be.quadrant(t[n],t[n+1]),r=e+1;rn.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return xn},Object.defineProperties(e,n),e}(En),xn=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[0],n=arguments[1],i=arguments[2],r=arguments[3],o=e.getContext(),s=i.getContext();this._si.processIntersections(o,n,s,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yn),Nn=function Yr(){if(this._quadrantSegments=Yr.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=Yr.CAP_ROUND,this._joinStyle=Yr.JOIN_ROUND,this._mitreLimit=Yr.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=Yr.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],o=arguments[2],s=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(r),this.setJoinStyle(o),this.setMitreLimit(s)}},bn={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Nn.prototype.getEndCapStyle=function(){return this._endCapStyle},Nn.prototype.isSingleSided=function(){return this._isSingleSided},Nn.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Nn.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Nn.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Nn.JOIN_ROUND&&(this._quadrantSegments=Nn.DEFAULT_QUADRANT_SEGMENTS)},Nn.prototype.getJoinStyle=function(){return this._joinStyle},Nn.prototype.setJoinStyle=function(t){this._joinStyle=t},Nn.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Nn.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Nn.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Nn.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Nn.prototype.getMitreLimit=function(){return this._mitreLimit},Nn.prototype.setMitreLimit=function(t){this._mitreLimit=t},Nn.prototype.setSingleSided=function(t){this._isSingleSided=t},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},Nn.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},bn.CAP_ROUND.get=function(){return 1},bn.CAP_FLAT.get=function(){return 2},bn.CAP_SQUARE.get=function(){return 3},bn.JOIN_ROUND.get=function(){return 1},bn.JOIN_MITRE.get=function(){return 2},bn.JOIN_BEVEL.get=function(){return 3},bn.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},bn.DEFAULT_MITRE_LIMIT.get=function(){return 5},bn.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Nn,bn);var Cn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=st.COUNTERCLOCKWISE,this._inputLine=t||null},Sn={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Cn.prototype.isDeletable=function(t,e,n,i){var r=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(r,o,s)&&!!this.isShallow(r,o,s,i)&&this.isShallowSampled(r,o,t,n,i)},Cn.prototype.deleteShallowConcavities=function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),i=!1;n=0;i--)this.addPt(t[i])},wn.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)Math.PI;)t-=On.PI_TIMES_2;for(;t<=-Math.PI;)t+=On.PI_TIMES_2;return t},On.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)}},On.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},On.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},On.interiorAngle=function(t,e,n){var i=On.angle(e,t),r=On.angle(e,n);return Math.abs(r-i)},On.normalizePositive=function(t){if(t<0){for(;t<0;)t+=On.PI_TIMES_2;t>=On.PI_TIMES_2&&(t=0)}else{for(;t>=On.PI_TIMES_2;)t-=On.PI_TIMES_2;t<0&&(t=0)}return t},On.angleBetween=function(t,e,n){var i=On.angle(e,t),r=On.angle(e,n);return On.diff(i,r)},On.diff=function(t,e){var n=null;return(n=tMath.PI&&(n=2*Math.PI-n),n},On.toRadians=function(t){return t*Math.PI/180},On.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?On.COUNTERCLOCKWISE:n<0?On.CLOCKWISE:On.NONE},On.angleBetweenOriented=function(t,e,n){var i=On.angle(e,t),r=On.angle(e,n)-i;return r<=-Math.PI?r+On.PI_TIMES_2:r>Math.PI?r-On.PI_TIMES_2:r},Pn.PI_TIMES_2.get=function(){return 2*Math.PI},Pn.PI_OVER_2.get=function(){return Math.PI/2},Pn.PI_OVER_4.get=function(){return Math.PI/4},Pn.COUNTERCLOCKWISE.get=function(){return st.COUNTERCLOCKWISE},Pn.CLOCKWISE.get=function(){return st.CLOCKWISE},Pn.NONE.get=function(){return st.COLLINEAR},Object.defineProperties(On,Pn);var Tn=function Hr(){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 dn,this._seg1=new dn,this._offset0=new dn,this._offset1=new dn,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 it,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===Nn.JOIN_ROUND&&(this._closingSegLengthFactor=Hr.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},Rn={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Tn.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=st.computeOrientation(this._s0,this._s1,this._s2),i=n===st.CLOCKWISE&&this._side===be.LEFT||n===st.COUNTERCLOCKWISE&&this._side===be.RIGHT;0===n?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Tn.prototype.addLineEndCap=function(t,e){var n=new dn(t,e),i=new dn;this.computeOffsetSegment(n,be.LEFT,this._distance,i);var r=new dn;this.computeOffsetSegment(n,be.RIGHT,this._distance,r);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,st.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Nn.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case Nn.CAP_SQUARE:var u=new x;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new x(i.p1.x+u.x,i.p1.y+u.y),h=new x(r.p1.x+u.x,r.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(h)}},Tn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Tn.prototype.addMitreJoin=function(t,e,n,i){var r=!0,o=null;try{o=j.intersection(e.p0,e.p1,n.p0,n.p1),(i<=0?1:o.distance(t)/Math.abs(i))>this._bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof V))throw t;o=new x(0,0),r=!1}r?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},Tn.prototype.addFilletCorner=function(t,e,n,i,r){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,h=Math.atan2(l,u);i===st.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,i,r),this._segList.addPt(n)},Tn.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var n=new x((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 x((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)}},Tn.prototype.createCircle=function(t){var e=new x(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Tn.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Tn.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new wn,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Tn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Tn.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Nn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Nn.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,st.CLOCKWISE,this._distance))},Tn.prototype.closeRing=function(){this._segList.closeRing()},Tn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Rn.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Rn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Rn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Rn.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Tn,Rn);var Dn=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Dn.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 o=r.getCoordinates();return n&&Ct.reverse(o),o},Dn.prototype.computeSingleSidedBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var r=Cn.simplify(t,-i),o=r.length-1;n.initSideSegments(r[o],r[o-1],be.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(r[s],!0)}else{n.addSegments(t,!1);var a=Cn.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],be.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},Dn.prototype.computeRingBufferCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);e===be.RIGHT&&(i=-i);var r=Cn.simplify(t,i),o=r.length-1;n.initSideSegments(r[o-1],r[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(r[s],a)}n.closeRing()},Dn.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),i=Cn.simplify(t,n),r=i.length-1;e.initSideSegments(i[0],i[1],be.LEFT);for(var o=2;o<=r;o++)e.addNextSegment(i[o],!0);e.addLastSegment(),e.addLineEndCap(i[r-1],i[r]);var s=Cn.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],be.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Dn.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Nn.CAP_ROUND:e.createCircle(t);break;case Nn.CAP_SQUARE:e.createSquare(t)}},Dn.prototype.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()},Dn.prototype.getBufferParameters=function(){return this._bufParams},Dn.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Dn.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Dn.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()},Dn.prototype.computeOffsetCurve=function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var r=Cn.simplify(t,-i),o=r.length-1;n.initSideSegments(r[o],r[o-1],be.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(r[s],!0)}else{var a=Cn.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],be.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},Dn.prototype.getSegGen=function(t){return new Tn(this._precisionModel,this._bufParams,t)},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},Dn.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;nr.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(M(arguments[2],Lt)&&arguments[0]instanceof x&&arguments[1]instanceof Ve){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getEdge().getCoordinates(),l=0;lthis._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y||st.computeOrientation(this._seg.p0,this._seg.p1,o)===st.RIGHT)){var h=s.getDepth(be.LEFT);this._seg.p0.equals(u[l])||(h=s.getDepth(be.RIGHT));var c=new Fn(this._seg,h);a.add(c)}}else if(M(arguments[2],Lt)&&arguments[0]instanceof x&&M(arguments[1],Lt))for(var p=arguments[0],f=arguments[1],g=arguments[2],d=f.iterator();d.hasNext();){var _=d.next();_.isForward()&&this.findStabbedSegments(p,_,g)}},An.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:$e.min(e)._leftDepth},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},kn.DepthSegment.get=function(){return Fn},Object.defineProperties(An,kn);var Fn=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new dn(t),this._leftDepth=e};Fn.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)},Fn.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},Fn.prototype.toString=function(){return this._upwardSeg.toString()},Fn.prototype.interfaces_=function(){return[I]},Fn.prototype.getClass=function(){return Fn};var Gn=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Gn.prototype.area=function(){return Gn.area(this.p0,this.p1,this.p2)},Gn.prototype.signedArea=function(){return Gn.signedArea(this.p0,this.p1,this.p2)},Gn.prototype.interpolateZ=function(t){if(null===t)throw new y("Supplied point is null.");return Gn.interpolateZ(t,this.p0,this.p1,this.p2)},Gn.prototype.longestSideLength=function(){return Gn.longestSideLength(this.p0,this.p1,this.p2)},Gn.prototype.isAcute=function(){return Gn.isAcute(this.p0,this.p1,this.p2)},Gn.prototype.circumcentre=function(){return Gn.circumcentre(this.p0,this.p1,this.p2)},Gn.prototype.area3D=function(){return Gn.area3D(this.p0,this.p1,this.p2)},Gn.prototype.centroid=function(){return Gn.centroid(this.p0,this.p1,this.p2)},Gn.prototype.inCentre=function(){return Gn.inCentre(this.p0,this.p1,this.p2)},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.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)},Gn.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Gn.det=function(t,e,n,i){return t*i-e*n},Gn.interpolateZ=function(t,e,n,i){var r=e.x,o=e.y,s=n.x-r,a=i.x-r,u=n.y-o,l=i.y-o,h=s*l-a*u,c=t.x-r,p=t.y-o,f=(l*c-a*p)/h,g=(-u*c+s*p)/h;return e.z+f*(n.z-e.z)+g*(i.z-e.z)},Gn.longestSideLength=function(t,e,n){var i=t.distance(e),r=e.distance(n),o=n.distance(t),s=i;return r>s&&(s=r),o>s&&(s=o),s},Gn.isAcute=function(t,e,n){return!!On.isAcute(t,e,n)&&!!On.isAcute(e,n,t)&&!!On.isAcute(n,t,e)},Gn.circumcentre=function(t,e,n){var i=n.x,r=n.y,o=t.x-i,s=t.y-r,a=e.x-i,u=e.y-r,l=2*Gn.det(o,s,a,u),h=Gn.det(s,o*o+s*s,u,a*a+u*u),c=Gn.det(o,o*o+s*s,a,a*a+u*u);return new x(i-h/l,r+c/l)},Gn.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y,r=new j(t.x+n/2,t.y+i/2,1),o=new j(t.x-i+n/2,t.y+n+i/2,1);return new j(r,o)},Gn.angleBisector=function(t,e,n){var i=e.distance(t),r=i/(i+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new x(t.x+r*o,t.y+r*s)},Gn.area3D=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=r*u-o*a,h=o*s-i*u,c=i*a-r*s,p=l*l+h*h+c*c;return Math.sqrt(p)/2},Gn.centroid=function(t,e,n){var i=(t.x+e.x+n.x)/3,r=(t.y+e.y+n.y)/3;return new x(i,r)},Gn.inCentre=function(t,e,n){var i=e.distance(n),r=t.distance(n),o=t.distance(e),s=i+r+o,a=(i*t.x+r*e.x+o*n.x)/s,u=(i*t.y+r*e.y+o*n.y)/s;return new x(a,u)};var Bn=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new xt;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Bn.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,S.EXTERIOR,S.INTERIOR)},Bn.prototype.addPolygon=function(t){var e=this._distance,n=be.LEFT;this._distance<0&&(e=-this._distance,n=be.RIGHT);var i=t.getExteriorRing(),r=Ct.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,S.EXTERIOR,S.INTERIOR);for(var o=0;o0&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,be.opposite(n),S.INTERIOR,S.EXTERIOR)}},Bn.prototype.isTriangleErodedCompletely=function(t,e){var n=new Gn(t[0],t[1],t[2]),i=n.inCentre();return st.distancePointLine(i,n.p0,n.p1)=ee.MINIMUM_VALID_SIZE&&st.isCCW(t)&&(o=r,s=i,n=be.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Bn.prototype.add=function(t){if(t.isEmpty())return null;t instanceof $t?this.addPolygon(t):t instanceof Jt?this.addLineString(t):t instanceof Zt?this.addPoint(t):t instanceof te?this.addCollection(t):t instanceof zt?this.addCollection(t):t instanceof ne?this.addCollection(t):t instanceof Vt&&this.addCollection(t)},Bn.prototype.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},Bn.prototype.addCollection=function(t){for(var e=0;e=this._max)throw new n;var t=this._parent.getGeometryN(this._index++);return t instanceof Vt?(this._subcollectionIterator=new Un(t),this._subcollectionIterator.next()):t},Un.prototype.remove=function(){throw new Error(this.getClass().getName())},Un.prototype.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)},Un.prototype.interfaces_=function(){return[Et]},Un.prototype.getClass=function(){return Un},Un.isAtomic=function(t){return!(t instanceof Vt)};var Vn=function(){this._geom=null;var t=arguments[0];this._geom=t};Vn.prototype.locate=function(t){return Vn.locate(t,this._geom)},Vn.prototype.interfaces_=function(){return[qn]},Vn.prototype.getClass=function(){return Vn},Vn.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&st.isPointInRing(t,e.getCoordinates())},Vn.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Vn.isPointInRing(t,n))return!1;for(var i=0;i=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)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(be.LEFT),i=t.getDepth(be.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,r)!==i)throw new we("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=o;u=0;r--){var o=this._resultAreaEdgeList.get(r),s=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),i){case this._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,i=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(o.getEdgeRing()!==t)continue;n.setNextMin(o),i=this._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(tt.isTrue(null!==e,"found null for first outgoing dirEdge"),tt.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},e.prototype.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){for(var n=arguments[0],i=0,r=this.iterator();r.hasNext();)r.next().getEdgeRing()===n&&i++;return i}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=S.NONE,e=this.iterator();e.hasNext();){var n=e.next(),i=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=S.INTERIOR;break}if(i.isInResult()){t=S.EXTERIOR;break}}}if(t===S.NONE)return null;for(var r=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(r===S.INTERIOR):(s.isInResult()&&(r=S.EXTERIOR),a.isInResult()&&(r=S.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new Te(S.NONE);for(var n=this.iterator();n.hasNext();)for(var i=n.next().getEdge().getLabel(),r=0;r<2;r++){var o=i.getLocation(r);o!==S.INTERIOR&&o!==S.BOUNDARY||this._label.setLocation(r,S.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(zn),Xn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new Fe(t,new jn)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ze),Yn=function Wr(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=Wr.orientation(t)};Yn.prototype.compareTo=function(t){var e=t;return Yn.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Yn.prototype.interfaces_=function(){return[I]},Yn.prototype.getClass=function(){return Yn},Yn.orientation=function(t){return 1===Ct.increasingDirection(t)},Yn.compareOriented=function(t,e,n,i){for(var r=e?1:-1,o=i?1:-1,s=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)===s,p=(l+=o)===a;if(c&&!p)return-1;if(!c&&p)return 1;if(c&&p)return 0}};var Hn=function(){this._edges=new xt,this._ocaMap=new h};Hn.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),r=0;r0&&t.print(","),t.print(i[r].x+" "+i[r].y);t.println(")")}t.print(") ")},Hn.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Hn.prototype.findEdgeIndex=function(t){for(var e=0;e0||!e.coord.equals2D(i);r||n--;var o=new Array(n).fill(null),s=0;o[s++]=new x(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return r&&(o[s]=e.coord),new ni(o,new Te(this.edge._label))},Zn.prototype.add=function(t,e,n){var i=new Kn(t,e,n),r=this._nodeMap.get(i);return null!==r?r:(this._nodeMap.put(i,i),i)},Zn.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn};var Qn=function(){};Qn.prototype.getChainStartIndices=function(t){var e=0,n=new xt;n.add(new R(e));do{var i=this.findChainEnd(t,e);n.add(new R(i)),e=i}while(en?e:n},$n.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return ee&&(i=1),this._depth[t][n]=i}}},ti.prototype.getDelta=function(t){return this._depth[t][be.RIGHT]-this._depth[t][be.LEFT]},ti.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?S.EXTERIOR:S.INTERIOR},ti.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},ti.prototype.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!==S.EXTERIOR&&i!==S.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=ti.depthAtLocation(i):this._depth[e][n]+=ti.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],o=arguments[1];arguments[2]===S.INTERIOR&&this._depth[r][o]++}},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.depthAtLocation=function(t){return t===S.EXTERIOR?0:t===S.INTERIOR?1:ti.NULL_VALUE},ei.NULL_VALUE.get=function(){return-1},Object.defineProperties(ti,ei);var ni=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Zn(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new ti,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this.pts=i,this._label=r}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,Te.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var i=!0,r=!0,o=this.pts.length,s=0;s0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.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("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new $n(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new X;for(var t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;ei||this._maxyo;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return tt.isTrue(!(s&&a),"Found bad envelope test"),a},ai.prototype.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 x(this._maxx,this._maxy),this._corner[1]=new x(this._minx,this._maxy),this._corner[2]=new x(this._minx,this._miny),this._corner[3]=new x(this._maxx,this._miny)},ai.prototype.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))},ai.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},ai.prototype.getCoordinate=function(){return this._originalPt},ai.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},ai.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=ai.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new X(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},ai.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))},ai.prototype.intersectsToleranceSquare=function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||n&&i||t.equals(this._pt)||e.equals(this._pt)))))},ai.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return!!this.intersects(n,i)&&(t.addIntersection(this.getCoordinate(),e),!0)},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ui.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(ai,ui);var li=function(){this.tempEnv1=new X,this.selectedSegment=new dn};li.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)}},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var hi=function(){this._index=null;var t=arguments[0];this._index=t},ci={HotPixelSnapAction:{configurable:!0}};hi.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(),o=new pi(e,n,i);return this._index.query(r,{interfaces_:function(){return[Je]},visitItem:function(t){t.select(r,o)}}),o.isNodeAdded()}},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},ci.HotPixelSnapAction.get=function(){return pi},Object.defineProperties(hi,ci);var pi=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],i=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[0],n=arguments[1],i=e.getContext();if(null!==this._parentEdge&&i===this._parentEdge&&n===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(li),fi=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new xt};fi.prototype.processIntersections=function(t,e,n,i){if(t===n&&e===i)return null;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];if(this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof we))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],i=di.precisionScaleFactor(this._argGeom,this._distance,n),r=new fe(i);this.bufferFixedPrecision(r)}},di.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===fe.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},di.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},di.prototype.bufferOriginalPrecision=function(){try{var t=new ii(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Q))throw t;this._saveException=t}},di.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},di.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di},di.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new di(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof lt&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1],r=arguments[2],o=new di(n);return o.setQuadrantSegments(r),o.getResultGeometry(i)}if(arguments[2]instanceof Nn&&arguments[0]instanceof lt&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1],u=arguments[2];return new di(s,u).getResultGeometry(a)}}else if(4===arguments.length){var l=arguments[0],h=arguments[1],c=arguments[2],p=arguments[3],f=new di(l);return f.setQuadrantSegments(c),f.setEndCapStyle(p),f.getResultGeometry(h)}},di.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),r=O.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,o)},_i.CAP_ROUND.get=function(){return Nn.CAP_ROUND},_i.CAP_BUTT.get=function(){return Nn.CAP_FLAT},_i.CAP_FLAT.get=function(){return Nn.CAP_FLAT},_i.CAP_SQUARE.get=function(){return Nn.CAP_SQUARE},_i.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(di,_i);var yi=function(){this._pt=[new x,new x],this._distance=m.NaN,this._isNull=!0};yi.prototype.getCoordinates=function(){return this._pt},yi.prototype.getCoordinate=function(t){return this._pt[t]},yi.prototype.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);ithis._distance&&this.initialize(e,n,i)}},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi};var mi=function(){};mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi},mi.computeDistance=function(){if(arguments[2]instanceof yi&&arguments[0]instanceof Jt&&arguments[1]instanceof x)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=t.getCoordinates(),r=new dn,o=0;o0||this._isIn?S.INTERIOR:S.EXTERIOR)},bi.prototype.interfaces_=function(){return[]},bi.prototype.getClass=function(){return bi};var Ci=function Kr(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var t=arguments[0],e=arguments[1];Kr.call(this,t,Kr.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}},Si={INSIDE_AREA:{configurable:!0}};Ci.prototype.isInsideArea=function(){return this._segIndex===Ci.INSIDE_AREA},Ci.prototype.getCoordinate=function(){return this._pt},Ci.prototype.getGeometryComponent=function(){return this._component},Ci.prototype.getSegmentIndex=function(){return this._segIndex},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Si.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Ci,Si);var wi=function(t){this._pts=t||null};wi.prototype.filter=function(t){t instanceof Zt&&this._pts.add(t)},wi.prototype.interfaces_=function(){return[qt]},wi.prototype.getClass=function(){return wi},wi.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Zt?$e.singletonList(t):wi.getPoints(t,new xt)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Zt?n.add(e):e instanceof Vt&&e.apply(new wi(n)),n}};var Mi=function(){this._locations=null;var t=arguments[0];this._locations=t};Mi.prototype.filter=function(t){(t instanceof Zt||t instanceof Jt||t instanceof $t)&&this._locations.add(new Ci(t,0,t.getCoordinate()))},Mi.prototype.interfaces_=function(){return[qt]},Mi.prototype.getClass=function(){return Mi},Mi.getLocations=function(t){var e=new xt;return t.apply(new Mi(e)),e};var Oi=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new bi,this._minDistanceLocation=null,this._minDistance=m.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=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}};Oi.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=1-e,r=xi.getPolygons(this._geom[e]);if(r.size()>0){var o=Mi.getLocations(this._geom[i]);if(this.computeContainmentDistance(o,r,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&M(arguments[0],Lt)&&M(arguments[1],Lt)){for(var s=arguments[0],a=arguments[1],u=arguments[2],l=0;lthis._minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),o=0;othis._minDistance)return null;for(var c=u.getCoordinates(),p=l.getCoordinates(),f=0;fthis._distance&&this.initialize(e,n,i)}},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var Ti=function(){};Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.computeDistance=function(){if(arguments[2]instanceof Pi&&arguments[0]instanceof Jt&&arguments[1]instanceof x)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new dn,r=t.getCoordinates(),o=0;o1||t<=0)throw new y("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Ri.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Ri.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Ri.prototype.computeOrientedDistance=function(t,e,n){var i=new Ai(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new ki(e,this._densifyFrac);t.apply(r),n.setMaximum(r.getMaxPointDistance())}},Ri.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.distance=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Ri(t,e).distance()}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],o=new Ri(n,i);return o.setDensifyFraction(r),o.distance()}},Di.MaxPointDistanceFilter.get=function(){return Ai},Di.MaxDensifiedByFractionDistanceFilter.get=function(){return ki},Object.defineProperties(Ri,Di);var Ai=function(){this._maxPtDist=new Pi,this._minPtDist=new Pi,this._euclideanDist=new Ti,this._geom=null;var t=arguments[0];this._geom=t};Ai.prototype.filter=function(t){this._minPtDist.initialize(),Ti.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ai.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ai.prototype.interfaces_=function(){return[pt]},Ai.prototype.getClass=function(){return Ai};var ki=function(){this._maxPtDist=new Pi,this._minPtDist=new Pi,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};ki.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,o=(i.y-n.y)/this._numSubSegs,s=0;sn){this._isValid=!1;var r=i.getCoordinates();this._errorLocation=r[1],this._errorIndicator=t.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Z.toLineString(r[0],r[1])+")"}},Fi.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Fi.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Fi.VERBOSE&&z.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Fi.prototype.checkNegativeValid=function(){if(!(this._input instanceof $t||this._input instanceof ne||this._input instanceof Vt))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Fi.prototype.getErrorIndicator=function(){return this._errorIndicator},Fi.prototype.checkMinimumDistance=function(t,e,n){var i=new Oi(t,e,n);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2?null:this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Bi.prototype.report=function(t){if(!Bi.VERBOSE)return null;z.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Bi.prototype.getErrorMessage=function(){return this._errorMsg},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi},Bi.isValidMsg=function(t,e,n){var i=new Bi(t,e,n);return i.isValid()?null:i.getErrorMessage()},Bi.isValid=function(t,e,n){return!!new Bi(t,e,n).isValid()},qi.VERBOSE.get=function(){return!1},qi.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Bi,qi);var Ui=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Ui.prototype.getCoordinates=function(){return this._pts},Ui.prototype.size=function(){return this._pts.length},Ui.prototype.getCoordinate=function(t){return this._pts[t]},Ui.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ui.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:cn.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Ui.prototype.setData=function(t){this._data=t},Ui.prototype.getData=function(){return this._data},Ui.prototype.toString=function(){return Z.toLineString(new ue(this._pts))},Ui.prototype.interfaces_=function(){return[pn]},Ui.prototype.getClass=function(){return Ui};var Vi=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new xt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};Vi.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Vi.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Vi.prototype.getIntersectionSegments=function(){return this._intSegments},Vi.prototype.count=function(){return this._intersectionCount},Vi.prototype.getIntersections=function(){return this._intersections},Vi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Vi.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Vi.prototype.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],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=r,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Vi.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},Vi.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Vi.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Vi.prototype.interfaces_=function(){return[Wn]},Vi.prototype.getClass=function(){return Vi},Vi.createAllIntersectionsFinder=function(t){var e=new Vi(t);return e.setFindAllIntersections(!0),e},Vi.createAnyIntersectionFinder=function(t){return new Vi(t)},Vi.createIntersectionCounter=function(t){var e=new Vi(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var zi=function(){this._li=new it,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};zi.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},zi.prototype.getIntersections=function(){return this._segInt.getIntersections()},zi.prototype.isValid=function(){return this.execute(),this._isValid},zi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},zi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Vi(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ln;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},zi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new we(this.getErrorMessage(),this._segInt.getInteriorIntersection())},zi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Z.toLineString(t[0],t[1])+" and "+Z.toLineString(t[2],t[3])},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi},zi.computeIntersections=function(t){var e=new zi(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var ji=function Zr(){this._nv=null;var t=arguments[0];this._nv=new zi(Zr.toSegmentStrings(t))};ji.prototype.checkValid=function(){this._nv.checkValid()},ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji},ji.toSegmentStrings=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ui(i.getCoordinates(),i))}return e},ji.checkValid=function(t){new ji(t).checkValid()};var Xi=function(t){this._mapOp=t};Xi.prototype.map=function(t){for(var e=new xt,n=0;n0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi};var Ji=function Qr(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new dn,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Jt&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];Qr.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=Qr.isClosed(n),this._snapTolerance=i}};Ji.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),i=0;i=0&&t.add(o+1,new x(r),!1)}},Ji.prototype.findSegmentIndexToSnap=function(t,e){for(var n=m.MAX_VALUE,i=-1,r=0;re&&(e=i)}return e}if(2===arguments.length){var r=arguments[0],o=arguments[1];return Math.min(Ki.computeOverlaySnapTolerance(r),Ki.computeOverlaySnapTolerance(o))}},Ki.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Ki.SNAP_PRECISION_FACTOR},Ki.snapToSelf=function(t,e,n){return new Ki(t).snapToSelf(e,n)},Zi.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Ki,Zi);var Qi=function(t){function e(e,n,i){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==i&&i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new Ji(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),i=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Wi),$i=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};$i.prototype.getCommon=function(){return m.longBitsToDouble(this._commonBits)},$i.prototype.add=function(t){var e=m.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=$i.signExpBits(this._commonBits),this._isFirst=!1,null):$i.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=$i.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=$i.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},$i.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=m.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+m.toBinaryString(t),i=n.substring(n.length-64);return i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]"}},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.getBit=function(t,e){return 0!=(t&1<>52},$i.zeroLowerBits=function(t,e){return t&~((1<=0;i--){if($i.getBit(t,i)!==$i.getBit(e,i))return n;n++}return 52};var tr=function(){this._commonCoord=null,this._ccFilter=new nr},er={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};tr.prototype.addCommonBits=function(t){var e=new ir(this._commonCoord);t.apply(e),t.geometryChanged()},tr.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new x(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new ir(e);return t.apply(n),t.geometryChanged(),t},tr.prototype.getCommonCoordinate=function(){return this._commonCoord},tr.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},er.CommonCoordinateFilter.get=function(){return nr},er.Translater.get=function(){return ir},Object.defineProperties(tr,er);var nr=function(){this._commonBitsX=new $i,this._commonBitsY=new $i};nr.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},nr.prototype.getCommonCoordinate=function(){return new x(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},nr.prototype.interfaces_=function(){return[pt]},nr.prototype.getClass=function(){return nr};var ir=function(){this.trans=null;var t=arguments[0];this.trans=t};ir.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)},ir.prototype.isDone=function(){return!1},ir.prototype.isGeometryChanged=function(){return!0},ir.prototype.interfaces_=function(){return[Ut]},ir.prototype.getClass=function(){return ir};var rr=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};rr.prototype.selfSnap=function(t){return new Ki(t).snapTo(t,this._snapTolerance)},rr.prototype.removeCommonBits=function(t){this._cbr=new tr,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},rr.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},rr.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=Cr.overlayOp(e[0],e[1],t);return this.prepareResult(n)},rr.prototype.checkValid=function(t){t.isValid()||z.out.println("Snapped geometry is invalid")},rr.prototype.computeSnapTolerance=function(){this._snapTolerance=Ki.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},rr.prototype.snap=function(t){var e=this.removeCommonBits(t);return Ki.snap(e[0],e[1],this._snapTolerance)},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.overlayOp=function(t,e,n){return new rr(t,e).getResultGeometry(n)},rr.union=function(t,e){return rr.overlayOp(t,e,Cr.UNION)},rr.intersection=function(t,e){return rr.overlayOp(t,e,Cr.INTERSECTION)},rr.symDifference=function(t,e){return rr.overlayOp(t,e,Cr.SYMDIFFERENCE)},rr.difference=function(t,e){return rr.overlayOp(t,e,Cr.DIFFERENCE)};var or=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};or.prototype.getResultGeometry=function(t){var e=null,n=!1,i=null;try{e=Cr.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof Q))throw t;i=t}if(!n)try{e=rr.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof Q?i:t}return e},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.overlayOp=function(t,e,n){return new or(t,e).getResultGeometry(n)},or.union=function(t,e){return or.overlayOp(t,e,Cr.UNION)},or.intersection=function(t,e){return or.overlayOp(t,e,Cr.INTERSECTION)},or.symDifference=function(t,e){return or.overlayOp(t,e,Cr.SYMDIFFERENCE)},or.difference=function(t,e){return or.overlayOp(t,e,Cr.DIFFERENCE)};var sr=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};sr.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},sr.prototype.interfaces_=function(){return[]},sr.prototype.getClass=function(){return sr};var ar=function $r(){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=$r.DELETE,this._xValue=t,this._insertEvent=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._eventType=$r.INSERT,this._label=n,this._xValue=i,this._obj=r}},ur={INSERT:{configurable:!0},DELETE:{configurable:!0}};ar.prototype.isDelete=function(){return this._eventType===ar.DELETE},ar.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},ar.prototype.getObject=function(){return this._obj},ar.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0},ar.prototype.getInsertEvent=function(){return this._insertEvent},ar.prototype.isInsert=function(){return this._eventType===ar.INSERT},ar.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},ar.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ar.prototype.interfaces_=function(){return[I]},ar.prototype.getClass=function(){return ar},ur.INSERT.get=function(){return 1},ur.DELETE.get=function(){return 2},Object.defineProperties(ar,ur);var lr=function(){};lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var hr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};hr.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(hr.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},hr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},hr.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},hr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},hr.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next().getCoordinate();if(t.isIntersection(i))return!0}return!1},hr.prototype.hasProperIntersection=function(){return this._hasProper},hr.prototype.hasIntersection=function(){return this._hasIntersection},hr.prototype.isDone=function(){return this._isDone},hr.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},hr.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},hr.prototype.addIntersections=function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this._li.computeIntersection(r,o,s,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))))},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var cr=function(t){function e(){t.call(this),this.events=new xt,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){$e.sort(this.events);for(var t=0;te||this._maxo?1:0},gr.prototype.interfaces_=function(){return[L]},gr.prototype.getClass=function(){return gr};var dr=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],i=arguments[2];this._min=e,this._max=n,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pr),_r=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.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)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(pr),yr=function(){this._leaves=new xt,this._root=null,this._level=0};yr.prototype.buildTree=function(){$e.sort(this._leaves,new pr.NodeComparator);for(var t=this._leaves,e=null,n=new xt;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},yr.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new dr(t,e,n))},yr.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},yr.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},yr.prototype.printNode=function(t){z.out.println(Z.toLineString(new x(t._min,this._level),new x(t._max,this._level)))},yr.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},yr.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.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},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===S.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var i=Ct.removeRepeatedPoints(t.getCoordinates());if(i.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var r=e,o=n;st.isCCW(i)&&(r=n,o=e);var s=new ni(i,new Te(this._argIndex,S.BOUNDARY,r,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,i[0],S.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var i=this._nodes.addNode(e),r=i.getLabel();null===r?i._label=new Te(t,n):r.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new cr},e.prototype.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 o=r.next();this.addSelfIntersectionNode(t,o.coord,i)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof ne&&(this._useBoundaryDeterminationRule=!1),e instanceof $t)this.addPolygon(e);else if(e instanceof Jt)this.addLineString(e);else if(e instanceof Zt)this.addPoint(e);else if(e instanceof te)this.addCollection(e);else if(e instanceof zt)this.addCollection(e);else if(e instanceof ne)this.addCollection(e);else{if(!(e instanceof Vt))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new vr(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?S.BOUNDARY:S.INTERIOR},e}(je),Nr=function(){if(this._li=new it,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 xr(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=ft.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xr(0,e,i),this._arg[1]=new xr(1,n,i)}else if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];r.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(r.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new xr(0,r,s),this._arg[1]=new xr(1,o,s)}};Nr.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Nr.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var br=function(){};br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br},br.map=function(){if(arguments[0]instanceof lt&&M(arguments[1],br.MapOp)){for(var t=arguments[0],e=arguments[1],n=new xt,i=0;i=t.size()?null:t.get(e)},Rr.union=function(t){return new Rr(t).union()},Dr.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Rr,Dr);var Ar=function(){};Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar},Ar.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Cr.createEmptyResult(Cr.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),or.overlayOp(t,e,Cr.UNION)},t.GeoJSONReader=xe,t.GeoJSONWriter=Ne,t.OverlayOp=Cr,t.UnionOp=Ar,t.BufferOp=di,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){t.exports=n(9)},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}n(10);var r=n(11),o=i(n(12)),s=i(n(13)),a=i(n(0));n(15),n(16),n(17),n(18),n(19),n(20);var u=i(n(2));n(27),n(28),n(29),n(30),n(31),n(32),n(33),n(34),L.PM=L.PM||{Map:o["default"],Toolbar:s["default"],Draw:a["default"],Edit:u["default"],version:r.version,initialize:function(){this.addInitHooks()},addInitHooks:function(){L.Map.addInitHook(function(){this.options.pmIgnore||(this.pm=new L.PM.Map(this))}),L.LayerGroup.addInitHook(function(){this.pm=new L.PM.Edit.LayerGroup(this)}),L.Marker.addInitHook(function(){this.options.pmIgnore||(this.pm=new L.PM.Edit.Marker(this))}),L.Polyline.addInitHook(function(){this.options.pmIgnore||(this.pm=new L.PM.Edit.Line(this))}),L.Polygon.addInitHook(function(){this.options.pmIgnore||(this.pm=new L.PM.Edit.Poly(this))}),L.Rectangle.addInitHook(function(){this.options.pmIgnore||(this.pm=new L.PM.Edit.Rectangle(this))}),L.Circle.addInitHook(function(){this.options.pmIgnore||(this.pm=new L.PM.Edit.Circle(this))})}},L.PM.initialize()},function(t,e){Array.prototype.findIndex=Array.prototype.findIndex||function(t){if(null===this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof t)throw new TypeError("callback must be a function");for(var e=Object(this),n=e.length>>>0,i=arguments[1],r=0;r>>0,i=arguments[1],r=0;r0&&arguments[0]!==undefined?arguments[0]:"Poly",e=arguments.length>1?arguments[1]:undefined;this.Draw.enable(t,e)},disableDraw:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"Poly";this.Draw.disable(t)},setPathOptions:function(t){this.Draw.setPathOptions(t)},removeLayer:function(t){var e=t.target;e._layers||e.pm&&e.pm.dragging()||t.target.remove()},toggleGlobalRemovalMode:function(){var t=this;this.globalRemovalEnabled()?(this._globalRemovalMode=!1,this.map.eachLayer(function(e){e.off("click",t.removeLayer)})):(this._globalRemovalMode=!0,this.map.eachLayer(function(e){e.pm&&e.on("click",t.removeLayer)})),this.Toolbar.toggleButton("deleteLayer",this._globalRemovalMode)},globalRemovalEnabled:function(){return this._globalRemovalMode},globalEditEnabled:function(){return this._globalEditMode},enableGlobalEditMode:function(t){var e=[];this.map.eachLayer(function(t){(t instanceof L.Polyline||t instanceof L.Marker||t instanceof L.Circle)&&e.push(t)}),e=(e=e.filter(function(t){return!!t.pm})).filter(function(t){return!t._pmTempLayer}),this._globalEditMode=!0,e.forEach(function(e){e.pm.enable(t)}),this.Toolbar.toggleButton("editPolygon",this._globalEditMode),this._fireEditModeEvent(!0)},disableGlobalEditMode:function(){var t=[];this.map.eachLayer(function(e){(e instanceof L.Polyline||e instanceof L.Marker||e instanceof L.Circle)&&t.push(e)}),t=(t=t.filter(function(t){return!!t.pm})).filter(function(t){return!t._pmTempLayer}),this._globalEditMode=!1,t.forEach(function(t){t.pm.disable()}),this.Toolbar.toggleButton("editPolygon",this._globalEditMode),this._fireEditModeEvent(!1)},_fireEditModeEvent:function(t){this.map.fire("pm:globaleditmodetoggled",{enabled:t,map:this.map})},toggleGlobalEditMode:function(t){this.globalEditEnabled()?this.disableGlobalEditMode():this.enableGlobalEditMode(t)}});e["default"]=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(14));L.Control.PMButton=i["default"];var r=L.Class.extend({options:{drawMarker:!0,drawPolygon:!0,drawPolyline:!0,drawCircle:!0,drawRectangle:!0,editMode:!0,cutPolygon:!0,dragPolygon:!1,removalMode:!0,position:"topleft"},initialize:function(t){this.map=t,this.buttons={},this.isVisible=!1,this.container=L.DomUtil.create("div","leaflet-pm-toolbar leaflet-bar leaflet-control"),this._defineButtons()},getButtons:function(){return this.buttons},addControls:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.options;"undefined"!=typeof t.editPolygon&&(t.editMode=t.editPolygon),"undefined"!=typeof t.deleteLayer&&(t.removalMode=t.deleteLayer),L.Util.setOptions(this,t),this._showHideButtons(),this.isVisible=!0},removeControls:function(){var t=this.getButtons();for(var e in t)t[e].remove();this.isVisible=!1},toggleControls:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.options;this.isVisible?this.removeControls():this.addControls(t)},_addButton:function(t,e){return this.buttons[t]=e,this.options[t]=this.options[t]||!1,this.buttons[t]},triggerClickOnToggledButtons:function(t){for(var e in this.buttons)this.buttons[e]!==t&&this.buttons[e].toggled()&&this.buttons[e]._triggerClick()},toggleButton:function(t,e){return"editPolygon"===t&&(t="editMode"),"deleteLayer"===t&&(t="removalMode"),this.triggerClickOnToggledButtons(this.buttons[t]),this.buttons[t].toggle(e)},_defineButtons:function(){var t=this,e={className:" leaflet-pm-icon-delete",onClick:function(){},afterClick:function(){t.map.pm.toggleGlobalRemovalMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},n={className:"leaflet-pm-icon-polygon",onClick:function(){},afterClick:function(){t.map.pm.Draw.Poly.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},i={className:"leaflet-pm-icon-cut",onClick:function(){},afterClick:function(){t.map.pm.Draw.Cut.toggle({snappable:!0,cursorMarker:!0,allowSelfIntersection:!1})},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},r={className:"leaflet-pm-icon-marker",onClick:function(){},afterClick:function(){t.map.pm.Draw.Marker.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},o={className:"leaflet-pm-icon-polyline",onClick:function(){},afterClick:function(){t.map.pm.Draw.Line.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},s={className:"leaflet-pm-icon-circle",onClick:function(){},afterClick:function(){t.map.pm.Draw.Circle.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},a={className:"leaflet-pm-icon-rectangle",onClick:function(){},afterClick:function(){t.map.pm.Draw.Rectangle.toggle()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},u={className:"leaflet-pm-icon-edit",onClick:function(){},afterClick:function(){t.map.pm.toggleGlobalEditMode()},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position},l={className:"leaflet-pm-icon-drag",onClick:function(){},afterClick:function(){},doToggle:!0,toggleStatus:!1,disableOtherButtons:!0,position:this.options.position};this._addButton("drawMarker",new L.Control.PMButton(r)),this._addButton("drawPolyline",new L.Control.PMButton(o)),this._addButton("drawRectangle",new L.Control.PMButton(a)),this._addButton("drawPolygon",new L.Control.PMButton(n)),this._addButton("drawCircle",new L.Control.PMButton(s)),this._addButton("cutPolygon",new L.Control.PMButton(i)),this._addButton("editMode",new L.Control.PMButton(u)),this._addButton("dragPolygon",new L.Control.PMButton(l)),this._addButton("removalMode",new L.Control.PMButton(e))},_showHideButtons:function(){this.removeControls();var t=this.getButtons();for(var e in t)this.options[e]&&(t[e].setPosition(this.options.position),t[e].addTo(this.map))}});e["default"]=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i=L.Control.extend({options:{position:"topleft"},initialize:function(t){this._button=L.Util.setOptions(this,t)},onAdd:function(t){return this._map=t,this._container=this._map.pm.Toolbar.container,this.buttonsDomNode=this._makeButton(this._button),this._container.appendChild(this.buttonsDomNode),this._container},onRemove:function(){return this.buttonsDomNode.remove(),this._container},getText:function(){return this._button.text},getIconUrl:function(){return this._button.iconUrl},destroy:function(){this._button={},this._update()},toggle:function(t){return this._button.toggleStatus="boolean"==typeof t?t:!this._button.toggleStatus,this._applyStyleClasses(),this._button.toggleStatus},toggled:function(){return this._button.toggleStatus},onCreate:function(){this.toggle(!1)},_triggerClick:function(t){this._button.onClick(t),this._clicked(t),this._button.afterClick(t)},_makeButton:function(t){var e=this,n=L.DomUtil.create("a","leaflet-buttons-control-button",this._container);t.toggleStatus&&L.DomUtil.addClass(n,"active");var i=L.DomUtil.create("div","control-icon",n);return t.iconUrl&&i.setAttribute("src",t.iconUrl),t.className&&L.DomUtil.addClass(i,t.className),L.DomEvent.addListener(n,"click",function(){e._button.disableOtherButtons&&e._map.pm.Toolbar.triggerClickOnToggledButtons(e)}),L.DomEvent.addListener(n,"click",this._triggerClick,this),L.DomEvent.disableClickPropagation(n),n},_applyStyleClasses:function(){this._container&&(this._button.toggleStatus?L.DomUtil.addClass(this.buttonsDomNode,"active"):L.DomUtil.removeClass(this.buttonsDomNode,"active"))},_clicked:function(){this._button.doToggle&&this.toggle()}});e["default"]=i},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(0));i["default"].Marker=i["default"].extend({initialize:function(t){this._map=t,this._shape="Marker",this.toolbarButtonName="drawMarker"},enable:function(t){L.Util.setOptions(this,t),this._enabled=!0,this._map.on("click",this._createMarker,this),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._hintMarker=L.marker([0,0],this.options.markerStyle),this._hintMarker._pmTempLayer=!0,this._hintMarker.addTo(this._map),this._layer=this._hintMarker,this._map.on("mousemove",this._syncHintMarker,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.eachLayer(function(t){t instanceof L.Marker&&t.pm&&t.pm.enable()})},disable:function(){this._enabled&&(this._map.off("click",this._createMarker,this),this._hintMarker.remove(),this._map.off("mousemove",this._syncHintMarker,this),this._map.eachLayer(function(t){t instanceof L.Marker&&t.pm&&!t._pmTempLayer&&t.pm.disable()}),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this._enabled=!1)},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},_createMarker:function(t){if(t.latlng){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng(),n=new L.Marker(e,this.options.markerStyle);n.addTo(this._map),n.pm.enable(),this._map.fire("pm:create",{shape:this._shape,marker:n,layer:n}),this._cleanupSnapping()}},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=i(n(6)),o=i(n(0));o["default"].Line=o["default"].extend({initialize:function(t){this._map=t,this._shape="Line",this.toolbarButtonName="drawPolyline",this._doesSelfIntersect=!1},enable:function(t){L.Util.setOptions(this,t),this.options.finishOnDoubleClick&&!this.options.finishOn&&(this.options.finishOn="dblclick"),this._enabled=!0,this._layerGroup=new L.LayerGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.polyline([],this.options.templineStyle),this._layer._pmTempLayer=!0,this._layerGroup.addLayer(this._layer),this._hintline=L.polyline([],this.options.hintlineStyle),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline),this._hintMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this._map._container.style.cursor="crosshair",this._map.on("click",this._createVertex,this),this.options.finishOn&&this._map.on(this.options.finishOn,this._finishShape,this),"dblclick"===this.options.finishOn&&(this.tempMapDoubleClickZoomState=this._map.doubleClickZoom._enabled,this.tempMapDoubleClickZoomState&&this._map.doubleClickZoom.disable()),this._map.on("mousemove",this._syncHintMarker,this),this._hintMarker.on("move",this._syncHintLine,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[]},disable:function(){this._enabled&&(this._enabled=!1,this._map._container.style.cursor="default",this._map.off("click",this._createVertex,this),this._map.off("mousemove",this._syncHintMarker,this),this.options.finishOn&&this._map.off(this.options.finishOn,this._finishShape,this),this.tempMapDoubleClickZoomState&&this._map.doubleClickZoom.enable(),this._map.removeLayer(this._layerGroup),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping())},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},hasSelfIntersection:function(){return(0,r["default"])(this._layer.toGeoJSON()).features.length>0},_syncHintLine:function(){var t=this._layer.getLatLngs();if(t.length>0){var e=t[t.length-1];this._hintline.setLatLngs([e,this._hintMarker.getLatLng()])}},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}this.options.allowSelfIntersection||this._handleSelfIntersection()},_handleSelfIntersection:function(){var t=L.polyline(this._layer.getLatLngs());t.addLatLng(this._hintMarker.getLatLng());var e=(0,r["default"])(t.toGeoJSON());this._doesSelfIntersect=e.features.length>0,this._doesSelfIntersect?this._hintline.setStyle({color:"red"}):this._hintline.setStyle({color:"#3388ff"})},_createVertex:function(t){if(this.options.allowSelfIntersection||!this._doesSelfIntersect){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng();if(e.equals(this._layer.getLatLngs()[0]))this._finishShape(t);else{var n=0===this._layer.getLatLngs().length;this._layer.addLatLng(e);var i=this._createMarker(e,n);this._hintline.setLatLngs([e,e]),this._layer.fire("pm:vertexadded",{shape:this._shape,workingLayer:this._layer,marker:i,latlng:e})}}},_finishShape:function(){if(this.options.allowSelfIntersection||!this._doesSelfIntersect){var t=this._layer.getLatLngs(),e=L.polyline(t,this.options.pathOptions).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:e}),this.options.snappable&&this._cleanupSnapping()}},_createMarker:function(t){var e=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return e._pmTempLayer=!0,this._layerGroup.addLayer(e),e.on("click",this._finishShape,this),e}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(0));i["default"].Poly=i["default"].Line.extend({initialize:function(t){this._map=t,this._shape="Poly",this.toolbarButtonName="drawPolygon"},_finishShape:function(){if(this.options.allowSelfIntersection||!this._doesSelfIntersect){var t=this._layer.getLatLngs(),e=L.polygon(t,this.options.pathOptions).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:e}),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex}},_createMarker:function(t,e){var n=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return n._pmTempLayer=!0,this._layerGroup.addLayer(n),e&&(n.on("click",this._finishShape,this),this._tempSnapLayerIndex=this._otherSnapLayers.push(n)-1,this.options.snappable&&this._cleanupSnapping()),n}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(0));i["default"].Rectangle=i["default"].extend({initialize:function(t){this._map=t,this._shape="Rectangle",this.toolbarButtonName="drawRectangle"},enable:function(t){if(L.Util.setOptions(this,t),this._enabled=!0,this._layerGroup=new L.LayerGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.rectangle([[0,0],[0,0]],this.options.pathOptions),this._layer._pmTempLayer=!0,this._startMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon rect-start-marker"}),draggable:!0,zIndexOffset:100,opacity:this.options.cursorMarker?1:0}),this._startMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._startMarker),this._hintMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker){L.DomUtil.addClass(this._hintMarker._icon,"visible"),this._styleMarkers=[];for(var e=0;e<2;e+=1){var n=L.marker([0,0],{icon:L.divIcon({className:"marker-icon rect-style-marker"}),draggable:!0,zIndexOffset:100});n._pmTempLayer=!0,this._layerGroup.addLayer(n),this._styleMarkers.push(n)}}this._map._container.style.cursor="crosshair",this._map.on("click",this._placeStartingMarkers,this),this._map.on("mousemove",this._syncHintMarker,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[]},disable:function(){this._enabled&&(this._enabled=!1,this._map._container.style.cursor="default",this._map.off("click",this._finishShape,this),this._map.off("click",this._placeStartingMarkers,this),this._map.off("mousemove",this._syncHintMarker,this),this._map.removeLayer(this._layerGroup),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping())},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},_placeStartingMarkers:function(t){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng();L.DomUtil.addClass(this._startMarker._icon,"visible"),this._startMarker.setLatLng(e),this.options.cursorMarker&&this._styleMarkers&&this._styleMarkers.forEach(function(t){L.DomUtil.addClass(t._icon,"visible"),t.setLatLng(e)}),this._map.off("click",this._placeStartingMarkers,this),this._map.on("click",this._finishShape,this),this._setRectangleOrigin()},_setRectangleOrigin:function(){var t=this._startMarker.getLatLng();t&&(this._layerGroup.addLayer(this._layer),this._layer.setLatLngs([t,t]),this._hintMarker.on("move",this._syncRectangleSize,this))},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}},_syncRectangleSize:function(){var t=this,e=this._startMarker.getLatLng(),n=this._hintMarker.getLatLng();if(this._layer.setBounds([e,n]),this.options.cursorMarker&&this._styleMarkers){var i=[];this._findCorners().forEach(function(e){e.equals(t._startMarker.getLatLng())||e.equals(t._hintMarker.getLatLng())||i.push(e)}),i.forEach(function(e,n){t._styleMarkers[n].setLatLng(e)})}},_finishShape:function(){var t=this._startMarker.getLatLng(),e=this._hintMarker.getLatLng(),n=L.rectangle([t,e],this.options.pathOptions).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:n})},_findCorners:function(){var t=this._layer.getBounds();return[t.getNorthWest(),t.getNorthEast(),t.getSouthEast(),t.getSouthWest()]}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(0));i["default"].Circle=i["default"].extend({initialize:function(t){this._map=t,this._shape="Circle",this.toolbarButtonName="drawCircle"},enable:function(t){L.Util.setOptions(this,t),this.options.radius=0,this._enabled=!0,this._layerGroup=new L.LayerGroup,this._layerGroup._pmTempLayer=!0,this._layerGroup.addTo(this._map),this._layer=L.circle([0,0],this.options.templineStyle),this._layer._pmTempLayer=!0,this._layerGroup.addLayer(this._layer),this._centerMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon"}),draggable:!1,zIndexOffset:100}),this._centerMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._centerMarker),this._hintMarker=L.marker([0,0],{icon:L.divIcon({className:"marker-icon cursor-marker"})}),this._hintMarker._pmTempLayer=!0,this._layerGroup.addLayer(this._hintMarker),this.options.cursorMarker&&L.DomUtil.addClass(this._hintMarker._icon,"visible"),this._hintline=L.polyline([],this.options.hintlineStyle),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline),this._map._container.style.cursor="crosshair",this._map.on("click",this._placeCenterMarker,this),this._map.on("mousemove",this._syncHintMarker,this),this._map.fire("pm:drawstart",{shape:this._shape,workingLayer:this._layer}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!0),this._otherSnapLayers=[]},disable:function(){this._enabled&&(this._enabled=!1,this._map._container.style.cursor="default",this._map.off("click",this._finishShape,this),this._map.off("click",this._placeCenterMarker,this),this._map.off("mousemove",this._syncHintMarker,this),this._map.removeLayer(this._layerGroup),this._map.fire("pm:drawend",{shape:this._shape}),this._map.pm.Toolbar.toggleButton(this.toolbarButtonName,!1),this.options.snappable&&this._cleanupSnapping())},enabled:function(){return this._enabled},toggle:function(t){this.enabled()?this.disable():this.enable(t)},_syncHintLine:function(){var t=this._centerMarker.getLatLng();this._hintline.setLatLngs([t,this._hintMarker.getLatLng()])},_syncCircleRadius:function(){var t=this._centerMarker.getLatLng(),e=this._hintMarker.getLatLng(),n=t.distanceTo(e);this._layer.setRadius(n)},_syncHintMarker:function(t){if(this._hintMarker.setLatLng(t.latlng),this.options.snappable){var e=t;e.target=this._hintMarker,this._handleSnapping(e)}},_placeCenterMarker:function(t){this._hintMarker._snapped||this._hintMarker.setLatLng(t.latlng);var e=this._hintMarker.getLatLng();this._centerMarker.setLatLng(e),this._map.off("click",this._placeCenterMarker,this),this._map.on("click",this._finishShape,this),this._placeCircleCenter()},_placeCircleCenter:function(){var t=this._centerMarker.getLatLng();t&&(this._layer.setLatLng(t),this._hintMarker.on("move",this._syncHintLine,this),this._hintMarker.on("move",this._syncCircleRadius,this),this._layer.fire("pm:centerplaced",{shape:this._shape,workingLayer:this._layer,latlng:t}))},_finishShape:function(){var t=this._centerMarker.getLatLng(),e=this._hintMarker.getLatLng(),n=t.distanceTo(e),i=L.circle(t,{radius:n}).addTo(this._map);this.disable(),this._map.fire("pm:create",{shape:this._shape,layer:i})},_createMarker:function(t){var e=new L.Marker(t,{draggable:!1,icon:L.divIcon({className:"marker-icon"})});return e._pmTempLayer=!0,this._layerGroup.addLayer(e),e}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=i(n(21)),o=i(n(24)),s=i(n(0));s["default"].Cut=s["default"].Poly.extend({initialize:function(t){this._map=t,this._shape="Cut",this.toolbarButtonName="cutPolygon"},_cut:function(t){var e=this,n=this._map._layers,i=[];Object.keys(n).map(function(t){return n[t]}).filter(function(t){return t.pm}).filter(function(t){return t instanceof L.Polygon}).filter(function(e){return e!==t}).filter(function(e){try{return!!(0,r["default"])(t.toGeoJSON(),e.toGeoJSON())}catch(n){return console.error("You cant cut polygons with self-intersections"),!1}}).forEach(function(n){var r=(0,o["default"])(n.toGeoJSON(),t.toGeoJSON());if("MultiPolygon"===r.geometry.type){r.geometry.coordinates.reduce(function(t,e){return t.push({type:"Polygon",coordinates:e}),t},[]).forEach(function(t){var r=L.geoJSON(t,n.options);i.push(r),r.addTo(e._map),r.pm.enable(e.options),r.pm.disable()})}else{var s=L.geoJSON(r,n.options).addTo(e._map);i.push(s),s.addTo(e._map),s.pm.enable(e.options),s.pm.disable()}n.fire("pm:cut",{shape:e._shape,layer:n,resultingLayers:i}),e._map.fire("pm:cut",{shape:e._shape,cuttedLayer:n,resultingLayers:i}),n._pmTempLayer=!0,t._pmTempLayer=!0,n.remove(),t.remove()})},_finishShape:function(){var t=this._layer.getLatLngs(),e=L.polygon(t,this.options.pathOptions);this._cut(e),this.disable(),this._cleanupSnapping(),this._otherSnapLayers.splice(this._tempSnapLayerIndex,1),delete this._tempSnapLayerIndex}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(7),r=(n.n(i),n(22)),o=n(4),s=n(1),a=n(23);e["default"]=function(t,e){var n=Object(o.b)(t),u=Object(o.b)(e);if(Object(a.a)(Object(r.a)(u,{precision:4})).coordinates[0].length<4)return null;if(Object(a.a)(Object(r.a)(n,{precision:4})).coordinates[0].length<4)return null;var l=new i.GeoJSONReader,h=l.read(Object(r.a)(n)),c=l.read(Object(r.a)(u)),p=i.OverlayOp.intersection(h,c);if(p.isEmpty())return null;var f=(new i.GeoJSONWriter).write(p);return Object(s.a)(f)}},function(t,e,n){"use strict";var i=n(3),r=n(1);e.a=function(t,e){if(e=e||{},!Object(r.c)(e))throw new Error("options is invalid");var n=e.precision,o=e.coordinates,s=e.mutate;if(n=n===undefined||null===n||isNaN(n)?6:n,o=o===undefined||null===o||isNaN(o)?3:o,!t)throw new Error(" is required");if("number"!=typeof n)throw new Error(" must be a number");if("number"!=typeof o)throw new Error(" must be a number");!1!==s&&s!==undefined||(t=JSON.parse(JSON.stringify(t)));var a=Math.pow(10,n);return Object(i.a)(t,function(t){!function(t,e,n){t.length>n&&t.splice(n,t.length);for(var i=0;i=Math.abs(h)?l>0?o<=i&&i<=a:a<=i&&i<=o:h>0?s<=r&&r<=u:u<=r&&r<=s)}(n,r=e[u+1],i)||s.push(i);return s.push(r),s}var r=n(1),o=n(4);e.a=function(t,e){var n="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var s=Object(o.c)(t),a=[];switch(s){case"LineString":a=i(t);break;case"MultiLineString":case"Polygon":Object(o.a)(t).forEach(function(t){a.push(i(t))});break;case"MultiPolygon":Object(o.a)(t).forEach(function(t){var e=[];t.forEach(function(t){e.push(i(t))}),a.push(e)});break;case"Point":return t;case"MultiPoint":var u={};Object(o.a)(t).forEach(function(t){var e=t.join("-");u.hasOwnProperty(e)||(a.push(t),u[e]=!0)});break;default:throw new Error(s+" geometry not supported")}return t.coordinates?!0===n?(t.coordinates=a,t):{type:s,coordinates:a}:!0===n?(t.geometry.coordinates=a,t):Object(r.a)({type:s,coordinates:a},t.properties,t.bbox,t.id)}},function(t,e,n){"use strict";function i(t){switch(t.type){case"Polygon":return Object(o.a)(t)>1?t:null;case"MultiPolygon":var e=[];if(Object(u.b)(t,function(t){Object(o.a)(t)>1&&e.push(t.geometry.coordinates)}),e.length)return{type:"MultiPolygon",coordinates:e}}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(7),o=(n.n(r),n(25)),s=n(1),a=n(4),u=n(3);e["default"]=function(t,e){var n=Object(a.b)(t),o=Object(a.b)(e),u=t.properties||{};if(n=i(n),o=i(o),!n)return null;if(!o)return Object(s.a)(n,u);var l=new r.GeoJSONReader,h=l.read(n),c=l.read(o),p=r.OverlayOp.difference(h,c);if(p.isEmpty())return null;var f=(new r.GeoJSONWriter).write(p);return Object(s.a)(f,u)}},function(t,e,n){"use strict";function i(t){var e,n=0;switch(t.type){case"Polygon":return r(t.coordinates);case"MultiPolygon":for(e=0;e0){e+=Math.abs(o(t[0]));for(var n=1;n2){for(a=0;a0&&arguments[0]!==undefined?arguments[0]:{draggable:!0,snappable:!0};this.options=t,this._map=this._layer._map,this.enabled()||(this._enabled=!0,this._layer.on("contextmenu",this._removeMarker,this),this.options.draggable&&this._layer.dragging.enable(),this.options.snappable&&this._initSnappableMarkers())},enabled:function(){return this._enabled},disable:function(){this._enabled=!1,this._layer.dragging.disable(),this._layer.off("contextmenu",this._removeMarker,this),this._layerEdited&&this._layer.fire("pm:update",{}),this._layerEdited=!1},_removeMarker:function(t){var e=t.target;e.remove(),e.fire("pm:remove")},_onDragEnd:function(t){t.target.fire("pm:edit"),this._layerEdited=!0},_initSnappableMarkers:function(){var t=this._layer;this.options.snapDistance=this.options.snapDistance||30,t.off("drag",this._handleSnapping,this),t.on("drag",this._handleSnapping,this),t.off("dragend",this._cleanupSnapping,this),t.on("dragend",this._cleanupSnapping,this),t.off("pm:dragstart",this._unsnap,this),t.on("pm:dragstart",this._unsnap,this)}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}var r=i(n(6)),o=i(n(2));o["default"].Line=o["default"].extend({initialize:function(t){this._layer=t,this._enabled=!1},toggleEdit:function(t){this.enabled()?this.disable():this.enable(t)},enable:function(t){L.Util.setOptions(this,t),this._map=this._layer._map,this._map&&(this.enabled()||this.disable(),this._enabled=!0,this._initMarkers(),this._layer.on("remove",this._onLayerRemove,this),this.options.allowSelfIntersection||this._layer.on("pm:vertexremoved",this._handleSelfIntersectionOnVertexRemoval,this),this.options.draggable&&this._initDraggableLayer(),this.options.allowSelfIntersection||this._handleLayerStyle())},_onLayerRemove:function(t){this.disable(t.target)},enabled:function(){return this._enabled},disable:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._layer;if(!this.enabled())return!1;if(t.pm._dragging)return!1;t.pm._enabled=!1,t.pm._markerGroup.clearLayers(),t.off("mousedown"),t.off("mouseup"),this._layer.off("remove",this._onLayerRemove),this.options.allowSelfIntersection||this._layer.off("pm:vertexremoved",this._handleSelfIntersectionOnVertexRemoval);var e=t._path;return L.DomUtil.removeClass(e,"leaflet-pm-draggable"),this.hasSelfIntersection()&&L.DomUtil.removeClass(e,"leaflet-pm-invalid"),this._layerEdited&&this._layer.fire("pm:update",{}),this._layerEdited=!1,!0},hasSelfIntersection:function(){return(0,r["default"])(this._layer.toGeoJSON()).features.length>0},_handleSelfIntersectionOnVertexRemoval:function(){this._handleLayerStyle(!0),this.hasSelfIntersection()&&(this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers())},_handleLayerStyle:function(t){var e=this._layer._path;if(this.hasSelfIntersection()){if(L.DomUtil.hasClass(e,"leaflet-pm-invalid"))return;t?(L.DomUtil.addClass(e,"leaflet-pm-invalid"),window.setTimeout(function(){L.DomUtil.removeClass(e,"leaflet-pm-invalid")},200)):L.DomUtil.addClass(e,"leaflet-pm-invalid"),this._layer.fire("pm:intersect",{intersection:(0,r["default"])(this._layer.toGeoJSON())})}else L.DomUtil.removeClass(e,"leaflet-pm-invalid")},_initMarkers:function(){var t=this,e=this._map,n=this._layer.getLatLngs();this._markerGroup&&this._markerGroup.clearLayers(),this._markerGroup=new L.LayerGroup,this._markerGroup._pmTempLayer=!0,e.addLayer(this._markerGroup);var i=function(e){var n=e.map(t._createMarker,t);return e.map(function(i,r){var o;return o=t.isPolygon()?(r+1)%e.length:r+1,t._createMiddleMarker(n[r],n[o])}),n};this._markers=[],this.isPolygon()?this._markers=n.map(i,this):this._markers=i(n),this.options.snappable&&this._initSnappableMarkers()},_createMarker:function(t){var e=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return e._pmTempLayer=!0,e.on("dragstart",this._onMarkerDragStart,this),e.on("move",this._onMarkerDrag,this),e.on("dragend",this._onMarkerDragEnd,this),e.on("contextmenu",this._removeMarker,this),this._markerGroup.addLayer(e),e},_createMiddleMarker:function(t,e){var n=this;if(!t||!e)return!1;var i=this._calcMiddleLatLng(t.getLatLng(),e.getLatLng()),r=this._createMarker(i),o=L.divIcon({className:"marker-icon marker-icon-middle"});return r.setIcon(o),t._middleMarkerNext=r,e._middleMarkerPrev=r,r.on("click",function(){var i=L.divIcon({className:"marker-icon"});r.setIcon(i),n._addMarker(r,t,e)}),r.on("movestart",function(){r.on("moveend",function(){var t=L.divIcon({className:"marker-icon"});r.setIcon(t),r.off("moveend")}),n._addMarker(r,t,e)}),r},_addMarker:function(t,e,n){t.off("movestart"),t.off("click");var i=t.getLatLng(),r=this._layer._latlngs,o=this.findMarkerIndex(this._markers,n),s=o.ringIndex,a=o.index,u=s>-1?r[s]:r,l=s>-1?this._markers[s]:this._markers;u.splice(a,0,i),l.splice(a,0,t),this._layer.setLatLngs(r),this._createMiddleMarker(e,t),this._createMiddleMarker(t,n),this._fireEdit(),this._layer.fire("pm:vertexadded",{layer:this._layer,marker:t,index:a,ringIndex:s}),this.options.snappable&&this._initSnappableMarkers()},_removeMarker:function(t){if(!this.options.allowSelfIntersection){var e=this._layer.getLatLngs();this._coordsBeforeEdit=JSON.parse(JSON.stringify(e))}var n=t.target,i=this._layer.getLatLngs(),r=this.findMarkerIndex(this._markers,n),o=r.ringIndex,s=r.index,a=o>-1?i[o]:i,u=o>-1?this._markers[o]:this._markers;if(!(-1===this.findMarkerIndex(this._markers,n).index)){a.splice(s,1),this._layer.setLatLngs(i),a.length<=1&&(i.splice(o,1),this._layer.setLatLngs(i),this.disable(),this.enable(this.options)),i.length<1&&this._layer.remove(),n._middleMarkerPrev&&this._markerGroup.removeLayer(n._middleMarkerPrev),n._middleMarkerNext&&this._markerGroup.removeLayer(n._middleMarkerNext),this._markerGroup.removeLayer(n);var l,h;if(this.isPolygon()?(l=(s+1)%u.length,h=(s+(u.length-1))%u.length):(h=s-1<0?undefined:s-1,l=s+1>=u.length?undefined:s+1),l!==h){var c=u[h],p=u[l];this._createMiddleMarker(c,p)}u.splice(s,1),this._fireEdit(),this._layer.fire("pm:vertexremoved",{layer:this._layer,marker:n,index:s,ringIndex:o})}},findMarkerIndex:function(t,e){var n,i;return this.isPolygon()?i=t.findIndex(function(t){return(n=t.findIndex(function(t){return e._leaflet_id===t._leaflet_id}))>-1}):n=t.findIndex(function(t){return e._leaflet_id===t._leaflet_id}),{index:n,ringIndex:i}},updatePolygonCoordsFromMarkerDrag:function(t){var e=this._layer.getLatLngs(),n=this.findMarkerIndex(this._markers,t),i=n.ringIndex,r=n.index;(i>-1?e[i]:e).splice(r,1,t.getLatLng()),this._layer.setLatLngs(e).redraw()},_onMarkerDrag:function(t){var e=t.target;if(!(-1===this.findMarkerIndex(this._markers,e).index)){this.updatePolygonCoordsFromMarkerDrag(e);var n=this.findMarkerIndex(this._markers,e),i=n.ringIndex,r=n.index,o=i>-1?this._markers[i]:this._markers,s=(r+1)%o.length,a=(r+o.length-1)%o.length,u=e.getLatLng(),l=o[a].getLatLng(),h=o[s].getLatLng();if(e._middleMarkerNext){var c=this._calcMiddleLatLng(u,h);e._middleMarkerNext.setLatLng(c)}if(e._middleMarkerPrev){var p=this._calcMiddleLatLng(u,l);e._middleMarkerPrev.setLatLng(p)}this.options.allowSelfIntersection||this._handleLayerStyle()}},_onMarkerDragEnd:function(t){var e=t.target,n=this.findMarkerIndex(this._markers,e),i=n.ringIndex,r=n.index;if(!this.options.allowSelfIntersection&&this.hasSelfIntersection())return this._layer.setLatLngs(this._coordsBeforeEdit),this._coordsBeforeEdit=null,this._initMarkers(),void this._handleLayerStyle();this._layer.fire("pm:markerdragend",{markerEvent:t,ringIndex:i,index:r}),this._fireEdit()},_onMarkerDragStart:function(t){var e=t.target,n=this.findMarkerIndex(this._markers,e),i=n.ringIndex,r=n.index;this._layer.fire("pm:markerdragstart",{markerEvent:t,ringIndex:i,index:r}),this.options.allowSelfIntersection||(this._coordsBeforeEdit=this._layer.getLatLngs())},_fireEdit:function(){this._layerEdited=!0,this._layer.fire("pm:edit")},_calcMiddleLatLng:function(t,e){var n=this._map,i=n.project(t),r=n.project(e);return n.unproject(i._add(r)._divideBy(2))}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(2));i["default"].Poly=i["default"].Line.extend({})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(2));i["default"].Rectangle=i["default"].Poly.extend({_initMarkers:function(){var t=this._map,e=this._findCorners();this._markerGroup&&this._markerGroup.clearLayers(),this._markerGroup=new L.LayerGroup,this._markerGroup._pmTempLayer=!0,t.addLayer(this._markerGroup),this._markers=[],this._markers[0]=e.map(this._createMarker,this),this._cornerMarkers=this._markers[0],this.options.snappable&&this._initSnappableMarkers()},_createMarker:function(t,e){var n=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return n._origLatLng=t,n._index=e,n._pmTempLayer=!0,n.on("dragstart",this._onMarkerDragStart,this),n.on("drag",this._onMarkerDrag,this),n.on("dragend",this._onMarkerDragEnd,this),n.on("contextmenu",this._removeMarker,this),n.on("pm:snap",this._adjustRectangleForMarkerSnap,this),this._markerGroup.addLayer(n),n},_removeMarker:function(){return null},_onMarkerDragStart:function(t){var e=t.target,n=this._findCorners();e._oppositeCornerLatLng=n[(e._index+2)%4],e._snapped=!1,this._layer.fire("pm:markerdragstart",{markerEvent:t})},_onMarkerDrag:function(t){var e=t.target;e._index!==undefined&&(e._snapped||this._adjustRectangleForMarkerMove(e))},_onMarkerDragEnd:function(t){var e=this._findCorners();this._adjustAllMarkers(e),this._cornerMarkers.forEach(function(t){delete t._oppositeCornerLatLng}),this._layer.setLatLngs(e),this._layer.redraw(),this._layer.fire("pm:markerdragend",{markerEvent:t}),this._fireEdit()},_adjustRectangleForMarkerMove:function(t){L.extend(t._origLatLng,t._latlng);var e=t.getLatLng();this._layer.setBounds(L.latLngBounds(e,t._oppositeCornerLatLng)),this._adjustAdjacentMarkers(t),this._layer.redraw()},_adjustRectangleForMarkerSnap:function(t){if(this.options.snappable){var e=t.target;this._adjustRectangleForMarkerMove(e)}},_adjustAllMarkers:function(t){t.length&&4==t.length?this._cornerMarkers.forEach(function(e,n){e.setLatLng(t[n])}):console.error("_adjustAllMarkers() requires an array of EXACTLY 4 LatLng coordinates")},_adjustAdjacentMarkers:function(t){if(t&&t.getLatLng&&t._oppositeCornerLatLng){var e=t.getLatLng(),n=t._oppositeCornerLatLng,i=[];this._findCorners().forEach(function(t){t.equals(e)||t.equals(n)||i.push(t)});var r=0;2==i.length&&this._cornerMarkers.forEach(function(t){var o=t.getLatLng();o.equals(e)||o.equals(n)||(t.setLatLng(i[r]),r+=1)})}else console.error("_adjustAdjacentMarkers() requires a valid Marker object")},_findCorners:function(){var t=this._layer.getBounds();return[t.getNorthWest(),t.getNorthEast(),t.getSouthEast(),t.getSouthWest()]}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(2));i["default"].Circle=i["default"].extend({initialize:function(t){this._layer=t,this._enabled=!1},toggleEdit:function(t){this.enabled()?this.disable():this.enable(t)},enabled:function(){return this._enabled},enable:function(t){var e=this;L.Util.setOptions(this,t),this._map=this._layer._map,this.enabled()||this.disable(),this._enabled=!0,this._initMarkers(),this._layer.on("remove",function(t){e.disable(t.target)})},disable:function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._layer;if(!this.enabled())return!1;if(t.pm._dragging)return!1;t.pm._enabled=!1,t.pm._layerGroup.clearLayers(),t.off("mousedown"),t.off("mouseup");var e=t._path;return L.DomUtil.removeClass(e,"leaflet-pm-draggable"),this._layerEdited&&this._layer.fire("pm:update",{}),this._layerEdited=!1,!0},_initMarkers:function(){var t=this._map;this._layerGroup&&this._layerGroup.clearLayers(),this._layerGroup=new L.LayerGroup,t.addLayer(this._layerGroup);var e=this._layer.getLatLng(),n=this._layer._radius,i=this._getLatLngOnCircle(e,n);this._centerMarker=this._createCenterMarker(e),this._outerMarker=this._createOuterMarker(i),this._markers=[this._centerMarker,this._outerMarker],this._createHintLine(this._centerMarker,this._outerMarker),this.options.snappable&&this._initSnappableMarkers()},_getLatLngOnCircle:function(t,e){var n=this._map.project(t),i=L.point(n.x+e,n.y);return this._map.unproject(i)},_resizeCircle:function(){this._syncHintLine(),this._syncCircleRadius(),this._fireEdit()},_moveCircle:function(t){var e=t.latlng;this._layer.setLatLng(e);var n=this._layer._radius,i=this._getLatLngOnCircle(e,n);this._outerMarker.setLatLng(i),this._syncHintLine(),this._fireEdit(),this._layer.fire("pm:centerplaced",{layer:this._layer,latlng:e})},_onMarkerDragStart:function(t){this._layer.fire("pm:markerdragstart",{markerEvent:t})},_onMarkerDragEnd:function(t){this._layer.fire("pm:markerdragend",{markerEvent:t})},_syncCircleRadius:function(){var t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng(),n=t.distanceTo(e);this._layer.setRadius(n)},_syncHintLine:function(){var t=this._centerMarker.getLatLng(),e=this._outerMarker.getLatLng();this._hintline.setLatLngs([t,e])},_createHintLine:function(t,e){var n=t.getLatLng(),i=e.getLatLng();this._hintline=L.polyline([n,i],this.options.hintlineStyle),this._hintline._pmTempLayer=!0,this._layerGroup.addLayer(this._hintline)},_createCenterMarker:function(t){var e=this._createMarker(t);return e.on("move",this._moveCircle,this),e},_createOuterMarker:function(t){var e=this._createMarker(t);return e.on("move",this._resizeCircle,this),e},_createMarker:function(t){var e=new L.Marker(t,{draggable:!0,icon:L.divIcon({className:"marker-icon"})});return e._origLatLng=t,e._pmTempLayer=!0,e.on("dragstart",this._onMarkerDragStart,this),e.on("dragend",this._onMarkerDragEnd,this),this._layerGroup.addLayer(e),e},_fireEdit:function(){this._layer.fire("pm:edit"),this._layerEdited=!0}})},function(t,e){},function(t,e){}]);