12345678 |
- /*!
- * 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;r<t.length;r++){var o=t[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++){if(0===r&&0===s&&!a(o[0][0])||!a(o[0][1]))throw new Error("coordinates must contain numbers");if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}}return i({type:"Polygon",coordinates:t},e,n)}function s(t,e,n){if(!t)throw new Error("coordinates is required");if(t.length<2)throw new Error("coordinates must be an array of two or more positions");if(!a(t[0][1])||!a(t[0][1]))throw new Error("coordinates must contain numbers");return i({type:"LineString",coordinates:t},e,n)}function a(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function u(t){return!!t&&t.constructor===Object}function l(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(t){if(!a(t))throw new Error("bbox must only contain numbers")})}function h(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}n.d(e,"a",function(){return i}),n.d(e,"e",function(){return r}),n.d(e,"d",function(){return s}),n.d(e,"b",function(){return a}),n.d(e,"c",function(){return u})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var r=i(n(5)),o=i(n(26)),s=L.Class.extend({includes:[o["default"],r["default"]],options:{snappable:!0,snapDistance:20,allowSelfIntersection:!0,draggable:!0},isPolygon:function(){return this._layer instanceof L.Polygon}});e["default"]=s},function(t,e,n){"use strict";function i(t,e,n){if(null!==t)for(var r,o,s,a,u,l,h,c,p=0,f=0,g=t.type,d="FeatureCollection"===g,_="Feature"===g,y=d?t.features.length:1,m=0;m<y;m++){u=(c=!!(h=d?t.features[m].geometry:_?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var v=0;v<u;v++){var I=0,E=0;if(null!==(a=c?h.geometries[v]:h)){l=a.coordinates;var L=a.type;switch(p=!n||"Polygon"!==L&&"MultiPolygon"!==L?0:1,L){case null:break;case"Point":e(l,f,m,I,E),f++,I++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++)e(l[r],f,m,I,E),f++,"MultiPoint"===L&&I++;"LineString"===L&&I++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(o=0;o<l[r].length-p;o++)e(l[r][o],f,m,I,E),f++;"MultiLineString"===L&&I++,"Polygon"===L&&E++}"Polygon"===L&&I++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for("MultiPolygon"===L&&(E=0),o=0;o<l[r].length;o++){for(s=0;s<l[r][o].length-p;s++)e(l[r][o][s],f,m,I,E),f++;E++}I++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)i(a.geometries[r],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function r(t,e){var n,i,r,o,s,a,u,l,h,c,p=0,f="FeatureCollection"===t.type,g="Feature"===t.type,d=f?t.features.length:1;for(n=0;n<d;n++){for(a=f?t.features[n].geometry:g?t.geometry:t,l=f?t.features[n].properties:g?t.properties:{},h=f?t.features[n].bbox:g?t.bbox:undefined,c=f?t.features[n].id:g?t.id:undefined,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,r=0;r<s;r++)if(null!==(o=u?a.geometries[r]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,p,l,h,c);break;case"GeometryCollection":for(i=0;i<o.geometries.length;i++)e(o.geometries[i],p,l,h,c);break;default:throw new Error("Unknown Geometry Type")}else e(null,p,l,h,c);p++}}function o(t,e,n){var i=n;return r(t,function(t,r,o,s,a){i=0===r&&n===undefined?t:e(i,t,r,o,s,a)}),i}function s(t,e){r(t,function(t,n,i,r,o){var s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return void e(Object(a.a)(t,i,{bbox:r,id:o}),n,0)}var u;switch(s){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon"}t.coordinates.forEach(function(t,r){var o={type:u,coordinates:t};e(Object(a.a)(o,i),n,r)})})}n.d(e,"a",function(){return i}),n.d(e,"c",function(){return o}),n.d(e,"b",function(){return s});var a=n(1)},function(t,e,n){"use strict";function i(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return r(e),e;throw new Error("No valid coordinates")}function r(t){if(t.length>1&&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.distance<s){i.setLatLng(n),i._snapped=!0;var u=this._snapLatLng||{},l=n||{};u.lat===l.lat&&u.lng===l.lng||(e._snapLatLng=n,i.fire("pm:snap",a),e._layer.fire("pm:snap",a))}else this._snapLatLng&&(this._unsnap(a),i._snapped=!1,a.marker.fire("pm:unsnap",a),this._layer.fire("pm:unsnap",a));return!0},_checkPrioritiySnapping:function(t){var e,n=this._map,i=t.segment[0],r=t.segment[1],o=t.latlng,s=this._getDistance(n,i,o),a=this._getDistance(n,r,o),u=s<a?i:r;return e=(s<a?s:a)<this.options.snapDistance?u:o,Object.assign({},e)},_createSnapList:function(){var t=this,e=[],n=[],i=this._map;i.eachLayer(function(r){if(r instanceof L.Polyline||r instanceof L.Marker||r instanceof L.CircleMarker){e.push(r),i.off("pm:remove",t._handleSnapLayerRemoval,t),i.on("pm:remove",t._handleSnapLayerRemoval,t);var o=L.polyline([],{color:"red",pmIgnore:!0});n.push(o)}}),e=(e=(e=e.filter(function(e){return t._layer!==e})).filter(function(t){return t._latlng||t._latlngs&&t._latlngs.length>0})).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<i.distance)&&((i=o).layer=e)}),i},_calcLayerDistances:function(t,e){var n,i=this,r=this._map,o=e instanceof L.Polygon,s=!(e instanceof L.Polygon)&&e instanceof L.Polyline,a=e instanceof L.Marker||e instanceof L.CircleMarker,u=t;if(o)n=e.getLatLngs()[0];else if(s)n=e.getLatLngs();else if(a)return n=e.getLatLng(),{latlng:Object.assign({},n),distance:this._getDistance(r,n,u)};var l,h;n.forEach(function(t,e){var s,a=t;s=o?e+1===n.length?0:e+1:e+1===n.length?undefined:e+1;var c=n[s];if(c){var p=i._getDistanceToSegment(r,u,a,c);(h===undefined||p<h)&&(h=p,l=[a,c])}return!0});var c=this._getClosestPointOnSegment(r,t,l[0],l[1]);return{latlng:Object.assign({},c),segment:l,distance:h}},_getClosestPointOnSegment:function(t,e,n,i){var r=t.getMaxZoom();r===Infinity&&(r=t.getZoom());var o=t.project(e,r),s=t.project(n,r),a=t.project(i,r),u=L.LineUtil.closestPointOnSegment(o,s,a);return t.unproject(u,r)},_getDistanceToSegment:function(t,e,n,i){var r=t.latLngToLayerPoint(e),o=t.latLngToLayerPoint(n),s=t.latLngToLayerPoint(i);return L.LineUtil.pointToSegmentDistance(r,o,s)},_getDistance:function(t,e,n){return t.latLngToLayerPoint(e).distanceTo(t.latLngToLayerPoint(n))}};e["default"]=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(1);e["default"]=function(t){var e,n,r={type:"FeatureCollection",features:[]};if("LineString"===(n="Feature"===t.type?t.geometry:t).type)e=[n.coordinates];else if("MultiLineString"===n.type)e=n.coordinates;else if("MultiPolygon"===n.type)e=[].concat.apply([],n.coordinates);else{if("Polygon"!==n.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=n.coordinates}return e.forEach(function(t){e.forEach(function(e){for(var n=0;n<t.length-1;n++)for(var o=n;o<e.length-1;o++){if(t===e){if(1===Math.abs(n-o))continue;if(0===n&&o===t.length-2&&t[n][0]===t[t.length-1][0]&&t[n][1]===t[t.length-1][1])continue}var s=function(t,e,n,i,r,o,s,a){var u,l,h,c,p,f={x:null,y:null,onLine1:!1,onLine2:!1};return 0==(u=(a-o)*(n-t)-(s-r)*(i-e))?null!==f.x&&null!==f.y&&f:(l=e-o,h=t-r,c=(s-r)*l-(a-o)*h,p=(n-t)*l-(i-e)*h,l=c/u,h=p/u,f.x=t+l*(n-t),f.y=e+l*(i-e),l>=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);i<r;)e[i]=t,++i;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var _=function(){};_.prototype.interfaces_=function(){return[]},_.prototype.getClass=function(){return _},_.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var y=function(){},m=function(){},v={MAX_VALUE:{configurable:!0}};m.isNaN=function(t){return Number.isNaN(t)},m.doubleToLongBits=function(t){return t},m.longBitsToDouble=function(t){return t},m.isInfinite=function(t){return!Number.isFinite(t)},v.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(m,v);var I=function(){},E=function(){},L=function(){},x=function kr(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=kr.NULL_ORDINATE;else if(1===arguments.length){var t=arguments[0];this.x=t.x,this.y=t.y,this.z=t.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=kr.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},N={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};x.prototype.setOrdinate=function(t,e){switch(t){case x.X:this.x=e;break;case x.Y:this.y=e;break;case x.Z:this.z=e;break;default:throw new y("Invalid ordinate index: "+t)}},x.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!_.equalsWithTolerance(this.x,e.x,n)&&!!_.equalsWithTolerance(this.y,e.y,n)}},x.prototype.getOrdinate=function(t){switch(t){case x.X:return this.x;case x.Y:return this.y;case x.Z:return this.z}throw new y("Invalid ordinate index: "+t)},x.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||m.isNaN(this.z))&&m.isNaN(t.z)},x.prototype.equals=function(t){return t instanceof x&&this.equals2D(t)},x.prototype.equalInZ=function(t,e){return _.equalsWithTolerance(this.z,t.z,e)},x.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},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 t<e?-1:t>e?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 e<r&&(r=e),n<r&&(r=n),i<r&&(r=i),r},O.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],o=arguments[2];return i<r?r:i>o?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.value<t?-1:this.value>t?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._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},A.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),i=A.magnitude(n._hi),r=A.TEN.pow(i);(n=n.divide(r)).gt(A.TEN)?(n=n.divide(A.TEN),i+=1):n.lt(A.ONE)&&(n=n.multiply(A.TEN),i-=1);for(var o=i+1,s=new T,a=A.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var h=!1,c=0;l>9?(h=!0,c="9"):c="0"+l,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._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._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._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},A.prototype.add=function(){if(arguments[0]instanceof A){var t=arguments[0];return A.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return A.copy(this).selfAdd(e)}},A.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof A){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}},A.prototype.gt=function(t){return(this._hi>t._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 r=t.charAt(e);"-"!==r&&"+"!==r||(e++,"-"===r&&(i=!0))}for(var o=new A,s=0,a=0,u=0;!(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;i<e;i++)n.append(t);return n.toString()},k.PI.get=function(){return new A(3.141592653589793,1.2246467991473532e-16)},k.TWO_PI.get=function(){return new A(6.283185307179586,2.4492935982947064e-16)},k.PI_2.get=function(){return new A(1.5707963267948966,6.123233995736766e-17)},k.E.get=function(){return new A(2.718281828459045,1.4456468917292502e-16)},k.NaN.get=function(){return new A(m.NaN,m.NaN)},k.EPS.get=function(){return 1.23259516440783e-32},k.SPLIT.get=function(){return 134217729},k.MAX_PRINT_DIGITS.get=function(){return 32},k.TEN.get=function(){return A.valueOf(10)},k.ONE.get=function(){return A.valueOf(1)},k.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},k.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(A,k);var F=function(){},G={DP_SAFE_EPSILON:{configurable:!0}};F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.orientationIndex=function(t,e,n){var i=F.orientationIndexFilter(t,e,n);if(i<=1)return i;var r=A.valueOf(e.x).selfAdd(-t.x),o=A.valueOf(e.y).selfAdd(-t.y),s=A.valueOf(n.x).selfAdd(-e.x),a=A.valueOf(n.y).selfAdd(-e.y);return r.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},F.signOfDet2x2=function(t,e,n,i){return t.multiply(i).selfSubtract(e.multiply(n)).signum()},F.intersection=function(t,e,n,i){var r=A.valueOf(i.y).selfSubtract(n.y).selfMultiply(A.valueOf(e.x).selfSubtract(t.x)),o=A.valueOf(i.x).selfSubtract(n.x).selfMultiply(A.valueOf(e.y).selfSubtract(t.y)),s=r.subtract(o),a=A.valueOf(i.x).selfSubtract(n.x).selfMultiply(A.valueOf(t.y).selfSubtract(n.y)),u=A.valueOf(i.y).selfSubtract(n.y).selfMultiply(A.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),h=A.valueOf(t.x).selfAdd(A.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),c=A.valueOf(e.x).selfSubtract(t.x).selfMultiply(A.valueOf(t.y).selfSubtract(n.y)),p=A.valueOf(e.y).selfSubtract(t.y).selfMultiply(A.valueOf(t.x).selfSubtract(n.x)),f=c.subtract(p).selfDivide(s).doubleValue(),g=A.valueOf(n.y).selfAdd(A.valueOf(i.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();return new x(h,g)},F.orientationIndexFilter=function(t,e,n){var i=null,r=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=r-o;if(r>0){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;s<e+r;s++)n[i+o]=t[s],o++},z.getProperty=function(t){return{"line.separator":"\n"}[t]};var j=function Gr(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof Gr&&arguments[1]instanceof Gr){var i=arguments[0],r=arguments[1];this.x=i.y*r.w-r.y*i.w,this.y=r.x*i.w-i.x*r.w,this.w=i.x*r.y-r.x*i.y}else if(arguments[0]instanceof x&&arguments[1]instanceof x){var o=arguments[0],s=arguments[1];this.x=o.y-s.y,this.y=s.x-o.x,this.w=o.x*s.y-s.x*o.y}}else if(3===arguments.length){var a=arguments[0],u=arguments[1],l=arguments[2];this.x=a,this.y=u,this.w=l}else if(4===arguments.length){var h=arguments[0],c=arguments[1],p=arguments[2],f=arguments[3],g=h.y-c.y,d=c.x-h.x,_=h.x*c.y-c.x*h.y,y=p.y-f.y,m=f.x-p.x,v=p.x*f.y-f.x*p.y;this.x=d*v-m*_,this.y=y*_-g*v,this.w=g*m-y*d}};j.prototype.getY=function(){var t=this.y/this.w;if(m.isNaN(t)||m.isInfinite(t))throw new V;return t},j.prototype.getX=function(){var t=this.x/this.w;if(m.isNaN(t)||m.isInfinite(t))throw new V;return t},j.prototype.getCoordinate=function(){var t=new x;return t.x=this.getX(),t.y=this.getY(),t},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j},j.intersection=function(t,e,n,i){var r=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-i.y,u=i.x-n.x,l=n.x*i.y-i.x*n.y,h=r*u-a*o,c=(o*l-u*s)/h,p=(a*s-r*l)/h;if(m.isNaN(c)||m.isInfinite(c)||m.isNaN(p)||m.isInfinite(p))throw new V;return new x(c,p)};var X=function Br(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof x){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Br){var e=arguments[0];this.init(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.init(r,o,s,a)}},Y={serialVersionUID:{configurable:!0}};X.prototype.getArea=function(){return this.getWidth()*this.getHeight()},X.prototype.equals=function(t){if(!(t instanceof X))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},X.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new X;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,i=this._maxx<t._maxx?this._maxx:t._maxx,r=this._maxy<t._maxy?this._maxy:t._maxy;return new X(e,i,n,r)},X.prototype.isNull=function(){return this._maxx<this._minx},X.prototype.getMaxX=function(){return this._maxx},X.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof x){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof X){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}},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._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof x){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||i>this._maxy||i<this._miny)}},X.prototype.getMinY=function(){return this._miny},X.prototype.getMinX=function(){return this._minx},X.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof x){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof X){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),i<this._miny&&(this._miny=i),i>this._maxy&&(this._maxy=i))}},X.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},X.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},X.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},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];r<o?(this._minx=r,this._maxx=o):(this._minx=o,this._maxx=r),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},X.prototype.getMaxY=function(){return this._maxy},X.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),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.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var i=arguments[0],r=arguments[1],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||h<a||(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(i.y,r.y),h=Math.max(i.y,r.y),l>u||h<a))}},Y.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(X,Y);var H={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},W=function(t){this.geometryFactory=t||new ye};W.prototype.read=function(t){var e,n,i;t=t.replace(/[\n\r]/g," ");var r=H.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((r=H.emptyTypeStr.exec(t))[2]=void 0),r&&(n=r[1].toLowerCase(),i=r[2],K[n]&&(e=K[n].apply(this,[i]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},W.prototype.write=function(t){return this.extractGeometry(t)},W.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!J[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+J[e].apply(this,[t])+")"};var J={coordinate:function(t){return t.x+" "+t.y},point:function(t){return J.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push("("+J.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,i=t._points._coordinates.length;n<i;++n)e.push(J.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,i=t._points._coordinates.length;n<i;++n)e.push(J.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push("("+J.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+J.linestring.apply(this,[t._shell])+")");for(var n=0,i=t._holes.length;n<i;++n)e.push("("+J.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push("("+J.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,i=t._geometries.length;n<i;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},K={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(H.spaces);return this.geometryFactory.createPoint(new x(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint();for(var e,n=t.trim().split(","),i=[],r=0,o=n.length;r<o;++r)e=n[r].replace(H.trimParens,"$1"),i.push(K.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(i)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),i=[],r=0,o=n.length;r<o;++r)e=n[r].trim().split(H.spaces),i.push(new x(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(i)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),i=[],r=0,o=n.length;r<o;++r)e=n[r].trim().split(H.spaces),i.push(new x(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(i)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(H.parenComma),i=[],r=0,o=n.length;r<o;++r)e=n[r].replace(H.trimParens,"$1"),i.push(K.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(i)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,i,r,o=t.trim().split(H.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(H.trimParens,"$1"),n=K.linestring.apply(this,[e]),i=this.geometryFactory.createLinearRing(n._points),0===a?r=i:s.push(i);return this.geometryFactory.createPolygon(r,s)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(H.doubleParenComma),i=[],r=0,o=n.length;r<o;++r)e=n[r].replace(H.trimParens,"$1"),i.push(K.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(i)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],i=0,r=e.length;i<r;++i)n.push(this.read(e[i]));return this.geometryFactory.createGeometryCollection(n)}},Z=function(t){this.parser=new W(t)};Z.prototype.write=function(t){return this.parser.write(t)},Z.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var Q=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),$=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){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.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Q),tt=function(){};tt.prototype.interfaces_=function(){return[]},tt.prototype.getClass=function(){return tt},tt.shouldNeverReachHere=function(){if(0===arguments.length)tt.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new $("Should never reach here"+(null!==t?": "+t:""))}},tt.isTrue=function(){var t,e;if(1===arguments.length)t=arguments[0],tt.isTrue(t,null);else if(2===arguments.length&&(t=arguments[0],e=arguments[1],!t))throw null===e?new $:new $(e)},tt.equals=function(){var t,e,n;if(2===arguments.length)t=arguments[0],e=arguments[1],tt.equals(t,e,null);else if(3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],!e.equals(t)))throw new $("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var et=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new x,this._intPt[1]=new x,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},nt={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};et.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},et.prototype.getTopologySummary=function(){var t=new T;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},et.prototype.computeIntersection=function(t,e,n,i){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(t,e,n,i)},et.prototype.getIntersectionNum=function(){return this._result},et.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},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;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}},et.prototype.getIntersection=function(t){return this._intPt[t]},et.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},et.prototype.hasIntersection=function(){return this._result!==et.NO_INTERSECTION},et.prototype.getEdgeDistance=function(t,e){return et.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},et.prototype.isCollinear=function(){return this._result===et.COLLINEAR_INTERSECTION},et.prototype.toString=function(){return Z.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Z.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},et.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},et.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},et.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},et.prototype.interfaces_=function(){return[]},et.prototype.getClass=function(){return et},et.computeEdgeDistance=function(t,e,n){var i=Math.abs(n.x-e.x),r=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=i>r?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)<o&&(r=e,o=Math.abs(e)),Math.abs(n)<o&&(r=n,o=Math.abs(n)),Math.abs(i)<o&&(r=i),r},e.prototype.checkDD=function(t,e,n,i,r){var o=F.intersection(t,e,n,i),s=this.isInSegmentEnvelopes(o);z.out.println("DD in env = "+s+" --------------------- "+o),r.distance(o)>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.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.x<i.x?n.x:i.x,h=n.y<i.y?n.y:i.y,c=n.x>i.x?n.x:i.x,p=n.y>i.y?n.y:i.y,f=((o>l?o:l)+(a<c?a:c))/2,g=((s>h?s:h)+(u<p?u:p))/2;r.x=f,r.y=g,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.computeIntersect=function(e,n,i,r){if(this._isProper=!1,!X.intersects(e,n,i,r))return t.NO_INTERSECTION;var o=st.orientationIndex(e,n,i),s=st.orientationIndex(e,n,r);if(o>0&&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 s<o&&(o=s,r=e),(s=st.distancePointLine(n,t,e))<o&&(o=s,r=n),(s=st.distancePointLine(i,t,e))<o&&(o=s,r=i),r},e}(et),rt=function(){};rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.orientationIndex=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return rt.signOfDet2x2(i,r,o,s)},rt.signOfDet2x2=function(t,e,n,i){var r=null,o=null,s=null;if(r=1,0===t||0===i)return 0===e||0===n?0:e>0?n>0?-r:r:n>0?r:-r;if(0===e||0===n)return i>0?t>0?r:-r:t>0?-r:r;if(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(e<i+i)return r}else{if(e>i+i)return-r;n=t-n,i=e-i,r=-r}if(0===i)return 0===n?0:-r;if(0===n)return r;if(s=Math.floor(t/n),t-=s*n,(e-=s*i)<0)return r;if(e>i)return-r;if(n>t+t){if(i<e+e)return-r}else{if(i>e+e)return r;t=n-t,e=i-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}};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.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,i=e.x;return n>i&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var r=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;a<o&&(u=-u),u>0&&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;o<e.size();o++)if(e.getCoordinate(o,i),e.getCoordinate(o-1,r),n.countSegment(i,r),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof x&&arguments[1]instanceof Array){for(var s=arguments[0],a=arguments[1],u=new ot(s),l=1;l<a.length;l++){var h=a[l],c=a[l-1];if(u.countSegment(h,c),u.isOnSegment())return u.getLocation()}return u.getLocation()}};var st=function(){},at={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.orientationIndex=function(t,e,n){return F.orientationIndex(t,e,n)},st.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,i=1;i<t.length-1;i++){var r=t[i].x-n,o=t[i+1].y;e+=r*(t[i-1].y-o)}return e/2}if(M(arguments[0],B)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new x,l=new x,h=new x;s.getCoordinate(0,l),s.getCoordinate(1,h);var c=l.x;h.x-=c;for(var p=0,f=1;f<a-1;f++)u.y=l.y,l.x=h.x,l.y=h.y,s.getCoordinate(f+1,h),h.x-=c,p+=l.x*(u.y-h.y);return p/2}},st.distanceLineLine=function(t,e,n,i){if(t.equals(e))return st.distancePointLine(t,n,i);if(n.equals(i))return st.distancePointLine(i,t,e);var r=!1;if(X.intersects(t,e,n,i)){var o=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(0===o)r=!0;else{var s=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||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;s<e;s++){t.getCoordinate(s,i);var a=i.x,u=i.y,l=a-r,h=u-o;n+=Math.sqrt(l*l+h*h),r=a,o=u}return n},st.isCCW=function(t){var e=t.length-1;if(e<3)throw new y("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],i=0,r=1;r<=e;r++){var o=t[r];o.y>n.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<e.length-1;i++){var r=st.distancePointLine(t,e[i],e[i+1]);r<n&&(n=r)}return n}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=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;i<e.length;i++){var r=e[i-1],o=e[i];if(n.computeIntersection(t,r,o),n.hasIntersection())return!0}return!1},at.CLOCKWISE.get=function(){return-1},at.RIGHT.get=function(){return st.CLOCKWISE},at.COUNTERCLOCKWISE.get=function(){return 1},at.LEFT.get=function(){return st.COUNTERCLOCKWISE},at.COLLINEAR.get=function(){return 0},at.STRAIGHT.get=function(){return st.COLLINEAR},Object.defineProperties(st,at);var ut=function(){};ut.prototype.filter=function(t){},ut.prototype.interfaces_=function(){return[]},ut.prototype.getClass=function(){return ut};var lt=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},ht={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};lt.prototype.isGeometryCollection=function(){return this.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION},lt.prototype.getFactory=function(){return this._factory},lt.prototype.getGeometryN=function(t){return this},lt.prototype.getArea=function(){return 0},lt.prototype.isRectangle=function(){return!1},lt.prototype.equals=function(){if(arguments[0]instanceof lt){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof lt))return!1;var n=e;return this.equalsExact(n)}},lt.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},lt.prototype.geometryChanged=function(){this.apply(lt.geometryChangedFilter)},lt.prototype.geometryChangedAction=function(){this._envelope=null},lt.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},lt.prototype.getLength=function(){return 0},lt.prototype.getNumGeometries=function(){return 1},lt.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,i)}},lt.prototype.getUserData=function(){return this._userData},lt.prototype.getSRID=function(){return this._SRID},lt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},lt.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION)throw new y("This method does not support GeometryCollection arguments")},lt.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},lt.prototype.norm=function(){var t=this.copy();return t.normalize(),t},lt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},lt.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new X(this._envelope)},lt.prototype.setSRID=function(t){this._SRID=t},lt.prototype.setUserData=function(t){this._userData=t},lt.prototype.compare=function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var r=n.next(),o=i.next(),s=r.compareTo(o);if(0!==s)return s}return n.hasNext()?1:i.hasNext()?-1:0},lt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},lt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===lt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===lt.SORTINDEX_MULTIPOINT||this.getSortIndex()===lt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===lt.SORTINDEX_MULTIPOLYGON},lt.prototype.interfaces_=function(){return[E,I,e]},lt.prototype.getClass=function(){return lt},lt.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},lt.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},ht.serialVersionUID.get=function(){return 0x799ea46522854c00},ht.SORTINDEX_POINT.get=function(){return 0},ht.SORTINDEX_MULTIPOINT.get=function(){return 1},ht.SORTINDEX_LINESTRING.get=function(){return 2},ht.SORTINDEX_LINEARRING.get=function(){return 3},ht.SORTINDEX_MULTILINESTRING.get=function(){return 4},ht.SORTINDEX_POLYGON.get=function(){return 5},ht.SORTINDEX_MULTIPOLYGON.get=function(){return 6},ht.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},ht.geometryChangedFilter.get=function(){return ct},Object.defineProperties(lt,ht);var ct=function(){};ct.interfaces_=function(){return[ut]},ct.filter=function(t){t.geometryChangedAction()};var pt=function(){};pt.prototype.filter=function(t){},pt.prototype.interfaces_=function(){return[]},pt.prototype.getClass=function(){return pt};var ft=function(){},gt={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};ft.prototype.isInBoundary=function(t){},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},gt.Mod2BoundaryNodeRule.get=function(){return dt},gt.EndPointBoundaryNodeRule.get=function(){return _t},gt.MultiValentEndPointBoundaryNodeRule.get=function(){return yt},gt.MonoValentEndPointBoundaryNodeRule.get=function(){return mt},gt.MOD2_BOUNDARY_RULE.get=function(){return new dt},gt.ENDPOINT_BOUNDARY_RULE.get=function(){return new _t},gt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new yt},gt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new mt},gt.OGC_SFS_BOUNDARY_RULE.get=function(){return ft.MOD2_BOUNDARY_RULE},Object.defineProperties(ft,gt);var dt=function(){};dt.prototype.isInBoundary=function(t){return t%2==1},dt.prototype.interfaces_=function(){return[ft]},dt.prototype.getClass=function(){return dt};var _t=function(){};_t.prototype.isInBoundary=function(t){return t>0},_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<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,i=this.array_.length;n<i;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(Lt),Nt=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new n;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(Et),bt=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.ensureCapacity(n.length),this.add(n,i)}}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[0],n=arguments[1],i=!1,r=e.iterator();r.hasNext();)this.add(r.next(),n),i=!0;return i}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){if(1===arguments.length){var e=arguments[0];t.prototype.add.call(this,e)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof x&&"boolean"==typeof arguments[1]){var r=arguments[0];if(!arguments[1]&&this.size()>=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<a.length;l++)this.add(a[l],u);else for(var h=a.length-1;h>=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(c<f&&this.get(c).equals2D(p))return null}}t.prototype.add.call(this,c,p)}}else if(4===arguments.length){var g=arguments[0],d=arguments[1],_=arguments[2],y=arguments[3],m=1;_>y&&(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.length;n++){var i=t[n];if(Ct.indexOf(i,e)<0)return i}return null},Ct.scroll=function(t,e){var n=Ct.indexOf(e,t);if(n<0)return null;var i=new Array(t.length).fill(null);z.arraycopy(t,n,i,0,t.length-n),z.arraycopy(t,0,i,t.length-n,n),z.arraycopy(i,0,t,0,t.length)},Ct.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2];if(i===r)return!0;if(null===i||null===r)return!1;if(i.length!==r.length)return!1;for(var s=0;s<i.length;s++)if(0!==o.compare(i[s],r[s]))return!1;return!0}},Ct.intersection=function(t,e){for(var n=new bt,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()},Ct.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},Ct.removeRepeatedPoints=function(t){return Ct.hasRepeatedPoints(t)?new bt(t,!1).toCoordinateArray():t},Ct.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var r=t[i];t[i]=t[e-i],t[e-i]=r}},Ct.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var i=new Array(e).fill(null);if(0===e)return i;for(var r=0,o=0;o<t.length;o++)null!==t[o]&&(i[r++]=t[o]);return i},Ct.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new x(t[n]);return e}if(5===arguments.length)for(var i=arguments[0],r=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new x(i[r+u])},Ct.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=e[t.length-n-1];if(0!==i.compareTo(r))return!1}return!0},Ct.envelope=function(t){for(var e=new X,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},Ct.toCoordinateArray=function(t){return t.toArray(Ct.coordArrayType)},Ct.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},Ct.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},Ct.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,i=t[e].compareTo(t[n]);if(0!==i)return i}return 1},Ct.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(0!==i)return i;n++}return n<e.length?-1:n<t.length?1:0},Ct.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},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),n<e&&(i=0);var r=new Array(i).fill(null);if(0===i)return r;for(var o=0,s=e;s<=n;s++)r[o++]=t[s];return r},Object.defineProperties(Ct,St);var wt=function(){};wt.prototype.compare=function(t,e){return Ct.compare(t,e)},wt.prototype.interfaces_=function(){return[L]},wt.prototype.getClass=function(){return wt};var Mt=function(){};Mt.prototype.compare=function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(0===n.length)return 0;var r=Ct.compare(n,i);return Ct.isEqualReversed(n,i)?0:r},Mt.prototype.OLDcompare=function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(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;u<n.length;u++){var l=n[s].compareTo(i[a]);if(0!==l)return l;s+=r,a+=o}return 0},Mt.prototype.interfaces_=function(){return[L]},Mt.prototype.getClass=function(){return Mt};var Ot=function(){};Ot.prototype.get=function(){},Ot.prototype.put=function(){},Ot.prototype.size=function(){},Ot.prototype.values=function(){},Ot.prototype.entrySet=function(){};var Pt=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}(Ot);(i.prototype=new Error).name="OperationNotSupported",(r.prototype=new vt).contains=function(){};var Tt=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.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new Rt(this)},e}(r),Rt=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new n;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new i},e}(Et),Dt=0;(h.prototype=new Pt).get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},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<n;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},p.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},p.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},p.prototype.remove=function(t){throw new i},p.prototype.size=function(){return this.array_.length},p.prototype.isEmpty=function(){return 0===this.array_.length},p.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},p.prototype.iterator=function(){return new kt(this)};var kt=function(t){this.treeSet_=t,this.position_=0};kt.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new n;return this.treeSet_.array_[this.position_++]},kt.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},kt.prototype.remove=function(){throw new i};var Ft=function(){};Ft.sort=function(){var t,e,n,i,r=arguments[0];if(1===arguments.length)i=function(t,e){return t.compareTo(e)},r.sort(i);else if(2===arguments.length)n=arguments[1],i=function(t,e){return n.compare(t,e)},r.sort(i);else if(3===arguments.length){(e=r.slice(arguments[1],arguments[2])).sort();var o=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length));for(r.splice(0,r.length),t=0;t<o.length;t++)r.push(o[t])}else if(4===arguments.length)for(e=r.slice(arguments[1],arguments[2]),n=arguments[3],i=function(t,e){return n.compare(t,e)},e.sort(i),o=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length)),r.splice(0,r.length),t=0;t<o.length;t++)r.push(o[t])},Ft.asList=function(t){for(var e=new xt,n=0,i=t.length;n<i;n++)e.add(t[n]);return e};var Gt=function(){},Bt={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Bt.P.get=function(){return 0},Bt.L.get=function(){return 1},Bt.A.get=function(){return 2},Bt.FALSE.get=function(){return-1},Bt.TRUE.get=function(){return-2},Bt.DONTCARE.get=function(){return-3},Bt.SYM_FALSE.get=function(){return"F"},Bt.SYM_TRUE.get=function(){return"T"},Bt.SYM_DONTCARE.get=function(){return"*"},Bt.SYM_P.get=function(){return"0"},Bt.SYM_L.get=function(){return"1"},Bt.SYM_A.get=function(){return"2"},Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.toDimensionSymbol=function(t){switch(t){case Gt.FALSE:return Gt.SYM_FALSE;case Gt.TRUE:return Gt.SYM_TRUE;case Gt.DONTCARE:return Gt.SYM_DONTCARE;case Gt.P:return Gt.SYM_P;case Gt.L:return Gt.SYM_L;case Gt.A:return Gt.SYM_A}throw new y("Unknown dimension value: "+t)},Gt.toDimensionValue=function(t){switch(D.toUpperCase(t)){case Gt.SYM_FALSE:return Gt.FALSE;case Gt.SYM_TRUE:return Gt.TRUE;case Gt.SYM_DONTCARE:return Gt.DONTCARE;case Gt.SYM_P:return Gt.P;case Gt.SYM_L:return Gt.L;case Gt.SYM_A:return Gt.A}throw new y("Unknown dimension symbol: "+t)},Object.defineProperties(Gt,Bt);var qt=function(){};qt.prototype.filter=function(t){},qt.prototype.interfaces_=function(){return[]},qt.prototype.getClass=function(){return qt};var Ut=function(){};Ut.prototype.filter=function(t,e){},Ut.prototype.isDone=function(){},Ut.prototype.isGeometryChanged=function(){},Ut.prototype.interfaces_=function(){return[]},Ut.prototype.getClass=function(){return Ut};var Vt=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new y("geometries must not contain null elements")}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new X,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var i=this._geometries[n].getCoordinates(),r=0;r<i.length;r++)t[++e]=i[r];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var i=e;if(this._geometries.length!==i._geometries.length)return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].equalsExact(i._geometries[r],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();Ft.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=Gt.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=Gt.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new p(Ft.asList(this._geometries)),n=new p(Ft.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var i=arguments[0],r=arguments[1],o=i,s=this.getNumGeometries(),a=o.getNumGeometries(),u=0;u<s&&u<a;){var l=this.getGeometryN(u),h=o.getGeometryN(u),c=l.compareToSameClass(h,r);if(0!==c)return c;u++}return u<s?1:u<a?-1:0}},e.prototype.apply=function(){if(M(arguments[0],pt))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(M(arguments[0],Ut)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(this._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(M(arguments[0],qt)){var r=arguments[0];r.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(r)}else if(M(arguments[0],ut)){var s=arguments[0];s.filter(this);for(var a=0;a<this._geometries.length;a++)this._geometries[a].apply(s)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),tt.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n<this._geometries.length;n++)e._geometries[n]=this._geometries[n].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(lt),zt=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_MULTILINESTRING},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 this.isClosed()?Gt.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new jt(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[At]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(Vt),jt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=ft.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}};jt.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},jt.prototype.getBoundary=function(){return this._geom instanceof Jt?this.boundaryLineString(this._geom):this._geom instanceof zt?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},jt.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},jt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},jt.prototype.computeBoundaryCoordinates=function(t){var e=new xt;this._endpointMap=new h;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(this.addEndpoint(i.getCoordinateN(0)),this.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var r=this._endpointMap.entrySet().iterator();r.hasNext();){var o=r.next(),s=o.getValue().count;this._bnRule.isInBoundary(s)&&e.add(o.getKey())}return Ct.toCoordinateArray(e)},jt.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Xt,this._endpointMap.put(t,e)),e.count++},jt.prototype.interfaces_=function(){return[]},jt.prototype.getClass=function(){return jt},jt.getBoundary=function(){if(1===arguments.length){var t=arguments[0];return new jt(t).getBoundary()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return new jt(e,n).getBoundary()}};var Xt=function(){this.count=null};Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt};var Yt=function(){},Ht={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Yt.prototype.interfaces_=function(){return[]},Yt.prototype.getClass=function(){return Yt},Yt.chars=function(t,e){for(var n=new Array(e).fill(null),i=0;i<e;i++)n[i]=t;return String(n)},Yt.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new function(){},n=new function(){}(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var i=arguments[0],r=arguments[1],o="",s=new function(){}(new function(){}(Yt.getStackTrace(i))),a=0;a<r;a++)try{o+=s.readLine()+Yt.NEWLINE}catch(t){if(!(t instanceof f))throw t;tt.shouldNeverReachHere()}return o}},Yt.split=function(t,e){for(var n=e.length,i=new xt,r=""+t,o=r.indexOf(e);o>=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;u<a.length;u++)a[u]=i.get(u);return a},Yt.toString=function(){if(1===arguments.length){var t=arguments[0];return Yt.SIMPLE_ORDINATE_FORMAT.format(t)}},Yt.spaces=function(t){return Yt.chars(" ",t)},Ht.NEWLINE.get=function(){return z.getProperty("line.separator")},Ht.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Yt,Ht);var Wt=function(){};Wt.prototype.interfaces_=function(){return[]},Wt.prototype.getClass=function(){return Wt},Wt.copyCoord=function(t,e,n,i){for(var r=Math.min(t.getDimension(),n.getDimension()),o=0;o<r;o++)n.setOrdinate(i,o,t.getOrdinate(e,o))},Wt.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,B.X)===t.getOrdinate(e-1,B.X)&&t.getOrdinate(0,B.Y)===t.getOrdinate(e-1,B.Y)},Wt.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var i=Math.min(t.getDimension(),e.getDimension()),r=0;r<n;r++)for(var o=0;o<i;o++){var s=t.getOrdinate(r,o),a=e.getOrdinate(r,o);if(!(t.getOrdinate(r,o)===e.getOrdinate(r,o)||m.isNaN(s)&&m.isNaN(a)))return!1}return!0},Wt.extend=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();if(Wt.copy(e,0,i,0,r),r>0)for(var o=r;o<n;o++)Wt.copy(e,r-1,i,o,1);return i},Wt.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),i=0;i<=n;i++)Wt.swap(t,i,e-i)},Wt.swap=function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var r=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,r)}},Wt.copy=function(t,e,n,i,r){for(var o=0;o<r;o++)Wt.copyCoord(t,e+o,n,i+o)},Wt.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),i=new T;i.append("(");for(var r=0;r<e;r++){r>0&&i.append(" ");for(var o=0;o<n;o++)o>0&&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;o<n;o++)Wt.copy(e,0,i,o,1);return i};var Jt=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new X:this._points.expandEnvelope(new X)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var i=e;if(this._points.size()!==i._points.size())return!1;for(var r=0;r<this._points.size();r++)if(!this.equal(this._points.getCoordinate(r),i._points.getCoordinate(r),n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e)))return this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0&&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<this._points.size()&&n<t._points.size();){var i=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==i)return i;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var r=arguments[0];return arguments[1].compare(this._points,r._points)}},e.prototype.apply=function(){if(M(arguments[0],pt))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(M(arguments[0],Ut)){var n=arguments[0];if(0===this._points.size())return null;for(var i=0;i<this._points.size()&&(n.filter(this._points,i),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else M(arguments[0],qt)?arguments[0].filter(this):M(arguments[0],ut)&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new jt(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new y("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[At]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(lt),Kt=function(){};Kt.prototype.interfaces_=function(){return[]},Kt.prototype.getClass=function(){return Kt};var Zt=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new X;var t=new X;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return Gt.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(M(arguments[0],pt)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(M(arguments[0],Ut)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else M(arguments[0],qt)?arguments[0].filter(this):M(arguments[0],ut)&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),tt.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[Kt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(lt),Qt=function(){};Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt};var $t=function(t){function e(e,n,i){if(t.call(this,i),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new y("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new y("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];for(var r=0;r<this._holes.length;r++)for(var o=this._holes[r].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(st.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(st.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var i=t.getX(n);if(i!==e.getMinX()&&i!==e.getMaxX())return!1;var r=t.getY(n);if(r!==e.getMinY()&&r!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o==(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var i=e,r=this._shell,o=i._shell;if(!r.equalsExact(o,n))return!1;if(this._holes.length!==i._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(i._holes[s],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);Ft.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var i=new Array(e.getCoordinates().length-1).fill(null);z.arraycopy(e.getCoordinates(),0,i,0,i.length);var r=Ct.minCoordinate(e.getCoordinates());Ct.scroll(i,r),z.arraycopy(i,0,e.getCoordinates(),0,i.length),e.getCoordinates()[i.length]=i[0],st.isCCW(e.getCoordinates())===n&&Ct.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var i=arguments[0],r=arguments[1],o=i,s=this._shell,a=o._shell,u=s.compareToSameClass(a,r);if(0!==u)return u;for(var l=this.getNumInteriorRing(),h=o.getNumInteriorRing(),c=0;c<l&&c<h;){var p=this.getInteriorRingN(c),f=o.getInteriorRingN(c),g=p.compareToSameClass(f,r);if(0!==g)return g;c++}return c<l?1:c<h?-1:0}},e.prototype.apply=function(t){if(M(t,pt)){this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(M(t,Ut)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(this._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(M(t,qt))t.filter(this);else if(M(t,ut)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)this._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var n=0;n<this._holes.length;n++)e._holes[n]=this._holes[n].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),i=0;i<n.length;i++)n[i]=this._holes[i].copy();return new e(t,n,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[Qt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(lt),te=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_MULTIPOINT},e.prototype.isValid=function(){return!0},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.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return Gt.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Kt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(Vt),ee=function(t){function e(e,n){e instanceof x&&n instanceof ye&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return lt.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return Gt.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return Wt.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new y("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new y("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 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;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new xt,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),i=0;i<n.getNumGeometries();i++)t.add(n.getGeometryN(i));var r=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(r))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Qt]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(Vt),ie=function(t){this._factory=t||null,this._isUserDataCopied=!1},re={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};ie.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},ie.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},ie.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Vt?this.editGeometryCollection(t,e):t instanceof $t?this.editPolygon(t,e):t instanceof Zt?e.edit(t,this._factory):t instanceof Jt?e.edit(t,this._factory):(tt.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},ie.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),i=new xt,r=0;r<n.getNumGeometries();r++){var o=this.edit(n.getGeometryN(r),e);null===o||o.isEmpty()||i.add(o)}return n.getClass()===te?this._factory.createMultiPoint(i.toArray([])):n.getClass()===zt?this._factory.createMultiLineString(i.toArray([])):n.getClass()===ne?this._factory.createMultiPolygon(i.toArray([])):this._factory.createGeometryCollection(i.toArray([]))},ie.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var i=this.edit(n.getExteriorRing(),e);if(null===i||i.isEmpty())return this._factory.createPolygon();for(var r=new xt,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||r.add(s)}return this._factory.createPolygon(i,r.toArray([]))},ie.prototype.interfaces_=function(){return[]},ie.prototype.getClass=function(){return ie},ie.GeometryEditorOperation=function(){},re.NoOpGeometryOperation.get=function(){return oe},re.CoordinateOperation.get=function(){return se},re.CoordinateSequenceOperation.get=function(){return ae},Object.defineProperties(ie,re);var oe=function(){};oe.prototype.edit=function(t,e){return t},oe.prototype.interfaces_=function(){return[ie.GeometryEditorOperation]},oe.prototype.getClass=function(){return oe};var se=function(){};se.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof ee?e.createLinearRing(n):t instanceof Jt?e.createLineString(n):t instanceof Zt?n.length>0?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;e<t;e++)this._coordinates[e]=new x}else if(M(arguments[0],B)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)this._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var r=arguments[0],o=arguments[1];this._coordinates=r,this._dimension=o,null===r&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],a=arguments[1];this._coordinates=new Array(s).fill(null),this._dimension=a;for(var u=0;u<s;u++)this._coordinates[u]=new x}},le={serialVersionUID:{configurable:!0}};ue.prototype.setOrdinate=function(t,e,n){switch(e){case B.X:this._coordinates[t].x=n;break;case B.Y:this._coordinates[t].y=n;break;case B.Z:this._coordinates[t].z=n;break;default:throw new y("invalid ordinateIndex")}},ue.prototype.size=function(){return this._coordinates.length},ue.prototype.getOrdinate=function(t,e){switch(e){case B.X:return this._coordinates[t].x;case B.Y:return this._coordinates[t].y;case B.Z:return this._coordinates[t].z}return m.NaN},ue.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},ue.prototype.getCoordinateCopy=function(t){return new x(this._coordinates[t])},ue.prototype.getDimension=function(){return this._dimension},ue.prototype.getX=function(t){return this._coordinates[t].x},ue.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new ue(t,this._dimension)},ue.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},ue.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new ue(t,this._dimension)},ue.prototype.toString=function(){if(this._coordinates.length>0){var t=new T(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},ue.prototype.getY=function(t){return this._coordinates[t].y},ue.prototype.toCoordinateArray=function(){return this._coordinates},ue.prototype.interfaces_=function(){return[B,e]},ue.prototype.getClass=function(){return ue},le.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ue,le);var he=function(){},ce={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};he.prototype.readResolve=function(){return he.instance()},he.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new ue(t)}if(M(arguments[0],B)){var e=arguments[0];return new ue(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return i>3&&(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<n.size();r++){var o=this.getCoordinateSequenceFactory().create(1,n.getDimension());Wt.copy(n,r,o,0,1),i[r]=this.createPoint(o)}return this.createMultiPoint(i)}}},ye.prototype.interfaces_=function(){return[e]},ye.prototype.getClass=function(){return ye},ye.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.getDefaultCoordinateSequenceFactory=function(){return he.instance()},ye.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},ye.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},me.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(ye,me);var ve=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ie=function(t){this.geometryFactory=t||new ye};Ie.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!Ee[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==ve.indexOf(n)?Ee[n].apply(this,[e.coordinates]):"GeometryCollection"===n?Ee[n].apply(this,[e.geometries]):Ee[n].apply(this,[e])},Ie.prototype.write=function(t){var e=t.getGeometryType();if(!Le[e])throw new Error("Geometry is not supported");return Le[e].apply(this,[t])};var Ee={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var i=t.geometry.type;if(!Ee[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Ee.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(new x(i[0],i[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new x(t[0],t[1]),new x(t[2],t[1]),new x(t[2],t[3]),new x(t[0],t[3]),new x(t[0],t[1])])},Point:function(t){var e=new x(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Ee.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=Ee.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Ee.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Ee.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),i=[],r=1;r<t.length;++r){var o=t[r],s=Ee.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);i.push(a)}return this.geometryFactory.createPolygon(n,i)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(Ee.Polygon.apply(this,[i]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(this.read(i))}return this.geometryFactory.createGeometryCollection(e)}},Le={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Le.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=Le.Point.apply(this,[i]);e.push(r.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),i=0;i<n.length;++i){var r=n[i];e.push(Le.coordinate.apply(this,[r]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=Le.LineString.apply(this,[i]);e.push(r.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=Le.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var i=0;i<t._holes.length;++i){var r=t._holes[i],o=Le.LineString.apply(this,[r]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=Le.Polygon.apply(this,[i]);e.push(r.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=i.getGeometryType();e.push(Le[r].apply(this,[i]))}return{type:"GeometryCollection",geometries:e}}},xe=function(t){this.geometryFactory=t||new ye,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Ie(this.geometryFactory)};xe.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===fe.FIXED&&this.reducePrecision(e),e},xe.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var Ne=function(){this.parser=new Ie(this.geometryFactory)};Ne.prototype.write=function(t){return this.parser.write(t)};var be=function(){},Ce={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};be.prototype.interfaces_=function(){return[]},be.prototype.getClass=function(){return be},be.opposite=function(t){return t===be.LEFT?be.RIGHT:t===be.RIGHT?be.LEFT:t},Ce.ON.get=function(){return 0},Ce.LEFT.get=function(){return 1},Ce.RIGHT.get=function(){return 2},Object.defineProperties(be,Ce),(g.prototype=new Error).name="EmptyStackException",(d.prototype=new Lt).add=function(t){return this.array_.push(t),!0},d.prototype.get=function(t){if(t<0||t>=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;e<n;e++)t.push(this.array_[e]);return t};var Se=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Se.prototype.getCoordinate=function(){return this._minCoord},Se.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},Se.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();tt.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],i=st.computeOrientation(this._minCoord,n,e),r=!1;e.y<this._minCoord.y&&n.y<this._minCoord.y&&i===st.COUNTERCLOCKWISE?r=!0:e.y>this._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].y<n[e+1].y&&(i=be.RIGHT),i},Se.prototype.getEdge=function(){return this._orientedDe},Se.prototype.checkForRightmostCoordinate=function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(null===this._minCoord||e[n].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},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.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._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;i<n.length-1;i++)t.expandToInclude(n[i]);this._env=t}return this._env},Oe.prototype.addReachable=function(t){var e=new d;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},Oe.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(be.LEFT,t.getDepth(be.RIGHT)),e.setDepth(be.RIGHT,t.getDepth(be.LEFT))},Oe.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var r=i.getSym().getNode();r.isVisited()||e.push(r)}},Oe.prototype.getNodes=function(){return this._nodes},Oe.prototype.getDirectedEdges=function(){return this._dirEdgeList},Oe.prototype.interfaces_=function(){return[I]},Oe.prototype.getClass=function(){return Oe};var Pe=function zr(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[be.ON]=e}else if(arguments[0]instanceof zr){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];this.init(3),this.location[be.ON]=r,this.location[be.LEFT]=o,this.location[be.RIGHT]=s}};Pe.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},Pe.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==S.NONE)return!1;return!0},Pe.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===S.NONE&&(this.location[e]=t)},Pe.prototype.isLine=function(){return 1===this.location.length},Pe.prototype.merge=function(t){if(t.location.length>this.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;n<this.location.length;n++)this.location[n]===S.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},Pe.prototype.getLocations=function(){return this.location},Pe.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[be.LEFT];this.location[be.LEFT]=this.location[be.RIGHT],this.location[be.RIGHT]=t},Pe.prototype.toString=function(){var t=new T;return this.location.length>1&&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 t<this.location.length?this.location[t]:S.NONE},Pe.prototype.isArea=function(){return this.location.length>1},Pe.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===S.NONE)return!0;return!1},Pe.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(be.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},Pe.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(S.NONE)},Pe.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},Pe.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},Pe.prototype.interfaces_=function(){return[]},Pe.prototype.getClass=function(){return Pe};var Te=function jr(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new Pe(t),this.elt[1]=new Pe(t)}else if(arguments[0]instanceof jr){var e=arguments[0];this.elt[0]=new Pe(e.elt[0]),this.elt[1]=new Pe(e.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new Pe(S.NONE),this.elt[1]=new Pe(S.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];this.elt[0]=new Pe(r,o,s),this.elt[1]=new Pe(r,o,s)}else if(4===arguments.length){var a=arguments[0],u=arguments[1],l=arguments[2],h=arguments[3];this.elt[0]=new Pe(S.NONE,S.NONE,S.NONE),this.elt[1]=new Pe(S.NONE,S.NONE,S.NONE),this.elt[a].setLocations(u,l,h)}};Te.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Te.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},Te.prototype.isNull=function(t){return this.elt[t].isNull()},Te.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},Te.prototype.isLine=function(t){return this.elt[t].isLine()},Te.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new Pe(t.elt[e]):this.elt[e].merge(t.elt[e])},Te.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Te.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(be.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},Te.prototype.toString=function(){var t=new T;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},Te.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},Te.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Te.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(be.ON,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.elt[n].setLocation(i,r)}},Te.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},Te.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},Te.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Pe(this.elt[t].location[0]))},Te.prototype.interfaces_=function(){return[]},Te.prototype.getClass=function(){return Te},Te.toLineLabel=function(t){for(var e=new Te(S.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var Re=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new xt,this._pts=new xt,this._label=new Te(S.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new xt,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};Re.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=st.isCCW(this._ring.getCoordinates())},Re.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Re.prototype.computePoints=function(t){this._startDe=t;var e=t,n=!0;do{if(null===e)throw new we("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new we("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var i=e.getLabel();tt.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},Re.prototype.getLinearRing=function(){return this._ring},Re.prototype.getCoordinate=function(t){return this._pts.get(t)},Re.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},Re.prototype.addPoints=function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var o=r;o<i.length;o++)this._pts.add(i[o])}else{var s=i.length-2;n&&(s=i.length-1);for(var a=s;a>=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<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},Re.prototype.interfaces_=function(){return[]},Re.prototype.getClass=function(){return Re};var De=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Re),Ae=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new xt,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new De(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Re),ke=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};ke.prototype.setVisited=function(t){this._isVisited=t},ke.prototype.setInResult=function(t){this._isInResult=t},ke.prototype.isCovered=function(){return this._isCovered},ke.prototype.isCoveredSet=function(){return this._isCoveredSet},ke.prototype.setLabel=function(t){this._label=t},ke.prototype.getLabel=function(){return this._label},ke.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},ke.prototype.updateIM=function(t){tt.isTrue(this._label.getGeometryCount()>=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=t<e?t:e;return 0===n&&3===(t>e?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._quadrant<t._quadrant?-1:st.computeOrientation(t._p0,t._p1,this._p1)},Ue.prototype.getDy=function(){return this._dy},Ue.prototype.getCoordinate=function(){return this._p0},Ue.prototype.setNode=function(t){this._node=t},Ue.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),r=n.substring(i+1);t.print(" "+r+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},Ue.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},Ue.prototype.getDirectedCoordinate=function(){return this._p1},Ue.prototype.getDx=function(){return this._dx},Ue.prototype.getLabel=function(){return this._label},Ue.prototype.getEdge=function(){return this._edge},Ue.prototype.getQuadrant=function(){return this._quadrant},Ue.prototype.getNode=function(){return this._node},Ue.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},Ue.prototype.computeLabel=function(t){},Ue.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=Be.quadrant(this._dx,this._dy),tt.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Ue.prototype.interfaces_=function(){return[I]},Ue.prototype.getClass=function(){return Ue};var Ve=function(t){function e(){var e=arguments[0],n=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var i=e.getNumPoints()-1;this.init(e.getCoordinate(i),e.getCoordinate(i-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new Te(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new we("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,be.LEFT)===S.INTERIOR&&this._label.getLocation(e,be.RIGHT)===S.INTERIOR||(t=!1);return t},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[be.LEFT]+"/"+this._depth[be.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,S.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,S.EXTERIOR);return t&&e&&n},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var i=1;t===be.LEFT&&(i=-1);var r=be.opposite(t),o=e+n*i;this.setDepth(t,e),this.setDepth(r,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===S.EXTERIOR&&e===S.INTERIOR?1:t===S.INTERIOR&&e===S.EXTERIOR?-1:0},e}(Ue),ze=function(){};ze.prototype.createNode=function(t){return new Fe(t,null)},ze.prototype.interfaces_=function(){return[]},ze.prototype.getClass=function(){return ze};var je=function(){if(this._edges=new xt,this._nodes=null,this._edgeEndList=new xt,0===arguments.length)this._nodes=new Ge(new ze);else if(1===arguments.length){var t=arguments[0];this._nodes=new Ge(t)}};je.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},je.prototype.find=function(t){return this._nodes.find(t)},je.prototype.addNode=function(){if(arguments[0]instanceof Fe){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof x){var e=arguments[0];return this._nodes.addNode(e)}},je.prototype.getNodeIterator=function(){return this._nodes.iterator()},je.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},je.prototype.debugPrintln=function(t){z.out.println(t)},je.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var i=n.getLabel();return null!==i&&i.getLocation(t)===S.BOUNDARY},je.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},je.prototype.matchInSameDirection=function(t,e,n,i){return!!t.equals(n)&&st.computeOrientation(t,e,i)===st.COLLINEAR&&Be.quadrant(t,e)===Be.quadrant(n,i)},je.prototype.getEdgeEnds=function(){return this._edgeEndList},je.prototype.debugPrint=function(t){z.out.print(t)},je.prototype.getEdgeIterator=function(){return this._edges.iterator()},je.prototype.findEdgeInSameDirection=function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),r=i.getCoordinates();if(this.matchInSameDirection(t,e,r[0],r[1]))return i;if(this.matchInSameDirection(t,e,r[r.length-1],r[r.length-2]))return i}return null},je.prototype.insertEdge=function(t){this._edges.add(t)},je.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},je.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var i=new Ve(n,!0),r=new Ve(n,!1);i.setSym(r),r.setSym(i),this.add(i),this.add(r)}},je.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},je.prototype.getNodes=function(){return this._nodes.values()},je.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),r=i.getCoordinates();if(t.equals(r[0])&&e.equals(r[1]))return i}return null},je.prototype.interfaces_=function(){return[]},je.prototype.getClass=function(){return je},je.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var Xe=function(){this._geometryFactory=null,this._shellList=new xt;var t=arguments[0];this._geometryFactory=t};Xe.prototype.sortShellsAndHoles=function(t,e,n){for(var i=t.iterator();i.hasNext();){var r=i.next();r.isHole()?n.add(r):e.add(r)}},Xe.prototype.computePolygons=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);e.add(i)}return e},Xe.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(null===i.getShell()){var r=this.findEdgeRingContaining(i,t);if(null===r)throw new we("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(r)}}},Xe.prototype.buildMinimalEdgeRings=function(t,e,n){for(var i=new xt,r=t.iterator();r.hasNext();){var o=r.next();if(o.getMaxNodeDegree()>2){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;r<o;r++)i.next(),i.set(n[r])},$e.singletonList=function(t){var e=new xt;return e.add(t),e};var tn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};tn.prototype.expandToQueue=function(t,e){var n=tn.isComposite(this._boundable1),i=tn.isComposite(this._boundable2);if(n&&i)return tn.area(this._boundable1)>tn.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._distance<e._distance?-1:this._distance>e._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()<i&&n.add(s)}},tn.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},tn.prototype.getDistance=function(){return this._distance},tn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},tn.prototype.interfaces_=function(){return[I]},tn.prototype.getClass=function(){return tn},tn.area=function(t){return t.getBounds().getArea()},tn.isComposite=function(t){return t instanceof Ze};var en=function Xr(){if(this._root=null,this._built=!1,this._itemBoundables=new xt,this._nodeCapacity=null,0===arguments.length){var t=Xr.DEFAULT_NODE_CAPACITY;this._nodeCapacity=t}else if(1===arguments.length){var e=arguments[0];tt.isTrue(e>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;u<a.size();u++){var l=a.get(u);this.getIntersectsOp().intersects(l.getBounds(),r)&&(l instanceof Ze?this.query(r,l,s):l instanceof He?s.visitItem(l.getItem()):tt.shouldNeverReachHere())}else if(M(arguments[2],Lt)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze)for(var h=arguments[0],c=arguments[1],p=arguments[2],f=c.getChildBoundables(),g=0;g<f.size();g++){var d=f.get(g);this.getIntersectsOp().intersects(d.getBounds(),h)&&(d instanceof Ze?this.query(h,d,p):d instanceof He?p.add(d.getItem()):tt.shouldNeverReachHere())}},en.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},en.prototype.getRoot=function(){return this.build(),this._root},en.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],o=this.removeItem(i,r);if(o)return!0;for(var s=null,a=i.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&u instanceof Ze&&(o=this.remove(n,u,r))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(s),o}},en.prototype.createHigherLevels=function(t,e){tt.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},en.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof Ze){var i=this.depth(n);i>t&&(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:t<e?-1:0},nn.IntersectsOp.get=function(){return rn},nn.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},nn.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(en,nn);var rn=function(){},on=function(){};on.prototype.distance=function(t,e){},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on};var sn=function(t){function n(e){e=e||n.DEFAULT_NODE_CAPACITY,t.call(this,e)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return n.prototype.createParentBoundablesFromVerticalSlices=function(t,e){tt.isTrue(t.length>0);for(var n=new xt,i=0;i<t.length;i++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[i],e));return n},n.prototype.createNode=function(t){return new an(t)},n.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},n.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,n)},n.prototype.getIntersectsOp=function(){return n.intersectsOp},n.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),i=new Array(e).fill(null),r=t.iterator(),o=0;o<e;o++){i[o]=new xt;for(var s=0;r.hasNext()&&s<n;){var a=r.next();i[o].add(a),s++}}return i},n.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments[0],i=arguments[1];t.prototype.query.call(this,n,i)}else if(3===arguments.length)if(M(arguments[2],Je)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze){var r=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,r,o,s)}else if(M(arguments[2],Lt)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},n.prototype.getComparator=function(){return n.yComparator},n.prototype.createParentBoundablesFromVerticalSlice=function(e,n){return t.prototype.createParentBoundables.call(this,e,n)},n.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return t.prototype.remove.call(this,e,n)}return t.prototype.remove.apply(this,arguments)},n.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},n.prototype.createParentBoundables=function(t,e){tt.isTrue(!t.isEmpty());var i=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),r=new xt(t);$e.sort(r,n.xComparator);var o=this.verticalSlices(r,Math.trunc(Math.ceil(Math.sqrt(i))));return this.createParentBoundablesFromVerticalSlices(o,e)},n.prototype.nearestNeighbour=function(){if(1===arguments.length){if(M(arguments[0],on)){var t=arguments[0],e=new tn(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof tn){var i=arguments[0];return this.nearestNeighbour(i,m.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof n&&M(arguments[1],on)){var r=arguments[0],o=arguments[1],s=new tn(this.getRoot(),r.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof tn&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,h=new We;for(h.add(a);!h.isEmpty()&&u>0;){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 t<e?-1:t>e?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.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.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<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),i=this._edge.getCoordinate(e+2);n.equals2D(i)&&t.add(new R(e+1))}},hn.prototype.addEdgeCoordinates=function(t,e,n){var i=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(i);n.add(new x(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));r&&n.add(new x(e.coord))},hn.prototype.iterator=function(){return this._nodeMap.values().iterator()},hn.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}},hn.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,1===i&&(n[0]=t.segmentIndex+1,!0)},hn.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();this.findCollapseIndex(i,r,e)&&t.add(new R(e[0])),i=r}},hn.prototype.getEdge=function(){return this._edge},hn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},hn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(i);r||n--;var 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.getCoordinate(a);return r&&(o[s]=new x(e.coord)),new gn(o,this._edge.getData())},hn.prototype.add=function(t,e){var n=new ln(this._edge,t,e,this._edge.getSegmentOctant(e)),i=this._nodeMap.get(n);return null!==i?(tt.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)},hn.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new Q("bad split edge start point at "+n);var i=t.get(t.size()-1).getCoordinates(),r=i[i.length-1];if(!r.equals2D(e[e.length-1]))throw new Q("bad split edge end point at "+r)},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var cn=function(){};cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new y("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),i=Math.abs(e);return t>=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}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<this._pts.length){var r=this._pts[i];t.equals2D(r)&&(n=i)}return this._nodeList.add(t,n)},gn.prototype.addIntersections=function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)},gn.prototype.interfaces_=function(){return[fn]},gn.prototype.getClass=function(){return gn},gn.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new xt;return gn.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[0],i=arguments[1],r=n.iterator();r.hasNext();)r.next().getNodeList().addSplitEdges(i)};var dn=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new x,this.p1=new x;else if(1===arguments.length){var t=arguments[0];this.p0=new x(t.p0),this.p1=new x(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2],r=arguments[3];this.p0=new x(e,n),this.p1=new x(i,r)}},_n={serialVersionUID:{configurable:!0}};dn.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},dn.prototype.orientationIndex=function(){if(arguments[0]instanceof dn){var t=arguments[0],e=st.orientationIndex(this.p0,this.p1,t.p0),n=st.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof 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))<i&&(i=r,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(r=a.distance(this.p0))<i&&(i=r,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(r=u.distance(this.p1))<i&&(i=r,n[0]=this.p1,n[1]=u),n},dn.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},dn.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},dn.prototype.getLength=function(){return this.p0.distance(this.p1)},dn.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},dn.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},dn.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},dn.prototype.lineIntersection=function(t){try{return j.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof V))throw t}return null},dn.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},dn.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),i=this.p0.y+t*(this.p1.y-this.p0.y),r=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(r*r+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*r/s,u=e*o/s}return new x(n-u,i+a)},dn.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},dn.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>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<s&&this.computeSelect(t,e,s,i),s<n&&this.computeSelect(t,s,n,i)},mn.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},mn.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},mn.prototype.setId=function(t){this._id=t},mn.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},mn.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new X(t,e)}return this._env},mn.prototype.getEndIndex=function(){return this._end},mn.prototype.getStartIndex=function(){return this._start},mn.prototype.getContext=function(){return this._context},mn.prototype.getId=function(){return this._id},mn.prototype.computeOverlapsInternal=function(t,e,n,i,r,o){var s=this._pts[t],a=this._pts[e],u=n._pts[i],l=n._pts[r];if(e-t==1&&r-i==1)return o.overlap(this,t,n,i),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((i+r)/2);t<h&&(i<c&&this.computeOverlapsInternal(t,h,n,i,c,o),c<r&&this.computeOverlapsInternal(t,h,n,c,r,o)),h<e&&(i<c&&this.computeOverlapsInternal(h,e,n,i,c,o),c<r&&this.computeOverlapsInternal(h,e,n,c,r,o))},mn.prototype.interfaces_=function(){return[]},mn.prototype.getClass=function(){return mn};var vn=function(){};vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},vn.getChainStartIndices=function(t){var e=0,n=new xt;n.add(new R(e));do{var i=vn.findChainEnd(t,e);n.add(new R(i)),e=i}while(e<t.length-1);return vn.toIntArray(n)},vn.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var i=Be.quadrant(t[n],t[n+1]),r=e+1;r<t.length&&(t[r-1].equals2D(t[r])||Be.quadrant(t[r-1],t[r])===i);)r++;return r-1},vn.getChains=function(){if(1===arguments.length){var t=arguments[0];return vn.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],i=new xt,r=vn.getChainStartIndices(e),o=0;o<r.length-1;o++){var s=new mn(e,r[o],r[o+1],n);i.add(s)}return i}},vn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var In=function(){};In.prototype.computeNodes=function(t){},In.prototype.getNodedSubstrings=function(){},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In};var En=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};En.prototype.setSegmentIntersector=function(t){this._segInt=t},En.prototype.interfaces_=function(){return[In]},En.prototype.getClass=function(){return En};var Ln=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new xt,this._index=new sn,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return gn.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=vn.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=new xn(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),i=this._index.query(n.getEnvelope()).iterator();i.hasNext();){var r=i.next();if(r.getId()>n.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},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<this._inputLine.length;){var r=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=Cn.DELETE,r=!0,i=!0),t=r?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return i},Cn.prototype.isShallowConcavity=function(t,e,n,i){return st.computeOrientation(t,e,n)===this._angleOrientation&&st.distancePointLine(e,t,n)<i},Cn.prototype.isShallowSampled=function(t,e,n,i,r){var o=Math.trunc((i-n)/Cn.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<i;s+=o)if(!this.isShallow(t,e,this._inputLine[s],r))return!1;return!0},Cn.prototype.isConcave=function(t,e,n){return st.computeOrientation(t,e,n)===this._angleOrientation},Cn.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=st.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},Cn.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Cn.DELETE;)e++;return e},Cn.prototype.isShallow=function(t,e,n,i){return st.distancePointLine(e,t,n)<i},Cn.prototype.collapseLine=function(){for(var t=new bt,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Cn.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn},Cn.simplify=function(t,e){return new Cn(t).simplify(e)},Sn.INIT.get=function(){return 0},Sn.DELETE.get=function(){return 1},Sn.KEEP.get=function(){return 1},Sn.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Cn,Sn);var wn=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new xt},Mn={COORDINATE_ARRAY_TYPE:{configurable:!0}};wn.prototype.getCoordinates=function(){return this._ptList.toArray(wn.COORDINATE_ARRAY_TYPE)},wn.prototype.setPrecisionModel=function(t){this._precisionModel=t},wn.prototype.addPt=function(t){var e=new x(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},wn.prototype.revere=function(){},wn.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var i=t.length-1;i>=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)<this._minimimVertexDistance},wn.prototype.toString=function(){return(new ye).createLineString(this.getCoordinates()).toString()},wn.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new x(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},wn.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},Mn.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(wn,Mn);var On=function(){},Pn={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.toDegrees=function(t){return 180*t/Math.PI},On.normalize=function(t){for(;t>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=t<e?e-t:t-e)>Math.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)<this._distance*Tn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Nn.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Nn.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},Tn.prototype.createSquare=function(t){this._segList.addPt(new x(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new x(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new x(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new x(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Tn.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Tn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Tn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Tn.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},Tn.prototype.addLimitedMitreJoin=function(t,e,n,i){var r=this._seg0.p1,o=On.angle(r,this._seg0.p0),s=On.angleBetweenOriented(this._seg0.p0,r,this._seg1.p1)/2,a=On.normalize(o+s),u=On.normalize(a+Math.PI),l=i*n,h=n-l*Math.abs(Math.sin(s)),c=r.x+l*Math.cos(u),p=r.y+l*Math.sin(u),f=new x(c,p),g=new dn(r,f),d=g.pointAlongOffset(1,h),_=g.pointAlongOffset(1,-h);this._side===be.LEFT?(this._segList.addPt(d),this._segList.addPt(_)):(this._segList.addPt(_),this._segList.addPt(d))},Tn.prototype.computeOffsetSegment=function(t,e,n,i){var r=e===be.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=r*n*o/a,l=r*n*s/a;i.p0.x=t.p0.x-l,i.p0.y=t.p0.y+u,i.p1.x=t.p1.x-l,i.p1.y=t.p1.y+u},Tn.prototype.addFilletArc=function(t,e,n,i,r){var o=i===st.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,h=new x;l<s;){var c=e+o*l;h.x=t.x+r*Math.cos(c),h.y=t.y+r*Math.sin(c),this._segList.addPt(h),l+=u}},Tn.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Tn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new 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;n<e.length;n++)e[n]=new x(t[n]);return e};var An=function(){this._subgraphs=null,this._seg=new dn,this._cga=new st;var t=arguments[0];this._subgraphs=t},kn={DepthSegment:{configurable:!0}};An.prototype.findStabbedSegments=function(){if(1===arguments.length){for(var t=arguments[0],e=new xt,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),r=i.getEnvelope();t.y<r.getMinY()||t.y>r.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(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;l<u.length-1;l++)if(this._seg.p0=u[l],this._seg.p1=u[l+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<o.x||this._seg.isHorizontal()||o.y<this._seg.p0.y||o.y>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;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=Ct.removeRepeatedPoints(s.getCoordinates());this._distance>0&&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)<Math.abs(e)},Bn.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=Ct.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,S.EXTERIOR,S.INTERIOR)},Bn.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var i=new gn(t,new Te(0,S.BOUNDARY,e,n));this._curveList.add(i)},Bn.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Bn.prototype.addPolygonRing=function(t,e,n,i,r){if(0===e&&t.length<ee.MINIMUM_VALID_SIZE)return null;var o=i,s=r;t.length>=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<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn};var qn=function(){};qn.prototype.locate=function(t){},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var Un=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Un.prototype.next=function(){if(this._atStart)return this._atStart=!1,Un.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new 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<e.getNumInteriorRing();i++){var r=e.getInteriorRingN(i);if(Vn.isPointInRing(t,r))return!1}return!0},Vn.containsPoint=function(t,e){if(e instanceof $t)return Vn.containsPointInPolygon(t,e);if(e instanceof Vt)for(var n=new Un(e);n.hasNext();){var i=n.next();if(i!==e&&Vn.containsPoint(t,i))return!0}return!1},Vn.locate=function(t,e){return e.isEmpty()?S.EXTERIOR:Vn.containsPoint(t,e)?S.INTERIOR:S.EXTERIOR};var zn=function(){this._edgeMap=new h,this._edgeList=null,this._ptInAreaLocation=[S.NONE,S.NONE]};zn.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},zn.prototype.propagateSideLabels=function(t){for(var e=S.NONE,n=this.iterator();n.hasNext();){var i=n.next().getLabel();i.isArea(t)&&i.getLocation(t,be.LEFT)!==S.NONE&&(e=i.getLocation(t,be.LEFT))}if(e===S.NONE)return null;for(var r=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,be.ON)===S.NONE&&a.setLocation(t,be.ON,r),a.isArea(t)){var u=a.getLocation(t,be.LEFT),l=a.getLocation(t,be.RIGHT);if(l!==S.NONE){if(l!==r)throw new we("side location conflict",s.getCoordinate());u===S.NONE&&tt.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),r=u}else tt.isTrue(a.getLocation(t,be.LEFT)===S.NONE,"found single null side"),a.setLocation(t,be.RIGHT,r),a.setLocation(t,be.LEFT,r)}}},zn.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},zn.prototype.print=function(t){z.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},zn.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},zn.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,i=e.get(n).getLabel().getLocation(t,be.LEFT);tt.isTrue(i!==S.NONE,"Found unlabelled area edge");for(var r=i,o=this.iterator();o.hasNext();){var s=o.next().getLabel();tt.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,be.LEFT),u=s.getLocation(t,be.RIGHT);if(a===u)return!1;if(u!==r)return!1;r=a}return!0},zn.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},zn.prototype.iterator=function(){return this.getEdges().iterator()},zn.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new xt(this._edgeMap.values())),this._edgeList},zn.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===S.NONE&&(this._ptInAreaLocation[t]=Vn.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},zn.prototype.toString=function(){var t=new T;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},zn.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},zn.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var i=n.next().getLabel(),r=0;r<2;r++)i.isLine(r)&&i.getLocation(r)===S.BOUNDARY&&(e[r]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=S.NONE;if(e[u])l=S.EXTERIOR;else{var h=s.getCoordinate();l=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,l)}},zn.prototype.getDegree=function(){return this._edgeMap.size()},zn.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn};var jn=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var r=this._resultAreaEdgeList.get(i),o=r.getSym();if(r.getLabel().isArea())switch(null===t&&r.isInResult()&&(t=r),n){case this._SCANNING_FOR_INCOMING:if(!o.isInResult())continue;e=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!r.isInResult())continue;e.setNext(r),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new we("no outgoing dirEdge found",this.getCoordinate());tt.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var i=t.get(e-1),r=n.getQuadrant(),o=i.getQuadrant();return Be.isNorthern(r)&&Be.isNorthern(o)?n:Be.isNorthern(r)||Be.isNorthern(o)?0!==n.getDy()?n:0!==i.getDy()?i:(tt.shouldNeverReachHere("found two horizontal edges incident on node"),null):i},e.prototype.print=function(t){z.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new xt;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var i=this._edgeList.get(n),r=i.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=i}e.setNext(t)},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<s;u++){var l=this._edgeList.get(u);l.setEdgeDepths(be.RIGHT,a),a=l.getDepth(be.LEFT)}return a}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=null,n=null,i=this._SCANNING_FOR_INCOMING,r=this._resultAreaEdgeList.size()-1;r>=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;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),r=0;r<i.length;r++)r>0&&t.print(","),t.print(i[r].x+" "+i[r].y);t.println(")")}t.print(") ")},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;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Hn.prototype.iterator=function(){return this._edges.iterator()},Hn.prototype.getEdges=function(){return this._edges},Hn.prototype.get=function(t){return this._edges.get(t)},Hn.prototype.findEqualEdge=function(t){var e=new Yn(t.getCoordinates());return this._ocaMap.get(e)},Hn.prototype.add=function(t){this._edges.add(t);var e=new Yn(t.getCoordinates());this._ocaMap.put(e,t)},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn};var Wn=function(){};Wn.prototype.processIntersections=function(t,e,n,i){},Wn.prototype.isDone=function(){},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn};var Jn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Jn.prototype.isTrivialIntersection=function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(Jn.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.size()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},Jn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Jn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Jn.prototype.getLineIntersector=function(){return this._li},Jn.prototype.hasProperIntersection=function(){return this._hasProper},Jn.prototype.processIntersections=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.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Jn.prototype.hasIntersection=function(){return this._hasIntersection},Jn.prototype.isDone=function(){return!1},Jn.prototype.hasInteriorIntersection=function(){return this._hasInterior},Jn.prototype.interfaces_=function(){return[Wn]},Jn.prototype.getClass=function(){return Jn},Jn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Kn=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new x(t),this.segmentIndex=e,this.dist=n};Kn.prototype.getSegmentIndex=function(){return this.segmentIndex},Kn.prototype.getCoordinate=function(){return this.coord},Kn.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Kn.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Kn.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Kn.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Kn.prototype.getDistance=function(){return this.dist},Kn.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Kn.prototype.interfaces_=function(){return[I]},Kn.prototype.getClass=function(){return Kn};var Zn=function(){this._nodeMap=new h,this.edge=null;var t=arguments[0];this.edge=t};Zn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Zn.prototype.iterator=function(){return this._nodeMap.values().iterator()},Zn.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}},Zn.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Zn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this.edge.pts[e.segmentIndex],r=e.dist>0||!e.coord.equals2D(i);r||n--;var 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(e<t.length-1);return Qn.toIntArray(n)},Qn.prototype.findChainEnd=function(t,e){for(var n=Be.quadrant(t[e],t[e+1]),i=e+1;i<t.length&&Be.quadrant(t[i-1],t[i])===n;)i++;return i-1},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var $n=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new X,this.env2=new X;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Qn;this.startIndex=e.getChainStartIndices(this.pts)};$n.prototype.getCoordinates=function(){return this.pts},$n.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},$n.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},$n.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(6===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],h=this.pts[r],c=this.pts[o],p=s.pts[a],f=s.pts[u];if(o-r==1&&u-a==1)return l.addIntersections(this.e,r,s.e,a),null;if(this.env1.init(h,c),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var g=Math.trunc((r+o)/2),d=Math.trunc((a+u)/2);r<g&&(a<d&&this.computeIntersectsForChain(r,g,s,a,d,l),d<u&&this.computeIntersectsForChain(r,g,s,d,u,l)),g<o&&(a<d&&this.computeIntersectsForChain(g,o,s,a,d,l),d<u&&this.computeIntersectsForChain(g,o,s,d,u,l))}},$n.prototype.getStartIndexes=function(){return this.startIndex},$n.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<t.startIndex.length-1;i++)this.computeIntersectsForChain(n,t,i,e)},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n};var ti=function Jr(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=Jr.NULL_VALUE},ei={NULL_VALUE:{configurable:!0}};ti.prototype.getDepth=function(t,e){return this._depth[t][e]},ti.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},ti.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==ti.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===ti.NULL_VALUE}if(2===arguments.length){var i=arguments[0],r=arguments[1];return this._depth[i][r]===ti.NULL_VALUE}},ti.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var i=0;this._depth[t][n]>e&&(i=1),this._depth[t][n]=i}}},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;s<this.pts.length;s++)if(this.pts[s].equals2D(n.pts[s])||(i=!1),this.pts[s].equals2D(n.pts[--o])||(r=!1),!i&&!r)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},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;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,n,i){var r=new x(t.getIntersection(i)),o=e,s=t.getEdgeDistance(n,i),a=o+1;if(a<this.pts.length){var u=this.pts[a];r.equals2D(u)&&(o=a,s=0)}this.eiList.add(r,o,s)},e.prototype.toString=function(){var t=new T;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,be.ON),e.getLocation(1,be.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,be.LEFT),e.getLocation(1,be.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,be.RIGHT),e.getLocation(1,be.RIGHT),2))},e}(ke),ii=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Hn,this._bufParams=t||null};ii.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},ii.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new Te(t.getLabel())).flip(),n.merge(i);var r=ii.depthDelta(i),o=e.getDepthDelta()+r;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(ii.depthDelta(t.getLabel()))},ii.prototype.buildSubgraphs=function(t,e){for(var n=new xt,i=t.iterator();i.hasNext();){var r=i.next(),o=r.getRightmostCoordinate(),s=new An(n).getDepth(o);r.computeDepth(s),r.findResultEdges(),n.add(r),e.add(r.getDirectedEdges(),r.getNodes())}},ii.prototype.createSubgraphs=function(t){for(var e=new xt,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var r=new Oe;r.create(i),e.add(r)}}return $e.sort(e,$e.reverseOrder()),e},ii.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ii.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new Ln,n=new it;return n.setPrecisionModel(t),e.setSegmentIntersector(new Jn(n)),e},ii.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new Dn(n,this._bufParams),r=new Bn(t,e,i).getCurves();if(r.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(r,n),this._graph=new je(new Xn),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new Xe(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},ii.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var i=n.getNodedSubstrings().iterator();i.hasNext();){var r=i.next(),o=r.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=r.getData(),a=new ni(r.getCoordinates(),new Te(s));this.insertUniqueEdge(a)}}},ii.prototype.setNoder=function(t){this._workingNoder=t},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ii.depthDelta=function(t){var e=t.getLocation(0,be.LEFT),n=t.getLocation(0,be.RIGHT);return e===S.INTERIOR&&n===S.EXTERIOR?1:e===S.EXTERIOR&&n===S.INTERIOR?-1:0},ii.convertSegStrings=function(t){for(var e=new ye,n=new xt;t.hasNext();){var i=t.next(),r=e.createLineString(i.getCoordinates());n.add(r)}return e.buildGeometry(n)};var ri=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=i,this._offsetX=r,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};ri.prototype.rescale=function(){if(M(arguments[0],vt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/this._scaleFactor+this._offsetX,n[i].y=n[i].y/this._scaleFactor+this._offsetY;2===n.length&&n[0].equals2D(n[1])&&z.out.println(n)}},ri.prototype.scale=function(){if(M(arguments[0],vt)){for(var t=arguments[0],e=new xt,n=t.iterator();n.hasNext();){var i=n.next();e.add(new gn(this.scale(i.getCoordinates()),i.getData()))}return e}if(arguments[0]instanceof Array){for(var r=arguments[0],o=new Array(r.length).fill(null),s=0;s<r.length;s++)o[s]=new x(Math.round((r[s].x-this._offsetX)*this._scaleFactor),Math.round((r[s].y-this._offsetY)*this._scaleFactor),r[s].z);return Ct.removeRepeatedPoints(o)}},ri.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},ri.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},ri.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},ri.prototype.interfaces_=function(){return[In]},ri.prototype.getClass=function(){return ri};var oi=function(){this._li=new it,this._segStrings=null;var t=arguments[0];this._segStrings=t},si={fact:{configurable:!0}};oi.prototype.checkEndPtVertexIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var r=i.next().getCoordinates(),o=1;o<r.length-1;o++)if(r[o].equals(n))throw new Q("found endpt/interior pt intersection at index "+o+" :pt "+n)},oi.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(e,i)}else if(2===arguments.length)for(var r=arguments[0],o=arguments[1],s=r.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(r,u,o,l);else if(4===arguments.length){var h=arguments[0],c=arguments[1],p=arguments[2],f=arguments[3];if(h===p&&c===f)return null;var g=h.getCoordinates()[c],d=h.getCoordinates()[c+1],_=p.getCoordinates()[f],y=p.getCoordinates()[f+1];if(this._li.computeIntersection(g,d,_,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,d)||this.hasInteriorIntersection(this._li,_,y)))throw new Q("found non-noded intersection at "+g+"-"+d+" and "+_+"-"+y)}},oi.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},oi.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var n=arguments[0].getCoordinates(),i=0;i<n.length-2;i++)this.checkCollapse(n[i],n[i+1],n[i+2])},oi.prototype.hasInteriorIntersection=function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var r=t.getIntersection(i);if(!r.equals(e)&&!r.equals(n))return!0}return!1},oi.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new Q("found non-noded collapse at "+oi.fact.createLineString([t,e,n]))},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},si.fact.get=function(){return new ye},Object.defineProperties(oi,si);var ai=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new y("Scale factor must be non-zero");1!==e&&(this._pt=new x(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new x,this._p1Scaled=new x),this.initCorners(this._pt)},ui={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};ai.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),r=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>i||this._maxy<r||this._miny>o;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<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}},fi.prototype.isDone=function(){return!1},fi.prototype.getInteriorIntersections=function(){return this._interiorIntersections},fi.prototype.interfaces_=function(){return[Wn]},fi.prototype.getClass=function(){return fi};var gi=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new it,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};gi.prototype.checkCorrectness=function(t){var e=gn.getNodedSubstrings(t),n=new oi(e);try{n.checkValid()}catch(t){if(!(t instanceof U))throw t;t.printStackTrace()}},gi.prototype.getNodedSubstrings=function(){return gn.getNodedSubstrings(this._nodedSegStrings)},gi.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},gi.prototype.findInteriorIntersections=function(t,e){var n=new fi(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},gi.prototype.computeVertexSnaps=function(){if(M(arguments[0],vt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof gn)for(var n=arguments[0],i=n.getCoordinates(),r=0;r<i.length;r++){var o=new ai(i[r],this._scaleFactor,this._li);this._pointSnapper.snap(o,n,r)&&n.addIntersection(i[r],r)}},gi.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Ln,this._pointSnapper=new hi(this._noder.getIndex()),this.snapRound(t,this._li)},gi.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=new ai(n,this._scaleFactor,this._li);this._pointSnapper.snap(i)}},gi.prototype.interfaces_=function(){return[In]},gi.prototype.getClass=function(){return gi};var di=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Nn,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},_i={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};di.prototype.bufferFixedPrecision=function(t){var e=new ri(new gi(new fe(1)),t.getScale()),n=new ii(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},di.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=di.MAX_PRECISION_DIGITS;e>=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);i<this._distance&&this.initialize(e,n,i)}},yi.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=r,this._isNull=!1}},yi.prototype.getDistance=function(){return this._distance},yi.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},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;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof yi&&arguments[0]instanceof $t&&arguments[1]instanceof x){var a=arguments[0],u=arguments[1],l=arguments[2];mi.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)mi.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof yi&&arguments[0]instanceof lt&&arguments[1]instanceof x){var c=arguments[0],p=arguments[1],f=arguments[2];if(c instanceof Jt)mi.computeDistance(c,p,f);else if(c instanceof $t)mi.computeDistance(c,p,f);else if(c instanceof Vt)for(var g=c,d=0;d<g.getNumGeometries();d++){var _=g.getGeometryN(d);mi.computeDistance(_,p,f)}else f.setMinimum(c.getCoordinate(),p)}else if(arguments[2]instanceof yi&&arguments[0]instanceof dn&&arguments[1]instanceof x){var y=arguments[0],m=arguments[1],v=arguments[2],I=y.closestPoint(m);v.setMinimum(I,m)}};var vi=function(t){this._maxPtDist=new yi,this._inputGeom=t||null},Ii={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};vi.prototype.computeMaxMidpointDistance=function(t){var e=new Li(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},vi.prototype.computeMaxVertexDistance=function(t){var e=new Ei(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},vi.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},vi.prototype.getDistancePoints=function(){return this._maxPtDist},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi},Ii.MaxPointDistanceFilter.get=function(){return Ei},Ii.MaxMidpointDistanceFilter.get=function(){return Li},Object.defineProperties(vi,Ii);var Ei=function(t){this._maxPtDist=new yi,this._minPtDist=new yi,this._geom=t||null};Ei.prototype.filter=function(t){this._minPtDist.initialize(),mi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ei.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ei.prototype.interfaces_=function(){return[pt]},Ei.prototype.getClass=function(){return Ei};var Li=function(t){this._maxPtDist=new yi,this._minPtDist=new yi,this._geom=t||null};Li.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),i=t.getCoordinate(e),r=new x((n.x+i.x)/2,(n.y+i.y)/2);this._minPtDist.initialize(),mi.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Li.prototype.isDone=function(){return!1},Li.prototype.isGeometryChanged=function(){return!1},Li.prototype.getMaxPointDistance=function(){return this._maxPtDist},Li.prototype.interfaces_=function(){return[Ut]},Li.prototype.getClass=function(){return Li};var xi=function(t){this._comps=t||null};xi.prototype.filter=function(t){t instanceof $t&&this._comps.add(t)},xi.prototype.interfaces_=function(){return[qt]},xi.prototype.getClass=function(){return xi},xi.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return xi.getPolygons(t,new xt)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof $t?n.add(e):e instanceof Vt&&e.apply(new xi(n)),n}};var Ni=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};Ni.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof ee){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Jt&&this._lines.add(t)},Ni.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Ni.prototype.interfaces_=function(){return[ut]},Ni.prototype.getClass=function(){return Ni},Ni.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(Ni.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(Ni.getLines(e,n))}},Ni.getLines=function(){if(1===arguments.length){var t=arguments[0];return Ni.getLines(t,!1)}if(2===arguments.length){if(M(arguments[0],vt)&&M(arguments[1],vt)){for(var e=arguments[0],n=arguments[1],i=e.iterator();i.hasNext();){var r=i.next();Ni.getLines(r,n)}return n}if(arguments[0]instanceof lt&&"boolean"==typeof arguments[1]){var o=arguments[0],s=arguments[1],a=new xt;return o.apply(new Ni(a,s)),a}if(arguments[0]instanceof lt&&M(arguments[1],vt)){var u=arguments[0],l=arguments[1];return u instanceof Jt?l.add(u):u.apply(new Ni(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&M(arguments[0],vt)&&M(arguments[1],vt)){for(var h=arguments[0],c=arguments[1],p=arguments[2],f=h.iterator();f.hasNext();){var g=f.next();Ni.getLines(g,c,p)}return c}if("boolean"==typeof arguments[2]&&arguments[0]instanceof lt&&M(arguments[1],vt)){var d=arguments[0],_=arguments[1],y=arguments[2];return d.apply(new Ni(_,y)),_}}};var bi=function(){if(this._boundaryRule=ft.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new y("Rule must be non-null");this._boundaryRule=t}};bi.prototype.locateInternal=function(){if(arguments[0]instanceof x&&arguments[1]instanceof $t){var t=arguments[0],e=arguments[1];if(e.isEmpty())return S.EXTERIOR;var n=e.getExteriorRing(),i=this.locateInPolygonRing(t,n);if(i===S.EXTERIOR)return S.EXTERIOR;if(i===S.BOUNDARY)return S.BOUNDARY;for(var r=0;r<e.getNumInteriorRing();r++){var o=e.getInteriorRingN(r),s=this.locateInPolygonRing(t,o);if(s===S.INTERIOR)return S.EXTERIOR;if(s===S.BOUNDARY)return S.BOUNDARY}return S.INTERIOR}if(arguments[0]instanceof x&&arguments[1]instanceof Jt){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return S.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?st.isOnLine(a,l)?S.INTERIOR:S.EXTERIOR:S.BOUNDARY}if(arguments[0]instanceof x&&arguments[1]instanceof Zt){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?S.INTERIOR:S.EXTERIOR}},bi.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?st.locatePointInRing(t,e.getCoordinates()):S.EXTERIOR},bi.prototype.intersects=function(t,e){return this.locate(t,e)!==S.EXTERIOR},bi.prototype.updateLocationInfo=function(t){t===S.INTERIOR&&(this._isIn=!0),t===S.BOUNDARY&&this._numBoundaries++},bi.prototype.computeLocation=function(t,e){if(e instanceof Zt&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Jt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof $t)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof zt)for(var n=e,i=0;i<n.getNumGeometries();i++){var r=n.getGeometryN(i);this.updateLocationInfo(this.locateInternal(t,r))}else if(e instanceof ne)for(var o=e,s=0;s<o.getNumGeometries();s++){var a=o.getGeometryN(s);this.updateLocationInfo(this.locateInternal(t,a))}else if(e instanceof Vt)for(var u=new Un(e);u.hasNext();){var l=u.next();l!==e&&this.computeLocation(t,l)}},bi.prototype.locate=function(t,e){return e.isEmpty()?S.EXTERIOR:e instanceof Jt?this.locateInternal(t,e):e instanceof $t?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?S.BOUNDARY:this._numBoundaries>0||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;l<s.size();l++)for(var h=s.get(l),c=0;c<a.size();c++)if(this.computeContainmentDistance(h,a.get(c),u),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ci&&arguments[1]instanceof $t){var p=arguments[0],f=arguments[1],g=arguments[2],d=p.getCoordinate();if(S.EXTERIOR!==this._ptLocator.locate(d,f))return this._minDistance=0,g[0]=p,g[1]=new Ci(f,d),null}},Oi.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(r,s,n),this._minDistance<=this._terminateDistance)return null}},Oi.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=Ni.getLines(this._geom[0]),n=Ni.getLines(this._geom[1]),i=wi.getPoints(this._geom[0]),r=wi.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,i,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(i,r,t),void this.updateMinDistance(t,!1))))},Oi.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Oi.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},Oi.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Oi.prototype.computeMinDistance=function(){if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Jt&&arguments[1]instanceof Zt){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),o=0;o<i.length-1;o++){var s=st.distancePointLine(r,i[o],i[o+1]);if(s<this._minDistance){this._minDistance=s;var a=new dn(i[o],i[o+1]).closestPoint(r);n[0]=new Ci(t,o,a),n[1]=new Ci(e,0,r)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Jt&&arguments[1]instanceof Jt){var u=arguments[0],l=arguments[1],h=arguments[2];if(u.getEnvelopeInternal().distance(l.getEnvelopeInternal())>this._minDistance)return null;for(var c=u.getCoordinates(),p=l.getCoordinates(),f=0;f<c.length-1;f++)for(var g=0;g<p.length-1;g++){var d=st.distanceLineLine(c[f],c[f+1],p[g],p[g+1]);if(d<this._minDistance){this._minDistance=d;var _=new dn(c[f],c[f+1]),y=new dn(p[g],p[g+1]),m=_.closestPoints(y);h[0]=new Ci(u,f,m[0]),h[1]=new Ci(l,g,m[1])}if(this._minDistance<=this._terminateDistance)return null}}},Oi.prototype.computeMinDistancePoints=function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),o=0;o<e.size();o++){var s=e.get(o),a=r.getCoordinate().distance(s.getCoordinate());if(a<this._minDistance&&(this._minDistance=a,n[0]=new Ci(r,0,r.getCoordinate()),n[1]=new Ci(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Oi.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new y("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Oi.prototype.computeMinDistanceLines=function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(r,s,n),this._minDistance<=this._terminateDistance)return null}},Oi.prototype.interfaces_=function(){return[]},Oi.prototype.getClass=function(){return Oi},Oi.distance=function(t,e){return new Oi(t,e).distance()},Oi.isWithinDistance=function(t,e,n){return new Oi(t,e,n).distance()<=n},Oi.nearestPoints=function(t,e){return new Oi(t,e).nearestPoints()};var Pi=function(){this._pt=[new x,new x],this._distance=m.NaN,this._isNull=!0};Pi.prototype.getCoordinates=function(){return this._pt},Pi.prototype.getCoordinate=function(t){return this._pt[t]},Pi.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);i<this._distance&&this.initialize(e,n,i)}},Pi.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=r,this._isNull=!1}},Pi.prototype.toString=function(){return Z.toLineString(this._pt[0],this._pt[1])},Pi.prototype.getDistance=function(){return this._distance},Pi.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);i>this._distance&&this.initialize(e,n,i)}},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;o<r.length-1;o++){i.setCoordinates(r[o],r[o+1]);var s=i.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof Pi&&arguments[0]instanceof $t&&arguments[1]instanceof x){var a=arguments[0],u=arguments[1],l=arguments[2];Ti.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)Ti.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof Pi&&arguments[0]instanceof lt&&arguments[1]instanceof x){var c=arguments[0],p=arguments[1],f=arguments[2];if(c instanceof Jt)Ti.computeDistance(c,p,f);else if(c instanceof $t)Ti.computeDistance(c,p,f);else if(c instanceof Vt)for(var g=c,d=0;d<g.getNumGeometries();d++){var _=g.getGeometryN(d);Ti.computeDistance(_,p,f)}else f.setMinimum(c.getCoordinate(),p)}else if(arguments[2]instanceof Pi&&arguments[0]instanceof dn&&arguments[1]instanceof x){var y=arguments[0],m=arguments[1],v=arguments[2],I=y.closestPoint(m);v.setMinimum(I,m)}};var Ri=function(){this._g0=null,this._g1=null,this._ptDist=new Pi,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Di={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Ri.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Ri.prototype.setDensifyFraction=function(t){if(t>1||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;s<this._numSubSegs;s++){var a=n.x+s*r,u=n.y+s*o,l=new x(a,u);this._minPtDist.initialize(),Ti.computeDistance(this._geom,l,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},ki.prototype.isDone=function(){return!1},ki.prototype.isGeometryChanged=function(){return!1},ki.prototype.getMaxPointDistance=function(){return this._maxPtDist},ki.prototype.interfaces_=function(){return[Ut]},ki.prototype.getClass=function(){return ki};var Fi=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Gi={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Fi.prototype.checkMaximumDistance=function(t,e,n){var i=new Ri(e,t);if(i.setDensifyFraction(.25),this._maxDistanceFound=i.orientedDistance(),this._maxDistanceFound>n){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._minDistanceFound<n){this._isValid=!1;var r=i.nearestPoints();this._errorLocation=i.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(r),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Z.toLineString(r[0],r[1])+" )"}},Fi.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},Fi.prototype.getErrorLocation=function(){return this._errorLocation},Fi.prototype.getPolygonLines=function(t){for(var e=new xt,n=new Ni(e),i=xi.getPolygons(t).iterator();i.hasNext();)i.next().apply(n);return t.getFactory().buildGeometry(e)},Fi.prototype.getErrorMessage=function(){return this._errMsg},Fi.prototype.interfaces_=function(){return[]},Fi.prototype.getClass=function(){return Fi},Gi.VERBOSE.get=function(){return!1},Gi.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Fi,Gi);var Bi=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},qi={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Bi.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Bi.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Bi.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new X(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new X(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Bi.prototype.checkDistance=function(){var t=new Fi(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},Bi.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Bi.prototype.checkPolygonal=function(){this._result instanceof $t||this._result instanceof ne||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Bi.prototype.getErrorIndicator=function(){return this._errorIndicator},Bi.prototype.getErrorLocation=function(){return this._errorLocation},Bi.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=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;n<t.getNumGeometries();n++){var i=this._mapOp.map(t.getGeometryN(n));i.isEmpty()||e.add(i)}return t.getFactory().createGeometryCollection(ye.toGeometryArray(e))},Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi},Xi.map=function(t,e){return new Xi(e).map(t)};var Yi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new xt,this._resultLineList=new xt;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Yi.prototype.collectLines=function(t){for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next();this.collectLineEdge(n,t,this._lineEdgesList),this.collectBoundaryTouchEdge(n,t,this._lineEdgesList)}},Yi.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Yi.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Yi.prototype.collectLineEdge=function(t,e,n){var i=t.getLabel(),r=t.getEdge();t.isLineEdge()&&(t.isVisited()||!Cr.isResultOfOp(i,e)||r.isCovered()||(n.add(r),t.setVisitedEdge(!0)))},Yi.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),i=n.getEdge();if(n.isLineEdge()&&!i.isCoveredSet()){var r=this._op.isCoveredByA(n.getCoordinate());i.setCovered(r)}}},Yi.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getLabel();n.isIsolated()&&(i.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},Yi.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),i=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(i),n.setInResult(!0)}},Yi.prototype.collectBoundaryTouchEdge=function(t,e,n){var i=t.getLabel();return t.isLineEdge()?null:t.isVisited()?null:t.isInteriorAreaEdge()?null:t.getEdge().isInResult()?null:(tt.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(Cr.isResultOfOp(i,e)&&e===Cr.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi};var Hi=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new xt;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Hi.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},Hi.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!(n.isInResult()||n.isIncidentEdgeInResult()||0!==n.getEdges().getDegree()&&t!==Cr.INTERSECTION)){var i=n.getLabel();Cr.isResultOfOp(i,t)&&this.filterCoveredNodeToPoint(n)}}},Hi.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var Wi=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Wi.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Wi.prototype.transformPolygon=function(t,e){var n=!0,i=this.transformLinearRing(t.getExteriorRing(),t);null!==i&&i instanceof ee&&!i.isEmpty()||(n=!1);for(var r=new xt,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof ee||(n=!1),r.add(s))}if(n)return this._factory.createPolygon(i,r.toArray([]));var a=new xt;return null!==i&&a.add(i),a.addAll(r),this._factory.buildGeometry(a)},Wi.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Wi.prototype.getInputGeometry=function(){return this._inputGeom},Wi.prototype.transformMultiLineString=function(t,e){for(var n=new xt,i=0;i<t.getNumGeometries();i++){var r=this.transformLineString(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this._factory.buildGeometry(n)},Wi.prototype.transformCoordinates=function(t,e){return this.copy(t)},Wi.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Wi.prototype.transformMultiPoint=function(t,e){for(var n=new xt,i=0;i<t.getNumGeometries();i++){var r=this.transformPoint(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this._factory.buildGeometry(n)},Wi.prototype.transformMultiPolygon=function(t,e){for(var n=new xt,i=0;i<t.getNumGeometries();i++){var r=this.transformPolygon(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this._factory.buildGeometry(n)},Wi.prototype.copy=function(t){return t.copy()},Wi.prototype.transformGeometryCollection=function(t,e){for(var n=new xt,i=0;i<t.getNumGeometries();i++){var r=this.transform(t.getGeometryN(i));null!==r&&(this._pruneEmptyGeometry&&r.isEmpty()||n.add(r))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(ye.toGeometryArray(n)):this._factory.buildGeometry(n)},Wi.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Zt)return this.transformPoint(t,null);if(t instanceof te)return this.transformMultiPoint(t,null);if(t instanceof ee)return this.transformLinearRing(t,null);if(t instanceof Jt)return this.transformLineString(t,null);if(t instanceof zt)return this.transformMultiLineString(t,null);if(t instanceof $t)return this.transformPolygon(t,null);if(t instanceof ne)return this.transformMultiPolygon(t,null);if(t instanceof Vt)return this.transformGeometryCollection(t,null);throw new y("Unknown Geometry subtype: "+t.getClass().getName())},Wi.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var i=n.size();return i>0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},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<n;i++){var r=t.get(i),o=this.findSnapForVertex(r,e);null!==o&&(t.set(i,new x(o)),0===i&&this._isClosed&&t.set(t.size()-1,new x(o)))}},Ji.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},Ji.prototype.snapTo=function(t){var e=new bt(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Ji.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var i=0;i<n;i++){var r=e[i],o=this.findSegmentIndexToSnap(r,t);o>=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;r<e.size()-1;r++){if(this._seg.p0=e.get(r),this._seg.p1=e.get(r+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var o=this._seg.distance(t);o<this._snapTolerance&&o<n&&(n=o,i=r)}return i},Ji.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ji.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Ki=function(t){this._srcGeom=t||null},Zi={SNAP_PRECISION_FACTOR:{configurable:!0}};Ki.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Qi(e,n).transform(this._srcGeom)},Ki.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),i=new Qi(t,n,!0).transform(this._srcGeom),r=i;return e&&M(r,Qt)&&(r=i.buffer(0)),r},Ki.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Ki.prototype.extractTargetCoordinates=function(t){for(var e=new p,n=t.getCoordinates(),i=0;i<n.length;i++)e.add(n[i]);return e.toArray(new Array(0).fill(null))},Ki.prototype.computeMinimumSegmentLength=function(t){for(var e=m.MAX_VALUE,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);i<e&&(e=i)}return e},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki},Ki.snap=function(t,e,n){var i=new Array(2).fill(null),r=new Ki(t);i[0]=r.snapTo(e,n);var o=new Ki(e);return i[1]=o.snapTo(i[0],n),i},Ki.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Ki.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===fe.FIXED){var i=1/n.getScale()*2/1.415;i>e&&(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<<e)?1:0},$i.signExpBits=function(t){return t>>52},$i.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},$i.numCommonMostSigMantissaBits=function(t,e){for(var n=0,i=52;i>=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._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._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;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof hr&&M(arguments[0],Lt)&&M(arguments[1],Lt)){var i=arguments[0],r=arguments[1],o=arguments[2];this.addEdges(i,i),this.addEdges(r,r),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&M(arguments[0],Lt)&&arguments[1]instanceof hr){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),i=n.getStartIndexes(),r=0;r<i.length-1;r++){var o=new sr(n,r),s=new ar(e,n.getMinX(r),o);this.events.add(s),this.events.add(new ar(n.getMaxX(r),s))}},e.prototype.processOverlaps=function(t,e,n,i){for(var r=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(r.computeIntersections(a,i),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1],r=n.iterator();r.hasNext();){var o=r.next();this.addEdge(o,i)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(lr),pr=function(){this._min=m.POSITIVE_INFINITY,this._max=m.NEGATIVE_INFINITY},fr={NodeComparator:{configurable:!0}};pr.prototype.getMin=function(){return this._min},pr.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},pr.prototype.getMax=function(){return this._max},pr.prototype.toString=function(){return Z.toLineString(new x(this._min,0),new x(this._max,0))},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr},fr.NodeComparator.get=function(){return gr},Object.defineProperties(pr,fr);var gr=function(){};gr.prototype.compare=function(t,e){var n=t,i=e,r=(n._min+n._max)/2,o=(i._min+i._max)/2;return r<o?-1:r>o?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<t.size();n+=2){var i=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(i);else{var r=new _r(t.get(n),t.get(n+1));e.add(r)}}},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr};var mr=function(){this._items=new xt};mr.prototype.visitItem=function(t){this._items.add(t)},mr.prototype.getItems=function(){return this._items},mr.prototype.interfaces_=function(){return[Je]},mr.prototype.getClass=function(){return mr};var vr=function(){this._index=null;var t=arguments[0];if(!M(t,Qt))throw new y("Argument must be Polygonal");this._index=new Lr(t)},Ir={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};vr.prototype.locate=function(t){var e=new ot(t),n=new Er(e);return this._index.query(t.y,t.y,n),e.getLocation()},vr.prototype.interfaces_=function(){return[qn]},vr.prototype.getClass=function(){return vr},Ir.SegmentVisitor.get=function(){return Er},Ir.IntervalIndexedGeometry.get=function(){return Lr},Object.defineProperties(vr,Ir);var Er=function(){this._counter=null;var t=arguments[0];this._counter=t};Er.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Er.prototype.interfaces_=function(){return[Je]},Er.prototype.getClass=function(){return Er};var Lr=function(){this._index=new yr;var t=arguments[0];this.init(t)};Lr.prototype.init=function(t){for(var e=Ni.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},Lr.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new dn(t[e-1],t[e]),i=Math.min(n.p0.y,n.p1.y),r=Math.max(n.p0.y,n.p1.y);this._index.insert(i,r,n)}},Lr.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new mr;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2];this._index.query(i,r,o)}},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr};var xr=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new pe,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new bi,2===arguments.length){var e=arguments[0],n=arguments[1],i=ft.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=i,null!==n&&this.add(n)}else if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=r,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,n){var i=this._nodes.addNode(n).getLabel(),r=1;S.NONE,i.getLocation(t,be.ON)===S.BOUNDARY&&r++;var o=e.determineBoundary(this._boundaryNodeRule,r);i.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],o=new hr(n,!0,!1);o.setIsDoneIfProperInt(r);var s=this.createEdgeSetIntersector(),a=this._parentGeom instanceof ee||this._parentGeom instanceof $t||this._parentGeom instanceof ne,u=i||!a;return s.computeIntersections(this._edges,o,u),this.addSelfIntersectionNodes(this._argIndex),o}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,n){var i=new hr(e,n,!0);return i.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,i),i},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Zt){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,S.INTERIOR)}else if(arguments[0]instanceof x){var e=arguments[0];this.insertPoint(this._argIndex,e,S.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),S.EXTERIOR,S.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,S.INTERIOR,S.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],S.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],S.BOUNDARY)},e.prototype.addLineString=function(t){var e=Ct.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new ni(e,new Te(this._argIndex,S.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),tt.isTrue(e.length>=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;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return M(this._parentGeom,Qt)&&this._parentGeom.getNumGeometries()>50?(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.getNumGeometries();i++){var r=e.map(t.getGeometryN(i));null!==r&&n.add(r)}return t.getFactory().buildGeometry(n)}if(M(arguments[0],vt)&&M(arguments[1],br.MapOp)){for(var o=arguments[0],s=arguments[1],a=new xt,u=o.iterator();u.hasNext();){var l=u.next(),h=s.map(l);null!==h&&a.add(h)}return a}},br.MapOp=function(){};var Cr=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new bi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Hn,this._resultPolyList=new xt,this._resultLineList=new xt,this._resultPointList=new xt,this._graph=new je(new Xn),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new Te(t.getLabel())).flip();var r=e.getDepth();r.isNull()&&r.add(n),r.add(i),n.merge(i)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,i,r){var o=new xt;return o.addAll(t),o.addAll(n),o.addAll(i),o.isEmpty()?e.createEmptyResult(r,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(this._ptLocator.locate(t,i)!==S.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new xt,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new xt;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ji.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new Xe(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var i=new Yi(this,this._geomFact,this._ptLocator);this._resultLineList=i.build(t);var r=new Hi(this,this._geomFact,this._ptLocator);this._resultPointList=r.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var i=n.next(),r=i.getLabel();r.isArea()&&!i.isInteriorAreaEdge()&&e.isResultOfOp(r.getLocation(0,be.RIGHT),r.getLocation(1,be.RIGHT),t)&&i.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),i=e.getDepth();if(!i.isNull()){i.normalize();for(var r=0;r<2;r++)n.isNull(r)||!n.isArea()||i.isNull(r)||(0===i.getDelta(r)?n.toLine(r):(tt.isTrue(!i.isNull(r,be.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(r,be.LEFT,i.getLocation(r,be.LEFT)),tt.isTrue(!i.isNull(r,be.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(r,be.RIGHT,i.getLocation(r,be.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Nr);Cr.overlayOp=function(t,e,n){return new Cr(t,e).getResultGeometry(n)},Cr.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return Cr.createEmptyResult(Cr.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return Xi.map(t,{interfaces_:function(){return[br.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),or.overlayOp(t,e,Cr.INTERSECTION)},Cr.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return Cr.createEmptyResult(Cr.SYMDIFFERENCE,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.SYMDIFFERENCE)},Cr.resultDimension=function(t,e,n){var i=e.getDimension(),r=n.getDimension(),o=-1;switch(t){case Cr.INTERSECTION:o=Math.min(i,r);break;case Cr.UNION:o=Math.max(i,r);break;case Cr.DIFFERENCE:o=i;break;case Cr.SYMDIFFERENCE:o=Math.max(i,r)}return o},Cr.createEmptyResult=function(t,e,n,i){var r=null;switch(Cr.resultDimension(t,e,n)){case-1:r=i.createGeometryCollection(new Array(0).fill(null));break;case 0:r=i.createPoint();break;case 1:r=i.createLineString();break;case 2:r=i.createPolygon()}return r},Cr.difference=function(t,e){return t.isEmpty()?Cr.createEmptyResult(Cr.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),or.overlayOp(t,e,Cr.DIFFERENCE))},Cr.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),i=t.getLocation(1);return Cr.isResultOfOp(n,i,e)}if(3===arguments.length){var r=arguments[0],o=arguments[1],s=arguments[2];switch(r===S.BOUNDARY&&(r=S.INTERIOR),o===S.BOUNDARY&&(o=S.INTERIOR),s){case Cr.INTERSECTION:return r===S.INTERIOR&&o===S.INTERIOR;case Cr.UNION:return r===S.INTERIOR||o===S.INTERIOR;case Cr.DIFFERENCE:return r===S.INTERIOR&&o!==S.INTERIOR;case Cr.SYMDIFFERENCE:return r===S.INTERIOR&&o!==S.INTERIOR||r!==S.INTERIOR&&o===S.INTERIOR}return!1}},Cr.INTERSECTION=1,Cr.UNION=2,Cr.DIFFERENCE=3,Cr.SYMDIFFERENCE=4;var Sr=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new bi,this._seg=new dn;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};Sr.prototype.isWithinToleranceOfBoundary=function(t){for(var e=0;e<this._linework.getNumGeometries();e++)for(var n=this._linework.getGeometryN(e).getCoordinateSequence(),i=0;i<n.size()-1;i++)if(n.getCoordinate(i,this._seg.p0),n.getCoordinate(i+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},Sr.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?S.BOUNDARY:this._ptLocator.locate(t,this._g)},Sr.prototype.extractLinework=function(t){var e=new wr;t.apply(e);var n=e.getLinework(),i=ye.toLineStringArray(n);return t.getFactory().createMultiLineString(i)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr};var wr=function(){this._linework=null,this._linework=new xt};wr.prototype.getLinework=function(){return this._linework},wr.prototype.filter=function(t){if(t instanceof $t){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},wr.prototype.interfaces_=function(){return[qt]},wr.prototype.getClass=function(){return wr};var Mr=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Mr.prototype.extractPoints=function(t,e,n){for(var i=t.getCoordinates(),r=0;r<i.length-1;r++)this.computeOffsetPoints(i[r],i[r+1],e,n)},Mr.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Mr.prototype.getPoints=function(t){for(var e=new xt,n=Ni.getLines(this._g).iterator();n.hasNext();){var i=n.next();this.extractPoints(i,t,e)}return e},Mr.prototype.computeOffsetPoints=function(t,e,n,i){var r=e.x-t.x,o=e.y-t.y,s=Math.sqrt(r*r+o*o),a=n*r/s,u=n*o/s,l=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new x(l-u,h+a);i.add(c)}if(this._doRight){var p=new x(l+u,h-a);i.add(p)}},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr};var Or=function to(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=to.TOLERANCE,this._testCoords=new xt;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=to.computeBoundaryDistanceTolerance(t,e),this._geom=[t,e,n],this._locFinder=[new Sr(this._geom[0],this._boundaryDistanceTolerance),new Sr(this._geom[1],this._boundaryDistanceTolerance),new Sr(this._geom[2],this._boundaryDistanceTolerance)]},Pr={TOLERANCE:{configurable:!0}};Or.prototype.reportResult=function(t,e,n){z.out.println("Overlay result invalid - A:"+S.toLocationSymbol(e[0])+" B:"+S.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+S.toLocationSymbol(e[2]))},Or.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);return this.checkValid(t)},Or.prototype.checkValid=function(){if(1===arguments.length){for(var t=arguments[0],e=0;e<this._testCoords.size();e++){var n=this._testCoords.get(e);if(!this.checkValid(t,n))return this._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],r=arguments[1];return this._location[0]=this._locFinder[0].getLocation(r),this._location[1]=this._locFinder[1].getLocation(r),this._location[2]=this._locFinder[2].getLocation(r),!!Or.hasLocation(this._location,S.BOUNDARY)||this.isValidResult(i,this._location)}},Or.prototype.addTestPts=function(t){var e=new Mr(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Or.prototype.isValidResult=function(t,e){var n=Cr.isResultOfOp(e[0],e[1],t),i=!(n^e[2]===S.INTERIOR);return i||this.reportResult(t,e,n),i},Or.prototype.getInvalidLocation=function(){return this._invalidLocation},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},Or.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Ki.computeSizeBasedSnapTolerance(t),Ki.computeSizeBasedSnapTolerance(e))},Or.isValid=function(t,e,n,i){return new Or(t,e,i).isValid(n)},Pr.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Or,Pr);var Tr=function eo(t){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=eo.extractFactory(t),this._inputGeoms=t};Tr.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this._skipEmpty&&i.isEmpty()||e.add(i)}},Tr.prototype.combine=function(){for(var t=new xt,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Tr.combine=function(){if(1===arguments.length){var t=arguments[0];return new Tr(t).combine()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return new Tr(Tr.createList(e,n)).combine()}if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2];return new Tr(Tr.createList(i,r,o)).combine()}},Tr.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Tr.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new xt;return n.add(t),n.add(e),n}if(3===arguments.length){var i=arguments[0],r=arguments[1],o=arguments[2],s=new xt;return s.add(i),s.add(r),s.add(o),s}};var Rr=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new xt)},Dr={STRTREE_NODE_CAPACITY:{configurable:!0}};Rr.prototype.reduceToGeometries=function(t){for(var e=new xt,n=t.iterator();n.hasNext();){var i=n.next(),r=null;M(i,Lt)?r=this.unionTree(i):i instanceof lt&&(r=i),e.add(r)}return e},Rr.prototype.extractByEnvelope=function(t,e,n){for(var i=new xt,r=0;r<e.getNumGeometries();r++){var o=e.getGeometryN(r);o.getEnvelopeInternal().intersects(t)?i.add(o):n.add(o)}return this._geomFactory.buildGeometry(i)},Rr.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),i=e.getEnvelopeInternal();if(!n.intersects(i))return Tr.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var r=n.intersection(i);return this.unionUsingEnvelopeIntersection(t,e,r)},Rr.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new sn(Rr.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var i=t.itemsTree();return this.unionTree(i)},Rr.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2];if(i-n<=1){var r=Rr.getGeometry(e,n);return this.unionSafe(r,null)}if(i-n==2)return this.unionSafe(Rr.getGeometry(e,n),Rr.getGeometry(e,n+1));var o=Math.trunc((i+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,i);return this.unionSafe(s,a)}},Rr.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var i=n.next();e=null===e?i.copy():e.union(i)}return e},Rr.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Rr.prototype.unionActual=function(t,e){return Rr.restrictToPolygons(t.union(e))},Rr.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Rr.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var i=new xt,r=this.extractByEnvelope(n,t,i),o=this.extractByEnvelope(n,e,i),s=this.unionActual(r,o);return i.add(s),Tr.combine(i)},Rr.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.restrictToPolygons=function(t){if(M(t,Qt))return t;var e=xi.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(ye.toPolygonArray(e))},Rr.getGeometry=function(t,e){return e>=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<n;r++)if(t.call(i,e[r],r,e))return r;return-1},Array.prototype.find=Array.prototype.find||function(t){if(null===this)throw new TypeError("Array.prototype.find 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<n;r++){var o=e[r];if(t.call(i,o,r,e))return o}},"function"!=typeof Object.assign&&(Object.assign=function(t){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var e=1;e<arguments.length;e++){var n=arguments[e];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach(function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})})},function(t,e){t.exports={name:"leaflet.pm",version:"0.23.1",description:"A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.0",keywords:["leaflet","polygon management","geometry editing","map data","map overlay","polygon","geojson","leaflet-draw","data-field-geojson","ui-leaflet-draw"],files:["dist"],main:"dist/leaflet.pm.min.js",dependencies:{"@turf/difference":"^5.0.4","@turf/intersect":"^5.0.4","@turf/kinks":"^5.0.4"},devDependencies:{"@babel/core":"^7.0.0-beta.34","@babel/preset-env":"^7.0.0-beta.34","babel-loader":"^8.0.0-beta.0","css-loader":"^0.28.0",eslint:"^4.11.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.8.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.1",leaflet:"^1.2.0","style-loader":"^0.19.0",tape:"^4.8.0","tape-run":"^3.0.0","uglifyjs-webpack-plugin":"^1.1.0","url-loader":"^0.6.2",webpack:"^3.8.1"},peerDependencies:{leaflet:"^1.2.0"},scripts:{start:"npm run dev",dev:"./node_modules/.bin/webpack --config=webpack.dev.js",test:"browserify ./spec/test.spec.js | tape-run",build:"./node_modules/.bin/webpack --config=webpack.build.js",prepare:"npm run build"},repository:{type:"git",url:"git+https://github.com/codeofsumit/leaflet.pm.git"},author:{name:"Sumit Kumar",email:"sk@outlook.com",url:"http://twitter.com/TweetsOfSumit"},license:"MIT",bugs:{url:"https://github.com/codeofsumit/leaflet.pm/issues"},homepage:"https://leafletpm.now.sh"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i=L.Class.extend({initialize:function(t){var e=this;this.map=t,this.Draw=new L.PM.Draw(t),this.Toolbar=new L.PM.Toolbar(t),this.map.on("layerremove",function(t){t.layer.pm&&!t.layer._pmTempLayer&&e.map.fire("pm:remove",t)}),this._globalRemovalMode=!1},addControls:function(t){this.Toolbar.addControls(t)},removeControls:function(){this.Toolbar.removeControls()},toggleControls:function(){this.Toolbar.toggleControls()},controlsVisible:function(){return this.Toolbar.isVisible},enableDraw:function(){var t=arguments.length>0&&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("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof o)throw new Error("<coordinates> 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<t.length;i++)t[i]=Math.round(t[i]*e)/e}(t,a,o)}),t}},function(t,e,n){"use strict";function i(t){var e=Object(o.a)(t);if(2===e.length&&!function(t,e){return t[0]===e[0]&&t[1]===e[1]}(e[0],e[1]))return e;var n,i,r,s=[],a=e.length-1;s.push(e[0]);for(var u=1;u<a;u++)n=e[u-1],i=e[u],function(t,e,n){var i=n[0],r=n[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,h=u-s;return(i-o)*h-(r-s)*l==0&&(Math.abs(l)>=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;e<t.coordinates.length;e++)n+=r(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(e=0;e<t.geometries.length;e++)n+=i(t.geometries[e]);return n}}function r(t){var e=0;if(t&&t.length>0){e+=Math.abs(o(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(o(t[n]))}return e}function o(t){var e,n,i,r,o,a,l=0,h=t.length;if(h>2){for(a=0;a<h;a++)a===h-2?(i=h-2,r=h-1,o=0):a===h-1?(i=h-1,r=0,o=1):(i=a,r=a+1,o=a+2),e=t[i],n=t[r],l+=(s(t[o][0])-s(e[0]))*Math.sin(s(n[1]));l=l*u*u/2}return l}function s(t){return t*Math.PI/180}var a=n(3),u=6378137;e.a=function(t){return Object(a.c)(t,function(t,e){return t+i(e)},0)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var i={_initDraggableLayer:function(){this._tempDragCoord=null;var t=this._layer._path;L.DomUtil.addClass(t,"leaflet-pm-draggable"),this._originalMapDragState=this._layer._map.dragging._enabled,this._safeToCacheDragState=!0,this._layer.on("mousedown",this._dragMixinOnMouseDown,this)},_dragMixinOnMouseUp:function(){var t=this,e=this._layer._path;return this._originalMapDragState&&this._layer._map.dragging.enable(),this._safeToCacheDragState=!0,this._layer._map.off("mousemove",this._dragMixinOnMouseMove,this),this._layer.off("mouseup",this._dragMixinOnMouseUp,this),!!this._dragging&&(this._initMarkers(),window.setTimeout(function(){t._dragging=!1,L.DomUtil.removeClass(e,"leaflet-pm-dragging"),t._layer.fire("pm:dragend"),t._fireEdit()},10),!0)},_dragMixinOnMouseMove:function(t){var e=this._layer._path;this._dragging||(this._dragging=!0,L.DomUtil.addClass(e,"leaflet-pm-dragging"),this._layer.bringToFront(),this._originalMapDragState&&this._layer._map.dragging.disable(),this._markerGroup.clearLayers(),this._layer.fire("pm:dragstart")),this._onLayerDrag(t)},_dragMixinOnMouseDown:function(t){this._safeToCacheDragState&&(this._originalMapDragState=this._layer._map.dragging._enabled,this._safeToCacheDragState=!1),this._tempDragCoord=t.latlng,this._layer.on("mouseup",this._dragMixinOnMouseUp,this),this._layer._map.on("mousemove",this._dragMixinOnMouseMove,this)},dragging:function(){return this._dragging},_onLayerDrag:function(t){var e,n=t.latlng,i={lat:n.lat-this._tempDragCoord.lat,lng:n.lng-this._tempDragCoord.lng},r=function(t){return t.map(function(t){return{lat:t.lat+i.lat,lng:t.lng+i.lng}})};e=this.isPolygon()?this._layer._latlngs.map(r,this):r(this._layer._latlngs),this._layer.setLatLngs(e).redraw(),this._tempDragCoord=n,this._layer.fire("pm:drag")}};e["default"]=i},function(t,e,n){"use strict";(function(t){return t&&t.__esModule?t:{"default":t}})(n(2))["default"].LayerGroup=L.Class.extend({initialize:function(t){var e=this;this._layerGroup=t,this._layers=this.findLayers(),this._layers.forEach(function(t){return e._initLayer(t)}),this._layerGroup.on("layeradd",function(t){t.target._pmTempLayer||(e._layers=e.findLayers(),t.layer.pm&&e._initLayer(t.layer),t.target.pm.enabled())})},findLayers:function(){var t=this._layerGroup.getLayers();return t=t.filter(function(t){return!!t.pm}),t=t.filter(function(t){return!t._pmTempLayer})},_initLayer:function(t){var e=this;["pm:edit","pm:update","pm:remove","pm:dragstart","pm:drag","pm:dragend","pm:snap","pm:unsnap","pm:cut","pm:intersect","pm:raiseMarkers","pm:markerdragend","pm:markerdragstart","pm:vertexadded","pm:vertexremoved","pm:centerplaced"].forEach(function(n){t.on(n,e._fireEvent,e)}),t.pm._layerGroup=this._layerGroup},_fireEvent:function(t){this._layerGroup.fireEvent(t.type,t)},toggleEdit:function(t){this._options=t,this._layers.forEach(function(e){e.pm.toggleEdit(t)})},enable:function(t){this._options=t,this._layers.forEach(function(e){e.pm.enable(t)})},disable:function(){this._layers.forEach(function(t){t.pm.disable()})},enabled:function(){var t=this._layers.find(function(t){return t.pm.enabled()});return!!t},dragging:function(){var t=this._layers.find(function(t){return t.pm.dragging()});return!!t},getOptions:function(){return this._options}})},function(t,e,n){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}}(n(2));i["default"].Marker=i["default"].extend({initialize:function(t){this._layer=t,this._enabled=!1,this._layer.on("dragend",this._onDragEnd,this)},toggleEdit:function(t){this.enabled()?this.disable():this.enable(t)},enable:function(){var t=arguments.length>0&&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){}]);
|