XWWitPark/witpark_jzzs/xw_jzzs_web/public/lib/turf/turf.min.js
2024-09-12 08:10:00 +08:00

2 lines
547 KiB
JavaScript

/* 2020-9-22 15:23:20 | 版权所有 军懋国兴 */
function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.turf={})}(this,function(t){"use strict";var p=6371008.8,r={meters:p,metres:p,millimeters:1e3*p,millimetres:1e3*p,centimeters:100*p,centimetres:100*p,kilometers:p/1e3,kilometres:p/1e3,miles:p/1609.344,nauticalmiles:p/1852,inches:39.37*p,yards:p/1.0936,feet:3.28084*p,radians:1,degrees:p/111325},e={meters:1,metres:1,millimeters:1e3,millimetres:1e3,centimeters:100,centimetres:100,kilometers:.001,kilometres:.001,miles:1/1609.344,nauticalmiles:1/1852,inches:39.37,yards:1/1.0936,feet:3.28084,radians:1/p,degrees:1/111325},o={meters:1,metres:1,millimeters:1e6,millimetres:1e6,centimeters:1e4,centimetres:1e4,kilometers:1e-6,kilometres:1e-6,acres:247105e-9,miles:386e-9,yards:1.195990046,feet:10.763910417,inches:1550.003100006};function j(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.bbox,i=n.id;if(void 0===t)throw new Error("geometry is required");if(e&&e.constructor!==Object)throw new Error("properties must be an Object");r&&w(r),i&&b(i);var o={type:"Feature"};return i&&(o.id=i),r&&(o.bbox=r),o.properties=e||{},o.geometry=t,o}function n(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r,i=n.bbox;if(!t)throw new Error("type is required");if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");switch(i&&w(i),t){case"Point":r=X(e).geometry;break;case"LineString":r=U(e).geometry;break;case"Polygon":r=G(e).geometry;break;case"MultiPoint":r=u(e).geometry;break;case"MultiLineString":r=v(e).geometry;break;case"MultiPolygon":r=x(e).geometry;break;default:throw new Error(t+" is invalid")}return i&&(r.bbox=i),r}function X(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(!V(t[0])||!V(t[1]))throw new Error("coordinates must contain numbers");return j({type:"Point",coordinates:t},e,n)}function i(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return Y(t.map(function(t){return X(t,e)}),n)}function G(t,e,n){if(!t)throw new Error("coordinates is required");for(var r=0;r<t.length;r++){var i=t[r];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var o=0;o<i[i.length-1].length;o++){if(0===r&&0===o&&!V(i[0][0])||!V(i[0][1]))throw new Error("coordinates must contain numbers");if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}}return j({type:"Polygon",coordinates:t},e,n)}function s(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return Y(t.map(function(t){return G(t,e)}),n)}function U(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(!V(t[0][1])||!V(t[0][1]))throw new Error("coordinates must contain numbers");return j({type:"LineString",coordinates:t},e,n)}function a(t,e,n){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");return Y(t.map(function(t){return U(t,e)}),n)}function Y(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.id;if(!t)throw new Error("No features passed");if(!Array.isArray(t))throw new Error("features must be an Array");n&&w(n),r&&b(r);var i={type:"FeatureCollection"};return r&&(i.id=r),n&&(i.bbox=n),i.features=t,i}function v(t,e,n){if(!t)throw new Error("coordinates is required");return j({type:"MultiLineString",coordinates:t},e,n)}function u(t,e,n){if(!t)throw new Error("coordinates is required");return j({type:"MultiPoint",coordinates:t},e,n)}function x(t,e,n){if(!t)throw new Error("coordinates is required");return j({type:"MultiPolygon",coordinates:t},e,n)}function h(t,e,n){if(!t)throw new Error("geometries is required");if(!Array.isArray(t))throw new Error("geometries must be an Array");return j({type:"GeometryCollection",geometries:t},e,n)}function c(t,e){if(null==t||isNaN(t))throw new Error("num is required");if(e&&!(0<=e))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function g(t,e){if(null==t)throw new Error("radians is required");if(e&&"string"!=typeof e)throw new Error("units must be a string");var n=r[e||"kilometers"];if(!n)throw new Error(e+" units is invalid");return t*n}function d(t,e){if(null==t)throw new Error("distance is required");if(e&&"string"!=typeof e)throw new Error("units must be a string");var n=r[e||"kilometers"];if(!n)throw new Error(e+" units is invalid");return t/n}function l(t,e){return y(d(t,e))}function f(t){if(null==t)throw new Error("bearing is required");var e=t%360;return e<0&&(e+=360),e}function y(t){if(null==t)throw new Error("radians is required");return t%(2*Math.PI)*180/Math.PI}function m(t){if(null==t)throw new Error("degrees is required");return t%360*Math.PI/180}function _(t,e,n){if(null==t)throw new Error("length is required");if(!(0<=t))throw new Error("length must be a positive number");return g(d(t,e),n||"kilometers")}function E(t,e,n){if(null==t)throw new Error("area is required");if(!(0<=t))throw new Error("area must be a positive number");var r=o[e||"meters"];if(!r)throw new Error("invalid original units");var i=o[n||"kilometers"];if(!i)throw new Error("invalid final units");return t/r*i}function V(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function H(t){return!!t&&t.constructor===Object}function w(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(!V(t))throw new Error("bbox must only contain numbers")})}function b(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")}var I=Object.freeze({earthRadius:p,factors:r,unitsFactors:e,areaFactors:o,feature:j,geometry:n,point:X,points:i,polygon:G,polygons:s,lineString:U,lineStrings:a,featureCollection:Y,multiLineString:v,multiPoint:u,multiPolygon:x,geometryCollection:h,round:c,radiansToLength:g,lengthToRadians:d,lengthToDegrees:l,bearingToAzimuth:f,radiansToDegrees:y,degreesToRadians:m,convertLength:_,convertArea:E,isNumber:V,isObject:H,validateBBox:w,validateId:b,radians2degrees:function(){throw new Error("method has been renamed to `radiansToDegrees`")},degrees2radians:function(){throw new Error("method has been renamed to `degreesToRadians`")},distanceToDegrees:function(){throw new Error("method has been renamed to `lengthToDegrees`")},distanceToRadians:function(){throw new Error("method has been renamed to `lengthToRadians`")},radiansToDistance:function(){throw new Error("method has been renamed to `radiansToLength`")},bearingToAngle:function(){throw new Error("method has been renamed to `bearingToAzimuth`")},convertDistance:function(){throw new Error("method has been renamed to `convertLength`")}});function N(t,e,n){if(null!==t)for(var r,i,o,s,a,u,h,c,l=0,p=t.type,f="FeatureCollection"===p,g="Feature"===p,d=f?t.features.length:1,y=0;y<d;y++){a=(c=!!(h=f?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var _=0;_<a;_++){var m=0,v=0;if(null!==(s=c?h.geometries[_]:h)){u=s.coordinates;var x=s.type,E=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1;switch(x){case null:break;case"Point":e(u,l,y,m,v),l++,m++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++)e(u[r],l,y,m,v),l++,"MultiPoint"===x&&m++;"LineString"===x&&m++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-E;i++)e(u[r][i],l,y,m,v),l++;"MultiLineString"===x&&m++,"Polygon"===x&&v++}"Polygon"===x&&m++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for("MultiPolygon"===x&&(v=0),i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-E;o++)e(u[r][i][o],l,y,m,v),l++;v++}m++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)N(s.geometries[r],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function C(t,o,s,e){var a=s;return N(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)},e),a}function S(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function M(t,n,r){var i=r;return S(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function L(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function P(t,n,r){var i=r;return L(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function O(t){var e=[];return N(t,function(t){e.push(t)}),e}function R(t,e){for(var n,r,i,o,s,a,u,h,c,l=0,p="FeatureCollection"===t.type,f="Feature"===t.type,g=p?t.features.length:1,d=0;d<g;d++){for(s=p?t.features[d].geometry:f?t.geometry:t,u=p?t.features[d].properties:f?t.properties:{},h=p?t.features[d].bbox:f?t.bbox:void 0,c=p?t.features[d].id:f?t.id:void 0,o=(a=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,r=0;r<o;r++)if(null!==(i=a?s.geometries[r]:s))switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(i,l,u,h,c);break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)e(i.geometries[n],l,u,h,c);break;default:throw new Error("Unknown Geometry Type")}else e(null,l,u,h,c);l++}}function T(t,o,s){var a=s;return R(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)}),a}function A(t,a){R(t,function(t,n,r,e,i){var o,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return a(j(t,r,{bbox:e,id:i}),n,0),0}switch(s){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}t.coordinates.forEach(function(t,e){a(j({type:o,coordinates:t},r),n,e)})})}function D(t,r,i){var o=i;return A(t,function(t,e,n){o=0===e&&0===n&&void 0===i?t:r(o,t,e,n)}),o}function F(t,l){A(t,function(a,u,h){var t,c=0;!a.geometry||"Point"!==(t=a.geometry.type)&&"MultiPoint"!==t&&C(a,function(t,e,n,r,i,o){var s=U([t,e],a.properties);return l(s,u,h,o,c),c++,e})})}function q(t,o,s){var a=s,u=!1;return F(t,function(t,e,n,r,i){a=!1===u&&void 0===s?t:o(a,t,e,n,r,i),u=!0}),a}function B(t,s){if(!t)throw new Error("geojson is required");A(t,function(t,e,n){if(null!==t.geometry){var r=t.geometry.type,i=t.geometry.coordinates;switch(r){case"LineString":s(t,e,n,0,0);break;case"Polygon":for(var o=0;o<i.length;o++)s(U(i[o],t.properties),e,n,o)}}})}function k(t,i,o){var s=o;return B(t,function(t,e,n,r){s=0===e&&void 0===o?t:i(s,t,e,n,r)}),s}var z=Object.freeze({coordEach:N,coordReduce:C,propEach:S,propReduce:M,featureEach:L,featureReduce:P,coordAll:O,geomEach:R,geomReduce:T,flattenEach:A,flattenReduce:D,segmentEach:F,segmentReduce:q,lineEach:B,lineReduce:k});function W(t){var e=[1/0,1/0,-1/0,-1/0];return N(t,function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])}),e}function J(t){if(!t)throw new Error("obj is required");var e=Z(t);if(1<e.length&&V(e[0])&&V(e[1]))return e;throw new Error("Coordinate is not a valid Point")}function Z(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 K(e),e;throw new Error("No valid coordinates")}function K(t){if(1<t.length&&V(t[0])&&V(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return K(t[0]);throw new Error("coordinates must only contain numbers")}function Q(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function $(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function tt(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0;r<t.features.length;r++){var i=t.features[r];if(!i||"Feature"!==i.type||!i.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!i.geometry||i.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+i.geometry.type)}}function et(t){if(!t)throw new Error("geojson is required");if(void 0!==t.geometry)return t.geometry;if(t.coordinates||t.geometries)return t;throw new Error("geojson must be a valid Feature or Geometry Object")}function nt(){throw new Error("invariant.getGeomType has been deprecated in v5.0 in favor of invariant.getType")}function rt(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")}var it=Object.freeze({getCoord:J,getCoords:Z,containsNumber:K,geojsonType:Q,featureOf:$,collectionOf:tt,getGeom:et,getGeomType:nt,getType:rt}),ot={successCallback:null,verbose:!1},st={};function at(t,e,n){return(t-e)/(n-e)}function ut(t){return 0===t.cval||15===t.cval}function ht(t){ut(t)||5===t.cval||10===t.cval||(t.cval=15)}function ct(t,e){return"top"===e?[t.top,1]:"bottom"===e?[t.bottom,0]:"right"===e?[1,t.right]:"left"===e?[0,t.left]:void 0}function lt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function pt(t,e){return t<e?-1:e<t?1:0}var ft=gt;function gt(t,e){if(!(this instanceof gt))return new gt(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function dt(t,e){yt(t,0,t.children.length,e,t)}function yt(t,e,n,r,i){(i=i||It(null)).minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],_t(i,t.leaf?r(o):o);return i}function _t(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function mt(t,e){return t.minX-e.minX}function vt(t,e){return t.minY-e.minY}function xt(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Et(t){return t.maxX-t.minX+(t.maxY-t.minY)}function wt(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function bt(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function It(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Nt(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(function t(e,n,r,i,o){for(r=r||0,i=i||e.length-1,o=o||pt;r<i;){var s,a,u,h,c;600<i-r&&(s=i-r+1,a=n-r+1,u=Math.log(s),h=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*h*(s-h)/s)*(a-s/2<0?-1:1),t(e,n,Math.max(r,Math.floor(n-a*h/s+c)),Math.min(i,Math.floor(n+(s-a)*h/s+c)),o));var l=e[n],p=r,f=i;for(lt(e,r,n),0<o(e[i],l)&&lt(e,r,i);p<f;){for(lt(e,p,f),p++,f--;o(e[p],l)<0;)p++;for(;0<o(e[f],l);)f--}0===o(e[r],l)?lt(e,r,f):lt(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}}(t,o=e+Math.ceil((n-e)/r/2)*r,e,n,i),s.push(e,o,o,n))}function Ct(t,e){return t(e={exports:{}},e.exports),e.exports}gt.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!bt(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],bt(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):wt(t,a)?this._all(s,n):u.push(s));e=u.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!bt(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],bt(t,s=e.leaf?n(o):o)){if(e.leaf||wt(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);return this}var r,i=this._build(t.slice(),0,t.length-1,0);return this.data.children.length?this.data.height===i.height?this._splitRoot(this.data,i):(this.data.height<i.height&&(r=this.data,this.data=i,i=r),this._insert(i,this.data.height-i.height-1,!0)):this.data=i,this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=It([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],h=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=h.pop(),o=!0),s.leaf&&-1!==(i=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!wt(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),h.push(n),n=0,s=(r=s).children[0])}return this},toBBox:function(t){return t},compareMinX:mt,compareMinY:vt,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return dt(i=It(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=It([])).leaf=!1,i.height=r;var a,u,h,c,l=Math.ceil(o/s),p=l*Math.ceil(Math.sqrt(s));for(Nt(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(Nt(t,a,h=Math.min(a+p-1,n),l,this.compareMinY),u=a;u<=h;u+=l)c=Math.min(u+l-1,h),i.children.push(this._build(t,u,c,r-1));return dt(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,h,c,l,p,f;r.push(e),!e.leaf&&r.length-1!==n;){for(c=l=1/0,i=0,o=e.children.length;i<o;i++)u=xt(s=e.children[i]),p=t,f=s,(h=(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-u)<l?(l=h,c=u<c?u:c,a=s):h===l&&u<c&&(c=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),_t(s,i);0<=e&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=It(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,dt(n,this.toBBox),dt(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=It([t,e]),this.data.height=t.height+1,this.data.leaf=!1,dt(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){for(var r,i,o,s,a,u,h,c,l,p,f,g,d=a=1/0,y=e;y<=n-e;y++)h=r=yt(t,0,y,this.toBBox),c=i=yt(t,y,n,this.toBBox),l=Math.max(h.minX,c.minX),p=Math.max(h.minY,c.minY),f=Math.min(h.maxX,c.maxX),g=Math.min(h.maxY,c.maxY),o=Math.max(0,f-l)*Math.max(0,g-p),s=xt(r)+xt(i),o<d?(d=o,u=y,a=s<a?s:a):o===d&&s<a&&(a=s,u=y);return u},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:mt,i=t.leaf?this.compareMinY:vt;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);for(var i,o=this.toBBox,s=yt(t,0,e,o),a=yt(t,n-e,n,o),u=Et(s)+Et(a),h=e;h<n-e;h++)i=t.children[h],_t(s,t.leaf?o(i):i),u+=Et(s);for(h=n-e-1;e<=h;h--)i=t.children[h],_t(a,t.leaf?o(i):i),u+=Et(a);return u},_adjustParentBBoxes:function(t,e,n){for(var r=n;0<=r;r--)_t(e[r],t)},_condense:function(t){for(var e,n=t.length-1;0<=n;n--)0===t[n].children.length?0<n?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():dt(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};function St(t,e,n){var r=t*e,i=Ot*t,o=i-(i-t),s=t-o,a=Ot*e,u=a-(a-e),h=e-u,c=s*h-(r-o*u-s*u-o*h);return n?(n[0]=c,n[1]=r,n):[c,r]}function Mt(t,e){var n,r,i,o,s,a=0|t.length,u=0|e.length;if(1==a&&1==u)return n=t[0],r=e[0],(s=n-((i=n+r)-(o=i-n))+(r-o))?[s,i]:[i];var h,c,l=new Array(a+u),p=0,f=0,g=0,d=Math.abs,y=t[f],_=d(y),m=e[g],v=d(m);_<v?(c=y,(f+=1)<a&&(_=d(y=t[f]))):(c=m,(g+=1)<u&&(v=d(m=e[g]))),f<a&&_<v||u<=g?(h=y,(f+=1)<a&&(_=d(y=t[f]))):(h=m,(g+=1)<u&&(v=d(m=e[g])));for(var x,E,w=h+c,b=c-(w-h),I=b,N=w;f<a&&g<u;)_<v?(h=y,(f+=1)<a&&(_=d(y=t[f]))):(h=m,(g+=1)<u&&(v=d(m=e[g]))),(b=(c=I)-((w=h+c)-h))&&(l[p++]=b),I=N-((x=N+w)-(E=x-N))+(w-E),N=x;for(;f<a;)(b=(c=I)-((w=(h=y)+c)-h))&&(l[p++]=b),I=N-((x=N+w)-(E=x-N))+(w-E),N=x,(f+=1)<a&&(y=t[f]);for(;g<u;)(b=(c=I)-((w=(h=m)+c)-h))&&(l[p++]=b),I=N-((x=N+w)-(E=x-N))+(w-E),N=x,(g+=1)<u&&(m=e[g]);return I&&(l[p++]=I),N&&(l[p++]=N),p||(l[p++]=0),l.length=p,l}function Lt(t,e){var n=t.length;if(1===n){var r=St(t[0],e);return r[0]?r:[r[1]]}var i=new Array(2*n),o=[.1,.1],s=[.1,.1],a=0;St(t[0],e,o),o[0]&&(i[a++]=o[0]);for(var u,h,c,l,p,f,g,d=1;d<n;++d){St(t[d],e,s);var y=o[1];g=f=p=l=void 0,f=(h=s[0])-(p=(l=(u=y)+h)-u),g=u-(l-p),(c=o)&&(c[0]=g+f,c[1]=l),o[0]&&(i[a++]=o[0]);var _=s[1],m=o[1],v=_+m,x=m-(v-_);o[1]=v,x&&(i[a++]=x)}return o[1]&&(i[a++]=o[1]),0===a&&(i[a++]=0),i.length=a,i}function Pt(t,e){var n,r,i,o,s,a=0|t.length,u=0|e.length;if(1==a&&1==u)return n=t[0],r=-e[0],(s=n-((i=n+r)-(o=i-n))+(r-o))?[s,i]:[i];var h,c,l=new Array(a+u),p=0,f=0,g=0,d=Math.abs,y=t[f],_=d(y),m=-e[g],v=d(m);_<v?(c=y,(f+=1)<a&&(_=d(y=t[f]))):(c=m,(g+=1)<u&&(v=d(m=-e[g]))),f<a&&_<v||u<=g?(h=y,(f+=1)<a&&(_=d(y=t[f]))):(h=m,(g+=1)<u&&(v=d(m=-e[g])));for(var x,E,w=h+c,b=c-(w-h),I=b,N=w;f<a&&g<u;)_<v?(h=y,(f+=1)<a&&(_=d(y=t[f]))):(h=m,(g+=1)<u&&(v=d(m=-e[g]))),(b=(c=I)-((w=h+c)-h))&&(l[p++]=b),I=N-((x=N+w)-(E=x-N))+(w-E),N=x;for(;f<a;)(b=(c=I)-((w=(h=y)+c)-h))&&(l[p++]=b),I=N-((x=N+w)-(E=x-N))+(w-E),N=x,(f+=1)<a&&(y=t[f]);for(;g<u;)(b=(c=I)-((w=(h=m)+c)-h))&&(l[p++]=b),I=N-((x=N+w)-(E=x-N))+(w-E),N=x,(g+=1)<u&&(m=-e[g]);return I&&(l[p++]=I),N&&(l[p++]=N),p||(l[p++]=0),l.length=p,l}var Ot=+(Math.pow(2,27)+1),Rt=Ct(function(o){function c(t,e){for(var n=new Array(t.length-1),r=1;r<t.length;++r)for(var i=n[r-1]=new Array(t.length-1),o=0,s=0;o<t.length;++o)o!==e&&(i[s++]=t[r][o]);return n}function l(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",l(t.slice(0,e)),",",l(t.slice(e)),")"].join("")}function p(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],n=0;n<t.length;++n)e.push(["scale(",l(p(c(t,n))),",",1&n?"-":"",t[0][n],")"].join(""));return e}function s(t){for(var e=[],n=[],r=function(t){for(var e=new Array(t),n=0;n<t;++n){e[n]=new Array(t);for(var r=0;r<t;++r)e[n][r]=["m",r,"[",t-n-1,"]"].join("")}return e}(t),i=[],o=0;o<t;++o)0==(1&o)?e.push.apply(e,p(c(r,o))):n.push.apply(n,p(c(r,o))),i.push("m"+o);var s=l(e),a=l(n),u="orientation"+t+"Exact",h=["function ",u,"(",i.join(),"){var p=",s,",n=",a,",d=sub(p,n);return d[d.length-1];};return ",u].join("");return new Function("sum","prod","scale","sub",h)(Mt,St,Lt,Pt)}var u=s(3),E=s(4),a=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){var r,i=(t[1]-n[1])*(e[0]-n[0]),o=(t[0]-n[0])*(e[1]-n[1]),s=i-o;if(0<i){if(o<=0)return s;r=i+o}else{if(!(i<0))return s;if(0<=o)return s;r=-(i+o)}var a=33306690738754716e-32*r;return a<=s||s<=-a?s:u(t,e,n)},function(t,e,n,r){var i=t[0]-r[0],o=e[0]-r[0],s=n[0]-r[0],a=t[1]-r[1],u=e[1]-r[1],h=n[1]-r[1],c=t[2]-r[2],l=e[2]-r[2],p=n[2]-r[2],f=o*h,g=s*u,d=s*a,y=i*h,_=i*u,m=o*a,v=c*(f-g)+l*(d-y)+p*(_-m),x=7771561172376103e-31*((Math.abs(f)+Math.abs(g))*Math.abs(c)+(Math.abs(d)+Math.abs(y))*Math.abs(l)+(Math.abs(_)+Math.abs(m))*Math.abs(p));return x<v||x<-v?v:E(t,e,n,r)}];!function(){for(;a.length<=5;)a.push(s(a.length));for(var t=[],e=["slow"],n=0;n<=5;++n)t.push("a"+n),e.push("o"+n);for(var r=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=5;++n)r.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");r.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),e.push(r.join(""));var i=Function.apply(void 0,e);for(o.exports=i.apply(void 0,[function(t){return(a[t.length]||(a[t.length]=s(t.length))).apply(void 0,t)}].concat(a)),n=0;n<=5;++n)o.exports[n]=a[n]}()}),Tt=Rt[3],At=Ft,Dt=Ft;function Ft(t,e){if(!(this instanceof Ft))return new Ft(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||qt,0<this.length)for(var n=(this.length>>1)-1;0<=n;n--)this._down(n)}function qt(t,e){return t<e?-1:e<t?1:0}Ft.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,0<this.length&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,n=this.compare,r=e[t];0<t;){var i=t-1>>1,o=e[i];if(0<=n(r,o))break;e[t]=o,t=i}e[t]=r},_down:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=o+1,a=e[o];if(s<this.length&&n(e[s],a)<0&&(a=e[o=s]),0<=n(a,i))break;e[t]=a,t=o}e[t]=i}},At.default=Dt;var Gt=Rt[3],Bt=kt;function kt(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;for(var r,i=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}for(var a=[e,n,r,i],u=a.slice(),o=0;o<t.length;o++)!function(t,e){for(var n=t[0],r=t[1],i=!1,o=0,s=e.length-1;o<e.length;s=o++){var a=e[o][0],u=e[o][1],h=e[s][0],c=e[s][1];r<u!=r<c&&n<(h-a)*(r-u)/(c-u)+a&&(i=!i)}return i}(t[o],a)&&u.push(t[o]);var h=function(n){var t=n.length;if(t<3){for(var e=new Array(t),r=0;r<t;++r)e[r]=r;return 2===t&&n[0][0]===n[1][0]&&n[0][1]===n[1][1]?[0]:e}for(var i=new Array(t),r=0;r<t;++r)i[r]=r;i.sort(function(t,e){return n[t][0]-n[e][0]||n[t][1]-n[e][1]});for(var o=[i[0],i[1]],s=[i[0],i[1]],r=2;r<t;++r){for(var a=i[r],u=n[a],h=o.length;1<h&&Tt(n[o[h-2]],n[o[h-1]],u)<=0;)--h,o.pop();for(o.push(a),h=s.length;1<h&&0<=Tt(n[s[h-2]],n[s[h-1]],u);)--h,s.pop();s.push(a)}for(var e=new Array(s.length+o.length-2),c=0,r=0,l=o.length;r<l;++r)e[c++]=o[r];for(var p=s.length-2;0<p;--p)e[c++]=s[p];return e}(u),c=[];for(o=0;o<h.length;o++)c.push(u[h[o]]);return c}(t),o=ft(16,["[0]","[1]","[0]","[1]"]).load(t),s=[],a=0;a<i.length;a++){var u=i[a];o.remove(u),r=Yt(u,r),s.push(r)}for(var h=ft(16),a=0;a<s.length;a++)h.insert(Ut(s[a]));for(var c=e*e,l=n*n;s.length;){var p,f=s.shift(),g=f.p,d=f.next.p,y=Vt(g,d);y<l||(p=y/c,(u=function(t,e,n,r,i,o,s){for(var a=new At(null,zt),u=t.data;u;){for(var h=0;h<u.children.length;h++){var c=u.children[h],l=u.leaf?Ht(c,n,r):function(t,e,n){if(jt(t,n)||jt(e,n))return 0;var r=Wt(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Wt(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Wt(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Wt(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}(n,r,c);o<l||a.push({node:c,dist:l})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=Ht(f,e,n),d=Ht(f,r,i);if(p.dist<g&&p.dist<d&&Xt(n,f,s)&&Xt(r,f,s))return f}(u=a.pop())&&(u=u.node)}return null}(o,f.prev.p,g,d,f.next.next.p,p,h))&&Math.min(Vt(u,g),Vt(u,d))<=p&&(s.push(f),s.push(Yt(u,f)),o.remove(u),h.remove(f),h.insert(Ut(f)),h.insert(Ut(f.next))))}f=r;for(var _=[];_.push(f.p),(f=f.next)!==r;);return _.push(f.p),_}function zt(t,e){return t.dist-e.dist}function jt(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Xt(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),h=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),l=n.search({minX:a,minY:u,maxX:h,maxY:c}),p=0;p<l.length;p++)if(r=l[p].p,i=l[p].next.p,o=t,r!==(s=e)&&i!==o&&0<Gt(r,i,o)!=0<Gt(r,i,s)&&0<Gt(o,s,r)!=0<Gt(o,s,i))return;return 1}function Ut(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function Yt(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,(n.prev=e).next.prev=n,e.next=n):(n.prev=n).next=n,n}function Vt(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Ht(t,e,n){var r,i=e[0],o=e[1],s=n[0]-i,a=n[1]-o;return 0===s&&0===a||(1<(r=((t[0]-i)*s+(t[1]-o)*a)/(s*s+a*a))?(i=n[0],o=n[1]):0<r&&(i+=s*r,o+=a*r)),(s=t[0]-i)*s+(a=t[1]-o)*a}function Wt(t,e,n,r,i,o,s,a){var u,h,c,l,p=n-t,f=r-e,g=s-i,d=a-o,y=t-i,_=e-o,m=p*p+f*f,v=p*g+f*d,x=g*g+d*d,E=p*y+f*_,w=g*y+d*_,b=m*x-v*v,I=b,N=b;0==b?(h=0,I=1,l=w,N=x):(l=m*w-v*E,(h=v*w-x*E)<0?(h=0,l=w,N=x):I<h&&(h=I,l=w+v,N=x)),l<0?-E<(l=0)?h=0:m<-E?h=I:(h=-E,I=m):N<l&&(l=N,v-E<0?h=0:m<v-E?h=I:(h=v-E,I=m));var C=(1-(c=0===l?0:l/N))*i+c*s-((1-(u=0===h?0:h/I))*t+u*n),S=(1-c)*o+c*a-((1-u)*e+u*r);return C*C+S*S}function Jt(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.concavity||1/0,r=[];if(N(t,function(t){r.push([t[0],t[1]])}),!r.length)return null;var i=Bt(r,n);return 3<i.length?G([i]):null}function Zt(t,e,n){if("object"!=_typeof(n=n||{}))throw new Error("options is invalid");var r=n.ignoreBoundary;if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var i=J(t),o=Z(e),s=e.geometry?e.geometry.type:e.type,a=e.bbox;if(a&&0==(a[0]<=i[0]&&a[1]<=i[1]&&a[2]>=i[0]&&a[3]>=i[1]))return!1;"Polygon"===s&&(o=[o]);for(var u=0,h=!1;u<o.length&&!h;u++)if(Kt(i,o[u][0],r)){for(var c=!1,l=1;l<o[u].length&&!c;)Kt(i,o[u][l],!r)&&(c=!0),l++;c||(h=!0)}return h}function Kt(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],h=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+h*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(h-t[1])<=0)return!n;a>t[1]!=h>t[1]&&t[0]<(u-s)*(t[1]-a)/(h-a)+s&&(r=!r)}return r}function Qt(t,e){var n=[];return R(e,function(e){L(t,function(t){Zt(t,e)&&n.push(t)})}),Y(n)}function $t(t,n){if("FeatureCollection"!==t.type)throw new Error("points must be a FeatureCollection");var o=!1;return Y(function(t){if(t.length<3)return[];t.sort(ee);for(var e,n,r,i,o,s,a=t[x=t.length-1].x,u=t[0].x,h=t[x].y,c=h;x--;)t[x].y<h&&(h=t[x].y),t[x].y>c&&(c=t[x].y);for(var l,p=u-a,f=c-h,g=f<p?p:f,d=.5*(u+a),y=.5*(c+h),_=[new te({x:d-20*g,y:y-g,__sentinel:!0},{x:d,y:y+20*g,__sentinel:!0},{x:d+20*g,y:y-g,__sentinel:!0})],m=[],v=[],x=t.length;x--;){for(v.length=0,l=_.length;l--;)0<(p=t[x].x-_[l].x)&&p*p>_[l].r?(m.push(_[l]),_.splice(l,1)):p*p+(f=t[x].y-_[l].y)*f>_[l].r||(v.push(_[l].a,_[l].b,_[l].b,_[l].c,_[l].c,_[l].a),_.splice(l,1));for(function(t){var e,n,r,i,o,s=t.length;t:for(;s;)for(n=t[--s],e=t[--s],r=s;r;)if(o=t[--r],e===(i=t[--r])&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}(v),l=v.length;l;)n=v[--l],e=v[--l],r=t[x],i=n.x-e.x,o=n.y-e.y,s=2*(i*(r.y-n.y)-o*(r.x-n.x)),1e-12<Math.abs(s)&&_.push(new te(e,n,r))}for(Array.prototype.push.apply(m,_),x=m.length;x--;)(m[x].a.__sentinel||m[x].b.__sentinel||m[x].c.__sentinel)&&m.splice(x,1);return m}(t.features.map(function(t){var e={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return n?e.z=t.properties[n]:3===t.geometry.coordinates.length&&(o=!0,e.z=t.geometry.coordinates[2]),e})).map(function(t){var e=[t.a.x,t.a.y],n=[t.b.x,t.b.y],r=[t.c.x,t.c.y],i={};return o?(e.push(t.a.z),n.push(t.b.z),r.push(t.c.z)):i={a:t.a.z,b:t.b.z,c:t.c.z},G([[e,n,r,e]],i)}))}function te(t,e,n){this.a=t,this.b=e,this.c=n;var r,i,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,h=o*(t.x+e.x)+s*(t.y+e.y),c=a*(t.x+n.x)+u*(t.y+n.y),l=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*h-s*c)/l,this.y=(o*c-a*h)/l,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i}function ee(t,e){return e.x-t.x}function ne(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.units,i=J(t),o=J(e),s=m(o[1]-i[1]),a=m(o[0]-i[0]),u=m(i[1]),h=m(o[1]),c=Math.pow(Math.sin(s/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(u)*Math.cos(h);return g(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),r)}function re(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return ie(t);case"FeatureCollection":return e=t,n={type:"FeatureCollection"},Object.keys(e).forEach(function(t){switch(t){case"type":case"features":return;default:n[t]=e[t]}}),n.features=e.features.map(ie),n;case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return oe(t);default:throw new Error("unknown GeoJSON type")}var e,n}function ie(e){var n={type:"Feature"};return Object.keys(e).forEach(function(t){switch(t){case"type":case"properties":case"geometry":return;default:n[t]=e[t]}}),n.properties=function n(r){var i={};return r&&Object.keys(r).forEach(function(t){var e=r[t];"object"==_typeof(e)?null===e?i[t]=null:e.length?i[t]=e.map(function(t){return t}):i[t]=n(e):i[t]=e}),i}(e.properties),n.geometry=oe(e.geometry),n}function oe(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?e.geometries=t.geometries.map(oe):e.coordinates=function t(e){return"object"!=_typeof(e[0])?e.slice():e.map(t)}(t.coordinates),e}Bt.default=kt;function se(t){return t}var ae=function(t){if(null==t)return se;var o,s,a=t.scale[0],u=t.scale[1],h=t.translate[0],c=t.translate[1];return function(t,e){e||(o=s=0);var n=2,r=t.length,i=new Array(r);for(i[0]=(o+=t[0])*a+h,i[1]=(s+=t[1])*u+c;n<r;)i[n]=t[n],++n;return i}},ue=function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n};function he(t,e){var o=ae(t.transform),s=t.arcs;function i(t){return o(t)}function a(t){for(var e=[],n=0,r=t.length;n<r;++n)!function(t,e){e.length&&e.pop();for(var n=s[t<0?~t:t],r=0,i=n.length;r<i;++r)e.push(o(n[r],r));t<0&&ue(e,i)}(t[n],e);return e.length<2&&e.push(e[0]),e}function n(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function u(t){return t.map(n)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=i(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(i);break;case"LineString":n=a(e.arcs);break;case"MultiLineString":n=e.arcs.map(a);break;case"Polygon":n=u(e.arcs);break;case"MultiPolygon":n=e.arcs.map(u);break;default:return null}return{type:r,coordinates:n}}(e)}function ce(p,i){var o={},f={},g={},s=[],a=-1;function t(t,e){for(var n in t){var r=t[n];delete e[r.start],delete r.start,delete r.end,r.forEach(function(t){o[t<0?~t:t]=1}),s.push(r)}}return i.forEach(function(t,e){var n,r=p.arcs[t<0?~t:t];r.length<3&&!r[1][0]&&!r[1][1]&&(n=i[++a],i[a]=t,i[e]=n)}),i.forEach(function(t){var e,n,r,i,o,s,a,u,h=(r=t,o=p.arcs[r<0?~r:r],s=o[0],p.transform?(i=[0,0],o.forEach(function(t){i[0]+=t[0],i[1]+=t[1]})):i=o[o.length-1],r<0?[i,s]:[s,i]),c=h[0],l=h[1];(e=g[c])?(delete g[e.end],e.push(t),e.end=l,(n=f[l])?(delete f[n.start],a=n===e?e:e.concat(n),f[a.start=e.start]=g[a.end=n.end]=a):f[e.start]=g[e.end]=e):(e=f[l])?(delete f[e.start],e.unshift(t),e.start=c,(n=g[c])?(delete g[n.end],u=n===e?e:n.concat(e),f[u.start=n.start]=g[u.end=e.end]=u):f[e.start]=g[e.end]=e):f[(e=[t]).start=c]=g[e.end=l]=e}),t(g,f),t(f,g),i.forEach(function(t){o[t<0?~t:t]||s.push([t])}),s}function le(o,s,a,t,u,e){3===arguments.length&&(t=e=Array,u=null);for(var h=new t(o=1<<Math.max(4,Math.ceil(Math.log(o)/Math.LN2))),c=new e(o),l=o-1,n=0;n<o;++n)h[n]=u;return{set:function(t,e){for(var n=s(t)&l,r=h[n],i=0;r!=u;){if(a(r,t))return c[n]=e;if(++i>=o)throw new Error("full hashmap");r=h[n=n+1&l]}return h[n]=t,c[n]=e},maybeSet:function(t,e){for(var n=s(t)&l,r=h[n],i=0;r!=u;){if(a(r,t))return c[n];if(++i>=o)throw new Error("full hashmap");r=h[n=n+1&l]}return h[n]=t,c[n]=e},get:function(t,e){for(var n=s(t)&l,r=h[n],i=0;r!=u;){if(a(r,t))return c[n];if(++i>=o)break;r=h[n=n+1&l]}return e},keys:function(){for(var t=[],e=0,n=h.length;e<n;++e){var r=h[e];r!=u&&t.push(r)}return t}}}function pe(t,e){return t[0]===e[0]&&t[1]===e[1]}function fe(t){de[0]=t[0],de[1]=t[1];var e=ye[0]^ye[1];return 2147483647&(e<<5^e>>7^ye[2]^ye[3])}var ge=new ArrayBuffer(16),de=new Float64Array(ge),ye=new Uint32Array(ge);function _e(t,e,n){for(var r,i=e+(n---e>>1);e<i;++e,--n)r=t[e],t[e]=t[n],t[n]=r}function me(t){var e,n=ve(t.geometry);for(e in null!=t.id&&(n.id=t.id),null!=t.bbox&&(n.bbox=t.bbox),t.properties){n.properties=t.properties;break}return n}function ve(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(ve)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return null!=t.bbox&&(e.bbox=t.bbox),e}function xe(t,d){var y=function(t){var r=1/0,i=1/0,o=-1/0,s=-1/0;function e(t){null!=t&&a.hasOwnProperty(t.type)&&a[t.type](t)}var n,a={GeometryCollection:function(t){t.geometries.forEach(e)},Point:function(t){u(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(u)},LineString:function(t){h(t.arcs)},MultiLineString:function(t){t.arcs.forEach(h)},Polygon:function(t){t.arcs.forEach(h)},MultiPolygon:function(t){t.arcs.forEach(c)}};function u(t){var e=t[0],n=t[1];e<r&&(r=e),o<e&&(o=e),n<i&&(i=n),s<n&&(s=n)}function h(t){t.forEach(u)}function c(t){t.forEach(h)}for(n in t)e(t[n]);return r<=o&&i<=s?[r,i,o,s]:void 0}(t=function(t){var e,n,r={};for(e in t)r[e]=null==(n=t[e])?{type:null}:("FeatureCollection"===n.type?function(t){var e={type:"GeometryCollection",geometries:t.features.map(me)};return null!=t.bbox&&(e.bbox=t.bbox),e}:"Feature"===n.type?me:ve)(n);return r}(t)),e=0<d&&y&&function(t){var l=y[0],p=y[1],e=y[2],n=y[3],f=e-l?(d-1)/(e-l):1,g=n-p?(d-1)/(n-p):1;function r(t){return[Math.round((t[0]-l)*f),Math.round((t[1]-p)*g)]}function i(t,e){for(var n,r,i,o,s,a=-1,u=0,h=t.length,c=new Array(h);++a<h;)n=t[a],o=Math.round((n[0]-l)*f),s=Math.round((n[1]-p)*g),o===r&&s===i||(c[u++]=[r=o,i=s]);for(c.length=u;u<e;)u=c.push([c[0][0],c[0][1]]);return c}function o(t){return i(t,2)}function s(t){return i(t,4)}function a(t){return t.map(s)}function u(t){null!=t&&c.hasOwnProperty(t.type)&&c[t.type](t)}var h,c={GeometryCollection:function(t){t.geometries.forEach(u)},Point:function(t){t.coordinates=r(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(r)},LineString:function(t){t.arcs=o(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(o)},Polygon:function(t){t.arcs=a(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(a)}};for(h in t)u(t[h]);return{scale:[1/f,1/g],translate:[l,p]}}(t),n=function(t){var e,n,c=t.coordinates,r=t.lines,i=t.rings,o=r.length+i.length;for(delete t.lines,delete t.rings,s=0,a=r.length;s<a;++s)for(e=r[s];e=e.next;)++o;for(s=0,a=i.length;s<a;++s)for(n=i[s];n=n.next;)++o;for(var h=le(2*o*1.4,fe,pe),l=t.arcs=[],s=0,a=r.length;s<a;++s)for(e=r[s];u(e),e=e.next;);for(s=0,a=i.length;s<a;++s)if((n=i[s]).next)for(;u(n),n=n.next;);else!function(t){var e,n,r,i,o;if(n=h.get(c[t[0]]))for(i=0,o=n.length;i<o;++i){if(p(r=n[i],t))return t[0]=r[0],t[1]=r[1];if(f(r,t))return t[0]=r[1],t[1]=r[0]}if(n=h.get(e=c[t[0]+g(t)]))for(i=0,o=n.length;i<o;++i){if(p(r=n[i],t))return t[0]=r[0],t[1]=r[1];if(f(r,t))return t[0]=r[1],t[1]=r[0]}n?n.push(t):h.set(e,[t]),l.push(t)}(n);function u(t){var e,n,r,i,o,s,a,u;if(r=h.get(e=c[t[0]]))for(a=0,u=r.length;a<u;++a)if(function(t,e){var n=t[0],r=e[0],i=t[1];if(n-i!=r-e[1])return!1;for(;n<=i;++n,++r)if(!pe(c[n],c[r]))return!1;return!0}(i=r[a],t))return t[0]=i[0],t[1]=i[1],0;if(o=h.get(n=c[t[1]]))for(a=0,u=o.length;a<u;++a)if(function(t,e){var n=t[0],r=e[0],i=t[1],o=e[1];if(n-i!=r-o)return!1;for(;n<=i;++n,--o)if(!pe(c[n],c[o]))return!1;return!0}(s=o[a],t))return t[1]=s[0],t[0]=s[1],0;r?r.push(t):h.set(e,[t]),o?o.push(t):h.set(n,[t]),l.push(t)}function p(t,e){var n=t[0],r=e[0],i=t[1]-n;if(i==e[1]-r){for(var o=g(t),s=g(e),a=0;a<i;++a)if(!pe(c[n+(a+o)%i],c[r+(a+s)%i]))return;return 1}}function f(t,e){var n=t[0],r=e[0],i=t[1],o=e[1],s=i-n;if(s==o-r){for(var a=g(t),u=s-g(e),h=0;h<s;++h)if(!pe(c[n+(h+a)%s],c[o-(h+u)%s]))return;return 1}}function g(t){for(var e=t[0],n=t[1],r=e,i=r,o=c[r];++r<n;){var s=c[r];(s[0]<o[0]||s[0]===o[0]&&s[1]<o[1])&&(i=r,o=s)}return i-e}return t}(function(t){for(var e,n,r,i,o,s=function(t){for(var i=t.coordinates,e=t.lines,n=t.rings,r=function(){for(var t=le(1.4*i.length,E,w,Int32Array,-1,Int32Array),e=new Int32Array(i.length),n=0,r=i.length;n<r;++n)e[n]=t.maybeSet(n,n);return e}(),s=new Int32Array(i.length),a=new Int32Array(i.length),u=new Int32Array(i.length),h=new Int8Array(i.length),c=0,o=0,l=i.length;o<l;++o)s[o]=a[o]=u[o]=-1;for(o=0,l=e.length;o<l;++o){var p=e[o],f=p[0],g=p[1],d=r[f],y=r[++f];for(++c,h[d]=1;++f<=g;)x(o,d,d=y,y=r[f]);++c,h[y]=1}for(o=0,l=i.length;o<l;++o)s[o]=-1;for(o=0,l=n.length;o<l;++o){var _=n[o],m=_[0]+1,v=_[1];for(x(o,r[v-1],d=r[m-1],y=r[m]);++m<=v;)x(o,d,d=y,y=r[m])}function x(t,e,n,r){var i,o;s[n]!==t&&(s[n]=t,0<=(i=a[n])?(o=u[n],i===e&&o===r||i===r&&o===e||(++c,h[n]=1)):(a[n]=e,u[n]=r))}function E(t){return fe(i[t])}function w(t,e){return pe(i[t],i[e])}s=a=u=null;var b,I=function(i,o,s,t,a){3===arguments.length&&(t=Array,a=null);for(var u=new t(i=1<<Math.max(4,Math.ceil(Math.log(i)/Math.LN2))),h=i-1,e=0;e<i;++e)u[e]=a;return{add:function(t){for(var e=o(t)&h,n=u[e],r=0;n!=a;){if(s(n,t))return!0;if(++r>=i)throw new Error("full hashset");n=u[e=e+1&h]}return u[e]=t,!0},has:function(t){for(var e=o(t)&h,n=u[e],r=0;n!=a;){if(s(n,t))return!0;if(++r>=i)break;n=u[e=e+1&h]}return!1},values:function(){for(var t=[],e=0,n=u.length;e<n;++e){var r=u[e];r!=a&&t.push(r)}return t}}}(1.4*c,fe,pe);for(o=0,l=i.length;o<l;++o)h[b=r[o]]&&I.add(i[b]);return I}(t),a=t.coordinates,u=t.lines,h=t.rings,c=0,l=u.length;c<l;++c)for(var p=u[c],f=p[0],g=p[1];++f<g;)s.has(a[f])&&(e={0:f,1:p[1]},p[1]=f,p=p.next=e);for(c=0,l=h.length;c<l;++c)for(var d=h[c],y=d[0],_=y,m=d[1],v=s.has(a[y]);++_<m;)s.has(a[_])&&(v?(e={0:_,1:d[1]},d[1]=_,d=d.next=e):(o=(i=m)-_,_e(n=a,r=y,i),_e(n,r,r+o),_e(n,r+o,i),a[m]=a[y],v=!0,_=y));return t}(function(t){var i=-1,o=[],s=[],a=[];function e(t){t&&r.hasOwnProperty(t.type)&&r[t.type](t)}var n,r={GeometryCollection:function(t){t.geometries.forEach(e)},LineString:function(t){t.arcs=u(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(u)},Polygon:function(t){t.arcs=t.arcs.map(h)},MultiPolygon:function(t){t.arcs=t.arcs.map(c)}};function u(t){for(var e=0,n=t.length;e<n;++e)a[++i]=t[e];var r={0:i-n+1,1:i};return o.push(r),r}function h(t){for(var e=0,n=t.length;e<n;++e)a[++i]=t[e];var r={0:i-n+1,1:i};return s.push(r),r}function c(t){return t.map(h)}for(n in t)e(t[n]);return{type:"Topology",coordinates:a,lines:o,rings:s,objects:t}}(t))),r=n.coordinates,i=le(1.4*n.arcs.length,Ee,we);function o(t){t&&a.hasOwnProperty(t.type)&&a[t.type](t)}t=n.objects,n.bbox=y,n.arcs=n.arcs.map(function(t,e){return i.set(t,e),r.slice(t[0],t[1]+1)}),delete n.coordinates,r=null;var s,a={GeometryCollection:function(t){t.geometries.forEach(o)},LineString:function(t){t.arcs=u(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(u)},Polygon:function(t){t.arcs=t.arcs.map(u)},MultiPolygon:function(t){t.arcs=t.arcs.map(h)}};function u(t){var e=[];do{var n=i.get(t);e.push(t[0]<t[1]?n:~n)}while(t=t.next);return e}function h(t){return t.map(u)}for(s in t)o(t[s]);return e&&(n.transform=e,n.arcs=function(t){for(var e=-1,n=t.length;++e<n;){for(var r,i,o=t[e],s=0,a=1,u=o.length,h=o[0],c=h[0],l=h[1];++s<u;)r=(h=o[s])[0],i=h[1],r===c&&i===l||(o[a++]=[r-c,i-l],c=r,l=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(n.arcs)),n}function Ee(t){var e,n=t[0],r=t[1];return r<n&&(e=n,n=r,r=e),n+31*r}function we(t,e){var n,r=t[0],i=t[1],o=e[0],s=e[1];return i<r&&(n=r,r=i,i=n),s<o&&(n=o,o=s,s=n),r===o&&i===s}function be(t){return t[0].toString()+","+t[1].toString()}function Ie(n,t){if(!H(t=t||{}))throw new Error("options is invalid");var e=t.mutate;if("FeatureCollection"!==rt(n))throw new Error("geojson must be a FeatureCollection");if(!n.features.length)throw new Error("geojson is empty");!1!==e&&void 0!==e||(n=re(n));var r=function(){var e={};A(n,function(t){e[t.geometry.type]=!0});var t=Object.keys(e);return 1===t.length?t[0]:null}();if(!r)throw new Error("geojson must be homogenous");switch(r){case"LineString":return function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==rt(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=re(t));var r=[],i=k(t,function(a,u){return function(){var t,e=a.geometry.coordinates,n=u.geometry.coordinates,r=be(e[0]),i=be(e[e.length-1]),o=be(n[0]),s=be(n[n.length-1]);if(r===s)t=n.concat(e.slice(1));else if(o===i)t=e.concat(n.slice(1));else if(r===o)t=e.slice(1).reverse().concat(n);else{if(i!==s)return null;t=e.concat(n.reverse().slice(1))}return U(t)}()||(r.push(a),u)});return i&&r.push(i),r.length?1===r.length?r[0]:v(r.map(function(t){return t.coordinates})):null}(n,t);case"Polygon":return function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==rt(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=re(t));var r=[];A(t,function(t){r.push(t.geometry)});var i=xe({geoms:h(r).geometry});return function(t){return he(t,function(a,t){var u={},n=[],r=[];function i(e){e.forEach(function(t){t.forEach(function(t){(u[t=t<0?~t:t]||(u[t]=[])).push(e)})}),n.push(e)}function h(t){return function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n<r;)e=i,i=t[n],o+=e[0]*i[1]-e[1]*i[0];return Math.abs(o)}(he(a,{type:"Polygon",arcs:[t]}).coordinates[0])}return t.forEach(function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":i(e.arcs);break;case"MultiPolygon":e.arcs.forEach(i)}}),n.forEach(function(t){if(!t._){var e=[],n=[t];for(t._=1,r.push(e);t=n.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){u[t<0?~t:t].forEach(function(t){t._||(t._=1,n.push(t))})})})}}),n.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:r.map(function(t){var e,n=[];if(t.forEach(function(t){t.forEach(function(t){t.forEach(function(t){u[t<0?~t:t].length<2&&n.push(t)})})}),1<(e=(n=ce(a,n)).length))for(var r,i,o=1,s=h(n[0]);o<e;++o)(r=h(n[o]))>s&&(i=n[0],n[0]=n[o],n[o]=i,s=r);return n})}}.apply(this,arguments))}(i,i.objects.geoms.geometries)}(n,t);default:throw new Error(r+" is not supported")}}function Ne(t,e){var n="object"==_typeof(e)?e.mutate:e;if(!t)throw new Error("geojson is required");var r=rt(t),i=[];switch(r){case"LineString":i=Ce(t);break;case"MultiLineString":case"Polygon":Z(t).forEach(function(t){i.push(Ce(t))});break;case"MultiPolygon":Z(t).forEach(function(t){var e=[];t.forEach(function(t){e.push(Ce(t))}),i.push(e)});break;case"Point":return t;case"MultiPoint":var o={};Z(t).forEach(function(t){var e=t.join("-");o.hasOwnProperty(e)||(i.push(t),o[e]=!0)});break;default:throw new Error(r+" geometry not supported")}return t.coordinates?!0===n?(t.coordinates=i,t):{type:r,coordinates:i}:!0===n?(t.geometry.coordinates=i,t):j({type:r,coordinates:i},t.properties,t.bbox,t.id)}function Ce(t){var e,n,r,i,o,s=Z(t);if(2===s.length&&(e=s[0],n=s[1],e[0]!==n[0]||e[1]!==n[1]))return s;var a=[],u=s.length-1;a.push(s[0]);for(var h,c,l,p,f,g,d,y,_,m,v,x=1;x<u;x++)r=s[x-1],i=s[x],h=r,c=o=s[x+1],v=m=_=y=d=g=f=p=void 0,p=(l=i)[0],f=l[1],g=h[0],d=h[1],y=c[0],_=c[1],0==(p-g)*(v=_-d)-(f-d)*(m=y-g)&&(Math.abs(m)>=Math.abs(v)?0<m?g<=p&&p<=y:y<=p&&p<=g:0<v?d<=f&&f<=_:_<=f&&f<=d)||a.push(i);return a.push(o),a}function Se(t,e){var n=t.length-1,r=[t[0]];return function t(e,n,r,i,o){for(var s,a,u,h,c,l,p,f,g,d=i,y=n+1;y<r;y++){var _=(a=e[y],u=e[n],h=e[r],g=f=p=l=c=void 0,l=u.x,p=u.y,f=h.x-l,g=h.y-p,0===f&&0===g||(1<(c=((a.x-l)*f+(a.y-p)*g)/(f*f+g*g))?(l=h.x,p=h.y):0<c&&(l+=f*c,p+=g*c)),(f=a.x-l)*f+(g=a.y-p)*g);d<_&&(s=y,d=_)}i<d&&(1<s-n&&t(e,n,s,i,o),o.push(e[s]),1<r-s&&t(e,s,r,i,o))}(t,0,n,e,r),r.push(t[n]),r}function Me(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return Se(t=n?t:function(t,e){for(var n,r,i,o=t[0],s=[o],a=1,u=t.length;a<u;a++)e<(r=(n=t[a]).x-o.x)*r+(i=n.y-o.y)*i&&(s.push(n),o=n);return o!==n&&s.push(n),s}(t,r),r)}function Le(t,e,n){return Me(t.map(function(t){return{x:t[0],y:t[1],z:t[2]}}),e,n).map(function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]})}function Pe(t,i,o){return t.map(function(t){var e=t.map(function(t){return{x:t[0],y:t[1]}});if(e.length<4)throw new Error("invalid polygon");for(var n,r=Me(e,i,o).map(function(t){return[t.x,t.y]});(n=r).length<3||3===n.length&&n[2][0]===n[0][0]&&n[2][1]===n[0][1];)r=Me(e,i-=.01*i,o).map(function(t){return[t.x,t.y]});return r[r.length-1][0]===r[0][0]&&r[r.length-1][1]===r[0][1]||r.push(r[0]),r})}function Oe(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length;for(var e=this.delay=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(e=0;e<this.length-1;e++){var n=this.points[e],r=this.points[e+1];this.centers.push({x:(n.x+r.x)/2,y:(n.y+r.y)/2,z:(n.z+r.z)/2})}for(this.controls.push([this.points[0],this.points[0]]),e=0;e<this.centers.length-1;e++){n=this.centers[e],r=this.centers[e+1];var i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,o=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,s=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+s)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+s)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}function Re(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.resolution||1e4,r=e.sharpness||.85;if(!t)throw new Error("line is required");if(!V(n))throw new Error("resolution must be an number");if(!V(r))throw new Error("sharpness must be an number");for(var i=[],o=new Oe({points:et(t).coordinates.map(function(t){return{x:t[0],y:t[1],z:t[2]||0}}),duration:n,sharpness:r}),s=0;s<o.duration;s+=10){var a=o.pos(s);Math.floor(s/100)%2==0&&i.push([a.x,a.y,a.z])}return U(i,t.properties)}function Te(t){w(t);var e=Number(t[0]),n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var o=[e,n];return G([[o,[r,n],[r,i],[e,i],o]])}function Ae(t){return Te(W(t))}function De(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=ne(t.slice(0,2),[r,n]);if(ne(t.slice(0,2),[e,i])<=o){var s=(n+i)/2;return[e,s-(r-e)/2,r,s+(r-e)/2]}var a=(e+r)/2;return[a-(i-n)/2,n,a+(i-n)/2,i]}function Fe(t,e,n,r){if(!H(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.properties,s=J(t),a=m(s[0]),u=m(s[1]),h=m(n),c=d(e,i),l=Math.asin(Math.sin(u)*Math.cos(c)+Math.cos(u)*Math.sin(c)*Math.cos(h));return X([y(a+Math.atan2(Math.sin(h)*Math.sin(c)*Math.cos(u),Math.cos(c)-Math.sin(u)*Math.sin(l))),y(l)],o)}function qe(t,e,n){var r=(n=n||{}).steps||64,i=n.properties;if(!t)throw new Error("center is required");if(!e)throw new Error("radius is required");if("object"!=_typeof(n))throw new Error("options must be an object");if("number"!=typeof r)throw new Error("steps must be a number");r=r||64,i=i||t.properties||{};for(var o=[],s=0;s<r;s++)o.push(Fe(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),G([o],i)}function Ge(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");if(!0===n.final)return(Ge(e,t)+180)%360;var r=J(t),i=J(e),o=m(r[0]),s=m(i[0]),a=m(r[1]),u=m(i[1]),h=Math.sin(s-o)*Math.cos(u),c=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return y(Math.atan2(h,c))}function Be(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.properties;if(!t)throw new Error("geojson is required");var r=W(t);return X([(r[0]+r[2])/2,(r[1]+r[3])/2],n)}function ke(t,e){var n=0,r=0,i=0;return N(t,function(t){n+=t[0],r+=t[1],i++},!0),X([n/i,r/i],e)}function ze(e){var n=[];return"FeatureCollection"===e.type?L(e,function(e){N(e,function(t){n.push(X(t,e.properties))})}):N(e,function(t){n.push(X(t,e.properties))}),Y(n)}Oe.prototype.cacheSteps=function(t){var e=[],n=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var i=this.pos(r);t<Math.sqrt((i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y)+(i.z-n.z)*(i.z-n.z))&&(e.push(r),n=i)}return e},Oe.prototype.vector=function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}},Oe.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(1<=n)return this.points[this.length-1];var r,i=Math.floor((this.points.length-1)*n),o=(this.length-1)*n-i,s=this.points[i],a=this.controls[i][1],u=this.controls[i+1][0],h=this.points[i+1],c=[(r=o*o)*o,3*r*(1-o),3*o*(1-o)*(1-o),(1-o)*(1-o)*(1-o)];return{x:h.x*c[0]+u.x*c[1]+a.x*c[2]+s.x*c[3],y:h.y*c[0]+u.y*c[1]+a.y*c[2]+s.y*c[3],z:h.z*c[0]+u.z*c[1]+a.z*c[2]+s.z*c[3]}};var je=Ue,Xe=Ue;function Ue(t,e,n){n=n||2;var r,i,o,s,a,u,h,c=e&&e.length,l=c?e[0]*n:t.length,p=Ye(t,0,l,n,!0),f=[];if(!p)return f;if(c&&(p=function(t,e,n,r){for(var i,o=[],s=0,a=e.length;s<a;s++)(i=Ye(t,e[s]*r,s<a-1?e[s+1]*r:t.length,r,!1))===i.next&&(i.steiner=!0),o.push(function(t){for(var e=t,n=t;e.x<n.x&&(n=e),(e=e.next)!==t;);return n}(i));for(o.sort(We),s=0;s<o.length;s++)(function(t,e){{var n;(e=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&s<a){if((s=a)===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===s)return n.prev;for(var u,h=n,c=n.x,l=n.y,p=1/0,r=n.next;r!==h;)i>=r.x&&r.x>=c&&i!==r.x&&Ze(o<l?i:s,o,c,l,o<l?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<p||u===p&&r.x>n.x)&&tn(r,t)&&(n=r,p=u),r=r.next;return n}(t,e))&&Ve(n=en(e,t),n.next)}})(o[s],n),n=Ve(n,n.next);return n}(t,e,p,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var g=n;g<l;g+=n)(a=t[g])<r&&(r=a),(u=t[g+1])<i&&(i=u),o<a&&(o=a),s<u&&(s=u);h=0!==(h=Math.max(o-r,s-i))?1/h:0}return He(p,f,n,r,i,h),f}function Ye(t,e,n,r,i){var o,s;if(i===0<sn(t,e,n,r))for(o=e;o<n;o+=r)s=nn(o,t[o],t[o+1],s);else for(o=n-r;e<=o;o-=r)s=nn(o,t[o],t[o+1],s);return s&&Qe(s,s.next)&&(rn(s),s=s.next),s}function Ve(t,e){if(!t)return t;e=e||t;var n,r=t;do{if(n=!1,r.steiner||!Qe(r,r.next)&&0!==Ke(r.prev,r,r.next))r=r.next;else{if(rn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function He(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){for(var i=t;null===i.z&&(i.z=Je(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,(i=i.next)!==t;);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,h=1;do{for(n=t,o=t=null,s=0;n;){for(s++,r=n,e=a=0;e<h&&(a++,r=r.nextZ);e++);for(u=h;0<a||0<u&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(n=(i=n).nextZ,a--):(r=(i=r).nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,h*=2}while(1<s)}(i)}(t,r,i,o);for(var a,u,h=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?function(t,e,n,r){var i=t.prev,o=t,s=t.next;if(0<=Ke(i,o,s))return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,u=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,h=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,l=Je(a,u,e,n,r),p=Je(h,c,e,n,r),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&Ze(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=Ke(f.prev,f,f.next))return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&Ze(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=Ke(f.prev,f,f.next))return!1;f=f.prevZ}return!0}(t,r,i,o):function(t){var e=t.prev,n=t,r=t.next;if(0<=Ke(e,n,r))return!1;for(var i=t.next.next;i!==t.prev;){if(Ze(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=Ke(i.prev,i,i.next))return!1;i=i.next}return!0}(t))e.push(a.i/n),e.push(t.i/n),e.push(u.i/n),rn(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?He(t=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Qe(i,o)&&$e(i,r,r.next,o)&&tn(i,o)&&tn(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),rn(r),rn(r.next),r=t=o),r=r.next}while(r!==t);return r}(t,e,n),e,n,r,i,o,2):2===s&&function(t,e,n,r,i,o){var s,a,u=t;do{for(var h=u.next.next;h!==u.prev;){if(u.i!==h.i&&(a=h,(s=u).next.i!==a.i&&s.prev.i!==a.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&$e(n,n.next,t,e))return 1;n=n.next}while(n!==t)}(s,a)&&tn(s,a)&&tn(a,s)&&function(t){for(var e=t,n=!1,r=(t.x+a.x)/2,i=(t.y+a.y)/2;e.y>i!=e.next.y>i&&e.next.y!==e.y&&r<(e.next.x-e.x)*(i-e.y)/(e.next.y-e.y)+e.x&&(n=!n),(e=e.next)!==t;);return n}(s))){var c=en(u,h);return u=Ve(u,u.next),c=Ve(c,c.next),He(u,e,n,r,i,o),He(c,e,n,r,i,o)}h=h.next}u=u.next}while(u!==t)}(t,e,n,r,i,o):He(Ve(t),e,n,r,i,o,1);break}}}function We(t,e){return t.x-e.x}function Je(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ze(t,e,n,r,i,o,s,a){return 0<=(i-s)*(e-a)-(t-s)*(o-a)&&0<=(t-s)*(r-a)-(n-s)*(e-a)&&0<=(n-s)*(o-a)-(i-s)*(r-a)}function Ke(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Qe(t,e){return t.x===e.x&&t.y===e.y}function $e(t,e,n,r){return Qe(t,e)&&Qe(n,r)||Qe(t,r)&&Qe(n,e)||0<Ke(t,e,n)!=0<Ke(t,e,r)&&0<Ke(n,r,t)!=0<Ke(n,r,e)}function tn(t,e){return Ke(t.prev,t,t.next)<0?0<=Ke(t,e,t.next)&&0<=Ke(t,t.prev,e):Ke(t,e,t.prev)<0||Ke(t,t.next,e)<0}function en(t,e){var n=new on(t.i,t.x,t.y),r=new on(e.i,e.x,e.y),i=t.next,o=e.prev;return(t.next=e).prev=t,(n.next=i).prev=n,(r.next=n).prev=r,(o.next=r).prev=o,r}function nn(t,e,n,r){var i=new on(t,e,n);return r?(i.next=r.next,(i.prev=r).next.prev=i,r.next=i):(i.prev=i).next=i,i}function rn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function on(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sn(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}function an(t){var r=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);0<i&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),i=je(r.vertices,r.holes,2),e=[],o=[];i.forEach(function(t,e){var n=i[e];o.push([r.vertices[2*n],r.vertices[2*n+1]])});for(var n=0;n<o.length;n+=3){var s=o.slice(n,n+3);s.push(o[n]),e.push(G([s]))}return e}function un(r,t){if(!r)throw new Error("targetPoint is required");if(!t)throw new Error("points is required");var i,o=1/0;return L(t,function(t,e){var n=ne(r,t);n<o&&((i=re(t)).properties.featureIndex=e,i.properties.distanceToPoint=n,o=n)}),i}function hn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function cn(t,e){return t<e?-1:e<t?1:0}function ln(t,e){if(!(this instanceof ln))return new ln(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function pn(t,e){fn(t,0,t.children.length,e,t)}function fn(t,e,n,r,i){(i=i||En(null)).minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],gn(i,t.leaf?r(o):o);return i}function gn(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function dn(t,e){return t.minX-e.minX}function yn(t,e){return t.minY-e.minY}function _n(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function mn(t){return t.maxX-t.minX+(t.maxY-t.minY)}function vn(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function xn(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function En(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function wn(t,e,n,r,i){for(var o,s,a,u,h=[e,n];h.length;)(n=h.pop())-(e=h.pop())<=r||(s=t,a=o=e+Math.ceil((n-e)/r/2)*r,u=i,function t(e,n,r,i,o){for(;r<i;){var s,a,u,h,c;600<i-r&&(s=i-r+1,a=n-r+1,u=Math.log(s),h=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*h*(s-h)/s)*(a-s/2<0?-1:1),t(e,n,Math.max(r,Math.floor(n-a*h/s+c)),Math.min(i,Math.floor(n+(s-a)*h/s+c)),o));var l=e[n],p=r,f=i;for(hn(e,r,n),0<o(e[i],l)&&hn(e,r,i);p<f;){for(hn(e,p,f),p++,f--;o(e[p],l)<0;)p++;for(;0<o(e[f],l);)f--}0===o(e[r],l)?hn(e,r,f):hn(e,++f,i),f<=n&&(r=f+1),n<=f&&(i=f-1)}}(s,a,e||0,n||s.length-1,u||cn),h.push(e,o,o,n))}function bn(t){var e=ln(t);return e.insert=function(t){var e;return Array.isArray(t)?(t=In(e=t)).bbox=e:t.bbox=t.bbox?t.bbox:Nn(t),ln.prototype.insert.call(this,t)},e.load=function(t){var n=[];return Array.isArray(t)?t.forEach(function(t){var e=In(t);e.bbox=t,n.push(e)}):L(t,function(t){t.bbox=t.bbox?t.bbox:Nn(t),n.push(t)}),ln.prototype.load.call(this,n)},e.remove=function(t){var e;return Array.isArray(t)&&((t=In(e=t)).bbox=e),ln.prototype.remove.call(this,t)},e.clear=function(){return ln.prototype.clear.call(this)},e.search=function(t){return{type:"FeatureCollection",features:ln.prototype.search.call(this,this.toBBox(t))}},e.collides=function(t){return ln.prototype.collides.call(this,this.toBBox(t))},e.all=function(){return{type:"FeatureCollection",features:ln.prototype.all.call(this)}},e.toJSON=function(){return ln.prototype.toJSON.call(this)},e.fromJSON=function(t){return ln.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;return{minX:(e=t.bbox?t.bbox:Array.isArray(t)&&4===t.length?t:Nn(t))[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}function In(t){var e=[t[0],t[1]],n=[t[0],t[3]],r=[t[2],t[3]];return{type:"Feature",bbox:t,properties:{},geometry:{type:"Polygon",coordinates:[[e,[t[2],t[1]],r,n,e]]}}}function Nn(t){var e=[1/0,1/0,-1/0,-1/0];return N(t,function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])}),e}function Cn(t){if(!t)throw new Error("geojson is required");var e=[];return A(t,function(t){!function(e,n){var t=[],r=e.geometry;switch(r.type){case"Polygon":t=Z(r);break;case"LineString":t=[Z(r)]}t.forEach(function(t){var a,u;(a=e.properties,u=[],t.reduce(function(t,e){var n,r,i,o,s=U([t,e],a);return s.bbox=(n=t[0],r=t[1],[n<(i=e[0])?n:i,r<(o=e[1])?r:o,i<n?n:i,o<r?r:o]),u.push(s),e}),u).forEach(function(t){t.id=n.length,n.push(t)})})}(t,e)}),Y(e)}function Sn(t,e){var i={},o=[];if("LineString"===t.type&&(t=j(t)),"LineString"===e.type&&(e=j(e)),"Feature"===t.type&&"Feature"===e.type&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var n=Mn(t,e);return n&&o.push(n),Y(o)}var s=bn();return s.load(Cn(e)),L(Cn(t),function(r){L(s.search(r),function(t){var e,n=Mn(r,t);n&&(e=Z(n).join(","),i[e]||(i[e]=!0,o.push(n)))})}),Y(o)}function Mn(t,e){var n=Z(t),r=Z(e);if(2!==n.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==r.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],u=r[0][0],h=r[0][1],c=r[1][0],l=r[1][1],p=(l-h)*(s-i)-(c-u)*(a-o);if(0==p)return null;var f=((c-u)*(o-h)-(l-h)*(i-u))/p,g=((s-i)*(o-h)-(a-o)*(i-u))/p;return 0<=f&&f<=1&&0<=g&&g<=1?X([i+f*(s-i),o+f*(a-o)]):null}function Ln(t,p,f){if(!H(f=f||{}))throw new Error("options is invalid");var e=t.geometry?t.geometry.type:t.type;if("LineString"!==e&&"MultiLineString"!==e)throw new Error("lines must be LineString or MultiLineString");var g=X([1/0,1/0],{dist:1/0}),d=0;return A(t,function(t){for(var e=Z(t),n=0;n<e.length-1;n++){var r=X(e[n]);r.properties.dist=ne(p,r,f);var i=X(e[n+1]);i.properties.dist=ne(p,i,f);var o=ne(r,i,f),s=Math.max(r.properties.dist,i.properties.dist),a=Ge(r,i),u=Fe(p,s,a+90,f),h=Fe(p,s,a-90,f),c=Sn(U([u.geometry.coordinates,h.geometry.coordinates]),U([r.geometry.coordinates,i.geometry.coordinates])),l=null;0<c.features.length&&((l=c.features[0]).properties.dist=ne(p,l,f),l.properties.location=d+ne(r,l,f)),r.properties.dist<g.properties.dist&&((g=r).properties.index=n,g.properties.location=d),i.properties.dist<g.properties.dist&&((g=i).properties.index=n+1,g.properties.location=d+o),l&&l.properties.dist<g.properties.dist&&((g=l).properties.index=n),d+=o}}),g}function Pn(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r,i=n.final;if(!t)throw new Error("start point is required");if(!e)throw new Error("end point is required");return 180<(r=i?On(J(e),J(t)):On(J(t),J(e)))?-(360-r):r}function On(t,e){var n=m(t[1]),r=m(e[1]),i=m(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4));return(y(Math.atan2(i,o))+360)%360}function Rn(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("from point is required");if(!e)throw new Error("to point is required");var i=J(t),o=J(e);return o[0]+=180<o[0]-i[0]?-360:180<i[0]-o[0]?360:0,_(function(t,e,n){var r=n=void 0===n?p:Number(n),i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),h=1e-11<Math.abs(u)?s/u:Math.cos(i);return Math.sqrt(s*s+h*h*a*a)*r}(i,o),"meters",r)}function Tn(t,e){return Dn(t,"mercator",e)}function An(t,e){return Dn(t,"wgs84",e)}function Dn(t,n,e){if(!H(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&V(t[0])?t=("mercator"===n?Fn:qn)(t):(!0!==r&&(t=re(t)),N(t,function(t){var e=("mercator"===n?Fn:qn)(t);t[0]=e[0],t[1]=e[1]})),t}function Fn(t){var e,n=Math.PI/180,r=20037508.342789244,i=[6378137*(Math.abs(t[0])<=180?t[0]:t[0]-360*((e=t[0])<0?-1:0<e?1:0))*n,6378137*Math.log(Math.tan(.25*Math.PI+.5*t[1]*n))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function qn(t){var e=180/Math.PI;return[t[0]*e/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/6378137)))*e]}Ue.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(sn(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var h=e[a]*n,c=a<u-1?e[a+1]*n:t.length;s-=Math.abs(sn(t,h,c,n))}for(var l=0,a=0;a<r.length;a+=3){var p=r[a]*n,f=r[a+1]*n,g=r[a+2]*n;l+=Math.abs((t[p]-t[g])*(t[1+f]-t[1+p])-(t[p]-t[f])*(t[1+g]-t[1+p]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},Ue.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);0<i&&(r+=t[i-1].length,n.holes.push(r))}return n},je.default=Xe,ln.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!xn(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],xn(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):vn(t,a)?this._all(s,n):u.push(s));e=u.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!xn(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],xn(t,s=e.leaf?n(o):o)){if(e.leaf||vn(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);return this}var r,i=this._build(t.slice(),0,t.length-1,0);return this.data.children.length?this.data.height===i.height?this._splitRoot(this.data,i):(this.data.height<i.height&&(r=this.data,this.data=i,i=r),this._insert(i,this.data.height-i.height-1,!0)):this.data=i,this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=En([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],h=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=h.pop(),o=!0),s.leaf&&-1!==(i=function(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}(t,s.children,e)))return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!vn(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),h.push(n),n=0,s=(r=s).children[0])}return this},toBBox:function(t){return t},compareMinX:dn,compareMinY:yn,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return pn(i=En(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=En([])).leaf=!1,i.height=r;var a,u,h,c,l=Math.ceil(o/s),p=l*Math.ceil(Math.sqrt(s));for(wn(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(wn(t,a,h=Math.min(a+p-1,n),l,this.compareMinY),u=a;u<=h;u+=l)c=Math.min(u+l-1,h),i.children.push(this._build(t,u,c,r-1));return pn(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,h,c,l,p,f;r.push(e),!e.leaf&&r.length-1!==n;){for(c=l=1/0,i=0,o=e.children.length;i<o;i++)u=_n(s=e.children[i]),p=t,f=s,(h=(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-u)<l?(l=h,c=u<c?u:c,a=s):h===l&&u<c&&(c=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),gn(s,i);0<=e&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=En(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,pn(n,this.toBBox),pn(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=En([t,e]),this.data.height=t.height+1,this.data.leaf=!1,pn(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){for(var r,i,o,s,a,u,h,c,l,p,f,g,d=a=1/0,y=e;y<=n-e;y++)h=r=fn(t,0,y,this.toBBox),c=i=fn(t,y,n,this.toBBox),l=Math.max(h.minX,c.minX),p=Math.max(h.minY,c.minY),f=Math.min(h.maxX,c.maxX),g=Math.min(h.maxY,c.maxY),o=Math.max(0,f-l)*Math.max(0,g-p),s=_n(r)+_n(i),o<d?(d=o,u=y,a=s<a?s:a):o===d&&s<a&&(a=s,u=y);return u},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:dn,i=t.leaf?this.compareMinY:yn;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);for(var i,o=this.toBBox,s=fn(t,0,e,o),a=fn(t,n-e,n,o),u=mn(s)+mn(a),h=e;h<n-e;h++)i=t.children[h],gn(s,t.leaf?o(i):i),u+=mn(s);for(h=n-e-1;e<=h;h--)i=t.children[h],gn(a,t.leaf?o(i):i),u+=mn(a);return u},_adjustParentBBoxes:function(t,e,n){for(var r=n;0<=r;r--)gn(e[r],t)},_condense:function(t){for(var e,n=t.length-1;0<=n;n--)0===t[n].children.length?0<n?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():pn(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}};var Gn=Object.freeze({toMercator:Tn,toWgs84:An});function Bn(t,e,i){if(!H(i=i||{}))throw new Error("options is invalid");if(!t)throw new Error("pt is required");if(Array.isArray(t)?t=X(t):"Point"===t.type?t=j(t):$(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=U(e):"LineString"===e.type?e=j(e):$(e,"LineString","line");var o=1/0,s=t.geometry.coordinates;return F(e,function(t){var e=t.geometry.coordinates[0],n=t.geometry.coordinates[1],r=function(t,e,n,r){var i=r.mercator,o=(!0!==i?ne:kn)(e,t,r),s=f((!0!==i?Ge:Pn)(e,t)),a=f((!0!==i?Ge:Pn)(e,n)),u=Math.abs(s-a);if(90<u)return o;var h=(a+180)%360,c=f((!0!==i?Ge:Pn)(n,t)),l=Math.abs(c-h);return 180<l&&(l=Math.abs(l-360)),90<l?(!0!==i?ne:kn)(t,n,r):!0!==i?o*Math.sin(m(u)):function(t,e,n,r){var i=0;(180<=Math.abs(t[0])||180<=Math.abs(e[0])||180<=Math.abs(n[0]))&&(i=0<t[0]||0<e[0]||0<n[0]?-180:180);var o,s,a,u,h,c,l,p=X(n),f=Tn([t[0]+i,t[1]]),g=Tn([e[0]+i,e[1]]),d=Tn([n[0]+i,n[1]]),y=An((o=f[0],s=f[1],a=g[0],u=g[1],[o+(l=((d[0]-o)*(h=a-o)+(d[1]-s)*(c=u-s))/(h*h+c*c))*h,s+l*c]));return 0!==i&&(y[0]-=i),Rn(p,y,r)}(e,n,t,r)}(s,e,n,i);r<o&&(o=r)}),o}function kn(t,e,n){var r=n.units,i=0;180<=Math.abs(t[0])&&(i=0<t[0]?-180:180),180<=Math.abs(e[0])&&(i=0<e[0]?-180:180);function o(t){return t*t}var s=Tn([t[0]+i,t[1]]),a=Tn([e[0]+i,e[1]]),u=o(s[0]-a[0])+o(s[1]-a[1]);return _(Math.sqrt(u),"meters",r)}function zn(t){for(var e,n="FeatureCollection"===(e=t).type?e:"Feature"===e.type?Y([e]):Y([j(e)]),r=Be(n),i=!1,o=0;!i&&o<n.features.length;){var s=n.features[o].geometry,a=!1;if("Point"===s.type)r.geometry.coordinates[0]===s.coordinates[0]&&r.geometry.coordinates[1]===s.coordinates[1]&&(i=!0);else if("MultiPoint"===s.type)for(var u=!1,h=0;!u&&h<s.coordinates.length;)r.geometry.coordinates[0]===s.coordinates[h][0]&&r.geometry.coordinates[1]===s.coordinates[h][1]&&(u=i=!0),h++;else if("LineString"===s.type)for(h=0;!a&&h<s.coordinates.length-1;)jn(r.geometry.coordinates[0],r.geometry.coordinates[1],s.coordinates[h][0],s.coordinates[h][1],s.coordinates[h+1][0],s.coordinates[h+1][1])&&(i=a=!0),h++;else if("MultiLineString"===s.type)for(var c=0;c<s.coordinates.length;){a=!1,h=0;for(var l=s.coordinates[c];!a&&h<l.length-1;)jn(r.geometry.coordinates[0],r.geometry.coordinates[1],l[h][0],l[h][1],l[h+1][0],l[h+1][1])&&(i=a=!0),h++;c++}else"Polygon"!==s.type&&"MultiPolygon"!==s.type||Zt(r,s)&&(i=!0);o++}if(i)return r;for(var p=Y([]),o=0;o<n.features.length;o++)p.features=p.features.concat(ze(n.features[o]).features);return X(un(r,p).geometry.coordinates)}function jn(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}function Xn(t){return T(t,function(t,e){return t+function t(e){var n,r=0;switch(e.type){case"Polygon":return Yn(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)r+=Yn(e.coordinates[n]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)r+=t(e.geometries[n]);return r}}(e)},0)}var Un=6378137;function Yn(t){var e=0;if(t&&0<t.length){e+=Math.abs(Vn(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Vn(t[n]))}return e}function Vn(t){var e,n,r,i,o,s,a=0,u=t.length;if(2<u){for(s=0;s<u;s++)o=s===u-2?(r=u-2,i=u-1,0):s===u-1?(r=u-1,i=0,1):(i=(r=s)+1,s+2),e=t[r],n=t[i],a+=(Hn(t[o][0])-Hn(e[0]))*Math.sin(Hn(n[1]));a=a*Un*Un/2}return a}function Hn(t){return t*Math.PI/180}function Wn(t,r){if(!H(r=r||{}))throw new Error("options is invalid");if(!t)throw new Error("geojson is required");return q(t,function(t,e){var n=e.geometry.coordinates;return t+ne(n[0],n[1],r)},0)}function Jn(t,e,n,r){if(!H(r=r||{}))throw new Error("options is invalid");var i,o=[];if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var s,a,u,h=0,c=0;c<i.length&&!(h<=e&&c===i.length-1);c++){if(e<h&&0===o.length){if(!(s=e-h))return o.push(i[c]),U(o);a=Ge(i[c],i[c-1])-180,u=Fe(i[c],s,a,r),o.push(u.geometry.coordinates)}if(n<=h)return(s=n-h)?(a=Ge(i[c],i[c-1])-180,u=Fe(i[c],s,a,r),o.push(u.geometry.coordinates)):o.push(i[c]),U(o);if(e<=h&&o.push(i[c]),c===i.length-1)return U(o);h+=ne(i[c],i[c+1],r)}return U(i[i.length-1])}function Zn(t,e,n){var r=(n=n||{}).ignoreEndVertices;if(!H(n))throw new Error("invalid options");if(!t)throw new Error("pt is required");if(!e)throw new Error("line is required");for(var i,o,s,a,u,h,c,l,p,f,g,d,y=J(t),_=Z(e),m=0;m<_.length-1;m++){var v=!1;if(r&&(0===m&&(v="start"),m===_.length-2&&(v="end"),0===m&&m+1===_.length-1&&(v="both")),i=_[m],o=_[m+1],a=v,d=g=f=p=l=c=h=u=void 0,u=(s=y)[0],h=s[1],c=i[0],l=i[1],p=o[0],f=o[1],g=p-c,d=f-l,0==(s[0]-c)*d-(s[1]-l)*g&&(a?"start"===a?Math.abs(g)>=Math.abs(d)?0<g?c<u&&u<=p:p<=u&&u<c:0<d?l<h&&h<=f:f<=h&&h<l:"end"===a?Math.abs(g)>=Math.abs(d)?0<g?c<=u&&u<p:p<u&&u<=c:0<d?l<=h&&h<f:f<h&&h<=l:"both"===a?Math.abs(g)>=Math.abs(d)?0<g?c<u&&u<p:p<u&&u<c:0<d?l<h&&h<f:f<h&&h<l:void 0:Math.abs(g)>=Math.abs(d)?0<g?c<=u&&u<=p:p<=u&&u<=c:0<d?l<=h&&h<=f:f<=h&&h<=l))return!0}return!1}function Kn(t,e){var n=rt(t),r=rt(e),i=et(t),o=et(e);switch(n){case"Point":switch(r){case"MultiPoint":return function(t,e){for(var n=!1,r=0;r<e.coordinates.length;r++)if($n(e.coordinates[r],t.coordinates)){n=!0;break}return n}(i,o);case"LineString":return Zn(i,o,{ignoreEndVertices:!0});case"Polygon":return Zt(i,o,{ignoreBoundary:!0});default:throw new Error("feature2 "+r+" geometry not supported")}case"MultiPoint":switch(r){case"MultiPoint":return function(t,e){for(var n=0;n<t.coordinates.length;n++){for(var r=!1,i=0;i<e.coordinates.length;i++)$n(t.coordinates[n],e.coordinates[i])&&(r=!0);if(!r)return!1}return!0}(i,o);case"LineString":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++){if(!Zn(t.coordinates[r],e))return!1;n=n||Zn(t.coordinates[r],e,{ignoreEndVertices:!0})}return n}(i,o);case"Polygon":return function(t,e){for(var n=!0,r=0;r<t.coordinates.length;r++){var i=Zt(t.coordinates[1],e);if(!i){n=!1;break}i=Zt(t.coordinates[1],e,{ignoreBoundary:!0})}return n&&i}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"LineString":return function(t,e){for(var n=0;n<t.coordinates.length;n++)if(!Zn(t.coordinates[n],e))return!1;return!0}(i,o);case"Polygon":return function(t,e){if(!Qn(W(e),W(t)))return!1;for(var n,r,i=!1,o=0;o<t.coordinates.length-1;o++){if(!Zt(t.coordinates[o],e))return!1;(i=i||Zt(t.coordinates[o],e,{ignoreBoundary:!0}))||(i=Zt((n=t.coordinates[o],r=t.coordinates[o+1],[(n[0]+r[0])/2,(n[1]+r[1])/2]),e,{ignoreBoundary:!0}))}return i}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":if("Polygon"!==r)throw new Error("feature2 "+r+" geometry not supported");return function(t,e){var n=W(t);if(!Qn(W(e),n))return!1;for(var r=0;r<t.coordinates[0].length;r++)if(!Zt(t.coordinates[0][r],e))return!1;return!0}(i,o);default:throw new Error("feature1 "+n+" geometry not supported")}}function Qn(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function $n(t,e){return t[0]===e[0]&&t[1]===e[1]}function tr(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.mask,i=n.properties,o=[];if(null==e)throw new Error("cellSide is required");if(!V(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(r&&-1===["Polygon","MultiPolygon"].indexOf(rt(r)))throw new Error("options.mask must be a (Multi)Polygon");for(var s=t[0],a=t[1],u=t[2],h=t[3],c=e/ne([s,a],[u,a],n)*(u-s),l=e/ne([s,a],[s,h],n)*(h-a),p=u-s,f=h-a,g=Math.floor(p/c),d=(f-Math.floor(f/l)*l)/2,y=s+(p-g*c)/2;y<=u;){for(var _=a+d;_<=h;){var m=X([y,_],i);r&&!Kn(m,r)||o.push(m),_+=l}y+=c}return Y(o)}function er(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.precision,r=e.coordinates,i=e.mutate,n=null==n||isNaN(n)?6:n,r=null==r||isNaN(r)?3:r;if(!t)throw new Error("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof r)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return N(t,function(t){!function(t,e){t.length>r&&t.splice(r,t.length);for(var n=0;n<t.length;n++)t[n]=Math.round(t[n]*e)/e}(t,o)}),t}function nr(t,e){if(t&&e&&t.length===e.length){for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!nr(t[n],e[n]))return}else if(t[n]!==e[n])return;return 1}}function rr(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i}function ir(t,e,n,r,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=n,this.nxtIsectAlongRingAndEdge1=r,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s}function or(t,e){if(void 0===e&&(e=!0),3!=t.length)throw new Error("This function requires an array of three points [x,y]");return 0<=(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])==e}function sr(t,e){if(t&&e&&t.length==e.length){for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!sr(t[n],e[n]))return}else if(t[n]!=e[n])return;return 1}}Number.prototype.modulo=function(t){return(this%t+t)%t};function ar(t,e){this.lon=t,this.lat=e,this.x=ur*t,this.y=ur*e}var ur=Math.PI/180,hr=180/Math.PI;ar.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},ar.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new ar(e,t)};function cr(){this.coords=[],this.length=0}cr.prototype.move_to=function(t){this.length++,this.coords.push(t)};function lr(t){this.properties=t||{},this.geometries=[]}lr.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1===this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},lr.prototype.wkt=function(){for(var t="",e="LINESTRING(",n=function(t){e+=t[0]+" "+t[1]+","},r=0;r<this.geometries.length;r++){if(0===this.geometries[r].coords.length)return"LINESTRING(empty)";this.geometries[r].coords.forEach(n),t+=e.substring(0,e.length-1)+")"}return t};function pr(t,e,n){if(!t||void 0===t.x||void 0===t.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||void 0===e.x||void 0===e.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new ar(t.x,t.y),this.end=new ar(e.x,e.y),this.properties=n||{};var r=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(r/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)}function fr(r,t){var i=[],o=bn();return A(t,function(t){var e,n;i.forEach(function(t,e){t.id=e}),i.length?(e=o.search(t)).features.length&&(n=dr(t,e),i=i.filter(function(t){return t.id!==n.id}),o.remove(n),L(gr(n,t),function(t){i.push(t),o.insert(t)})):((i=gr(r,t).features).forEach(function(t){t.bbox||(t.bbox=De(W(t)))}),o.load(Y(i)))}),Y(i)}function gr(t,o){var s=[],e=Z(t)[0],n=Z(t)[t.geometry.coordinates.length-1];if(yr(e,J(o))||yr(n,J(o)))return Y([t]);var r=bn(),i=Cn(t);r.load(i);var a=r.search(o);if(!a.features.length)return Y([t]);var u=dr(o,a),h=P(i,function(t,e,n){var r=Z(e)[1],i=J(o);return n===u.id?(t.push(i),s.push(U(t)),yr(i,r)?[i]:[i,r]):(t.push(r),t)},[e]);return 1<h.length&&s.push(U(h)),Y(s)}function dr(n,t){if(!t.features.length)throw new Error("lines must contain features");if(1===t.features.length)return t.features[0];var r,i=1/0;return L(t,function(t){var e=Ln(t,n).properties.dist;e<i&&(r=t,i=e)}),r}function yr(t,e){return t[0]===e[0]&&t[1]===e[1]}function _r(t,e,n,r,i){if(!H(i=i||{}))throw new Error("options is invalid");var o=i.steps,s=i.units;if(!t)throw new Error("center is required");if(!e)throw new Error("radius is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if("object"!=_typeof(i))throw new Error("options must be an object");o=o||64;var a=mr(n),u=mr(r),h=t.properties;if(a===u)return U(qe(t,e,i).geometry.coordinates[0],h);for(var c=a,l=a<u?u:u+360,p=c,f=[],g=0;p<l;)f.push(Fe(t,e,p,s).geometry.coordinates),p=c+360*++g/o;return l<p&&f.push(Fe(t,e,l,s).geometry.coordinates),U(f,h)}function mr(t){var e=t%360;return e<0&&(e+=360),e}function vr(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.properties,r=rt(t),i=Z(t),n=n||t.properties||{};if(!i.length)throw new Error("polygon must contain coordinates");switch(r){case"Polygon":return xr(i,n);case"MultiPolygon":var o=[];return i.forEach(function(t){o.push(xr(t,n))}),Y(o);default:throw new Error("geom "+r+" not supported")}}function xr(t,e){return 1<t.length?v(t,e):U(t[0],e)}function Er(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.properties,r=e.autoComplete,i=e.orderCoords;if(!t)throw new Error("lines is required");switch(r=void 0===r||r,i=void 0===i||i,rt(t)){case"FeatureCollection":case"GeometryCollection":var o=[];return(t.features?t.features:t.geometries).forEach(function(t){o.push(Z(wr(t,{},r,i)))}),x(o,n)}return wr(t,n,r,i)}function wr(t,e,a,u){e=e||t.properties||{};var n=Z(t),r=rt(t);if(!n.length)throw new Error("line must contain coordinates");switch(r){case"LineString":return a&&(n=br(n)),G([n],e);case"MultiLineString":var h=[],c=0;return n.forEach(function(t){var e,n,r,i,o,s;a&&(t=br(t)),u?(r=(n=W(U(t)))[0],i=n[1],o=n[2],s=n[3],e=Math.abs(r-o)*Math.abs(i-s),c<e?(h.unshift(t),c=e):h.push(t)):h.push(t)}),G(h,e);default:throw new Error("geometry type "+r+" is not supported")}}function br(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return n===o&&r===s||t.push(e),t}pr.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=hr*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[hr*Math.atan2(i,r),s]},pr.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;i<t;++i){var o=r*i,s=this.interpolate(o);n.push(s)}for(var a=!1,u=0,h=e&&e.offset?e.offset:10,c=180-h,l=-180+h,p=360-h,f=1;f<n.length;++f){var g=n[f-1][0],d=n[f][0],y=Math.abs(d-g);p<y&&(c<d&&g<l||c<g&&d<l)?a=!0:u<y&&(u=y)}var _=[];if(a&&u<h){var m=[];_.push(m);for(var v=0;v<n.length;++v){var x=parseFloat(n[v][0]);if(0<v&&Math.abs(x-n[v-1][0])>p){var E,w,b,I,N=parseFloat(n[v-1][0]),C=parseFloat(n[v-1][1]),S=parseFloat(n[v][0]),M=parseFloat(n[v][1]);if(-180<N&&N<l&&180===S&&v+1<n.length&&-180<n[v-1][0]&&n[v-1][0]<l){m.push([-180,n[v][1]]),v++,m.push([n[v][0],n[v][1]]);continue}if(c<N&&N<180&&-180===S&&v+1<n.length&&n[v-1][0]>c&&n[v-1][0]<180){m.push([180,n[v][1]]),v++,m.push([n[v][0],n[v][1]]);continue}N<l&&c<S&&(E=N,N=S,S=E,w=C,C=M,M=w),c<N&&S<l&&(S+=360),N<=180&&180<=S&&N<S?(I=(b=(180-N)/(S-N))*M+(1-b)*C,m.push([n[v-1][0]>c?180:-180,I]),(m=[]).push([n[v-1][0]>c?-180:180,I])):m=[],_.push(m),m.push([x,n[v][1]])}else m.push([n[v][0],n[v][1]])}}else{var L=[];_.push(L);for(var P=0;P<n.length;++P)L.push([n[P][0],n[P][1]])}for(var O=new lr(this.properties),R=0;R<_.length;++R){var T=new cr;O.geometries.push(T);for(var A=_[R],D=0;D<A.length;++D)T.move_to(A[D])}return O};var Ir=Nr;function Nr(t,e,n){var r,i,o,s,a,u=t.length,h=Sr(t[0],e),c=[];for(n=n||[],r=1;r<u;r++){for(i=t[r-1],s=a=Sr(o=t[r],e);;){if(!(h|s)){c.push(i),s!==a?(c.push(o),r<u-1&&(n.push(c),c=[])):r===u-1&&c.push(o);break}if(h&s)break;h?h=Sr(i=Cr(i,o,h,e),e):s=Sr(o=Cr(i,o,s,e),e)}h=a}return c.length&&n.push(c),n}function Cr(t,e,n,r){return 8&n?[t[0]+(e[0]-t[0])*(r[3]-t[1])/(e[1]-t[1]),r[3]]:4&n?[t[0]+(e[0]-t[0])*(r[1]-t[1])/(e[1]-t[1]),r[1]]:2&n?[r[2],t[1]+(e[1]-t[1])*(r[2]-t[0])/(e[0]-t[0])]:1&n?[r[0],t[1]+(e[1]-t[1])*(r[0]-t[0])/(e[0]-t[0])]:null}function Sr(t,e){var n=0;return t[0]<e[0]?n|=1:t[0]>e[2]&&(n|=2),t[1]<e[1]?n|=4:t[1]>e[3]&&(n|=8),n}function Mr(t,e){for(var n=[],r=0;r<t.length;r++){var i=Ir.polygon(t[r],e);0<i.length&&(i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1]||i.push(i[0]),4<=i.length&&n.push(i))}return n}(Nr.polyline=Nr).polygon=function(t,e){for(var n,r,i,o,s,a,u=1;u<=8;u*=2){for(n=[],i=!(Sr(r=t[t.length-1],e)&u),o=0;o<t.length;o++)(a=!(Sr(s=t[o],e)&u))!==i&&n.push(Cr(r,s,u,e)),a&&n.push(s),r=s,i=a;if(!(t=n).length)break}return n};var Lr=Array.prototype.slice;function Pr(t){return"[object Arguments]"===Object.prototype.toString.call(t)}function Or(t,e,n){return n=n||{},t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=_typeof(t)&&"object"!=_typeof(e)?(n.strict,t===e):function(t,e,n){var r,i;if(Rr(t)||Rr(e))return!1;if(t.prototype!==e.prototype)return!1;if(Pr(t))return!!Pr(e)&&Or(t=Lr.call(t),e=Lr.call(e),n);if(Tr(t)){if(!Tr(e))return!1;if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}try{var o=Object.keys(t),s=Object.keys(e)}catch(t){return!1}if(o.length!==s.length)return!1;for(o.sort(),s.sort(),r=o.length-1;0<=r;r--)if(o[r]!==s[r])return!1;for(r=o.length-1;0<=r;r--)if(!Or(t[i=o[r]],e[i],n))return!1;return _typeof(t)==_typeof(e)}(t,e,n))}function Rr(t){return null==t}function Tr(t){return t&&"object"==_typeof(t)&&"number"==typeof t.length&&"function"==typeof t.copy&&"function"==typeof t.slice&&!(0<t.length&&"number"!=typeof t[0])}function Ar(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var o,s=n.tolerance||0,a=[],u=bn();return u.load(Cn(t)),F(e,function(r){var i=!1;L(u.search(r),function(t){var e,n;!1===i&&(Or(e=Z(r).sort(),n=Z(t).sort())||(0===s?Zn(e[0],t)&&Zn(e[1],t):Ln(t,e[0]).properties.dist<=s&&Ln(t,e[1]).properties.dist<=s)?(i=!0,o=o?Dr(o,r):r):(0===s?Zn(n[0],r)&&Zn(n[1],r):Ln(r,n[0]).properties.dist<=s&&Ln(r,n[1]).properties.dist<=s)&&(o=o?Dr(o,t):t))}),!1===i&&o&&(a.push(o),o=void 0)}),o&&a.push(o),Y(a)}function Dr(t,e){var n=Z(e),r=Z(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return Or(n[0],i)?s.unshift(n[1]):Or(n[0],o)?s.push(n[1]):Or(n[1],i)?s.unshift(n[0]):Or(n[1],o)&&s.push(n[0]),t}function Fr(t){var e=t%360;return e<0&&(e+=360),e}function qr(t,e,n,r){if(!H(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.properties;if(!t)throw new Error("origin is required");if(null==e)throw new Error("distance is required");if(null==n)throw new Error("bearing is required");if(!(0<=e))throw new Error("distance must be greater than 0");var l=_(e,i,"meters"),s=J(t),a=function(t,e,n){var r=l/(n=void 0===n?p:Number(n)),i=t[0]*Math.PI/180,o=m(t[1]),s=m(e),a=r*Math.cos(s),u=o+a;Math.abs(u)>Math.PI/2&&(u=0<u?Math.PI-u:-Math.PI-u);var h=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),c=1e-11<Math.abs(h)?a/h:Math.cos(o);return[(180*(i+r*Math.sin(s)/c)/Math.PI+540)%360-180,180*u/Math.PI]}(s,n);return a[0]+=180<a[0]-s[0]?-360:180<s[0]-a[0]?360:0,X(a,o)}function Gr(t,e,n,r,i,o){for(var s=0;s<t.length;s++){var a=t[s],u=t[s+1];s===t.length-1&&(u=t[0]),r=Br(a,u,e),n<=0&&0<r?Br(e,a,i)<0||(i=a):0<n&&r<=0&&(0<Br(e,a,o)||(o=a)),n=r}return[i,o]}function Br(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function kr(t){if(!t)throw new Error("line is required");var e=t.geometry?t.geometry.type:t.type;if(!Array.isArray(t)&&"LineString"!==e)throw new Error("geometry must be a LineString");for(var n,r,i=Z(t),o=0,s=1;s<i.length;)n=r||i[0],o+=((r=i[s])[0]-n[0])*(r[1]+n[1]),s++;return 0<o}function zr(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return R(t,function(t){zr(t,e)}),t;case"LineString":return jr(Z(t),e),t;case"Polygon":return Xr(Z(t),e),t;case"MultiLineString":return Z(t).forEach(function(t){jr(t,e)}),t;case"MultiPolygon":return Z(t).forEach(function(t){Xr(t,e)}),t;case"Point":case"MultiPoint":return t}}function jr(t,e){kr(t)===e&&t.reverse()}function Xr(t,e){kr(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)kr(t[n])===e&&t[n].reverse()}var Ur={successCallback:null,verbose:!1,polygons:!1},Yr={};function Vr(t,e,N,n){n=n||{};for(var r=Object.keys(Ur),i=0;i<r.length;i++){var o=r[i],s=null!=(s=n[o])?s:Ur[o];Yr[o]=s}Yr.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+N)+"]");var a,u,h=function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=e+Math.abs(N),s=0;s<n;++s){i.cells[s]=[];for(var a=0;a<r;++a){var u,h,c,l,p,f,g,d,y,_,m,v,x=0,E=t[s+1][a],w=t[s+1][a+1],b=t[s][a+1],I=t[s][a];isNaN(E)||isNaN(w)||isNaN(b)||isNaN(I)||(x|=E<e?0:o<E?128:64,x|=w<e?0:o<w?32:16,x|=b<e?0:o<b?8:4,u=+(x|=I<e?0:o<I?2:1),c=0,17!==x&&18!==x&&33!==x&&34!==x&&38!==x&&68!==x&&72!==x&&98!==x&&102!==x&&132!==x&&136!==x&&137!==x&&152!==x&&153!==x||(c=o<(h=(E+w+b+I)/4)?2:h<e?0:1,34===x?1===c?x=35:0===c&&(x=136):136===x?1===c?(x=35,c=4):0===c&&(x=34):17===x?1===c?(x=155,c=4):0===c&&(x=153):68===x?1===c?(x=103,c=4):0===c&&(x=102):153===x?1===c&&(x=155):102===x?1===c&&(x=103):152===x?c<2&&(x=156,c=1):137===x?c<2&&(x=139,c=1):98===x?c<2&&(x=99,c=1):38===x?c<2&&(x=39,c=1):18===x?0<c?(x=156,c=4):x=152:33===x?0<c?(x=139,c=4):x=137:72===x?0<c?(x=99,c=4):x=98:132===x&&(0<c?(x=39,c=4):x=38)),0!=x&&170!=x&&(m=l=p=f=g=d=y=_=.5,v=[],1===x?(p=1-Gi(e,b,I),_=1-Gi(e,E,I),v.push(Ri[x])):169===x?(p=Gi(o,I,b),_=Gi(o,I,E),v.push(Ri[x])):4===x?(d=1-Gi(e,w,b),f=Gi(e,I,b),v.push(Pi[x])):166===x?(d=Gi(o,b,w),f=1-Gi(o,b,I),v.push(Pi[x])):16===x?(g=Gi(e,b,w),l=Gi(e,E,w),v.push(Li[x])):154===x?(g=1-Gi(o,w,b),l=1-Gi(o,w,E),v.push(Li[x])):64===x?(y=Gi(e,I,E),m=1-Gi(e,w,E),v.push(Ai[x])):106===x?(y=1-Gi(o,E,I),m=Gi(o,E,w),v.push(Ai[x])):168===x?(f=Gi(o,I,b),p=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),v.push(Oi[x]),v.push(Ri[x])):2===x?(f=1-Gi(e,b,I),p=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),v.push(Oi[x]),v.push(Ri[x])):162===x?(g=Gi(o,b,w),d=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),v.push(Oi[x]),v.push(Ri[x])):8===x?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),v.push(Li[x]),v.push(Pi[x])):138===x?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),m=1-Gi(o,w,E),l=1-Gi(e,w,E),v.push(Li[x]),v.push(Pi[x])):32===x?(g=Gi(o,b,w),d=Gi(e,b,w),m=Gi(e,E,w),l=Gi(o,E,w),v.push(Li[x]),v.push(Pi[x])):42===x?(_=1-Gi(o,E,I),y=1-Gi(e,E,I),m=Gi(e,E,w),l=Gi(o,E,w),v.push(Ti[x]),v.push(Ai[x])):128===x&&(_=Gi(e,I,E),y=Gi(o,I,E),m=1-Gi(o,w,E),l=1-Gi(e,w,E),v.push(Ti[x]),v.push(Ai[x])),5===x?(d=1-Gi(e,w,b),_=1-Gi(e,E,I),v.push(Pi[x])):165===x?(d=Gi(o,b,w),_=Gi(o,I,E),v.push(Pi[x])):20===x?(f=Gi(e,I,b),l=Gi(e,E,w),v.push(Oi[x])):150===x?(f=1-Gi(o,b,I),l=1-Gi(o,w,E),v.push(Oi[x])):80===x?(g=Gi(e,b,w),y=Gi(e,I,E),v.push(Li[x])):90===x?(g=1-Gi(o,w,b),y=1-Gi(o,E,I),v.push(Li[x])):65===x?(p=1-Gi(e,b,I),m=1-Gi(e,w,E),v.push(Ri[x])):105===x?(p=Gi(o,I,b),m=Gi(o,E,w),v.push(Ri[x])):160===x?(g=Gi(o,b,w),d=Gi(e,b,w),_=Gi(e,I,E),y=Gi(o,I,E),v.push(Li[x]),v.push(Pi[x])):10===x?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),_=1-Gi(o,E,I),y=1-Gi(e,E,I),v.push(Li[x]),v.push(Pi[x])):130===x?(f=1-Gi(e,b,I),p=1-Gi(o,b,I),m=1-Gi(o,w,E),l=1-Gi(e,w,E),v.push(Oi[x]),v.push(Ri[x])):40===x?(f=Gi(o,I,b),p=Gi(e,I,b),m=Gi(e,E,w),l=Gi(o,E,w),v.push(Oi[x]),v.push(Ri[x])):101===x?(d=Gi(o,b,w),m=Gi(o,E,w),v.push(Pi[x])):69===x?(d=1-Gi(e,w,b),m=1-Gi(e,w,E),v.push(Pi[x])):149===x?(_=Gi(o,I,E),l=1-Gi(o,w,E),v.push(Ti[x])):21===x?(_=1-Gi(e,E,I),l=Gi(e,E,w),v.push(Ti[x])):86===x?(f=1-Gi(o,b,I),y=1-Gi(o,E,I),v.push(Oi[x])):84===x?(f=Gi(e,I,b),y=Gi(e,I,E),v.push(Oi[x])):89===x?(g=1-Gi(o,w,b),p=Gi(o,I,b),v.push(Ri[x])):81===x?(g=Gi(e,b,w),p=1-Gi(e,b,I),v.push(Ri[x])):96===x?(g=Gi(o,b,w),d=Gi(e,b,w),y=Gi(e,I,E),m=Gi(o,E,w),v.push(Li[x]),v.push(Pi[x])):74===x?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),y=1-Gi(o,E,I),m=1-Gi(e,w,E),v.push(Li[x]),v.push(Pi[x])):24===x?(g=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),l=Gi(e,E,w),v.push(Li[x]),v.push(Ri[x])):146===x?(g=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),l=1-Gi(o,w,E),v.push(Li[x]),v.push(Ri[x])):6===x?(d=1-Gi(e,w,b),f=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),v.push(Pi[x]),v.push(Oi[x])):164===x?(d=Gi(o,b,w),f=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),v.push(Pi[x]),v.push(Oi[x])):129===x?(p=1-Gi(e,b,I),_=Gi(o,I,E),m=1-Gi(o,w,E),l=1-Gi(e,w,E),v.push(Ri[x]),v.push(Ti[x])):41===x?(p=Gi(o,I,b),_=1-Gi(e,E,I),m=Gi(e,E,w),l=Gi(o,E,w),v.push(Ri[x]),v.push(Ti[x])):66===x?(f=1-Gi(e,b,I),p=1-Gi(o,b,I),y=1-Gi(o,E,I),m=1-Gi(e,w,E),v.push(Oi[x]),v.push(Ri[x])):104===x?(f=Gi(o,I,b),p=Gi(e,I,b),y=Gi(e,I,E),m=Gi(o,E,w),v.push(Ri[x]),v.push(Di[x])):144===x?(g=Gi(e,b,w),_=Gi(e,I,E),y=Gi(o,I,E),l=1-Gi(o,w,E),v.push(Li[x]),v.push(Ai[x])):26===x?(g=1-Gi(o,w,b),_=1-Gi(o,E,I),y=1-Gi(e,E,I),l=Gi(e,E,w),v.push(Li[x]),v.push(Ai[x])):36===x?(d=Gi(o,b,w),f=Gi(e,I,b),m=Gi(e,E,w),l=Gi(o,E,w),v.push(Pi[x]),v.push(Oi[x])):134===x?(d=1-Gi(e,w,b),f=1-Gi(o,b,I),m=1-Gi(o,w,E),l=1-Gi(e,w,E),v.push(Pi[x]),v.push(Oi[x])):9===x?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),p=Gi(o,I,b),_=1-Gi(e,E,I),v.push(Li[x]),v.push(Pi[x])):161===x?(g=Gi(o,b,w),d=Gi(e,b,w),p=1-Gi(e,b,I),_=Gi(o,I,E),v.push(Li[x]),v.push(Pi[x])):37===x?(d=Gi(o,b,w),_=1-Gi(e,E,I),m=Gi(e,E,w),l=Gi(o,E,w),v.push(Pi[x]),v.push(Ti[x])):133===x?(d=1-Gi(e,w,b),_=Gi(o,I,E),m=1-Gi(o,w,E),l=1-Gi(e,w,E),v.push(Pi[x]),v.push(Ti[x])):148===x?(f=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),l=1-Gi(o,w,E),v.push(Oi[x]),v.push(Ai[x])):22===x?(f=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),l=Gi(e,E,w),v.push(Oi[x]),v.push(Ai[x])):82===x?(g=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),y=1-Gi(o,E,I),v.push(Li[x]),v.push(Ri[x])):88===x?(g=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),y=Gi(e,I,E),v.push(Li[x]),v.push(Ri[x])):73===x?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),p=Gi(o,I,b),m=1-Gi(e,w,E),v.push(Li[x]),v.push(Pi[x])):97===x?(g=Gi(o,b,w),d=Gi(e,b,w),p=1-Gi(e,b,I),m=Gi(o,E,w),v.push(Li[x]),v.push(Pi[x])):145===x?(g=Gi(e,b,w),p=1-Gi(e,b,I),_=Gi(o,I,E),l=1-Gi(o,w,E),v.push(Li[x]),v.push(Ti[x])):25===x?(g=1-Gi(o,w,b),p=Gi(o,I,b),_=1-Gi(e,E,I),l=Gi(e,E,w),v.push(Li[x]),v.push(Ti[x])):70===x?(d=1-Gi(e,w,b),f=1-Gi(o,b,I),y=1-Gi(o,E,I),m=1-Gi(e,w,E),v.push(Pi[x]),v.push(Oi[x])):100===x?(d=Gi(o,b,w),f=Gi(e,I,b),y=Gi(e,I,E),m=Gi(o,E,w),v.push(Pi[x]),v.push(Oi[x])):34===x?(l=0===c?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)):(g=Gi(o,b,w),d=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)),v.push(Li[x]),v.push(Pi[x]),v.push(Ti[x]),v.push(Ai[x])):35===x?(l=4===c?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)):(g=Gi(o,b,w),d=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)),v.push(Li[x]),v.push(Pi[x]),v.push(Ri[x]),v.push(Ai[x])):136===x?(l=0===c?(g=Gi(o,b,w),d=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)):(g=1-Gi(e,w,b),d=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)),v.push(Li[x]),v.push(Pi[x]),v.push(Ti[x]),v.push(Ai[x])):153===x?(l=0===c?(g=Gi(e,b,w),p=1-Gi(e,b,I),_=1-Gi(e,E,I),Gi(e,E,w)):(g=1-Gi(o,w,b),p=Gi(o,I,b),_=Gi(o,I,E),1-Gi(o,w,E)),v.push(Li[x]),v.push(Ri[x])):102===x?(m=0===c?(d=1-Gi(e,w,b),f=Gi(e,I,b),y=Gi(e,I,E),1-Gi(e,w,E)):(d=Gi(o,b,w),f=1-Gi(o,b,I),y=1-Gi(o,E,I),Gi(o,E,w)),v.push(Pi[x]),v.push(Ai[x])):155===x?(l=4===c?(g=Gi(e,b,w),p=1-Gi(e,b,I),_=1-Gi(e,E,I),Gi(e,E,w)):(g=1-Gi(o,w,b),p=Gi(o,I,b),_=Gi(o,I,E),1-Gi(o,w,E)),v.push(Li[x]),v.push(Ti[x])):103===x?(m=4===c?(d=1-Gi(e,w,b),f=Gi(e,I,b),y=Gi(e,I,E),1-Gi(e,w,E)):(d=Gi(o,b,w),f=1-Gi(o,b,I),y=1-Gi(o,E,I),Gi(o,E,w)),v.push(Pi[x]),v.push(Oi[x])):152===x?(l=0===c?(g=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),Gi(e,E,w)):(g=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),1-Gi(o,w,E)),v.push(Li[x]),v.push(Oi[x]),v.push(Ri[x])):156===x?(l=4===c?(g=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),Gi(e,E,w)):(g=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),1-Gi(o,w,E)),v.push(Li[x]),v.push(Ri[x]),v.push(Ai[x])):137===x?(l=0===c?(g=Gi(o,b,w),d=Gi(e,b,w),p=1-Gi(e,b,I),_=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)):(g=1-Gi(e,w,b),d=1-Gi(o,w,b),p=Gi(o,I,b),_=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)),v.push(Li[x]),v.push(Pi[x]),v.push(Ri[x])):139===x?(l=4===c?(g=Gi(o,b,w),d=Gi(e,b,w),p=1-Gi(e,b,I),_=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)):(g=1-Gi(e,w,b),d=1-Gi(o,w,b),p=Gi(o,I,b),_=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)),v.push(Li[x]),v.push(Pi[x]),v.push(Ti[x])):98===x?(m=0===c?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),y=Gi(e,I,E),1-Gi(e,w,E)):(g=Gi(o,b,w),d=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),y=1-Gi(o,E,I),Gi(o,E,w)),v.push(Li[x]),v.push(Pi[x]),v.push(Ai[x])):99===x?(m=4===c?(g=1-Gi(e,w,b),d=1-Gi(o,w,b),f=Gi(o,I,b),p=Gi(e,I,b),y=Gi(e,I,E),1-Gi(e,w,E)):(g=Gi(o,b,w),d=Gi(e,b,w),f=1-Gi(e,b,I),p=1-Gi(o,b,I),y=1-Gi(o,E,I),Gi(o,E,w)),v.push(Li[x]),v.push(Pi[x]),v.push(Ri[x])):38===x?(l=0===c?(d=1-Gi(e,w,b),f=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)):(d=Gi(o,b,w),f=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)),v.push(Pi[x]),v.push(Ti[x]),v.push(Ai[x])):39===x?(l=4===c?(d=1-Gi(e,w,b),f=Gi(e,I,b),_=Gi(e,I,E),y=Gi(o,I,E),m=1-Gi(o,w,E),1-Gi(e,w,E)):(d=Gi(o,b,w),f=1-Gi(o,b,I),_=1-Gi(o,E,I),y=1-Gi(e,E,I),m=Gi(e,E,w),Gi(o,E,w)),v.push(Pi[x]),v.push(Oi[x]),v.push(Ai[x])):85===x&&(m=_=p=d=0,l=y=f=g=1),(m<0||1<m||l<0||1<l||g<0||1<g||f<0||1<f||_<0||1<_||y<0||1<y)&&console.log("MarchingSquaresJS-isoBands: "+x+" "+u+" "+E+","+w+","+b+","+I+" "+c+" "+m+" "+l+" "+g+" "+d+" "+f+" "+p+" "+_+" "+y),i.cells[s][a]={cval:x,cval_real:u,flipped:c,topleft:m,topright:l,righttop:g,rightbottom:d,bottomright:f,bottomleft:p,leftbottom:_,lefttop:y,edges:v}))}}return i}(t,e),c=Yr.polygons?(Yr.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),a=[],u=0,h.cells.forEach(function(t,r){t.forEach(function(t,e){var n;void 0!==t&&("object"==_typeof(n=qi[t.cval](t))&&Bi(n)?"object"==_typeof(n[0])&&Bi(n[0])?"object"==_typeof(n[0][0])&&Bi(n[0][0])?n.forEach(function(t){t.forEach(function(t){t[0]+=e,t[1]+=r}),a[u++]=t}):(n.forEach(function(t){t[0]+=e,t[1]+=r}),a[u++]=n):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates"))})}),a):(Yr.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),function(t){for(var e=[],n=t.rows,r=t.cols,i=[],o=0;o<n;o++)for(var s=0;s<r;s++)if(void 0!==t.cells[o][s]&&0<t.cells[o][s].edges.length){var a,u=function(t){if(0<t.edges.length){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Wr?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return n&Jr?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return n&Jr?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return n&Zr?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Wr?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return n&Jr?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return n&Jr?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return n&Zr?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return n&Jr?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return n&Zr?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return n&Zr?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&Hr?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return n&Jr?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return n&Zr?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return n&Zr?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&Hr?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return n&Jr?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&Hr?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return n&Zr?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&Hr?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&Hr?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Wr?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&Hr?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Wr?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}(t.cells[o][s]),h=s,c=o;null!==u&&i.push([u.p[0]+h,u.p[1]+c]);do{if(null===(a=function(t,e,n,r){var i,o,s,a,u,h=t.cval;switch(e){case-1:u=0===r?(i=Pi[h],s=si[h],a=ai[h],ui[h]):(i=Li[h],s=ri[h],a=ii[h],oi[h]);break;case 1:u=0===r?(i=Ti[h],s=mi[h],a=vi[h],xi[h]):(i=Ai[h],s=di[h],a=yi[h],_i[h]);break;default:switch(n){case-1:u=0===r?(i=Di[h],s=Kr[h],a=Qr[h],$r[h]):(i=Fi[h],s=ti[h],a=ei[h],ni[h]);break;case 1:u=0===r?(i=Ri[h],s=hi[h],a=ci[h],li[h]):(i=Oi[h],s=pi[h],a=fi[h],gi[h])}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var n=e+1;n<t.edges.length;n++)t.edges[n-1]=t.edges[n];t.edges.pop()}(t,o),h=t.cval_real,i){case 0:n=h&Wr?(e=t.topleft,1):(e=1,t.righttop);break;case 1:n=h&Jr?(e=1,t.rightbottom):(e=t.topleft,1);break;case 2:n=h&Jr?(e=t.topleft,1):(e=t.bottomright,0);break;case 3:n=h&Zr?(e=t.bottomleft,0):(e=t.topleft,1);break;case 4:n=h&Wr?(e=t.topright,1):(e=1,t.righttop);break;case 5:n=h&Jr?(e=1,t.rightbottom):(e=t.topright,1);break;case 6:n=h&Jr?(e=t.topright,1):(e=t.bottomright,0);break;case 7:n=h&Zr?(e=t.bottomleft,0):(e=t.topright,1);break;case 8:n=h&Jr?(e=1,t.righttop):(e=t.bottomright,0);break;case 9:n=h&Zr?(e=t.bottomleft,0):(e=1,t.righttop);break;case 10:n=h&Zr?(e=1,t.righttop):(e=0,t.leftbottom);break;case 11:n=h&Hr?(e=0,t.lefttop):(e=1,t.righttop);break;case 12:n=h&Jr?(e=1,t.rightbottom):(e=t.bottomright,0);break;case 13:n=h&Zr?(e=t.bottomleft,0):(e=1,t.rightbottom);break;case 14:n=h&Zr?(e=1,t.rightbottom):(e=0,t.leftbottom);break;case 15:n=h&Hr?(e=0,t.lefttop):(e=1,t.rightbottom);break;case 16:n=h&Jr?(e=0,t.leftbottom):(e=t.bottomright,0);break;case 17:n=h&Hr?(e=0,t.lefttop):(e=t.bottomright,0);break;case 18:n=h&Zr?(e=t.bottomleft,0):(e=0,t.leftbottom);break;case 19:n=h&Hr?(e=0,t.lefttop):(e=t.bottomleft,0);break;case 20:n=h&Hr?(e=0,t.leftbottom):(e=t.topleft,1);break;case 21:n=h&Wr?(e=t.topright,1):(e=0,t.leftbottom);break;case 22:n=h&Hr?(e=0,t.lefttop):(e=t.topleft,1);break;case 23:n=h&Wr?(e=t.topright,1):(e=0,t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return void 0!==e&&void 0!==n&&void 0!==s&&void 0!==a&&void 0!==u||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+u)),{p:[e,n],x:s,y:a,o:u}}(t.cells[c][h],u.x,u.y,u.o)))break;if(i.push([a.p[0]+h,a.p[1]+c]),h+=a.x,(c+=(u=a).y)<0||n<=c||h<0||r<=h||void 0===t.cells[c][h]){var l=function(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,h=n+i,c=[],l=!1;!l;){if(void 0===t.cells[h]||void 0===t.cells[h][u])if(h-=i,u-=r,a=(s=t.cells[h][u]).cval_real,-1===i)if(0===o)if(a&Zr)c.push([u,h]),r=-1,o=i=0;else{if(!(a&Jr)){c.push([u+s.bottomright,h]),o=i=1,l=!(r=0);break}c.push([u+1,h]),r=1,o=i=0}else{if(!(a&Zr)){if(a&Jr){c.push([u+s.bottomright,h]),o=i=1,l=!(r=0);break}c.push([u+s.bottomleft,h]),i=1,l=!(o=r=0);break}c.push([u,h]),r=-1,o=i=0}else if(1===i)if(0===o){if(!(a&Wr)){if(a&Hr){c.push([u+s.topleft,h+1]),i=-1,l=!(o=r=0);break}c.push([u+s.topright,h+1]),i=-1,o=1,l=!(r=0);break}c.push([u+1,h+1]),i=0,o=r=1}else c.push([u+1,h+1]),i=0,o=r=1;else if(-1===r)if(0===o){if(!(a&Hr)){if(a&Zr){c.push([u,h+s.leftbottom]),r=1,l=!(o=i=0);break}c.push([u,h+s.lefttop]),o=r=1,l=!(i=0);break}c.push([u,h+1]),i=1,o=r=0}else{if(!(a&Hr)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,h+1]),i=1,o=r=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(a&Jr)){c.push([u+1,h+s.rightbottom]),r=-1,l=!(o=i=0);break}c.push([u+1,h]),r=0,i=-1,o=1}else{if(!(a&Jr)){if(a&Wr){c.push([u+1,h+s.righttop]),r=-1,i=0,o=1;break}c.push([u+1,h+s.rightbottom]),r=-1,l=!(o=i=0);break}c.push([u+1,h]),r=0,i=-1,o=1}}else if(a=(s=t.cells[h][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[h-1]&&void 0!==t.cells[h-1][u])r=0,i=-1,o=1;else{if(!(a&Zr)){c.push([u+s.bottomright,h]),o=i=1,l=!(r=0);break}c.push([u,h])}else{if(!(a&Hr)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+h);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===r){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[h+1]&&void 0!==t.cells[h+1][u])i=1,o=r=0;else{if(!(a&Wr)){c.push([u+s.topleft,h+1]),i=-1,l=!(o=r=0);break}c.push([u+1,h+1]),i=0,o=r=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[h][u+1])i=0,o=r=1;else{if(!(a&Jr)){c.push([u+1,h+s.righttop]),r=-1,o=1,l=!(i=0);break}c.push([u+1,h]),r=0,i=-1,o=1}}else{if(1!==i){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[h][u-1])r=-1,o=i=0;else{if(!(a&Hr)){c.push([u,h+s.leftbottom]),r=1,l=!(o=i=0);break}c.push([u,h+1]),i=1,o=r=0}}if(h+=i,(u+=r)===e&&h===n)break}return{path:c,i:u,j:h,x:r,y:i,o:o}}(t,h-=a.x,c-=a.y,a.x,a.y,a.o);if(null===l)break;l.path.forEach(function(t){i.push(t)}),h=l.i,c=l.j,u=l}}while(void 0!==t.cells[c][h]&&0<t.cells[c][h].edges.length);e.push(i),i=[],0<t.cells[o][s].edges.length&&s--}return e}(h));return"function"==typeof Yr.successCallback&&Yr.successCallback(c),c}var Hr=64,Wr=16,Jr=4,Zr=1,Kr=[],Qr=[],$r=[],ti=[],ei=[],ni=[],ri=[],ii=[],oi=[],si=[],ai=[],ui=[],hi=[],ci=[],li=[],pi=[],fi=[],gi=[],di=[],yi=[],_i=[],mi=[],vi=[],xi=[];ri[85]=si[85]=-1,ii[85]=ai[85]=0,oi[85]=ui[85]=1,di[85]=mi[85]=1,yi[85]=vi[85]=0,_i[85]=xi[85]=1,Kr[85]=ti[85]=0,Qr[85]=ei[85]=-1,$r[85]=li[85]=0,pi[85]=hi[85]=0,fi[85]=ci[85]=1,ni[85]=gi[85]=1,mi[1]=mi[169]=0,vi[1]=vi[169]=-1,xi[1]=xi[169]=0,hi[1]=hi[169]=-1,ci[1]=ci[169]=0,li[1]=li[169]=0,si[4]=si[166]=0,ai[4]=ai[166]=-1,ui[4]=ui[166]=1,pi[4]=pi[166]=1,fi[4]=fi[166]=0,gi[4]=gi[166]=0,ri[16]=ri[154]=0,ii[16]=ii[154]=1,oi[16]=oi[154]=1,ti[16]=ti[154]=1,ei[16]=ei[154]=0,ni[16]=ni[154]=1,di[64]=di[106]=0,yi[64]=yi[106]=1,_i[64]=_i[106]=0,Kr[64]=Kr[106]=-1,Qr[64]=Qr[106]=0,$r[64]=$r[106]=1,di[2]=di[168]=0,yi[2]=yi[168]=-1,_i[2]=_i[168]=1,mi[2]=mi[168]=0,vi[2]=vi[168]=-1,xi[2]=xi[168]=0,hi[2]=hi[168]=-1,ci[2]=ci[168]=0,li[2]=li[168]=0,pi[2]=pi[168]=-1,fi[2]=fi[168]=0,gi[2]=gi[168]=1,ri[8]=ri[162]=0,ii[8]=ii[162]=-1,oi[8]=oi[162]=0,si[8]=si[162]=0,ai[8]=ai[162]=-1,ui[8]=ui[162]=1,hi[8]=hi[162]=1,ci[8]=ci[162]=0,li[8]=li[162]=1,pi[8]=pi[162]=1,fi[8]=fi[162]=0,gi[8]=gi[162]=0,ri[32]=ri[138]=0,ii[32]=ii[138]=1,oi[32]=oi[138]=1,si[32]=si[138]=0,ai[32]=ai[138]=1,ui[32]=ui[138]=0,Kr[32]=Kr[138]=1,Qr[32]=Qr[138]=0,$r[32]=$r[138]=0,ti[32]=ti[138]=1,ei[32]=ei[138]=0,ni[32]=ni[138]=1,mi[128]=mi[42]=0,vi[128]=vi[42]=1,xi[128]=xi[42]=1,di[128]=di[42]=0,yi[128]=yi[42]=1,_i[128]=_i[42]=0,Kr[128]=Kr[42]=-1,Qr[128]=Qr[42]=0,$r[128]=$r[42]=1,ti[128]=ti[42]=-1,ei[128]=ei[42]=0,ni[128]=ni[42]=0,si[5]=si[165]=-1,ai[5]=ai[165]=0,ui[5]=ui[165]=0,mi[5]=mi[165]=1,vi[5]=vi[165]=0,xi[5]=xi[165]=0,pi[20]=pi[150]=0,fi[20]=fi[150]=1,gi[20]=gi[150]=1,ti[20]=ti[150]=0,ei[20]=ei[150]=-1,ni[20]=ni[150]=1,ri[80]=ri[90]=-1,ii[80]=ii[90]=0,oi[80]=oi[90]=1,di[80]=di[90]=1,yi[80]=yi[90]=0,_i[80]=_i[90]=1,hi[65]=hi[105]=0,ci[65]=ci[105]=1,li[65]=li[105]=0,Kr[65]=Kr[105]=0,Qr[65]=Qr[105]=-1,$r[65]=$r[105]=0,ri[160]=ri[10]=-1,ii[160]=ii[10]=0,oi[160]=oi[10]=1,si[160]=si[10]=-1,ai[160]=ai[10]=0,ui[160]=ui[10]=0,mi[160]=mi[10]=1,vi[160]=vi[10]=0,xi[160]=xi[10]=0,di[160]=di[10]=1,yi[160]=yi[10]=0,_i[160]=_i[10]=1,pi[130]=pi[40]=0,fi[130]=fi[40]=1,gi[130]=gi[40]=1,hi[130]=hi[40]=0,ci[130]=ci[40]=1,li[130]=li[40]=0,Kr[130]=Kr[40]=0,Qr[130]=Qr[40]=-1,$r[130]=$r[40]=0,ti[130]=ti[40]=0,ei[130]=ei[40]=-1,ni[130]=ni[40]=1,si[37]=si[133]=0,ai[37]=ai[133]=1,ui[37]=ui[133]=1,mi[37]=mi[133]=0,vi[37]=vi[133]=1,xi[37]=xi[133]=0,Kr[37]=Kr[133]=-1,Qr[37]=Qr[133]=0,$r[37]=$r[133]=0,ti[37]=ti[133]=1,ei[37]=ei[133]=0,ni[37]=ni[133]=0,pi[148]=pi[22]=-1,fi[148]=fi[22]=0,gi[148]=gi[22]=0,mi[148]=mi[22]=0,vi[148]=vi[22]=-1,xi[148]=xi[22]=1,di[148]=di[22]=0,yi[148]=yi[22]=1,_i[148]=_i[22]=1,ti[148]=ti[22]=-1,ei[148]=ei[22]=0,ni[148]=ni[22]=1,ri[82]=ri[88]=0,ii[82]=ii[88]=-1,oi[82]=oi[88]=1,pi[82]=pi[88]=1,fi[82]=fi[88]=0,gi[82]=gi[88]=1,hi[82]=hi[88]=-1,ci[82]=ci[88]=0,li[82]=li[88]=1,di[82]=di[88]=0,yi[82]=yi[88]=-1,_i[82]=_i[88]=0,ri[73]=ri[97]=0,ii[73]=ii[97]=1,oi[73]=oi[97]=0,si[73]=si[97]=0,ai[73]=ai[97]=-1,ui[73]=ui[97]=0,hi[73]=hi[97]=1,ci[73]=ci[97]=0,li[73]=li[97]=0,Kr[73]=Kr[97]=1,Qr[73]=Qr[97]=0,$r[73]=$r[97]=1,ri[145]=ri[25]=0,ii[145]=ii[25]=-1,oi[145]=oi[25]=0,hi[145]=hi[25]=1,ci[145]=ci[25]=0,li[145]=li[25]=1,mi[145]=mi[25]=0,vi[145]=vi[25]=1,xi[145]=xi[25]=1,ti[145]=ti[25]=-1,ei[145]=ei[25]=0,ni[145]=ni[25]=0,si[70]=si[100]=0,ai[70]=ai[100]=1,ui[70]=ui[100]=0,pi[70]=pi[100]=-1,fi[70]=fi[100]=0,gi[70]=gi[100]=1,di[70]=di[100]=0,yi[70]=yi[100]=-1,_i[70]=_i[100]=1,Kr[70]=Kr[100]=1,Qr[70]=Qr[100]=0,$r[70]=$r[100]=0,si[101]=si[69]=0,ai[101]=ai[69]=1,ui[101]=ui[69]=0,Kr[101]=Kr[69]=1,Qr[101]=Qr[69]=0,$r[101]=$r[69]=0,mi[149]=mi[21]=0,vi[149]=vi[21]=1,xi[149]=xi[21]=1,ti[149]=ti[21]=-1,ei[149]=ei[21]=0,ni[149]=ni[21]=0,pi[86]=pi[84]=-1,fi[86]=fi[84]=0,gi[86]=gi[84]=1,di[86]=di[84]=0,yi[86]=yi[84]=-1,_i[86]=_i[84]=1,ri[89]=ri[81]=0,ii[89]=ii[81]=-1,oi[89]=oi[81]=0,hi[89]=hi[81]=1,ci[89]=ci[81]=0,li[89]=li[81]=1,ri[96]=ri[74]=0,ii[96]=ii[74]=1,oi[96]=oi[74]=0,si[96]=si[74]=-1,ai[96]=ai[74]=0,ui[96]=ui[74]=1,di[96]=di[74]=1,yi[96]=yi[74]=0,_i[96]=_i[74]=0,Kr[96]=Kr[74]=1,Qr[96]=Qr[74]=0,$r[96]=$r[74]=1,ri[24]=ri[146]=0,ii[24]=ii[146]=-1,oi[24]=oi[146]=1,pi[24]=pi[146]=1,fi[24]=fi[146]=0,gi[24]=gi[146]=1,hi[24]=hi[146]=0,ci[24]=ci[146]=1,li[24]=li[146]=1,ti[24]=ti[146]=0,ei[24]=ei[146]=-1,ni[24]=ni[146]=0,si[6]=si[164]=-1,ai[6]=ai[164]=0,ui[6]=ui[164]=1,pi[6]=pi[164]=-1,fi[6]=fi[164]=0,gi[6]=gi[164]=0,mi[6]=mi[164]=0,vi[6]=vi[164]=-1,xi[6]=xi[164]=1,di[6]=di[164]=1,yi[6]=yi[164]=0,_i[6]=_i[164]=0,hi[129]=hi[41]=0,ci[129]=ci[41]=1,li[129]=li[41]=1,mi[129]=mi[41]=0,vi[129]=vi[41]=1,xi[129]=xi[41]=0,Kr[129]=Kr[41]=-1,Qr[129]=Qr[41]=0,$r[129]=$r[41]=0,ti[129]=ti[41]=0,ei[129]=ei[41]=-1,ni[129]=ni[41]=0,pi[66]=pi[104]=0,fi[66]=fi[104]=1,gi[66]=gi[104]=0,hi[66]=hi[104]=-1,ci[66]=ci[104]=0,li[66]=li[104]=1,di[66]=di[104]=0,yi[66]=yi[104]=-1,_i[66]=_i[104]=0,Kr[66]=Kr[104]=0,Qr[66]=Qr[104]=-1,$r[66]=$r[104]=1,ri[144]=ri[26]=-1,ii[144]=ii[26]=0,oi[144]=oi[26]=0,mi[144]=mi[26]=1,vi[144]=vi[26]=0,xi[144]=xi[26]=1,di[144]=di[26]=0,yi[144]=yi[26]=1,_i[144]=_i[26]=1,ti[144]=ti[26]=-1,ei[144]=ei[26]=0,ni[144]=ni[26]=1,si[36]=si[134]=0,ai[36]=ai[134]=1,ui[36]=ui[134]=1,pi[36]=pi[134]=0,fi[36]=fi[134]=1,gi[36]=gi[134]=0,Kr[36]=Kr[134]=0,Qr[36]=Qr[134]=-1,$r[36]=$r[134]=1,ti[36]=ti[134]=1,ei[36]=ei[134]=0,ni[36]=ni[134]=0,ri[9]=ri[161]=-1,ii[9]=ii[161]=0,oi[9]=oi[161]=0,si[9]=si[161]=0,ai[9]=ai[161]=-1,ui[9]=ui[161]=0,hi[9]=hi[161]=1,ci[9]=ci[161]=0,li[9]=li[161]=0,mi[9]=mi[161]=1,vi[9]=vi[161]=0,xi[9]=xi[161]=1,ri[136]=0,ii[136]=1,oi[136]=1,si[136]=0,ai[136]=1,ui[136]=0,pi[136]=-1,fi[136]=0,gi[136]=1,hi[136]=-1,ci[136]=0,li[136]=0,mi[136]=0,vi[136]=-1,xi[136]=0,di[136]=0,yi[136]=-1,_i[136]=1,Kr[136]=1,Qr[136]=0,$r[136]=0,ti[136]=1,ei[136]=0,ni[136]=1,ri[34]=0,ii[34]=-1,oi[34]=0,si[34]=0,ai[34]=-1,ui[34]=1,pi[34]=1,fi[34]=0,gi[34]=0,hi[34]=1,ci[34]=0,li[34]=1,mi[34]=0,vi[34]=1,xi[34]=1,di[34]=0,yi[34]=1,_i[34]=0,Kr[34]=-1,Qr[34]=0,$r[34]=1,ti[34]=-1,ei[34]=0,ni[34]=0,ri[35]=0,ii[35]=1,oi[35]=1,si[35]=0,ai[35]=-1,ui[35]=1,pi[35]=1,fi[35]=0,gi[35]=0,hi[35]=-1,ci[35]=0,li[35]=0,mi[35]=0,vi[35]=-1,xi[35]=0,di[35]=0,yi[35]=1,_i[35]=0,Kr[35]=-1,Qr[35]=0,$r[35]=1,ti[35]=1,ei[35]=0,ni[35]=1,ri[153]=0,ii[153]=1,oi[153]=1,hi[153]=-1,ci[153]=0,li[153]=0,mi[153]=0,vi[153]=-1,xi[153]=0,ti[153]=1,ei[153]=0,ni[153]=1,si[102]=0,ai[102]=-1,ui[102]=1,pi[102]=1,fi[102]=0,gi[102]=0,di[102]=0,yi[102]=1,_i[102]=0,Kr[102]=-1,Qr[102]=0,$r[102]=1,ri[155]=0,ii[155]=-1,oi[155]=0,hi[155]=1,ci[155]=0,li[155]=1,mi[155]=0,vi[155]=1,xi[155]=1,ti[155]=-1,ei[155]=0,ni[155]=0,si[103]=0,ai[103]=1,ui[103]=0,pi[103]=-1,fi[103]=0,gi[103]=1,di[103]=0,yi[103]=-1,_i[103]=1,Kr[103]=1,Qr[103]=0,$r[103]=0,ri[152]=0,ii[152]=1,oi[152]=1,pi[152]=-1,fi[152]=0,gi[152]=1,hi[152]=-1,ci[152]=0,li[152]=0,mi[152]=0,vi[152]=-1,xi[152]=0,di[152]=0,yi[152]=-1,_i[152]=1,ti[152]=1,ei[152]=0,ni[152]=1,ri[156]=0,ii[156]=-1,oi[156]=1,pi[156]=1,fi[156]=0,gi[156]=1,hi[156]=-1,ci[156]=0,li[156]=0,mi[156]=0,vi[156]=-1,xi[156]=0,di[156]=0,yi[156]=1,_i[156]=1,ti[156]=-1,ei[156]=0,ni[156]=1,ri[137]=0,ii[137]=1,oi[137]=1,si[137]=0,ai[137]=1,ui[137]=0,hi[137]=-1,ci[137]=0,li[137]=0,mi[137]=0,vi[137]=-1,xi[137]=0,Kr[137]=1,Qr[137]=0,$r[137]=0,ti[137]=1,ei[137]=0,ni[137]=1,ri[139]=0,ii[139]=1,oi[139]=1,si[139]=0,ai[139]=-1,ui[139]=0,hi[139]=1,ci[139]=0,li[139]=0,mi[139]=0,vi[139]=1,xi[139]=0,Kr[139]=-1,Qr[139]=0,$r[139]=0,ti[139]=1,ei[139]=0,ni[139]=1,ri[98]=0,ii[98]=-1,oi[98]=0,si[98]=0,ai[98]=-1,ui[98]=1,pi[98]=1,fi[98]=0,gi[98]=0,hi[98]=1,ci[98]=0,li[98]=1,di[98]=0,yi[98]=1,_i[98]=0,Kr[98]=-1,Qr[98]=0,$r[98]=1,ri[99]=0,ii[99]=1,oi[99]=0,si[99]=0,ai[99]=-1,ui[99]=1,pi[99]=1,fi[99]=0,gi[99]=0,hi[99]=-1,ci[99]=0,li[99]=1,di[99]=0,yi[99]=-1,_i[99]=0,Kr[99]=1,Qr[99]=0,$r[99]=1,si[38]=0,ai[38]=-1,ui[38]=1,pi[38]=1,fi[38]=0,gi[38]=0,mi[38]=0,vi[38]=1,xi[38]=1,di[38]=0,yi[38]=1,_i[38]=0,Kr[38]=-1,Qr[38]=0,$r[38]=1,ti[38]=-1,ei[38]=0,ni[38]=0,si[39]=0,ai[39]=1,ui[39]=1,pi[39]=-1,fi[39]=0,gi[39]=0,mi[39]=0,vi[39]=-1,xi[39]=1,di[39]=0,yi[39]=1,_i[39]=0,Kr[39]=-1,Qr[39]=0,$r[39]=1,ti[39]=1,ei[39]=0,ni[39]=0;function Ei(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]}function wi(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]}function bi(t){return[[t.topright,1],[1,1],[1,t.righttop]]}function Ii(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]}function Ni(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]}function Ci(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]}function Si(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]}function Mi(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]}var Li=[],Pi=[],Oi=[],Ri=[],Ti=[],Ai=[],Di=[],Fi=[];Ri[1]=Ti[1]=18,Ri[169]=Ti[169]=18,Oi[4]=Pi[4]=12,Oi[166]=Pi[166]=12,Li[16]=Fi[16]=4,Li[154]=Fi[154]=4,Ai[64]=Di[64]=22,Ai[106]=Di[106]=22,Oi[2]=Ai[2]=17,Ri[2]=Ti[2]=18,Oi[168]=Ai[168]=17,Ri[168]=Ti[168]=18,Li[8]=Ri[8]=9,Pi[8]=Oi[8]=12,Li[162]=Ri[162]=9,Pi[162]=Oi[162]=12,Li[32]=Fi[32]=4,Pi[32]=Di[32]=1,Li[138]=Fi[138]=4,Pi[138]=Di[138]=1,Ti[128]=Fi[128]=21,Ai[128]=Di[128]=22,Ti[42]=Fi[42]=21,Ai[42]=Di[42]=22,Pi[5]=Ti[5]=14,Pi[165]=Ti[165]=14,Oi[20]=Fi[20]=6,Oi[150]=Fi[150]=6,Li[80]=Ai[80]=11,Li[90]=Ai[90]=11,Ri[65]=Di[65]=3,Ri[105]=Di[105]=3,Li[160]=Ai[160]=11,Pi[160]=Ti[160]=14,Li[10]=Ai[10]=11,Pi[10]=Ti[10]=14,Oi[130]=Fi[130]=6,Ri[130]=Di[130]=3,Oi[40]=Fi[40]=6,Ri[40]=Di[40]=3,Pi[101]=Di[101]=1,Pi[69]=Di[69]=1,Ti[149]=Fi[149]=21,Ti[21]=Fi[21]=21,Oi[86]=Ai[86]=17,Oi[84]=Ai[84]=17,Li[89]=Ri[89]=9,Li[81]=Ri[81]=9,Li[96]=Di[96]=0,Pi[96]=Ai[96]=15,Li[74]=Di[74]=0,Pi[74]=Ai[74]=15,Li[24]=Oi[24]=8,Ri[24]=Fi[24]=7,Li[146]=Oi[146]=8,Ri[146]=Fi[146]=7,Pi[6]=Ai[6]=15,Oi[6]=Ti[6]=16,Pi[164]=Ai[164]=15,Oi[164]=Ti[164]=16,Ri[129]=Fi[129]=7,Ti[129]=Di[129]=20,Ri[41]=Fi[41]=7,Ti[41]=Di[41]=20,Oi[66]=Di[66]=2,Ri[66]=Ai[66]=19,Oi[104]=Di[104]=2,Ri[104]=Ai[104]=19,Li[144]=Ti[144]=10,Ai[144]=Fi[144]=23,Li[26]=Ti[26]=10,Ai[26]=Fi[26]=23,Pi[36]=Fi[36]=5,Oi[36]=Di[36]=2,Pi[134]=Fi[134]=5,Oi[134]=Di[134]=2,Li[9]=Ti[9]=10,Pi[9]=Ri[9]=13,Li[161]=Ti[161]=10,Pi[161]=Ri[161]=13,Pi[37]=Fi[37]=5,Ti[37]=Di[37]=20,Pi[133]=Fi[133]=5,Ti[133]=Di[133]=20,Oi[148]=Ti[148]=16,Ai[148]=Fi[148]=23,Oi[22]=Ti[22]=16,Ai[22]=Fi[22]=23,Li[82]=Oi[82]=8,Ri[82]=Ai[82]=19,Li[88]=Oi[88]=8,Ri[88]=Ai[88]=19,Li[73]=Di[73]=0,Pi[73]=Ri[73]=13,Li[97]=Di[97]=0,Pi[97]=Ri[97]=13,Li[145]=Ri[145]=9,Ti[145]=Fi[145]=21,Li[25]=Ri[25]=9,Ti[25]=Fi[25]=21,Pi[70]=Di[70]=1,Oi[70]=Ai[70]=17,Pi[100]=Di[100]=1,Oi[100]=Ai[100]=17,Li[34]=Ri[34]=9,Pi[34]=Oi[34]=12,Ti[34]=Fi[34]=21,Ai[34]=Di[34]=22,Li[136]=Fi[136]=4,Pi[136]=Di[136]=1,Oi[136]=Ai[136]=17,Ri[136]=Ti[136]=18,Li[35]=Fi[35]=4,Pi[35]=Oi[35]=12,Ri[35]=Ti[35]=18,Ai[35]=Di[35]=22,Li[153]=Fi[153]=4,Ri[153]=Ti[153]=18,Pi[102]=Oi[102]=12,Ai[102]=Di[102]=22,Li[155]=Ri[155]=9,Ti[155]=Fi[155]=23,Pi[103]=Di[103]=1,Oi[103]=Ai[103]=17,Li[152]=Fi[152]=4,Oi[152]=Ai[152]=17,Ri[152]=Ti[152]=18,Li[156]=Oi[156]=8,Ri[156]=Ti[156]=18,Ai[156]=Fi[156]=23,Li[137]=Fi[137]=4,Pi[137]=Di[137]=1,Ri[137]=Ti[137]=18,Li[139]=Fi[139]=4,Pi[139]=Ri[139]=13,Ti[139]=Di[139]=20,Li[98]=Ri[98]=9,Pi[98]=Oi[98]=12,Ai[98]=Di[98]=22,Li[99]=Di[99]=0,Pi[99]=Oi[99]=12,Ri[99]=Ai[99]=19,Pi[38]=Oi[38]=12,Ti[38]=Fi[38]=21,Ai[38]=Di[38]=22,Pi[39]=Fi[39]=5,Oi[39]=Ti[39]=16,Ai[39]=Di[39]=22;var qi=[];function Gi(t,e,n){return(t-e)/(n-e)}function Bi(t){return-1<t.constructor.toString().indexOf("Array")}function ki(t){for(var e=t.map(function(t){return{lrCoordinates:t,grouped:!1}}),n=[];!function(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return!1;return!0}(e);)for(var r=0;r<e.length;r++)if(!e[r].grouped){var i=[];i.push(e[r].lrCoordinates),e[r].grouped=!0;for(var o=G([e[r].lrCoordinates]),s=r+1;s<e.length;s++)e[s].grouped||!function(t,e){for(var n=ze(t),r=0;r<n.features.length;r++)if(!Zt(n.features[r],e))return!1;return!0}(G([e[s].lrCoordinates]),o)||(i.push(e[s].lrCoordinates),e[s].grouped=!0);n.push(i)}return n}function zi(t,i,e){if(!H(e=e||{}))throw new Error("options is invalid");var o=e.pivot,n=e.mutate;if(!t)throw new Error("geojson is required");if(null==i||isNaN(i))throw new Error("angle is required");return 0===i||(o=o||ke(t),!1!==n&&void 0!==n||(t=re(t)),N(t,function(t){var e=Pn(o,t)+i,n=Rn(o,t),r=Z(qr(o,n,e));t[0]=r[0],t[1]=r[1]})),t}function ji(n,r,t){if(!H(t=t||{}))throw new Error("options is invalid");var i=t.origin,e=t.mutate;if(!n)throw new Error("geojson required");if("number"!=typeof r||0===r)throw new Error("invalid factor");var o=Array.isArray(i)||"object"==_typeof(i);return!0!==e&&(n=re(n)),"FeatureCollection"!==n.type||o?Xi(n,r,i):(L(n,function(t,e){n.features[e]=Xi(t,r,i)}),n)}function Xi(t,i,o){var e="Point"===rt(t);return o=function(t,e){if(null==e&&(e="centroid"),Array.isArray(e)||"object"==_typeof(e))return J(e);var n=t.bbox?t.bbox:W(t),r=n[0],i=n[1],o=n[2],s=n[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return X([r,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return X([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return X([r,s]);case"ne":case"northeast":case"eastnorth":case"topright":return X([o,s]);case"center":return Be(t);case void 0:case null:case"centroid":return ke(t);default:throw new Error("invalid origin")}}(t,o),1===i||e||N(t,function(t){var e=Rn(o,t),n=Pn(o,t),r=Z(qr(o,e*i,n));t[0]=r[0],t[1]=r[1],3===t.length&&(t[2]*=i)}),t}function Ui(t){var e=t[0],n=t[1];return[n[0]-e[0],n[1]-e[1]]}function Yi(t,e){return t[0]*e[1]-e[0]*t[1]}function Vi(t,e,n){var x=[],E=l(e,n),w=Z(t),b=[];return w.forEach(function(t,e){var n,r,i,o,s,a,u,h,c,l,p,f,g,d,y,_,m,v;e!==w.length-1&&(g=t,d=w[e+1],y=E,_=Math.sqrt((g[0]-d[0])*(g[0]-d[0])+(g[1]-d[1])*(g[1]-d[1])),m=g[0]+y*(d[1]-g[1])/_,v=d[0]+y*(d[1]-g[1])/_,n=[[m,g[1]+y*(g[0]-d[0])/_],[v,d[1]+y*(g[0]-d[0])/_]],x.push(n),0<e&&(r=x[e-1],s=r,!1!==(i=0!==Yi(Ui(o=n),Ui(s))&&(h=o[0],c=Ui(o),l=s[0],f=Yi(c,p=Ui(s)),a=[(u=Yi([l[0]-h[0],l[1]-h[1]],p)/f)*c[0],u*c[1]],[h[0]+a[0],h[1]+a[1]]))&&(r[1]=i,n[0]=i),b.push(r[0]),e===w.length-2&&(b.push(n[0]),b.push(n[1]))),2===w.length&&(b.push(n[0]),b.push(n[1])))}),U(b,t.properties)}function Hi(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0],s=n[1]-e[1];return Math.sign(r*s-o*i)}function Wi(e,t){return t.geometry.coordinates[0].every(function(t){return Zt(X(t),e)})}qi[1]=qi[169]=Ei,qi[4]=qi[166]=wi,qi[16]=qi[154]=bi,qi[64]=qi[106]=Ii,qi[168]=qi[2]=Ni,qi[162]=qi[8]=Ci,qi[138]=qi[32]=Si,qi[42]=qi[128]=Mi,qi[5]=qi[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},qi[20]=qi[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},qi[80]=qi[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},qi[65]=qi[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},qi[160]=qi[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},qi[130]=qi[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},qi[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},qi[101]=qi[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},qi[149]=qi[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},qi[86]=qi[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},qi[89]=qi[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},qi[96]=qi[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},qi[24]=qi[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},qi[6]=qi[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},qi[129]=qi[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},qi[66]=qi[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},qi[144]=qi[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},qi[36]=qi[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},qi[9]=qi[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},qi[37]=qi[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},qi[148]=qi[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},qi[82]=qi[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},qi[73]=qi[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},qi[145]=qi[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},qi[70]=qi[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},qi[34]=function(t){return[Mi(t),Ci(t)]},qi[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},qi[136]=function(t){return[Si(t),Ni(t)]},qi[153]=function(t){return[bi(t),Ei(t)]},qi[102]=function(t){return[wi(t),Ii(t)]},qi[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},qi[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},qi[152]=function(t){return[bi(t),Ni(t)]},qi[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},qi[137]=function(t){return[Si(t),Ei(t)]},qi[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},qi[98]=function(t){return[Ci(t),Ii(t)]},qi[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},qi[38]=function(t){return[wi(t),Mi(t)]},qi[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};function Ji(t){this.id=Ji.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}Ji.buildId=function(t){return t.join(",")},Ji.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(t){return t.from.id!==e.from.id})},Ji.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(t){return t.to.id!==e.to.id})},Ji.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},Ji.prototype.sortOuterEdges=function(){var o=this;this.outerEdgesSorted||(this.outerEdges.sort(function(t,e){var n=t.to,r=e.to;if(0<=n.coordinates[0]-o.coordinates[0]&&r.coordinates[0]-o.coordinates[0]<0)return 1;if(n.coordinates[0]-o.coordinates[0]<0&&0<=r.coordinates[0]-o.coordinates[0])return-1;if(n.coordinates[0]-o.coordinates[0]==0&&r.coordinates[0]-o.coordinates[0]==0)return 0<=n.coordinates[1]-o.coordinates[1]||0<=r.coordinates[1]-o.coordinates[1]?n.coordinates[1]-r.coordinates[1]:r.coordinates[1]-n.coordinates[1];var i=Hi(o.coordinates,n.coordinates,r.coordinates);return i<0?1:0<i?-1:Math.pow(n.coordinates[0]-o.coordinates[0],2)+Math.pow(n.coordinates[1]-o.coordinates[1],2)-(Math.pow(r.coordinates[0]-o.coordinates[0],2)+Math.pow(r.coordinates[1]-o.coordinates[1],2))}),this.outerEdgesSorted=!0)},Ji.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},Ji.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},Ji.prototype.addInnerEdge=function(t){this.innerEdges.push(t)};function Zi(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}Zi.prototype.getSymetric=function(){return this.symetric||(this.symetric=new Zi(this.to,this.from),this.symetric.symetric=this),this.symetric},Zi.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},Zi.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},Zi.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},Zi.prototype.toLineString=function(){return U([this.from.coordinates,this.to.coordinates])},Zi.prototype.compareTo=function(t){return Hi(t.from.coordinates,t.to.coordinates,this.to.coordinates)};function Ki(){this.edges=[],this.polygon=void 0,this.envelope=void 0}var Qi={length:{configurable:!0}};Ki.prototype.push=function(t){this[this.edges.length]=t,this.edges.push(t),this.polygon=this.envelope=void 0},Ki.prototype.get=function(t){return this.edges[t]},Qi.length.get=function(){return this.edges.length},Ki.prototype.forEach=function(t){this.edges.forEach(t)},Ki.prototype.map=function(t){return this.edges.map(t)},Ki.prototype.some=function(t){return this.edges.some(t)},Ki.prototype.isValid=function(){return!0},Ki.prototype.isHole=function(){var r=this,t=this.edges.reduce(function(t,e,n){return e.from.coordinates[1]>r.edges[t].from.coordinates[1]&&(t=n),t},0),e=(0===t?this.length:t)-1,n=(t+1)%this.length,i=Hi(this.edges[e].from.coordinates,this.edges[t].from.coordinates,this.edges[n].from.coordinates);return 0===i?this.edges[e].from.coordinates[0]>this.edges[n].from.coordinates[0]:0<i},Ki.prototype.toMultiPoint=function(){return u(this.edges.map(function(t){return t.from.coordinates}))},Ki.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(t){return t.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=G([t])},Ki.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Ae(this.toPolygon())},Ki.findEdgeRingContaining=function(h,t){var c,l,p=h.getEnvelope();return t.forEach(function(t){var e,n,r,i,o,s,a,u=t.getEnvelope();l&&(c=l.getEnvelope()),n=p,r=(e=u).geometry.coordinates.map(function(t){return t[0]}),i=e.geometry.coordinates.map(function(t){return t[1]}),o=n.geometry.coordinates.map(function(t){return t[0]}),s=n.geometry.coordinates.map(function(t){return t[1]}),Math.max(null,r)===Math.max(null,o)&&Math.max(null,i)===Math.max(null,s)&&Math.min(null,r)===Math.min(null,o)&&Math.min(null,i)===Math.min(null,s)||!Wi(u,p)||(a=h.map(function(t){return t.from.coordinates}).find(function(n){return!t.some(function(t){return e=t.from.coordinates,n[0]===e[0]&&n[1]===e[1];var e})}))&&t.inside(X(a))&&(l&&!Wi(c,u)||(l=t))}),l},Ki.prototype.inside=function(t){return Zt(t,this.toPolygon())},Object.defineProperties(Ki.prototype,Qi);function $i(){this.edges=[],this.nodes={}}function to(t,e){for(var n,r,i,o,s,a,u,h=0;h<t.coordinates.length-1;h++)if(n=t.coordinates[h],r=t.coordinates[h+1],i=e.coordinates,u=a=s=o=void 0,o=i[0]-n[0],s=i[1]-n[1],a=r[0]-n[0],u=r[1]-n[1],0==o*u-s*a&&(Math.abs(a)>=Math.abs(u)?0<a?n[0]<=i[0]&&i[0]<=r[0]:r[0]<=i[0]&&i[0]<=n[0]:0<u?n[1]<=i[1]&&i[1]<=r[1]:r[1]<=i[1]&&i[1]<=n[1]))return 1}function eo(t,e){return 0<Sn(e,vr(t)).features.length}function no(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function ro(t,e){return t[0]===e[0]&&t[1]===e[1]}function io(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&!n&&!r;){for(var s=0;s<e.coordinates.length-1;s++){var a=!0;0!==s&&s!==e.coordinates.length-2||(a=!1),ao(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function oo(t,e){return 0<Sn(t,vr(e)).features.length}function so(t,e){for(var n=!1,r=!1,i=t.coordinates[0].length,o=0;o<i&&n&&r;)Zt(X(t.coordinates[0][o]),e)?n=!0:r=!0,o++;return r&&r}function ao(t,e,n,r){var i=n[0]-t[0],o=n[1]-t[1],s=e[0]-t[0],a=e[1]-t[1];return 0==i*a-o*s&&(r?Math.abs(s)>=Math.abs(a)?0<s?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:0<a?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?0<s?t[0]<n[0]&&n[0]<e[0]:e[0]<n[0]&&n[0]<t[0]:0<a?t[1]<n[1]&&n[1]<e[1]:e[1]<n[1]&&n[1]<t[1])}$i.fromGeoJson=function(t){!function(t){if(!t)throw new Error("No geojson passed");if("FeatureCollection"!==t.type&&"GeometryCollection"!==t.type&&"MultiLineString"!==t.type&&"LineString"!==t.type&&"Feature"!==t.type)throw new Error("Invalid input type '"+t.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}(t);var i=new $i;return A(t,function(t){$(t,"LineString","Graph::fromGeoJson"),C(t,function(t,e){var n,r;return t&&(n=i.getNode(t),r=i.getNode(e),i.addEdge(n,r)),e})}),i},$i.prototype.getNode=function(t){var e=Ji.buildId(t);return this.nodes[e]||(this.nodes[e]=new Ji(t))},$i.prototype.addEdge=function(t,e){var n=new Zi(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push(r)},$i.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(t){return e.nodes[t]}).forEach(function(t){return e._removeIfDangle(t)})},$i.prototype._removeIfDangle=function(t){var e,n=this;t.innerEdges.length<=1&&(e=t.getOuterEdges().map(function(t){return t.to}),this.removeNode(t),e.forEach(function(t){return n._removeIfDangle(t)}))},$i.prototype.deleteCutEdges=function(){var e=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(t){t.label===t.symetric.label&&(e.removeEdge(t.symetric),e.removeEdge(t))})},$i.prototype._computeNextCWEdges=function(n){var e=this;void 0===n?Object.keys(this.nodes).forEach(function(t){return e._computeNextCWEdges(e.nodes[t])}):n.getOuterEdges().forEach(function(t,e){n.getOuterEdge((0===e?n.getOuterEdges().length:e)-1).symetric.next=t})},$i.prototype._computeNextCCWEdges=function(t,e){for(var n,r,i=t.getOuterEdges(),o=i.length-1;0<=o;--o){var s=i[o],a=s.symetric,u=void 0,h=void 0;s.label===e&&(u=s),a.label===e&&(h=a),u&&h&&(h&&(r=h),u&&(r&&(r.next=u,r=void 0),n=n||u))}r&&(r.next=n)},$i.prototype._findLabeledEdgeRings=function(){var n=[],r=0;return this.edges.forEach(function(t){if(!(0<=t.label)){n.push(t);for(var e=t;e.label=r,e=e.next,!t.isEqual(e););r++}}),n},$i.prototype.getEdgeRings=function(){var n=this;this._computeNextCWEdges(),this.edges.forEach(function(t){t.label=void 0}),this._findLabeledEdgeRings().forEach(function(e){n._findIntersectionNodes(e).forEach(function(t){n._computeNextCCWEdges(t,e.label)})});var e=[];return this.edges.forEach(function(t){t.ring||e.push(n._findEdgeRing(t))}),e},$i.prototype._findIntersectionNodes=function(n){for(var t=[],r=n;function(){var e=0;r.from.getOuterEdges().forEach(function(t){t.label===n.label&&++e}),1<e&&t.push(r.from),r=r.next}(),!n.isEqual(r););return t},$i.prototype._findEdgeRing=function(t){for(var e=t,n=new Ki;n.push(e),e.ring=n,e=e.next,!t.isEqual(e););return n},$i.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(t){return e.removeEdge(t)}),t.innerEdges.forEach(function(t){return e.removeEdge(t)}),delete this.nodes[t.id]},$i.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(t){return!t.isEqual(e)}),e.deleteEdge()};function uo(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:go}var ho=Ct(function(t,e){function n(t){var e,n=[];for(e in t)n.push(e);return n}(t.exports="function"==typeof Object.keys?Object.keys:n).shim=n}),co=(ho.shim,Ct(function(t,e){var n="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function i(t){return t&&"object"==_typeof(t)&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}(e=t.exports=n?r:i).supported=r,e.unsupported=i})),lo=(co.supported,co.unsupported,Ct(function(t){var a=Array.prototype.slice,u=t.exports=function(t,e,n){return n=n||{},t===e||(t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=_typeof(t)&&"object"!=_typeof(e)?n.strict?t===e:t==e:function(t,e,n){var r,i;if(h(t)||h(e))return!1;if(t.prototype!==e.prototype)return!1;if(co(t))return!!co(e)&&(t=a.call(t),e=a.call(e),u(t,e,n));if(c(t)){if(!c(e))return!1;if(t.length!==e.length)return!1;for(r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}try{var o=ho(t),s=ho(e)}catch(t){return!1}if(o.length!=s.length)return!1;for(o.sort(),s.sort(),r=o.length-1;0<=r;r--)if(o[r]!=s[r])return!1;for(r=o.length-1;0<=r;r--)if(i=o[r],!u(t[i],e[i],n))return!1;return _typeof(t)==_typeof(e)}(t,e,n))};function h(t){return null==t}function c(t){return t&&"object"==_typeof(t)&&"number"==typeof t.length&&"function"==typeof t.copy&&"function"==typeof t.slice&&!(0<t.length&&"number"!=typeof t[0])}}));function po(e){return e.coordinates.map(function(t){return{type:e.type.replace("Multi",""),coordinates:t}})}function fo(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function go(t,e){return lo(t,e,{strict:!0})}uo.prototype.compare=function(t,e){if(t.type!==e.type||!fo(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(0===t.type.indexOf("Multi")){var n=this,r=po(t),i=po(e);return r.every(function(e){return this.some(function(t){return n.compare(e,t)})},i)}}return!1},uo.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].toFixed(this.precision)!==e[n].toFixed(this.precision))return!1;return!0},uo.prototype.compareLine=function(t,e,n,r){if(!fo(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!r||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){var s=this.compareCoord(i[n],o[n]);return this.direction||s?this.comparePath(i,o):!!this.compareCoord(i[n],o[o.length-(1+n)])&&this.comparePath(i.slice().reverse(),o)}},uo.prototype.fixStartIndex=function(t,e){for(var n,r=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){r=i;break}return 0<=r&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},uo.prototype.comparePath=function(t,e){var n=this;return t.every(function(t,e){return n.compareCoord(t,this[e])},e)},uo.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every(function(e){return this.some(function(t){return i.compareLine(e,t,1,!0)})},r)}return!1},uo.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},uo.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},uo.prototype.removePseudo=function(t){return t};var yo=uo;function _o(t,n){if(!t)throw new Error("feature1 is required");if(!n)throw new Error("feature2 is required");var e=rt(t);if(e!==rt(n))throw new Error("features must be of the same type");if("Point"===e)throw new Error("Point geometry not supported");if(new yo({precision:6}).compare(t,n))return!1;var r=0;switch(e){case"MultiPoint":var i=O(t),o=O(n);i.forEach(function(e){o.forEach(function(t){e[0]===t[0]&&e[1]===t[1]&&r++})});break;case"LineString":case"MultiLineString":F(t,function(e){F(n,function(t){Ar(e,t).features.length&&r++})});break;case"Polygon":case"MultiPolygon":F(t,function(e){F(n,function(t){Sn(e,t).features.length&&r++})})}return 0<r}var mo=Ct(function(t){function e(t,e,n,r){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,n,r)}e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i,o,s=0;s<this._datasetLength;s++){1!==this._visited[s]&&(this._visited[s]=1,(i=this._regionQuery(s)).length<this.minPts?this.noise.push(s):(o=this.clusters.length,this.clusters.push([]),this._addToCluster(s,o),this._expandCluster(o,i)))}return this.clusters},e.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+_typeof(t)+" given");this.dataset=t,this.clusters=[],this.noise=[],this._datasetLength=t.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._expandCluster=function(t,e){for(var n=0;n<e.length;n++){var r,i=e[n];1!==this._visited[i]&&(this._visited[i]=1,(r=this._regionQuery(i)).length>=this.minPts&&(e=this._mergeArrays(e,r))),1!==this._assigned[i]&&this._addToCluster(i,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],n=0;n<this._datasetLength;n++)this.distance(this.dataset[t],this.dataset[n])<this.epsilon&&e.push(n);return e},e.prototype._mergeArrays=function(t,e){for(var n=e.length,r=0;r<n;r++){var i=e[r];t.indexOf(i)<0&&t.push(i)}return t},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)}),vo=Ct(function(t){function e(t,e,n){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,e,n)}e.prototype.init=function(t,e,n){this.assignments=[],this.centroids=[],void 0!==t&&(this.dataset=t),void 0!==e&&(this.k=e),void 0!==n&&(this.distance=n)},e.prototype.run=function(t,e){this.init(t,e);for(var n=this.dataset.length,r=0;r<this.k;r++)this.centroids[r]=this.randomCentroid();for(var i=!0;i;){i=this.assign();for(var o=0;o<this.k;o++){for(var s=new Array(c),a=0,u=0;u<c;u++)s[u]=0;for(var h=0;h<n;h++){var c=this.dataset[h].length;if(o===this.assignments[h]){for(u=0;u<c;u++)s[u]+=this.dataset[h][u];a++}}if(0<a){for(u=0;u<c;u++)s[u]/=a;this.centroids[o]=s}else this.centroids[o]=this.randomCentroid(),i=!0}}return this.getClusters()},e.prototype.randomCentroid=function(){for(var t,e,n=this.dataset.length-1;e=Math.round(Math.random()*n),t=this.dataset[e],0<=this.centroids.indexOf(t););return t},e.prototype.assign=function(){for(var t,e=!1,n=this.dataset.length,r=0;r<n;r++)(t=this.argmin(this.dataset[r],this.centroids,this.distance))!=this.assignments[r]&&(this.assignments[r]=t,e=!0);return e},e.prototype.getClusters=function(){for(var t,e=new Array(this.k),n=0;n<this.assignments.length;n++)void 0===e[t=this.assignments[n]]&&(e[t]=[]),e[t].push(n);return e},e.prototype.argmin=function(t,e,n){for(var r,i=Number.MAX_VALUE,o=0,s=e.length,a=0;a<s;a++)(r=n(t,e[a]))<i&&(i=r,o=a);return o},e.prototype.distance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;){var i=t[r]-e[r];n+=i*i}return Math.sqrt(n)},t.exports&&(t.exports=e)}),xo=Ct(function(t){function e(t,e,n){this._queue=[],this._priorities=[],this._sorting="desc",this._init(t,e,n)}e.prototype.insert=function(t,e){for(var n=this._queue.length,r=n;r--;){var i=this._priorities[r];"desc"===this._sorting?i<e&&(n=r):e<i&&(n=r)}this._insertAt(t,e,n)},e.prototype.remove=function(t){for(var e=this._queue.length;e--;)if(t===this._queue[e]){this._queue.splice(e,1),this._priorities.splice(e,1);break}},e.prototype.forEach=function(t){this._queue.forEach(t)},e.prototype.getElements=function(){return this._queue},e.prototype.getElementPriority=function(t){return this._priorities[t]},e.prototype.getPriorities=function(){return this._priorities},e.prototype.getElementsWithPriorities=function(){for(var t=[],e=0,n=this._queue.length;e<n;e++)t.push([this._queue[e],this._priorities[e]]);return t},e.prototype._init=function(t,e,n){if(t&&e){if(this._queue=[],this._priorities=[],t.length!==e.length)throw new Error("Arrays must have the same length");for(var r=0;r<t.length;r++)this.insert(t[r],e[r])}n&&(this._sorting=n)},e.prototype._insertAt=function(t,e,n){this._queue.length===n?(this._queue.push(t),this._priorities.push(e)):(this._queue.splice(n,0,t),this._priorities.splice(n,0,e))},t.exports&&(t.exports=e)}),Eo=Ct(function(t){var h;function e(t,e,n,r){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,n,r)}t.exports&&(h=xo),e.prototype.run=function(t,e,n,r){this._init(t,e,n,r);for(var i,o,s,a=0,u=this.dataset.length;a<u;a++){1!==this._processed[a]&&(this._processed[a]=1,this.clusters.push([a]),i=this.clusters.length-1,this._orderedList.push(a),o=new h(null,null,"asc"),s=this._regionQuery(a),void 0!==this._distanceToCore(a)&&(this._updateQueue(a,s,o),this._expandCluster(i,o)))}return this.clusters},e.prototype.getReachabilityPlot=function(){for(var t=[],e=0,n=this._orderedList.length;e<n;e++){var r=this._orderedList[e],i=this._reachability[r];t.push([r,i])}return t},e.prototype._init=function(t,e,n,r){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+_typeof(t)+" given");this.dataset=t,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),n&&(this.minPts=n),r&&(this.distance=r)},e.prototype._updateQueue=function(r,t,i){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(t){var e,n;void 0===o._processed[t]&&(e=o.distance(o.dataset[r],o.dataset[t]),n=Math.max(o._coreDistance,e),void 0===o._reachability[t]?(o._reachability[t]=n,i.insert(t,n)):n<o._reachability[t]&&(o._reachability[t]=n,i.remove(t),i.insert(t,n)))})},e.prototype._expandCluster=function(t,e){for(var n=e.getElements(),r=0,i=n.length;r<i;r++){var o,s=n[r];void 0===this._processed[s]&&(o=this._regionQuery(s),this._processed[s]=1,this.clusters[t].push(s),this._orderedList.push(s),void 0!==this._distanceToCore(s)&&(this._updateQueue(s,o,e),this._expandCluster(t,e)))}},e.prototype._distanceToCore=function(t){for(var e=this.epsilon,n=0;n<e;n++)if(this._regionQuery(t,n).length>=this.minPts)return n},e.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var n=[],r=0,i=this.dataset.length;r<i;r++)this.distance(this.dataset[t],this.dataset[r])<e&&n.push(r);return n},e.prototype._euclideanDistance=function(t,e){for(var n=0,r=Math.min(t.length,e.length);r--;)n+=(t[r]-e[r])*(t[r]-e[r]);return Math.sqrt(n)},t.exports&&(t.exports=e)}),wo=Ct(function(t){t.exports&&(t.exports={DBSCAN:mo,KMEANS:vo,OPTICS:Eo,PriorityQueue:xo})});wo.DBSCAN,wo.KMEANS,wo.OPTICS,wo.PriorityQueue;function bo(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++){var s=(t[o]||0)-(e[o]||0);i+=s*s}return n?Math.sqrt(i):i}function Io(t,e,n){var r=Math.abs(t-e);return n?r:r*r}var No=bo,Co=bo;function So(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}function Mo(t,e,n,r){var i,o=[],s=[],a=[],u=!1,h=r||1e4,c=t.length,l=t[0].length,p=0<l,f=[];if(n)o="kmrand"==n?function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=0<t[0].length;r.length<e&&0<i--;){var a=t[Math.floor(Math.random()*o)],u=s?a.join("_"):""+a;n[u]||(n[u]=!0,r.push(a))}if(r.length<e)throw new Error("Error initializating clusters");return r}(t,e):"kmpp"==n?function(t,e){var n=t[0].length?No:Io,r=[],i=t.length,o=0<t[0].length,s=t[Math.floor(Math.random()*i)];for(o&&s.join("_"),r.push(s);r.length<e;){for(var a=[],u=r.length,h=0,c=[],l=0;l<i;l++){for(var p=1/0,f=0;f<u;f++){var g=n(t[l],r[f]);g<=p&&(p=g)}a[l]=p}for(var d=0;d<i;d++)h+=a[d];for(var y=0;y<i;y++)c[y]={i:y,v:t[y],pr:a[y]/h,cs:0};c.sort(function(t,e){return t.pr-e.pr}),c[0].cs=c[0].pr;for(var _=1;_<i;_++)c[_].cs=c[_-1].cs+c[_].pr;for(var m=Math.random(),v=0;v<i-1&&c[v++].cs<m;);r.push(c[v-1].v)}return r}(t,e):n;else for(var g={};o.length<e;){var d=Math.floor(Math.random()*c);g[d]||(g[d]=!0,o.push(t[d]))}do{So(e,0,f);for(var y=0;y<c;y++){for(var _=1/0,m=0,v=0;v<e;v++)(i=p?Co(t[y],o[v]):Math.abs(t[y]-o[v]))<=_&&(_=i,m=v);f[a[y]=m]++}for(var x=[],E=(s=[],0);E<e;E++)x[E]=p?So(l,0,x[E]):0,s[E]=o[E];if(p){for(var w=0;w<e;w++)o[w]=[];for(var b=0;b<c;b++)for(var I=x[a[b]],N=t[b],C=0;C<l;C++)I[C]+=N[C];u=!0;for(var S=0;S<e;S++){for(var M=o[S],L=x[S],P=s[S],O=f[S],R=0;R<l;R++)M[R]=L[R]/O||0;if(u)for(var T=0;T<l;T++)if(P[T]!=M[T]){u=!1;break}}}else{for(var A=0;A<c;A++)x[a[A]]+=t[A];for(var D=0;D<e;D++)o[D]=x[D]/f[D]||0;u=!0;for(var F=0;F<e;F++)if(s[F]!=o[F]){u=!1;break}}u=u||--h<=0}while(!u);return{it:1e4-h,k:e,idxs:a,centroids:o}}function Lo(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function Po(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}var Oo={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||Oo.heuristics.manhattan,o=r.closest||!1,s=new Ao(function(t){return t.f}),a=e;for(e.h=i(e,n),s.push(e);0<s.size();){var u=s.pop();if(u===n)return Po(u);u.closed=!0;for(var h=t.neighbors(u),c=0,l=h.length;c<l;++c){var p,f,g=h[c];g.closed||g.isWall()||(p=u.g+g.getCost(u),(!(f=g.visited)||p<g.g)&&(g.visited=!0,g.parent=u,g.h=g.h||i(g,n),g.g=p,g.f=g.g+g.h,t.markDirty(g),o&&(g.h<a.h||g.h===a.h&&g.g<a.g)&&(a=g),f?s.rescoreElement(g):s.push(g)))}}return o?Po(a):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var n=Math.sqrt(2),r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return+(r+i)+(n-2)*Math.min(r,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Ro(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var n=0;n<t.length;n++){this.grid[n]=[];for(var r=0,i=t[n];r<i.length;r++){var o=new To(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function To(t,e,n){this.x=t,this.y=e,this.weight=n}function Ao(t){this.content=[],this.scoreFunction=t}Ro.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Oo.cleanNode(this.nodes[t])},Ro.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Oo.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Ro.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Ro.prototype.neighbors=function(t){var e=[],n=t.x,r=t.y,i=this.grid;return i[n-1]&&i[n-1][r]&&e.push(i[n-1][r]),i[n+1]&&i[n+1][r]&&e.push(i[n+1][r]),i[n]&&i[n][r-1]&&e.push(i[n][r-1]),i[n]&&i[n][r+1]&&e.push(i[n][r+1]),this.diagonal&&(i[n-1]&&i[n-1][r-1]&&e.push(i[n-1][r-1]),i[n+1]&&i[n+1][r-1]&&e.push(i[n+1][r-1]),i[n-1]&&i[n-1][r+1]&&e.push(i[n-1][r+1]),i[n+1]&&i[n+1][r+1]&&e.push(i[n+1][r+1])),e},Ro.prototype.toString=function(){for(var t,e,n,r,i=[],o=this.grid,s=0,a=o.length;s<a;s++){for(t=[],n=0,r=(e=o[s]).length;n<r;n++)t.push(e[n].weight);i.push(t.join(" "))}return i.join("\n")},To.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},To.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},To.prototype.isWall=function(){return 0===this.weight},Ao.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return 0<this.content.length&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];0<t;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[n]=e,this.content[t]=r,t=n}},bubbleUp:function(t){for(var e=this.content.length,n=this.content[t],r=this.scoreFunction(n);;){var i,o,s,a=t+1<<1,u=a-1,h=null;if(u<e&&(o=this.content[u],(i=this.scoreFunction(o))<r&&(h=u)),a<e&&(s=this.content[a],this.scoreFunction(s)<(null===h?r:i)&&(h=a)),null===h)break;this.content[t]=this.content[h],this.content[h]=n,t=h}}};function Do(t){return function(){return t}}function Fo(t){return t[0]}function qo(t){return t[1]}function Go(){this._=null}function Bo(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function ko(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function zo(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function jo(t){for(;t.L;)t=t.L;return t}function Xo(t,e,n,r){var i=[null,null],o=as.push(i)-1;return i.left=t,i.right=e,n&&Yo(i,t,e,n),r&&Yo(i,e,t,r),os[t.index].halfedges.push(o),os[e.index].halfedges.push(o),i}function Uo(t,e,n){var r=[e,n];return r.left=t,r}function Yo(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function Vo(t,e){return e[+(e.left!==t.site)]}Go.prototype={constructor:Go,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else n=this._?(t=jo(this._),e.P=null,(e.N=t).P=t.L=e,t):(e.P=e.N=null,this._=e,null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(ko(this,n),n=(t=n).U),n.C=!1,r.C=!0,zo(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(zo(this,n),n=(t=n).U),n.C=!1,r.C=!0,ko(this,r)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,r=t.U,i=t.L,o=t.R,s=i?o?jo(o):i:o;if(r?r.L===t?r.L=s:r.R=s:this._=s,i&&o?(n=s.C,s.C=t.C,((s.L=i).U=s)!==o?(r=s.U,s.U=t.U,t=s.R,r.L=t,(s.R=o).U=s):(s.U=r,t=(r=s).R)):(n=t.C,t=s),t&&(t.U=r),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===r.L){if((e=r.R).C&&(e.C=!1,r.C=!0,ko(this,r),e=r.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,zo(this,e),e=r.R),e.C=r.C,r.C=e.R.C=!1,ko(this,r),t=this._;break}}else if((e=r.L).C&&(e.C=!1,r.C=!0,zo(this,r),e=r.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,ko(this,e),e=r.L),e.C=r.C,r.C=e.L.C=!1,zo(this,r),t=this._;break}e.C=!0,r=(t=r).U}while(!t.C);t&&(t.C=!1)}}};var Ho,Wo=[];function Jo(){Bo(this),this.x=this.y=this.arc=this.site=this.cy=null}function Zo(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var s=i[0],a=i[1],u=r[0]-s,h=r[1]-a,c=o[0]-s,l=o[1]-a,p=2*(u*l-h*c);if(!(-hs<=p)){var f=u*u+h*h,g=c*c+l*l,d=(l*f-h*g)/p,y=(u*g-c*f)/p,_=Wo.pop()||new Jo;_.arc=t,_.site=i,_.x=d+s,_.y=(_.cy=y+a)+Math.sqrt(d*d+y*y),t.circle=_;for(var m=null,v=ss._;v;)if(_.y<v.y||_.y===v.y&&_.x<=v.x){if(!v.L){m=v.P;break}v=v.L}else{if(!v.R){m=v;break}v=v.R}ss.insert(m,_),m||(Ho=_)}}}}function Ko(t){var e=t.circle;e&&(e.P||(Ho=e.N),ss.remove(e),Wo.push(e),Bo(e),t.circle=null)}var Qo=[];function $o(){Bo(this),this.edge=this.site=this.circle=null}function ts(t){var e=Qo.pop()||new $o;return e.site=t,e}function es(t){Ko(t),is.remove(t),Qo.push(t),Bo(t)}function ns(t){for(var e,n,r,i,o=t[0],s=t[1],a=is._;a;)if(r=rs(a,s)-o,us<r)a=a.L;else{if(i=o-function(t,e){var n=t.N;if(n)return rs(n,e);var r=t.site;return r[1]===e?r[0]:1/0}(a,s),!(us<i)){-us<r?(e=a.P,n=a):-us<i?n=(e=a).N:e=n=a;break}if(!a.R){e=a;break}a=a.R}os[t.index]={site:t,halfedges:[]};var u,h,c,l,p,f,g,d,y,_,m,v,x=ts(t);if(is.insert(e,x),e||n){if(e===n)return Ko(e),n=ts(e.site),is.insert(x,n),x.edge=n.edge=Xo(e.site,x.site),Zo(e),Zo(n),0;n?(Ko(e),Ko(n),h=(u=e.site)[0],c=u[1],l=t[0]-h,p=t[1]-c,g=(f=n.site)[0]-h,v=[((d=f[1]-c)*(_=l*l+p*p)-p*(m=g*g+d*d))/(y=2*(l*d-p*g))+h,(l*m-g*_)/y+c],Yo(n.edge,u,f,v),x.edge=Xo(u,t,null,v),n.edge=Xo(t,f,null,v),Zo(e),Zo(n)):x.edge=Xo(e.site,x.site)}}function rs(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],u=n[1],h=u-e;if(!h)return a;var c=a-r,l=1/o-1/h,p=c/h;return l?(-p+Math.sqrt(p*p-2*l*(c*c/(-2*h)-u+h/2+i-o/2)))/l+r:(r+a)/2}var is,os,ss,as,us=1e-6,hs=1e-12;function cs(t,e){return e[1]-t[1]||e[0]-t[0]}function ls(t,e){var n,r,i,o,s,a,u,h=t.sort(cs).pop();for(as=[],os=new Array(t.length),is=new Go,ss=new Go;;)if(i=Ho,h&&(!i||h[1]<i.y||h[1]===i.y&&h[0]<i.x))h[0]===n&&h[1]===r||(ns(h),n=h[0],r=h[1]),h=t.pop();else{if(!i)break;!function(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,s=t.N,a=[t];es(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)<us&&Math.abs(r-u.circle.cy)<us;)o=u.P,a.unshift(u),es(u),u=o;a.unshift(u),Ko(u);for(var h=s;h.circle&&Math.abs(n-h.circle.x)<us&&Math.abs(r-h.circle.cy)<us;)s=h.N,a.push(h),es(h),h=s;a.push(h),Ko(h);for(var c=a.length,l=1;l<c;++l)h=a[l],u=a[l-1],Yo(h.edge,u.site,h.site,i);u=a[0],(h=a[c-1]).edge=Xo(u.site,h.site,null,i),Zo(u),Zo(h)}(i.arc)}(function(){for(var t,e,n,r,i,o,s,a=0,u=os.length;a<u;++a)if((t=os[a])&&(n=(e=t.halfedges).length)){for(var h=new Array(n),c=new Array(n),l=0;l<n;++l)h[l]=l,c[l]=(r=as[e[l]],s=o=void 0,i=t.site,o=r.left,i===(s=r.right)&&(s=o,o=i),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(s=i===o?(o=r[1],r[0]):(o=r[0],r[1]),Math.atan2(o[0]-s[0],s[1]-o[1])));for(h.sort(function(t,e){return c[e]-c[t]}),l=0;l<n;++l)c[l]=e[h[l]];for(l=0;l<n;++l)e[l]=c[l]}})(),e&&(function(t,e,n,r){for(var i,o=as.length;o--;)(function(t,e,n,r,i){var o=t[1];if(o)return 1;var s,a,u=t[0],h=t.left,c=t.right,l=h[0],p=h[1],f=c[0],g=c[1],d=(l+f)/2,y=(p+g)/2;if(g===p){if(d<e||r<=d)return;if(f<l){if(u){if(u[1]>=i)return}else u=[d,n];o=[d,i]}else{if(u){if(u[1]<n)return}else u=[d,i];o=[d,n]}}else if(a=y-(s=(l-f)/(g-p))*d,s<-1||1<s)if(f<l){if(u){if(u[1]>=i)return}else u=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(u){if(u[1]<n)return}else u=[(i-a)/s,i];o=[(n-a)/s,n]}else if(p<g){if(u){if(u[0]>=r)return}else u=[e,s*e+a];o=[r,s*r+a]}else{if(u){if(u[0]<e)return}else u=[r,s*r+a];o=[e,s*e+a]}return t[0]=u,t[1]=o,1})(i=as[o],t,e,n,r)&&function(t,e,n,r,i){var o=t[0],s=t[1],a=o[0],u=o[1],h=0,c=1,l=s[0]-a,p=s[1]-u,f=e-a;if(l||!(0<f)){if(f/=l,l<0){if(f<h)return;f<c&&(c=f)}else if(0<l){if(c<f)return;h<f&&(h=f)}if(f=r-a,l||!(f<0)){if(f/=l,l<0){if(c<f)return;h<f&&(h=f)}else if(0<l){if(f<h)return;f<c&&(c=f)}if(f=n-u,p||!(0<f)){if(f/=p,p<0){if(f<h)return;f<c&&(c=f)}else if(0<p){if(c<f)return;h<f&&(h=f)}if(f=i-u,p||!(f<0)){if(f/=p,p<0){if(c<f)return;h<f&&(h=f)}else if(0<p){if(f<h)return;f<c&&(c=f)}return(0<h||c<1)&&(0<h&&(t[0]=[a+h*l,u+h*p]),c<1&&(t[1]=[a+c*l,u+c*p])),1}}}}}(i,t,e,n,r)&&(Math.abs(i[0][0]-i[1][0])>us||Math.abs(i[0][1]-i[1][1])>us)||delete as[o]}(o=+e[0][0],s=+e[0][1],a=+e[1][0],u=+e[1][1]),function(t,e,n,r){var i,o,s,a,u,h,c,l,p,f,g,d,y=os.length,_=!0;for(C=0;C<y;++C)if(i=os[C]){for(o=i.site,s=(a=i.halfedges).length;s--;)as[a[s]]||a.splice(s,1);for(s=0,u=a.length;s<u;)f=(p=(d=as[a[s]])[+(d.left===i.site)])[0],g=p[1],c=(h=Vo(i,as[a[++s%u]]))[0],l=h[1],(Math.abs(f-c)>us||Math.abs(g-l)>us)&&(a.splice(s,0,as.push(Uo(o,p,Math.abs(f-t)<us&&us<r-g?[t,Math.abs(c-t)<us?l:r]:Math.abs(g-r)<us&&us<n-f?[Math.abs(l-r)<us?c:n,r]:Math.abs(f-n)<us&&us<g-e?[n,Math.abs(c-n)<us?l:e]:Math.abs(g-e)<us&&us<f-t?[Math.abs(l-e)<us?c:t,e]:null))-1),++u);u&&(_=!1)}if(_){for(var m,v,x,E,w,b,I,N=1/0,C=0,_=null;C<y;++C)(i=os[C])&&(x=(m=(o=i.site)[0]-t)*m+(v=o[1]-e)*v)<N&&(N=x,_=i);_&&(E=[t,e],w=[t,r],b=[n,r],I=[n,e],_.halfedges.push(as.push(Uo(o=_.site,E,w))-1,as.push(Uo(o,w,b))-1,as.push(Uo(o,b,I))-1,as.push(Uo(o,I,E))-1))}for(C=0;C<y;++C)(i=os[C])&&(i.halfedges.length||delete os[C])}(o,s,a,u)),this.edges=as,this.cells=os,is=ss=as=os=null}function ps(t){return(t=t.slice()).push(t[0]),G([t])}function fs(t,e,n,r){var i=(r=r||{}).steps||64,o=r.units||"kilometers",s=r.angle||0,a=r.pivot||t,u=r.properties||t.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!n)throw new Error("ySemiAxis is required");if(!H(r))throw new Error("options must be an object");if(!V(i))throw new Error("steps must be a number");if(!V(s))throw new Error("angle must be a number");var h,c=J(t);"degrees"===o?h=m(s):(e=qr(t,e,90,{units:o}),n=qr(t,n,0,{units:o}),e=J(e)[0]-c[0],n=J(n)[1]-c[1]);for(var l=[],p=0;p<i;p+=1){var f,g,d=-360*p/i,y=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e,2)*Math.pow(gs(d),2)),_=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(gs(d),2));d<-90&&-270<=d&&(y=-y),d<-180&&-360<=d&&(_=-_),"degrees"===o&&(f=y*Math.cos(h)+_*Math.sin(h),g=_*Math.cos(h)-y*Math.sin(h),y=f,_=g),l.push([y+c[0],_+c[1]])}return l.push(l[0]),"degrees"===o?G([l],u):zi(G([l],u),s,{pivot:a})}function gs(t){var e=t*Math.PI/180;return Math.tan(e)}function ds(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.properties,i=e.weight;if(!t)throw new Error("geojson is required");var o=0,s=0,a=0;return R(t,function(t,e,n){var r=n[i];if(!V(r=null==r?1:r))throw new Error("weight value must be a number for feature index "+e);0<(r=Number(r))&&N(t,function(t){o+=t[0]*r,s+=t[1]*r,a+=r})}),X([o/a,s/a],n)}function ys(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function _s(t){if(H(t)&&(t=t.bbox),t&&!Array.isArray(t))throw new Error("bbox is invalid");return t?(e=t,[Math.random()*(e[2]-e[0])+e[0],Math.random()*(e[3]-e[1])+e[1]]):[360*Es(),180*Es()];var e}function ms(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.bbox;null==t&&(t=1);for(var r=[],i=0;i<t;i++)r.push(X(_s(n)));return Y(r)}function vs(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.num_vertices,i=e.max_radial_length;null==t&&(t=1),V(r)||(r=10),V(i)||(i=10);for(var o=[],s=0;s<t;s++){var a=[],u=Array.apply(null,new Array(r+1)).map(Math.random);u.forEach(h),u.forEach(c),a[a.length-1]=a[0],a=a.map(function(e){return function(t){return[t[0]+e[0],t[1]+e[1]]}}(_s(n))),o.push(G([a]))}function h(t,e,n){n[e]=0<e?t+n[e-1]:t}function c(t){t=2*t*Math.PI/u[u.length-1];var e=Math.random();a.push([e*i*Math.sin(t),e*i*Math.cos(t)])}return Y(o)}function xs(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!V(r)||r<2)&&(r=10),V(i)||(i=1e-4),V(o)||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[_s(n)],h=0;h<r-1;h++){var c=(0===h?2*Math.random()*Math.PI:Math.tan((u[h][1]-u[h-1][1])/(u[h][0]-u[h-1][0])))+(Math.random()-.5)*o*2,l=Math.random()*i;u.push([u[h][0]+l*Math.cos(c),u[h][1]+l*Math.sin(c)])}s.push(U(u))}return Y(s)}function Es(){return Math.random()-.5}ls.prototype={constructor:ls,polygons:function(){var n=this.edges;return this.cells.map(function(e){var t=e.halfedges.map(function(t){return Vo(e,n[t])});return t.data=e.site.data,t})},triangles:function(){var h=[],c=this.edges;return this.cells.forEach(function(t,e){if(r=(n=t.halfedges).length)for(var n,r,i,o=t.site,s=-1,a=c[n[r-1]],u=a.left===o?a.right:a.left;++s<r;)i=u,u=(a=c[n[s]]).left===o?a.right:a.left,i&&u&&e<i.index&&e<u.index&&(o[0]-u[0])*(i[1]-o[1])-(o[0]-i[0])*(u[1]-o[1])<0&&h.push([o.data,i.data,u.data])}),h},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(s,a,t){for(var e,u,h=this,c=h._found||0,n=h.cells.length;!(u=h.cells[c]);)if(++c>=n)return null;for(var r=s-u.site[0],i=a-u.site[1],l=r*r+i*i;u=h.cells[e=c],c=null,u.halfedges.forEach(function(t){var e,n,r,i=h.edges[t],o=i.left;!(o!==u.site&&o||(o=i.right))||(r=(e=s-o[0])*e+(n=a-o[1])*n)<l&&(l=r,c=o.index)}),null!==c;);return h._found=e,null==t||l<=t*t?u.site:null}};var ws=Object.freeze({randomPosition:_s,randomPoint:ms,randomPolygon:vs,randomLineString:xs});function bs(t,e){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("filter is required");var n=[];return L(t,function(t){Ss(t.properties,e)&&n.push(t)}),Y(n)}function Is(t,e,n){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("property is required");for(var r=Cs(t,e),i=Object.keys(r),o=0;o<i.length;o++){for(var s=i[o],a=r[s],u=[],h=0;h<a.length;h++)u.push(t.features[a[h]]);n(Y(u),s,o)}}function Ns(t,e,r,i){var o=i;return Is(t,e,function(t,e,n){o=0===n&&void 0===i?t:r(o,t,e,n)}),o}function Cs(t,i){var o={};return L(t,function(t,e){var n,r=t.properties||{};r.hasOwnProperty(i)&&(n=r[i],o.hasOwnProperty(n)?o[n].push(e):o[n]=[e])}),o}function Ss(t,e){if(void 0===t)return!1;var n=_typeof(e);if("number"===n||"string"===n)return t.hasOwnProperty(e);if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(!Ss(t,e[r]))return!1;return!0}return Ms(t,e)}function Ms(t,e){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r];if(t[i]!==e[i])return!1}return!0}function Ls(t,e){if(!e)return{};if(!e.length)return{};for(var n={},r=0;r<e.length;r++){var i=e[r];t.hasOwnProperty(i)&&(n[i]=t[i])}return n}var Ps=Object.freeze({getCluster:bs,clusterEach:Is,clusterReduce:Ns,createBins:Cs,applyFilter:Ss,propertiesContainsFilter:Ms,filterProperties:Ls});"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t,e,n){if(null==this)throw new TypeError(this+" is not an object");for(var r=Object(this),i=Math.max(Math.min(r.length,9007199254740991),0)||0,o=((o=1 in arguments&&parseInt(Number(e),10)||0)<0?Math.max(i+o,0):Math.min(o,i)),s=((s=2 in arguments&&void 0!==n?parseInt(Number(n),10)||0:i)<0?Math.max(i+n,0):Math.min(s,i));o<s;)r[o]=t,++o;return r},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)};function Os(){}Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},Os.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};function Rs(){}function Ts(){}var As={MAX_VALUE:{configurable:!0}};Ts.isNaN=function(t){return Number.isNaN(t)},Ts.doubleToLongBits=function(t){return t},Ts.longBitsToDouble=function(t){return t},Ts.isInfinite=function(t){return!Number.isFinite(t)},As.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Ts,As);function Ds(){}function Fs(){}function qs(){}function Gs(){}var Bs=function t(){var e;this.x=null,this.y=null,this.z=null,0===arguments.length?(this.x=0,this.y=0,this.z=t.NULL_ORDINATE):1===arguments.length?(e=arguments[0],this.x=e.x,this.y=e.y,this.z=e.z):2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},ks={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};Bs.prototype.setOrdinate=function(t,e){switch(t){case Bs.X:this.x=e;break;case Bs.Y:this.y=e;break;case Bs.Z:this.z=e;break;default:throw new Rs}},Bs.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!!Os.equalsWithTolerance(this.x,e.x,n)&&!!Os.equalsWithTolerance(this.y,e.y,n)}},Bs.prototype.getOrdinate=function(t){switch(t){case Bs.X:return this.x;case Bs.Y:return this.y;case Bs.Z:return this.z}throw new Rs},Bs.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Ts.isNaN(this.z))&&Ts.isNaN(t.z)},Bs.prototype.equals=function(t){return t instanceof Bs&&this.equals2D(t)},Bs.prototype.equalInZ=function(t,e){return Os.equalsWithTolerance(this.z,t.z,e)},Bs.prototype.compareTo=function(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0},Bs.prototype.clone=function(){},Bs.prototype.copy=function(){return new Bs(this)},Bs.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},Bs.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},Bs.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},Bs.prototype.hashCode=function(){return 37*(629+Bs.hashCode(this.x))+Bs.hashCode(this.y)},Bs.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},Bs.prototype.interfaces_=function(){return[Ds,Fs,Gs]},Bs.prototype.getClass=function(){return Bs},Bs.hashCode=function(){if(1===arguments.length){var t=Ts.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},ks.DimensionalComparator.get=function(){return zs},ks.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},ks.NULL_ORDINATE.get=function(){return Ts.NaN},ks.X.get=function(){return 0},ks.Y.get=function(){return 1},ks.Z.get=function(){return 2},Object.defineProperties(Bs,ks);var zs=function(t){if(this._dimensionsToTest=2,0!==arguments.length&&1===arguments.length){if(2!==t&&3!==t)throw new Rs;this._dimensionsToTest=t}};zs.prototype.compare=function(t,e){var n=t,r=e,i=zs.compare(n.x,r.x);if(0!==i)return i;var o=zs.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:zs.compare(n.z,r.z)},zs.prototype.interfaces_=function(){return[qs]},zs.prototype.getClass=function(){return zs},zs.compare=function(t,e){return t<e?-1:e<t?1:Ts.isNaN(t)?Ts.isNaN(e)?0:-1:Ts.isNaN(e)?1:0};function js(){}js.prototype.create=function(){},js.prototype.interfaces_=function(){return[]},js.prototype.getClass=function(){return js};function Xs(){}var Us={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};Xs.prototype.interfaces_=function(){return[]},Xs.prototype.getClass=function(){return Xs},Xs.toLocationSymbol=function(t){switch(t){case Xs.EXTERIOR:return"e";case Xs.BOUNDARY:return"b";case Xs.INTERIOR:return"i";case Xs.NONE:return"-"}throw new Rs},Us.INTERIOR.get=function(){return 0},Us.BOUNDARY.get=function(){return 1},Us.EXTERIOR.get=function(){return 2},Us.NONE.get=function(){return-1},Object.defineProperties(Xs,Us);function Ys(t,e){return t.interfaces_&&-1<t.interfaces_().indexOf(e)}function Vs(){}var Hs={LOG_10:{configurable:!0}};Vs.prototype.interfaces_=function(){return[]},Vs.prototype.getClass=function(){return Vs},Vs.log10=function(t){var e=Math.log(t);return Ts.isInfinite(e)||Ts.isNaN(e)?e:e/Vs.LOG_10},Vs.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},Vs.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:n<t?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:o<r?o:r}},Vs.wrap=function(t,e){return t<0?e- -t%e:t%e},Vs.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[0];return n<t&&(n=t),n<e&&(n=e),n}if(4===arguments.length){var r=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return s<r&&(s=r),s<i&&(s=i),s<o&&(s=o),s}},Vs.average=function(t,e){return(t+e)/2},Hs.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Vs,Hs);function Ws(t){this.str=t}Ws.prototype.append=function(t){this.str+=t},Ws.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},Ws.prototype.toString=function(t){return this.str};function Js(t){this.value=t}Js.prototype.intValue=function(){return this.value},Js.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},Js.isNaN=function(t){return Number.isNaN(t)};function Zs(){}Zs.isWhitespace=function(t){return t<=32&&0<=t||127===t},Zs.toUpperCase=function(t){return t.toUpperCase()};function Ks(){var t,e,n,r;this._hi=0,(this._lo=0)===arguments.length?this.init(0):1===arguments.length?"number"==typeof arguments[0]?(t=arguments[0],this.init(t)):arguments[0]instanceof Ks?(e=arguments[0],this.init(e)):"string"==typeof arguments[0]&&Ks.call(this,Ks.parse(arguments[0])):2===arguments.length&&(n=arguments[0],r=arguments[1],this.init(n,r))}var Qs={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}};Ks.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},Ks.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=Ks.magnitude(n._hi),i=Ks.TEN.pow(r);(n=n.divide(i)).gt(Ks.TEN)?(n=n.divide(Ks.TEN),r+=1):n.lt(Ks.ONE)&&(n=n.multiply(Ks.TEN),--r);for(var o=r+1,s=new Ws,a=Ks.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var h=Math.trunc(n._hi);if(h<0)break;var c=!1,l=9<h?(c=!0,"9"):"0"+h;s.append(l),n=n.subtract(Ks.valueOf(h)).multiply(Ks.TEN),c&&n.selfAdd(Ks.TEN);var p=!0,f=Ks.magnitude(n._hi);if(f<0&&Math.abs(f)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},Ks.prototype.sqr=function(){return this.multiply(this)},Ks.prototype.doubleValue=function(){return this._hi+this._lo},Ks.prototype.subtract=function(){if(arguments[0]instanceof Ks){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},Ks.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},Ks.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Ks.prototype.selfSubtract=function(){if(arguments[0]instanceof Ks){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)}},Ks.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Ks.prototype.min=function(t){return this.le(t)?this:t},Ks.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Ks){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,r,i,o,s=arguments[0],a=arguments[1],u=null,h=null,c=this._hi/s,l=(u=(o=Ks.SPLIT*c)-(o-c))*(h=(l=Ks.SPLIT*s)-(l-s))-(i=c*s)+u*(r=s-h)+(n=c-u)*h+n*r;return l=c+(o=(this._hi-i-l+this._lo-c*a)/s),this._hi=l,this._lo=c-l+o,this}},Ks.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Ks.prototype.divide=function(){if(arguments[0]instanceof Ks){var t,e,n,r=arguments[0],i=null,o=null,s=(e=this._hi/r._hi)-(i=(u=Ks.SPLIT*e)-(u-e)),a=i*(o=(a=Ks.SPLIT*r._hi)-(a-r._hi))-(n=e*r._hi)+i*(t=r._hi-o)+s*o+s*t,u=(this._hi-n-a+this._lo-e*r._lo)/r._hi;return new Ks(a=e+u,e-a+u)}if("number"==typeof arguments[0]){var h=arguments[0];return Ts.isNaN(h)?Ks.createNaN():Ks.copy(this).selfDivide(h,0)}},Ks.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},Ks.prototype.pow=function(t){if(0===t)return Ks.valueOf(1);var e=new Ks(this),n=Ks.valueOf(1),r=Math.abs(t);if(1<r)for(;0<r;)r%2==1&&n.selfMultiply(e),0<(r/=2)&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},Ks.prototype.ceil=function(){if(this.isNaN())return Ks.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Ks(t,e)},Ks.prototype.compareTo=function(t){return this._hi<t._hi?-1:this._hi>t._hi?1:this._lo<t._lo?-1:this._lo>t._lo?1:0},Ks.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Ks.prototype.setValue=function(){if(arguments[0]instanceof Ks){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},Ks.prototype.max=function(t){return this.ge(t)?this:t},Ks.prototype.sqrt=function(){if(this.isZero())return Ks.valueOf(0);if(this.isNegative())return Ks.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=Ks.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},Ks.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Ks){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,n,r,i,o=arguments[0],s=(n=this._hi+o)-(r=n-this._hi),a=(i=o-r+(this._hi-s)+this._lo)+(n-(e=n+i));return this._hi=e+a,this._lo=a+(e-this._hi),this}}else if(2===arguments.length){var u,h,c,l=arguments[0],p=arguments[1],f=this._hi+l,g=this._lo+p,d=f-(c=f-this._hi),y=g-(h=g-this._lo),_=(u=f+(c=l-c+(this._hi-d)+g))+(c=p-h+(this._lo-y)+(c+(f-u))),m=c+(u-_);return this._hi=_,this._lo=m,this}},Ks.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Ks){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,r,i,o,s=arguments[0],a=arguments[1],u=(o=Ks.SPLIT*this._hi)-this._hi,h=Ks.SPLIT*s;u=o-u,n=this._hi-u,i=h-s;var c=(o=this._hi*s)+(h=u*(i=h-i)-o+u*(r=s-i)+n*i+n*r+(this._hi*a+this._lo*s)),l=h+(o-c);return this._hi=c,this._lo=l,this}},Ks.prototype.selfSqr=function(){return this.selfMultiply(this)},Ks.prototype.floor=function(){if(this.isNaN())return Ks.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Ks(t,e)},Ks.prototype.negate=function(){return this.isNaN()?this:new Ks(-this._hi,-this._lo)},Ks.prototype.clone=function(){},Ks.prototype.multiply=function(){if(arguments[0]instanceof Ks){var t=arguments[0];return t.isNaN()?Ks.createNaN():Ks.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Ts.isNaN(e)?Ks.createNaN():Ks.copy(this).selfMultiply(e,0)}},Ks.prototype.isNaN=function(){return Ts.isNaN(this._hi)},Ks.prototype.intValue=function(){return Math.trunc(this._hi)},Ks.prototype.toString=function(){var t=Ks.magnitude(this._hi);return-3<=t&&t<=20?this.toStandardNotation():this.toSciNotation()},Ks.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e,n=new Array(1).fill(null),r=this.extractSignificantDigits(!0,n),i=n[0]+1,o=r;return"."===r.charAt(0)?o="0"+r:i<0?o="0."+Ks.stringOfChar("0",-i)+r:-1===r.indexOf(".")&&(e=i-r.length,o=r+Ks.stringOfChar("0",e)+".0"),this.isNegative()?"-"+o:o},Ks.prototype.reciprocal=function(){var t,e,n,r,i,o=null,s=(e=1/this._hi)-(o=(r=Ks.SPLIT*e)-(r-e)),a=(i=Ks.SPLIT*this._hi)-this._hi,u=e+(r=(1-(n=e*this._hi)-(o*(a=i-a)-n+o*(t=this._hi-a)+s*a+s*t)-e*this._lo)/this._hi);return new Ks(u,e-u+r)},Ks.prototype.toSciNotation=function(){if(this.isZero())return Ks.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=Ks.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";1<n.length&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},Ks.prototype.abs=function(){return this.isNaN()?Ks.NaN:this.isNegative()?this.negate():new Ks(this)},Ks.prototype.isPositive=function(){return(0<this._hi||0===this._hi)&&0<this._lo},Ks.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},Ks.prototype.add=function(){if(arguments[0]instanceof Ks){var t=arguments[0];return Ks.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Ks.copy(this).selfAdd(e)}},Ks.prototype.init=function(){var t,e,n,r;1===arguments.length?"number"==typeof arguments[0]?(t=arguments[0],this._hi=t,this._lo=0):arguments[0]instanceof Ks&&(e=arguments[0],this._hi=e._hi,this._lo=e._lo):2===arguments.length&&(n=arguments[0],r=arguments[1],this._hi=n,this._lo=r)},Ks.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},Ks.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Ks.prototype.trunc=function(){return this.isNaN()?Ks.NaN:this.isPositive()?this.floor():this.ceil()},Ks.prototype.signum=function(){return 0<this._hi?1:this._hi<0?-1:0<this._lo?1:this._lo<0?-1:0},Ks.prototype.interfaces_=function(){return[Gs,Ds,Fs]},Ks.prototype.getClass=function(){return Ks},Ks.sqr=function(t){return Ks.valueOf(t).selfMultiply(t)},Ks.valueOf=function(){return"string"==typeof arguments[0]?Ks.parse(arguments[0]):"number"==typeof arguments[0]?new Ks(arguments[0]):void 0},Ks.sqrt=function(t){return Ks.valueOf(t).sqrt()},Ks.parse=function(t){for(var e=0,n=t.length;Zs.isWhitespace(t.charAt(e));)e++;var r,i=!1;e<n&&("-"!==(r=t.charAt(e))&&"+"!==r||(e++,"-"===r&&(i=!0)));for(var o=new Ks,s=0,a=0,u=0;!(n<=e);){var h=t.charAt(e);if(e++,Zs.isDigit(h)){var c=h-"0";o.selfMultiply(Ks.TEN),o.selfAdd(c),s++}else{if("."!==h){if("e"!==h&&"E"!==h)throw new Error("Unexpected character '"+h+"' at position "+e+" in string "+t);var l=t.substring(e);try{u=Js.parseInt(l)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+l+" in string "+t):e}break}a=s}}var p,f,g=o,d=s-a-u;return 0==d?g=o:0<d?(p=Ks.TEN.pow(d),g=o.divide(p)):d<0&&(f=Ks.TEN.pow(-d),g=o.multiply(f)),i?g.negate():g},Ks.createNaN=function(){return new Ks(Ts.NaN,Ts.NaN)},Ks.copy=function(t){return new Ks(t)},Ks.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},Ks.stringOfChar=function(t,e){for(var n=new Ws,r=0;r<e;r++)n.append(t);return n.toString()},Qs.PI.get=function(){return new Ks(3.141592653589793,12246467991473532e-32)},Qs.TWO_PI.get=function(){return new Ks(6.283185307179586,24492935982947064e-32)},Qs.PI_2.get=function(){return new Ks(1.5707963267948966,6123233995736766e-32)},Qs.E.get=function(){return new Ks(2.718281828459045,14456468917292502e-32)},Qs.NaN.get=function(){return new Ks(Ts.NaN,Ts.NaN)},Qs.EPS.get=function(){return 123259516440783e-46},Qs.SPLIT.get=function(){return 134217729},Qs.MAX_PRINT_DIGITS.get=function(){return 32},Qs.TEN.get=function(){return Ks.valueOf(10)},Qs.ONE.get=function(){return Ks.valueOf(1)},Qs.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Qs.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Ks,Qs);function $s(){}var ta={DP_SAFE_EPSILON:{configurable:!0}};$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s},$s.orientationIndex=function(t,e,n){var r=$s.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=Ks.valueOf(e.x).selfAdd(-t.x),o=Ks.valueOf(e.y).selfAdd(-t.y),s=Ks.valueOf(n.x).selfAdd(-e.x),a=Ks.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},$s.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},$s.intersection=function(t,e,n,r){var i=Ks.valueOf(r.y).selfSubtract(n.y).selfMultiply(Ks.valueOf(e.x).selfSubtract(t.x)),o=Ks.valueOf(r.x).selfSubtract(n.x).selfMultiply(Ks.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=Ks.valueOf(r.x).selfSubtract(n.x).selfMultiply(Ks.valueOf(t.y).selfSubtract(n.y)),u=Ks.valueOf(r.y).selfSubtract(n.y).selfMultiply(Ks.valueOf(t.x).selfSubtract(n.x)),h=a.subtract(u).selfDivide(s).doubleValue(),c=Ks.valueOf(t.x).selfAdd(Ks.valueOf(e.x).selfSubtract(t.x).selfMultiply(h)).doubleValue(),l=Ks.valueOf(e.x).selfSubtract(t.x).selfMultiply(Ks.valueOf(t.y).selfSubtract(n.y)),p=Ks.valueOf(e.y).selfSubtract(t.y).selfMultiply(Ks.valueOf(t.x).selfSubtract(n.x)),f=l.subtract(p).selfDivide(s).doubleValue(),g=Ks.valueOf(n.y).selfAdd(Ks.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();return new Bs(c,g)},$s.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(0<i){if(o<=0)return $s.signum(s);r=i+o}else{if(!(i<0))return $s.signum(s);if(0<=o)return $s.signum(s);r=-i-o}var a=$s.DP_SAFE_EPSILON*r;return a<=s||a<=-s?$s.signum(s):2},$s.signum=function(t){return 0<t?1:t<0?-1:0},ta.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties($s,ta);function ea(){}var na={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};na.X.get=function(){return 0},na.Y.get=function(){return 1},na.Z.get=function(){return 2},na.M.get=function(){return 3},ea.prototype.setOrdinate=function(t,e,n){},ea.prototype.size=function(){},ea.prototype.getOrdinate=function(t,e){},ea.prototype.getCoordinate=function(){},ea.prototype.getCoordinateCopy=function(t){},ea.prototype.getDimension=function(){},ea.prototype.getX=function(t){},ea.prototype.clone=function(){},ea.prototype.expandEnvelope=function(t){},ea.prototype.copy=function(){},ea.prototype.getY=function(t){},ea.prototype.toCoordinateArray=function(){},ea.prototype.interfaces_=function(){return[Fs]},ea.prototype.getClass=function(){return ea},Object.defineProperties(ea,na);function ra(){}function ia(){}var oa,sa=((oa=ra)&&(aa.__proto__=oa),((aa.prototype=Object.create(oa&&oa.prototype)).constructor=aa).prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa},aa);function aa(){oa.call(this,"Projective point not representable on the Cartesian plane.")}ia.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},ia.getProperty=function(t){return{"line.separator":"\n"}[t]};function ua(){var t,e,n,r,i,o,s,a,u,h,c,l,p,f,g,d,y,_,m,v;this.x=null,this.y=null,this.w=null,0===arguments.length?(this.x=0,this.y=0,this.w=1):1===arguments.length?(t=arguments[0],this.x=t.x,this.y=t.y,this.w=1):2===arguments.length?"number"==typeof arguments[0]&&"number"==typeof arguments[1]?(e=arguments[0],n=arguments[1],this.x=e,this.y=n,this.w=1):arguments[0]instanceof ua&&arguments[1]instanceof ua?(r=arguments[0],i=arguments[1],this.x=r.y*i.w-i.y*r.w,this.y=i.x*r.w-r.x*i.w,this.w=r.x*i.y-i.x*r.y):arguments[0]instanceof Bs&&arguments[1]instanceof Bs&&(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):3===arguments.length?(a=arguments[0],u=arguments[1],h=arguments[2],this.x=a,this.y=u,this.w=h):4===arguments.length&&(l=arguments[1],p=arguments[2],f=arguments[3],g=(c=arguments[0]).y-l.y,d=l.x-c.x,y=c.x*l.y-l.x*c.y,_=p.y-f.y,m=f.x-p.x,v=p.x*f.y-f.x*p.y,this.x=d*v-m*y,this.y=_*y-g*v,this.w=g*m-_*d)}ua.prototype.getY=function(){var t=this.y/this.w;if(Ts.isNaN(t)||Ts.isInfinite(t))throw new sa;return t},ua.prototype.getX=function(){var t=this.x/this.w;if(Ts.isNaN(t)||Ts.isInfinite(t))throw new sa;return t},ua.prototype.getCoordinate=function(){var t=new Bs;return t.x=this.getX(),t.y=this.getY(),t},ua.prototype.interfaces_=function(){return[]},ua.prototype.getClass=function(){return ua},ua.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,h=n.x*r.y-r.x*n.y,c=i*u-a*o,l=(o*h-u*s)/c,p=(a*s-i*h)/c;if(Ts.isNaN(l)||Ts.isInfinite(l)||Ts.isNaN(p)||Ts.isInfinite(p))throw new sa;return new Bs(l,p)};function ha(){var t,e,n,r,i,o,s,a;this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length?this.init():1===arguments.length?arguments[0]instanceof Bs?(t=arguments[0],this.init(t.x,t.x,t.y,t.y)):arguments[0]instanceof ha&&(e=arguments[0],this.init(e)):2===arguments.length?(n=arguments[0],r=arguments[1],this.init(n.x,r.x,n.y,r.y)):4===arguments.length&&(i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],this.init(i,o,s,a))}var ca={serialVersionUID:{configurable:!0}};ha.prototype.getArea=function(){return this.getWidth()*this.getHeight()},ha.prototype.equals=function(t){if(!(t instanceof ha))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()},ha.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new ha;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new ha(e,r,n,i)},ha.prototype.isNull=function(){return this._maxx<this._minx},ha.prototype.getMaxX=function(){return this._maxx},ha.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof Bs){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof ha){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],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}},ha.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof ha){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 Bs){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},ha.prototype.getMinY=function(){return this._miny},ha.prototype.getMinX=function(){return this._minx},ha.prototype.expandToInclude=function(){var t,e;if(1===arguments.length){if(arguments[0]instanceof Bs){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof ha){var r=arguments[0];if(r.isNull())return null;this.isNull()?(this._minx=r.getMinX(),this._maxx=r.getMaxX(),this._miny=r.getMinY(),this._maxy=r.getMaxY()):(r._minx<this._minx&&(this._minx=r._minx),r._maxx>this._maxx&&(this._maxx=r._maxx),r._miny<this._miny&&(this._miny=r._miny),r._maxy>this._maxy&&(this._maxy=r._maxy))}}else 2===arguments.length&&(t=arguments[0],e=arguments[1],this.isNull()?(this._minx=t,this._maxx=t,this._miny=e,this._maxy=e):(t<this._minx&&(this._minx=t),t>this._maxx&&(this._maxx=t),e<this._miny&&(this._miny=e),e>this._maxy&&(this._maxy=e)))},ha.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},ha.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},ha.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},ha.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},ha.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},ha.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},ha.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},ha.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return e<t?t:e},ha.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()}},ha.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof ha){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof Bs){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},ha.prototype.centre=function(){return this.isNull()?null:new Bs((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},ha.prototype.init=function(){var t,e,n,r,i,o,s,a;0===arguments.length?this.setToNull():1===arguments.length?arguments[0]instanceof Bs?(t=arguments[0],this.init(t.x,t.x,t.y,t.y)):arguments[0]instanceof ha&&(e=arguments[0],this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy):2===arguments.length?(n=arguments[0],r=arguments[1],this.init(n.x,r.x,n.y,r.y)):4===arguments.length&&(i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],this._maxx=i<o?(this._minx=i,o):(this._minx=o,i),this._maxy=s<a?(this._miny=s,a):(this._miny=a,s))},ha.prototype.getMaxY=function(){return this._maxy},ha.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)},ha.prototype.hashCode=function(){return 37*(37*(37*(629+Bs.hashCode(this._minx))+Bs.hashCode(this._maxx))+Bs.hashCode(this._miny))+Bs.hashCode(this._maxy)},ha.prototype.interfaces_=function(){return[Ds,Gs]},ha.prototype.getClass=function(){return ha},ha.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 r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),h=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(u<h||c<a||(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),h=Math.min(r.y,i.y),c=Math.max(r.y,i.y),u<h||c<a))}},ca.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(ha,ca);function la(t){this.geometryFactory=t||new mh}var pa={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*$/};la.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=pa.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=pa.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],da[n]&&(e=da[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},la.prototype.write=function(t){return this.extractGeometry(t)},la.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!ga[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+ga[e].apply(this,[t])+")"};function fa(t){this.parser=new la(t)}var ga={coordinate:function(t){return t.x+" "+t.y},point:function(t){return ga.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+ga.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(ga.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(ga.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+ga.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+ga.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+ga.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+ga.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},da={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(pa.spaces);return this.geometryFactory.createPoint(new Bs(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(pa.trimParens,"$1"),r.push(da.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(pa.spaces),r.push(new Bs(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(pa.spaces),r.push(new Bs(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var n=t.trim().split(pa.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(pa.trimParens,"$1"),r.push(da.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e,n,r;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(pa.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(pa.trimParens,"$1"),n=da.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(pa.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(pa.trimParens,"$1"),r.push(da.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},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=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}};fa.prototype.write=function(t){return this.parser.write(t)},fa.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};function ya(){}var _a,ma,va=((ma=Error)&&(wa.__proto__=ma),(wa.prototype=Object.create(ma&&ma.prototype)).constructor=wa),xa=((_a=va)&&(Ea.__proto__=_a),((Ea.prototype=Object.create(_a&&_a.prototype)).constructor=Ea).prototype.interfaces_=function(){return[]},Ea.prototype.getClass=function(){return Ea},Ea);function Ea(){var t;_a.call(this),0===arguments.length?_a.call(this):1===arguments.length&&(t=arguments[0],_a.call(this,t))}function wa(t){ma.call(this,t),this.name="RuntimeException",this.message=t,this.stack=(new ma).stack}ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya},ya.shouldNeverReachHere=function(){if(0===arguments.length)ya.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new xa("Should never reach here"+(null!==t?": "+t:""))}},ya.isTrue=function(){var t;if(1===arguments.length)ya.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new xa:new xa(t)},ya.equals=function(){var t,e,n;if(2===arguments.length)ya.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new xa("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};function ba(){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 Bs,this._intPt[1]=new Bs,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}var Ia={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ba.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},ba.prototype.getTopologySummary=function(){var t=new Ws;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},ba.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)},ba.prototype.getIntersectionNum=function(){return this._result},ba.prototype.computeIntLineIndex=function(){var t,e,n;0===arguments.length?null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1)):1===arguments.length&&(t=arguments[0],e=this.getEdgeDistance(t,0),n=this.getEdgeDistance(t,1),this._intLineIndex[t][1]=n<e?(this._intLineIndex[t][0]=0,1):(this._intLineIndex[t][0]=1,0))},ba.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ba.prototype.setPrecisionModel=function(t){this._precisionModel=t},ba.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}},ba.prototype.getIntersection=function(t){return this._intPt[t]},ba.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ba.prototype.hasIntersection=function(){return this._result!==ba.NO_INTERSECTION},ba.prototype.getEdgeDistance=function(t,e){return ba.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},ba.prototype.isCollinear=function(){return this._result===ba.COLLINEAR_INTERSECTION},ba.prototype.toString=function(){return fa.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fa.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ba.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},ba.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},ba.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},ba.prototype.interfaces_=function(){return[]},ba.prototype.getClass=function(){return ba},ba.computeEdgeDistance=function(t,e,n){var r,i,o=Math.abs(n.x-e.x),s=Math.abs(n.y-e.y),a=-1;return t.equals(e)?a=0:t.equals(n)?a=s<o?o:s:(r=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y),0!==(a=s<o?r:i)||t.equals(e)||(a=Math.max(r,i))),ya.isTrue(!(0===a&&!t.equals(e)),"Bad distance calculation"),a},ba.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return ya.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},Ia.DONT_INTERSECT.get=function(){return 0},Ia.DO_INTERSECT.get=function(){return 1},Ia.COLLINEAR.get=function(){return 2},Ia.NO_INTERSECTION.get=function(){return 0},Ia.POINT_INTERSECTION.get=function(){return 1},Ia.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ba,Ia);function Na(){}var Ca,Sa=((Ca=ba)&&(Ma.__proto__=Ca),((Ma.prototype=Object.create(Ca&&Ca.prototype)).constructor=Ma).prototype.isInSegmentEnvelopes=function(t){var e=new ha(this._inputLines[0][0],this._inputLines[0][1]),n=new ha(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},Ma.prototype.computeIntersection=function(){if(3!==arguments.length)return Ca.prototype.computeIntersection.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,ha.intersects(e,n,t)&&0===Pa.orientationIndex(e,n,t)&&0===Pa.orientationIndex(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=Ca.POINT_INTERSECTION,null;this._result=Ca.NO_INTERSECTION},Ma.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},Ma.prototype.safeHCoordinateIntersection=function(e,n,r,i){var o=null;try{o=ua.intersection(e,n,r,i)}catch(t){if(!(t instanceof sa))throw t;o=Ma.nearestEndpoint(e,n,r,i)}return o},Ma.prototype.intersection=function(t,e,n,r){var i=this.intersectionWithNormalization(t,e,n,r);return this.isInSegmentEnvelopes(i)||(i=new Bs(Ma.nearestEndpoint(t,e,n,r))),null!==this._precisionModel&&this._precisionModel.makePrecise(i),i},Ma.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},Ma.prototype.checkDD=function(t,e,n,r,i){var o=$s.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);ia.out.println("DD in env = "+s+" --------------------- "+o),1e-4<i.distance(o)&&ia.out.println("Distance = "+i.distance(o))},Ma.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new Bs(t),o=new Bs(e),s=new Bs(n),a=new Bs(r),u=new Bs;this.normalizeToEnvCentre(i,o,s,a,u);var h=this.safeHCoordinateIntersection(i,o,s,a);return h.x+=u.x,h.y+=u.y,h},Ma.prototype.computeCollinearIntersection=function(t,e,n,r){var i=ha.intersects(t,e,n),o=ha.intersects(t,e,r),s=ha.intersects(n,r,t),a=ha.intersects(n,r,e);return i&&o?(this._intPt[0]=n,this._intPt[1]=r,Ca.COLLINEAR_INTERSECTION):s&&a?(this._intPt[0]=t,this._intPt[1]=e,Ca.COLLINEAR_INTERSECTION):i&&s?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||o||a?Ca.COLLINEAR_INTERSECTION:Ca.POINT_INTERSECTION):i&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||o||s?Ca.COLLINEAR_INTERSECTION:Ca.POINT_INTERSECTION):o&&s?(this._intPt[0]=r,this._intPt[1]=t,!r.equals(t)||i||a?Ca.COLLINEAR_INTERSECTION:Ca.POINT_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||i||s?Ca.COLLINEAR_INTERSECTION:Ca.POINT_INTERSECTION):Ca.NO_INTERSECTION},Ma.prototype.normalizeToEnvCentre=function(t,e,n,r,i){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,h=n.x<r.x?n.x:r.x,c=n.y<r.y?n.y:r.y,l=n.x>r.x?n.x:r.x,p=n.y>r.y?n.y:r.y,f=((h<o?o:h)+(a<l?a:l))/2,g=((c<s?s:c)+(u<p?u:p))/2;i.x=f,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},Ma.prototype.computeIntersect=function(t,e,n,r){if(this._isProper=!1,!ha.intersects(t,e,n,r))return Ca.NO_INTERSECTION;var i=Pa.orientationIndex(t,e,n),o=Pa.orientationIndex(t,e,r);if(0<i&&0<o||i<0&&o<0)return Ca.NO_INTERSECTION;var s=Pa.orientationIndex(n,r,t),a=Pa.orientationIndex(n,r,e);return 0<s&&0<a||s<0&&a<0?Ca.NO_INTERSECTION:0===i&&0===o&&0===s&&0===a?this.computeCollinearIntersection(t,e,n,r):(0===i||0===o||0===s||0===a?(this._isProper=!1,t.equals2D(n)||t.equals2D(r)?this._intPt[0]=t:e.equals2D(n)||e.equals2D(r)?this._intPt[0]=e:0===i?this._intPt[0]=new Bs(n):0===o?this._intPt[0]=new Bs(r):0===s?this._intPt[0]=new Bs(t):0===a&&(this._intPt[0]=new Bs(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,r)),Ca.POINT_INTERSECTION)},Ma.prototype.interfaces_=function(){return[]},Ma.prototype.getClass=function(){return Ma},Ma.nearestEndpoint=function(t,e,n,r){var i=t,o=Pa.distancePointLine(t,n,r),s=Pa.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=Pa.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=Pa.distancePointLine(r,t,e))<o&&(o=s,i=r),i},Ma);function Ma(){Ca.apply(this,arguments)}Na.prototype.interfaces_=function(){return[]},Na.prototype.getClass=function(){return Na},Na.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return Na.signOfDet2x2(r,i,o,s)},Na.signOfDet2x2=function(t,e,n,r){var i,o=null,s=null,o=1;if(0===t||0===r)return 0===e||0===n?0:0<e?0<n?-o:o:0<n?o:-o;if(0===e||0===n)return 0<r?0<t?o:-o:0<t?-o:o;if(0<e?0<r?e<=r||(o=-o,s=t,t=n,n=s,s=e,e=r,r=s):r=e<=-r?(o=-o,n=-n,-r):(s=t,t=-n,n=s,s=e,e=-r,s):0<r?-e<=r?(o=-o,t=-t,e=-e):(s=-t,t=n,n=s,s=-e,e=r,r=s):r=r<=e?(t=-t,e=-e,n=-n,-r):(o=-o,s=-t,t=-n,n=s,s=-e,e=-r,s),0<t){if(!(0<n))return o;if(!(t<=n))return o}else{if(0<n)return-o;if(!(n<=t))return-o;o=-o,t=-t,n=-n}for(;;){if((r-=(i=Math.floor(n/t))*e)<0)return-o;if(e<r)return o;if((n-=i*t)+n<t){if(e<r+r)return o}else{if(r+r<e)return-o;n=t-n,r=e-r,o=-o}if(0===r)return 0===n?0:-o;if(0===n)return o;if((e-=(i=Math.floor(t/n))*r)<0)return o;if(r<e)return-o;if((t-=i*n)+t<n){if(r<e+e)return-o}else{if(e+e<r)return o;t=n-t,e=r-e,o=-o}if(0===e)return 0===t?0:o;if(0===t)return-o}};function La(t){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1,this._p=t}La.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,r=e.x;return r<n&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(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 i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=Na.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),0<u&&this._crossingCount++}},La.prototype.isPointInPolygon=function(){return this.getLocation()!==Xs.EXTERIOR},La.prototype.getLocation=function(){return this._isPointOnSegment?Xs.BOUNDARY:this._crossingCount%2==1?Xs.INTERIOR:Xs.EXTERIOR},La.prototype.isOnSegment=function(){return this._isPointOnSegment},La.prototype.interfaces_=function(){return[]},La.prototype.getClass=function(){return La},La.locatePointInRing=function(){if(arguments[0]instanceof Bs&&Ys(arguments[1],ea)){for(var t=arguments[1],e=new La(arguments[0]),n=new Bs,r=new Bs,i=1;i<t.size();i++)if(t.getCoordinate(i,n),t.getCoordinate(i-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof Bs&&arguments[1]instanceof Array){for(var o=arguments[1],s=new La(arguments[0]),a=1;a<o.length;a++){var u=o[a],h=o[a-1];if(s.countSegment(u,h),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var Pa=function(){},Oa={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};Pa.prototype.interfaces_=function(){return[]},Pa.prototype.getClass=function(){return Pa},Pa.orientationIndex=function(t,e,n){return $s.orientationIndex(t,e,n)},Pa.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,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y;e+=i*(t[r-1].y-o)}return e/2}if(Ys(arguments[0],ea)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new Bs,h=new Bs,c=new Bs;s.getCoordinate(0,h),s.getCoordinate(1,c);var l=h.x;c.x-=l;for(var p=0,f=1;f<a-1;f++)u.y=h.y,h.x=c.x,h.y=c.y,s.getCoordinate(f+1,c),c.x-=l,p+=h.x*(u.y-c.y);return p/2}},Pa.distanceLineLine=function(t,e,n,r){if(t.equals(e))return Pa.distancePointLine(t,n,r);if(n.equals(r))return Pa.distancePointLine(r,t,e);var i,o,s,a,u=!1;return!ha.intersects(t,e,n,r)||0==(i=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x))?u=!0:(o=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),s=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/i,((a=o/i)<0||1<a||s<0||1<s)&&(u=!0)),u?Vs.min(Pa.distancePointLine(t,n,r),Pa.distancePointLine(e,n,r),Pa.distancePointLine(n,t,e),Pa.distancePointLine(r,t,e)):0},Pa.isPointInRing=function(t,e){return Pa.locatePointInRing(t,e)!==Xs.EXTERIOR},Pa.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new Bs;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,u=r.y,h=a-i,c=u-o;n+=Math.sqrt(h*h+c*c),i=a,o=u}return n},Pa.isCCW=function(t){var e=t.length-1;if(e<3)throw new Rs;for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}for(var s=r;--s<0&&(s=e),t[s].equals2D(n)&&s!==r;);for(var a=r;t[a=(a+1)%e].equals2D(n)&&a!==r;);var u=t[s],h=t[a];if(u.equals2D(n)||h.equals2D(n)||u.equals2D(h))return!1;var c=Pa.computeOrientation(u,n,h);return 0===c?u.x>h.x:0<c},Pa.locatePointInRing=function(t,e){return La.locatePointInRing(t,e)},Pa.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},Pa.computeOrientation=function(t,e,n){return Pa.orientationIndex(t,e,n)},Pa.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new Rs;for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=Pa.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}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),h=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(h<=0)return o.distance(s);if(1<=h)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},Pa.isOnLine=function(t,e){for(var n=new Sa,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},Oa.CLOCKWISE.get=function(){return-1},Oa.RIGHT.get=function(){return Pa.CLOCKWISE},Oa.COUNTERCLOCKWISE.get=function(){return 1},Oa.LEFT.get=function(){return Pa.COUNTERCLOCKWISE},Oa.COLLINEAR.get=function(){return 0},Oa.STRAIGHT.get=function(){return Pa.COLLINEAR},Object.defineProperties(Pa,Oa);function Ra(){}Ra.prototype.filter=function(t){},Ra.prototype.interfaces_=function(){return[]},Ra.prototype.getClass=function(){return Ra};function Ta(t){var e=t;this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=e,this._SRID=e.getSRID()}var Aa={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}};Ta.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ta.SORTINDEX_GEOMETRYCOLLECTION},Ta.prototype.getFactory=function(){return this._factory},Ta.prototype.getGeometryN=function(t){return this},Ta.prototype.getArea=function(){return 0},Ta.prototype.isRectangle=function(){return!1},Ta.prototype.equals=function(){if(arguments[0]instanceof Ta){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof Ta))return!1;return this.equalsExact(e)}},Ta.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Ta.prototype.geometryChanged=function(){this.apply(Ta.geometryChangedFilter)},Ta.prototype.geometryChangedAction=function(){this._envelope=null},Ta.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},Ta.prototype.getLength=function(){return 0},Ta.prototype.getNumGeometries=function(){return 1},Ta.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],r=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,r)}},Ta.prototype.getUserData=function(){return this._userData},Ta.prototype.getSRID=function(){return this._SRID},Ta.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ta.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Ta.SORTINDEX_GEOMETRYCOLLECTION)throw new Rs},Ta.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},Ta.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Ta.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ta.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new ha(this._envelope)},Ta.prototype.setSRID=function(t){this._SRID=t},Ta.prototype.setUserData=function(t){this._userData=t},Ta.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},Ta.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ta.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ta.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ta.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ta.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ta.SORTINDEX_MULTIPOLYGON},Ta.prototype.interfaces_=function(){return[Fs,Ds,Gs]},Ta.prototype.getClass=function(){return Ta},Ta.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},Ta.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},Aa.serialVersionUID.get=function(){return 0x799ea46522854c00},Aa.SORTINDEX_POINT.get=function(){return 0},Aa.SORTINDEX_MULTIPOINT.get=function(){return 1},Aa.SORTINDEX_LINESTRING.get=function(){return 2},Aa.SORTINDEX_LINEARRING.get=function(){return 3},Aa.SORTINDEX_MULTILINESTRING.get=function(){return 4},Aa.SORTINDEX_POLYGON.get=function(){return 5},Aa.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Aa.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Aa.geometryChangedFilter.get=function(){return Da},Object.defineProperties(Ta,Aa);var Da=function(){};Da.interfaces_=function(){return[Ra]},Da.filter=function(t){t.geometryChangedAction()};function Fa(){}Fa.prototype.filter=function(t){},Fa.prototype.interfaces_=function(){return[]},Fa.prototype.getClass=function(){return Fa};function qa(){}var Ga={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}};qa.prototype.isInBoundary=function(t){},qa.prototype.interfaces_=function(){return[]},qa.prototype.getClass=function(){return qa},Ga.Mod2BoundaryNodeRule.get=function(){return Ba},Ga.EndPointBoundaryNodeRule.get=function(){return ka},Ga.MultiValentEndPointBoundaryNodeRule.get=function(){return za},Ga.MonoValentEndPointBoundaryNodeRule.get=function(){return ja},Ga.MOD2_BOUNDARY_RULE.get=function(){return new Ba},Ga.ENDPOINT_BOUNDARY_RULE.get=function(){return new ka},Ga.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new za},Ga.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new ja},Ga.OGC_SFS_BOUNDARY_RULE.get=function(){return qa.MOD2_BOUNDARY_RULE},Object.defineProperties(qa,Ga);var Ba=function(){};Ba.prototype.isInBoundary=function(t){return t%2==1},Ba.prototype.interfaces_=function(){return[qa]},Ba.prototype.getClass=function(){return Ba};var ka=function(){};ka.prototype.isInBoundary=function(t){return 0<t},ka.prototype.interfaces_=function(){return[qa]},ka.prototype.getClass=function(){return ka};var za=function(){};za.prototype.isInBoundary=function(t){return 1<t},za.prototype.interfaces_=function(){return[qa]},za.prototype.getClass=function(){return za};var ja=function(){};ja.prototype.isInBoundary=function(t){return 1===t},ja.prototype.interfaces_=function(){return[qa]},ja.prototype.getClass=function(){return ja};function Xa(){}Xa.prototype.add=function(){},Xa.prototype.addAll=function(){},Xa.prototype.isEmpty=function(){},Xa.prototype.iterator=function(){},Xa.prototype.size=function(){},Xa.prototype.toArray=function(){},Xa.prototype.remove=function(){};function Ua(){}var Ya=function(e){function t(t){e.call(this),this.message=t||""}e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t;var n={name:{configurable:!0}};return n.name.get=function(){return"IndexOutOfBoundsException"},Object.defineProperties(t,n),t}(Error);Ua.prototype.hasNext=function(){},Ua.prototype.next=function(){},Ua.prototype.remove=function(){};var Va,Ha=((Va=Xa)&&(Wa.__proto__=Va),((Wa.prototype=Object.create(Va&&Va.prototype)).constructor=Wa).prototype.get=function(){},Wa.prototype.set=function(){},Wa.prototype.isEmpty=function(){},Wa);function Wa(){Va.apply(this,arguments)}function Ja(t){this.message=t||""}(Ja.prototype=new Error).name="NoSuchElementException";function Za(){}var Ka,Qa,$a=((Qa=Ha)&&(iu.__proto__=Qa),((iu.prototype=Object.create(Qa&&Qa.prototype)).constructor=iu).prototype.ensureCapacity=function(){},iu.prototype.interfaces_=function(){return[Qa,Xa]},iu.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(t,arguments[1]),!0},iu.prototype.clear=function(){this.array_=[]},iu.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},iu.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},iu.prototype.iterator=function(){return new tu(this)},iu.prototype.get=function(t){if(t<0||t>=this.size())throw new Ya;return this.array_[t]},iu.prototype.isEmpty=function(){return 0===this.array_.length},iu.prototype.size=function(){return this.array_.length},iu.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},iu.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},iu),tu=((Ka=Ua)&&(ru.__proto__=Ka),((ru.prototype=Object.create(Ka&&Ka.prototype)).constructor=ru).prototype.next=function(){if(this.position_===this.arrayList_.size())throw new Ja;return this.arrayList_.get(this.position_++)},ru.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},ru.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},ru.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},ru),eu=function(v){function t(){var t,e,n;v.call(this),0===arguments.length||(1===arguments.length?(t=arguments[0],this.ensureCapacity(t.length),this.add(t,!0)):2===arguments.length&&(e=arguments[0],n=arguments[1],this.ensureCapacity(e.length),this.add(e,n)))}v&&(t.__proto__=v),(t.prototype=Object.create(v&&v.prototype)).constructor=t;var e={coordArrayType:{configurable:!0}};return e.coordArrayType.get=function(){return new Array(0).fill(null)},t.prototype.getCoordinate=function(t){return this.get(t)},t.prototype.addAll=function(){if(2!==arguments.length)return v.prototype.addAll.apply(this,arguments);for(var t=arguments[1],e=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),t),e=!0;return e},t.prototype.clone=function(){for(var t=v.prototype.clone.call(this),e=0;e<this.size();e++)t.add(e,this.get(e).copy());return t},t.prototype.toCoordinateArray=function(){return this.toArray(t.coordArrayType)},t.prototype.add=function(){if(1===arguments.length){var t=arguments[0];v.prototype.add.call(this,t)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var e=arguments[0],n=arguments[1];return this.add(e,n,!0),!0}if(arguments[0]instanceof Bs&&"boolean"==typeof arguments[1]){var r=arguments[0];if(!arguments[1]&&1<=this.size()&&this.get(this.size()-1).equals2D(r))return null;v.prototype.add.call(this,r)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var i=arguments[0],o=arguments[1];return this.add(i,o),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];if(arguments[2])for(var u=0;u<s.length;u++)this.add(s[u],a);else for(var h=s.length-1;0<=h;h--)this.add(s[h],a);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Bs){var c=arguments[0],l=arguments[1];if(!arguments[2]){var p=this.size();if(0<p){if(0<c&&this.get(c-1).equals2D(l))return null;if(c<p&&this.get(c).equals2D(l))return null}}v.prototype.add.call(this,c,l)}}else if(4===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],y=arguments[3],_=1;y<d&&(_=-1);for(var m=d;m!==y;m+=_)this.add(f[m],g);return!0}},t.prototype.closeRing=function(){0<this.size()&&this.add(new Bs(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,e),t}($a),nu={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};function ru(t){Ka.call(this),this.arrayList_=t,this.position_=0}function iu(){Qa.call(this),this.array_=[],arguments[0]instanceof Xa&&this.addAll(arguments[0])}nu.ForwardComparator.get=function(){return ou},nu.BidirectionalComparator.get=function(){return su},nu.coordArrayType.get=function(){return new Array(0).fill(null)},Za.prototype.interfaces_=function(){return[]},Za.prototype.getClass=function(){return Za},Za.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},Za.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(Za.indexOf(r,e)<0)return r}return null},Za.scroll=function(t,e){var n=Za.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);ia.arraycopy(t,n,r,0,t.length-n),ia.arraycopy(t,0,r,t.length-n,n),ia.arraycopy(r,0,t,0,t.length)},Za.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 r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},Za.intersection=function(t,e){for(var n=new eu,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},Za.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},Za.removeRepeatedPoints=function(t){return Za.hasRepeatedPoints(t)?new eu(t,!1).toCoordinateArray():t},Za.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},Za.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},Za.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 Bs(t[n]);return e}if(5===arguments.length)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new Bs(r[i+u])},Za.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(0!==r.compareTo(i))return!1}return!0},Za.envelope=function(t){for(var e=new ha,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},Za.toCoordinateArray=function(t){return t.toArray(Za.coordArrayType)},Za.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},Za.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},Za.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},Za.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},Za.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||0<e.compareTo(t[n]))&&(e=t[n]);return e},Za.extract=function(t,e,n){e=Vs.clamp(e,0,t.length);var r=(n=Vs.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(Za,nu);var ou=function(){};ou.prototype.compare=function(t,e){return Za.compare(t,e)},ou.prototype.interfaces_=function(){return[qs]},ou.prototype.getClass=function(){return ou};var su=function(){};su.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=Za.compare(n,r);return Za.isEqualReversed(n,r)?0:i},su.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=Za.increasingDirection(n),o=Za.increasingDirection(r),s=0<i?0:n.length-1,a=0<o?0:n.length-1,u=0;u<n.length;u++){var h=n[s].compareTo(r[a]);if(0!==h)return h;s+=i,a+=o}return 0},su.prototype.interfaces_=function(){return[qs]},su.prototype.getClass=function(){return su};function au(){}au.prototype.get=function(){},au.prototype.put=function(){},au.prototype.size=function(){},au.prototype.values=function(){},au.prototype.entrySet=function(){};var uu,hu=((uu=au)&&(cu.__proto__=uu),(cu.prototype=Object.create(uu&&uu.prototype)).constructor=cu);function cu(){uu.apply(this,arguments)}function lu(t){this.message=t||""}function pu(){}(lu.prototype=new Error).name="OperationNotSupported",(pu.prototype=new Xa).contains=function(){};var fu,gu,du=((gu=pu)&&(vu.__proto__=gu),((vu.prototype=Object.create(gu&&gu.prototype)).constructor=vu).prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e]===t)return!0;return!1},vu.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},vu.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},vu.prototype.remove=function(t){throw new Error},vu.prototype.size=function(){return this.array_.length},vu.prototype.isEmpty=function(){return 0===this.array_.length},vu.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},vu.prototype.iterator=function(){return new yu(this)},vu),yu=((fu=Ua)&&(mu.__proto__=fu),((mu.prototype=Object.create(fu&&fu.prototype)).constructor=mu).prototype.next=function(){if(this.position_===this.hashSet_.size())throw new Ja;return this.hashSet_.array_[this.position_++]},mu.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},mu.prototype.remove=function(){throw new lu},mu),_u=0;function mu(t){fu.call(this),this.hashSet_=t,this.position_=0}function vu(){gu.call(this),this.array_=[],arguments[0]instanceof Xa&&this.addAll(arguments[0])}function xu(t){return null===t?_u:t.color}function Eu(t){return null===t?null:t.parent}function wu(t,e){null!==t&&(t.color=e)}function bu(t){return null===t?null:t.left}function Iu(t){return null===t?null:t.right}function Nu(){this.root_=null,this.size_=0}(Nu.prototype=new hu).get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(0<n))return e.value;e=e.right}}return null},Nu.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:_u,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(0<r)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:_u,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},Nu.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;){var e,n;Eu(t)===bu(Eu(Eu(t)))?1===xu(e=Iu(Eu(Eu(t))))?(wu(Eu(t),_u),wu(e,_u),wu(Eu(Eu(t)),1),t=Eu(Eu(t))):(t===Iu(Eu(t))&&(t=Eu(t),this.rotateLeft(t)),wu(Eu(t),_u),wu(Eu(Eu(t)),1),this.rotateRight(Eu(Eu(t)))):1===xu(n=bu(Eu(Eu(t))))?(wu(Eu(t),_u),wu(n,_u),wu(Eu(Eu(t)),1),t=Eu(Eu(t))):(t===bu(Eu(t))&&(t=Eu(t),this.rotateRight(t)),wu(Eu(t),_u),wu(Eu(Eu(t)),1),this.rotateLeft(Eu(Eu(t))))}this.root_.color=_u},Nu.prototype.values=function(){var t=new $a,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=Nu.successor(e));)t.add(e.value);return t},Nu.prototype.entrySet=function(){var t=new du,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=Nu.successor(e));)t.add(e);return t},Nu.prototype.rotateLeft=function(t){var e;null!=t&&(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).parent=e)},Nu.prototype.rotateRight=function(t){var e;null!=t&&(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).parent=e)},Nu.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},Nu.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,r=t;null!==n&&r===n.right;)n=(r=n).parent;return n},Nu.prototype.size=function(){return this.size_};function Cu(){}function Su(){}function Mu(){this.array_=[],arguments[0]instanceof Xa&&this.addAll(arguments[0])}Cu.prototype.interfaces_=function(){return[]},Cu.prototype.getClass=function(){return Cu},Su.prototype=new pu,(Mu.prototype=new Su).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},Mu.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},Mu.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},Mu.prototype.remove=function(t){throw new lu},Mu.prototype.size=function(){return this.array_.length},Mu.prototype.isEmpty=function(){return 0===this.array_.length},Mu.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},Mu.prototype.iterator=function(){return new Lu(this)};var Lu=function(t){this.treeSet_=t,this.position_=0};Lu.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new Ja;return this.treeSet_.array_[this.position_++]},Lu.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Lu.prototype.remove=function(){throw new lu};function Pu(){}Pu.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},Pu.asList=function(t){for(var e=new $a,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};function Ou(){}var Ru={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}};Ru.P.get=function(){return 0},Ru.L.get=function(){return 1},Ru.A.get=function(){return 2},Ru.FALSE.get=function(){return-1},Ru.TRUE.get=function(){return-2},Ru.DONTCARE.get=function(){return-3},Ru.SYM_FALSE.get=function(){return"F"},Ru.SYM_TRUE.get=function(){return"T"},Ru.SYM_DONTCARE.get=function(){return"*"},Ru.SYM_P.get=function(){return"0"},Ru.SYM_L.get=function(){return"1"},Ru.SYM_A.get=function(){return"2"},Ou.prototype.interfaces_=function(){return[]},Ou.prototype.getClass=function(){return Ou},Ou.toDimensionSymbol=function(t){switch(t){case Ou.FALSE:return Ou.SYM_FALSE;case Ou.TRUE:return Ou.SYM_TRUE;case Ou.DONTCARE:return Ou.SYM_DONTCARE;case Ou.P:return Ou.SYM_P;case Ou.L:return Ou.SYM_L;case Ou.A:return Ou.SYM_A}throw new Rs},Ou.toDimensionValue=function(t){switch(Zs.toUpperCase(t)){case Ou.SYM_FALSE:return Ou.FALSE;case Ou.SYM_TRUE:return Ou.TRUE;case Ou.SYM_DONTCARE:return Ou.DONTCARE;case Ou.SYM_P:return Ou.P;case Ou.SYM_L:return Ou.L;case Ou.SYM_A:return Ou.A}throw new Rs},Object.defineProperties(Ou,Ru);function Tu(){}Tu.prototype.filter=function(t){},Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu};function Au(){}Au.prototype.filter=function(t,e){},Au.prototype.isDone=function(){},Au.prototype.isGeometryChanged=function(){},Au.prototype.interfaces_=function(){return[]},Au.prototype.getClass=function(){return Au};var Du=function(i){function n(t,e){if(i.call(this,e),this._geometries=t||[],i.hasNullElements(this._geometries))throw new Rs}i&&(n.__proto__=i);var t={serialVersionUID:{configurable:!0}};return((n.prototype=Object.create(i&&i.prototype)).constructor=n).prototype.computeEnvelopeInternal=function(){for(var t=new ha,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},n.prototype.getGeometryN=function(t){return this._geometries[t]},n.prototype.getSortIndex=function(){return i.SORTINDEX_GEOMETRYCOLLECTION},n.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[i];return t},n.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},n.prototype.equalsExact=function(){if(2!==arguments.length)return i.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._geometries.length!==n._geometries.length)return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].equalsExact(n._geometries[r],e))return!1;return!0},n.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();Pu.sort(this._geometries)},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},n.prototype.getBoundaryDimension=function(){for(var t=Ou.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},n.prototype.getDimension=function(){for(var t=Ou.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},n.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},n.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},n.prototype.getNumGeometries=function(){return this._geometries.length},n.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)},n.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new Mu(Pu.asList(this._geometries)),n=new Mu(Pu.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),h=i.getGeometryN(a),c=u.compareToSameClass(h,r);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},n.prototype.apply=function(){if(Ys(arguments[0],Fa))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(Ys(arguments[0],Au)){var n=arguments[0];if(0===this._geometries.length)return null;for(var r=0;r<this._geometries.length&&(this._geometries[r].apply(n),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(Ys(arguments[0],Tu)){var i=arguments[0];i.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(i)}else if(Ys(arguments[0],Ra)){var s=arguments[0];s.filter(this);for(var a=0;a<this._geometries.length;a++)this._geometries[a].apply(s)}},n.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),ya.shouldNeverReachHere(),null},n.prototype.clone=function(){var t=i.prototype.clone.call(this);t._geometries=new Array(this._geometries.length).fill(null);for(var e=0;e<this._geometries.length;e++)t._geometries[e]=this._geometries[e].clone();return t},n.prototype.getGeometryType=function(){return"GeometryCollection"},n.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new n(t,this._factory)},n.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},t.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(n,t),n}(Ta),Fu=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n);var t={serialVersionUID:{configurable:!0}};return((r.prototype=Object.create(n&&n.prototype)).constructor=r).prototype.getSortIndex=function(){return Ta.SORTINDEX_MULTILINESTRING},r.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&n.prototype.equalsExact.call(this,t,e)},r.prototype.getBoundaryDimension=function(){return this.isClosed()?Ou.FALSE:0},r.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},r.prototype.getDimension=function(){return 1},r.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)},r.prototype.getBoundary=function(){return new qu(this).getBoundary()},r.prototype.getGeometryType=function(){return"MultiLineString"},r.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new r(t,this._factory)},r.prototype.interfaces_=function(){return[Cu]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(r,t),r}(Du),qu=function(t,e){var n,r,i,o;this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length?(n=t,r=qa.MOD2_BOUNDARY_RULE,this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r):2===arguments.length&&(i=t,o=e,this._geom=i,this._geomFact=i.getFactory(),this._bnRule=o)};qu.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)},qu.prototype.getBoundary=function(){return this._geom instanceof Ju?this.boundaryLineString(this._geom):this._geom instanceof Fu?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},qu.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()])},qu.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},qu.prototype.computeBoundaryCoordinates=function(t){var e=new $a;this._endpointMap=new Nu;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);0!==r.getNumPoints()&&(this.addEndpoint(r.getCoordinateN(0)),this.addEndpoint(r.getCoordinateN(r.getNumPoints()-1)))}for(var i=this._endpointMap.entrySet().iterator();i.hasNext();){var o=i.next(),s=o.getValue().count;this._bnRule.isInBoundary(s)&&e.add(o.getKey())}return Za.toCoordinateArray(e)},qu.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Gu,this._endpointMap.put(t,e)),e.count++},qu.prototype.interfaces_=function(){return[]},qu.prototype.getClass=function(){return qu},qu.getBoundary=function(){return 1===arguments.length?new qu(arguments[0]).getBoundary():2===arguments.length?new qu(arguments[0],arguments[1]).getBoundary():void 0};var Gu=function(){this.count=null};function Bu(){}function ku(){}Gu.prototype.interfaces_=function(){return[]},Gu.prototype.getClass=function(){return Gu};function zu(){}function ju(){}function Xu(){}function Uu(){}function Yu(){}var Vu={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Yu.prototype.interfaces_=function(){return[]},Yu.prototype.getClass=function(){return Yu},Yu.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Yu.getStackTrace=function(){if(1===arguments.length){var t=new ju,e=new Bu;return arguments[0].printStackTrace(e),t.toString()}if(2===arguments.length){for(var n=arguments[1],r="",i=new Uu(new ku(Yu.getStackTrace(arguments[0]))),o=0;o<n;o++)try{r+=i.readLine()+Yu.NEWLINE}catch(t){if(!(t instanceof Xu))throw t;ya.shouldNeverReachHere()}return r}},Yu.split=function(t,e){for(var n=e.length,r=new $a,i=""+t,o=i.indexOf(e);0<=o;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}0<i.length&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u<a.length;u++)a[u]=r.get(u);return a},Yu.toString=function(){if(1===arguments.length){var t=arguments[0];return Yu.SIMPLE_ORDINATE_FORMAT.format(t)}},Yu.spaces=function(t){return Yu.chars(" ",t)},Vu.NEWLINE.get=function(){return ia.getProperty("line.separator")},Vu.SIMPLE_ORDINATE_FORMAT.get=function(){return new zu},Object.defineProperties(Yu,Vu);function Hu(){}Hu.prototype.interfaces_=function(){return[]},Hu.prototype.getClass=function(){return Hu},Hu.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},Hu.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,ea.X)===t.getOrdinate(e-1,ea.X)&&t.getOrdinate(0,ea.Y)===t.getOrdinate(e-1,ea.Y)},Hu.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||Ts.isNaN(s)&&Ts.isNaN(a)))return!1}return!0},Hu.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(Hu.copy(e,0,r,0,i),0<i)for(var o=i;o<n;o++)Hu.copy(e,i-1,r,o,1);return r},Hu.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)Hu.swap(t,r,e-r)},Hu.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},Hu.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)Hu.copyCoord(t,e+o,n,r+o)},Hu.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new Ws;r.append("(");for(var i=0;i<e;i++){0<i&&r.append(" ");for(var o=0;o<n;o++)0<o&&r.append(","),r.append(Yu.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},Hu.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Hu.createClosedRing(t,e,4):e.getOrdinate(0,ea.X)===e.getOrdinate(n-1,ea.X)&&e.getOrdinate(0,ea.Y)===e.getOrdinate(n-1,ea.Y)?e:Hu.createClosedRing(t,e,n+1)},Hu.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();Hu.copy(e,0,r,0,i);for(var o=i;o<n;o++)Hu.copy(e,0,r,o,1);return r};function Wu(){}var Ju=function(i){function e(t,e){i.call(this,e),this._points=null,this.init(t)}i&&(e.__proto__=i);var t={serialVersionUID:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new ha:this._points.expandEnvelope(new ha)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return i.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2!==arguments.length)return i.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._points.size()!==n._points.size())return!1;for(var r=0;r<this._points.size();r++)if(!this.equal(this._points.getCoordinate(r),n._points.getCoordinate(r),e))return!1;return!0},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 0<this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))&&Hu.reverse(this._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Ou.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 Pa.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Hu.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 r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(Ys(arguments[0],Fa))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(Ys(arguments[0],Au)){var n=arguments[0];if(0===this._points.size())return null;for(var r=0;r<this._points.size()&&(n.filter(this._points,r),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else(Ys(arguments[0],Tu)||Ys(arguments[0],Ra))&&arguments[0].filter(this)},e.prototype.getBoundary=function(){return new qu(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var t=i.prototype.clone.call(this);return t._points=this._points.clone(),t},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 Rs(t.size());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[Cu]},e.prototype.getClass=function(){return e},t.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,t),e}(Ta);Wu.prototype.interfaces_=function(){return[]},Wu.prototype.getClass=function(){return Wu};function Zu(){}var Ku=function(n){function t(t,e){n.call(this,e),this._coordinates=t||null,this.init(this._coordinates)}n&&(t.__proto__=n);var e={serialVersionUID:{configurable:!0}};return((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new ha;var t=new ha;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},t.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},t.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},t.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))},t.prototype.normalize=function(){},t.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},t.prototype.getBoundaryDimension=function(){return Ou.FALSE},t.prototype.getDimension=function(){return 0},t.prototype.getNumPoints=function(){return this.isEmpty()?0:1},t.prototype.reverse=function(){return this.copy()},t.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},t.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)}},t.prototype.apply=function(){if(Ys(arguments[0],Fa)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(Ys(arguments[0],Au)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else(Ys(arguments[0],Tu)||Ys(arguments[0],Ra))&&arguments[0].filter(this)},t.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},t.prototype.clone=function(){var t=n.prototype.clone.call(this);return t._coordinates=this._coordinates.clone(),t},t.prototype.getGeometryType=function(){return"Point"},t.prototype.copy=function(){return new t(this._coordinates.copy(),this._factory)},t.prototype.getCoordinateSequence=function(){return this._coordinates},t.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},t.prototype.isEmpty=function(){return 0===this._coordinates.size()},t.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),ya.isTrue(t.size()<=1),this._coordinates=t},t.prototype.isSimple=function(){return!0},t.prototype.interfaces_=function(){return[Wu]},t.prototype.getClass=function(){return t},e.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(t,e),t}(Ta);Zu.prototype.interfaces_=function(){return[]},Zu.prototype.getClass=function(){return Zu};function Qu(t){this._factory=t||null,this._isUserDataCopied=!1}var $u=function(s){function r(t,e,n){if(s.call(this,n),this._shell=null,(this._holes=null)===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),s.hasNullElements(e))throw new Rs;if(t.isEmpty()&&s.hasNonEmptyElements(e))throw new Rs;this._shell=t,this._holes=e}s&&(r.__proto__=s);var t={serialVersionUID:{configurable:!0}};return((r.prototype=Object.create(s&&s.prototype)).constructor=r).prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},r.prototype.getSortIndex=function(){return s.SORTINDEX_POLYGON},r.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},r.prototype.getArea=function(){var t=0;t+=Math.abs(Pa.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(Pa.signedArea(this._holes[e].getCoordinateSequence()));return t},r.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 r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),h=t.getY(a);if(u!==o==(h!==s))return!1;o=u,s=h}return!0},r.prototype.equalsExact=function(){if(2!==arguments.length)return s.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t,r=this._shell,i=n._shell;if(!r.equalsExact(i,e))return!1;if(this._holes.length!==n._holes.length)return!1;for(var o=0;o<this._holes.length;o++)if(!this._holes[o].equalsExact(n._holes[o],e))return!1;return!0},r.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);Pu.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);ia.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=Za.minCoordinate(e.getCoordinates());Za.scroll(r,i),ia.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],Pa.isCCW(e.getCoordinates())===n&&Za.reverse(e.getCoordinates())}},r.prototype.getCoordinate=function(){return this._shell.getCoordinate()},r.prototype.getNumInteriorRing=function(){return this._holes.length},r.prototype.getBoundaryDimension=function(){return 1},r.prototype.getDimension=function(){return 2},r.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},r.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},r.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},r.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},r.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 r=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,r);if(0!==a)return a;for(var u=this.getNumInteriorRing(),h=i.getNumInteriorRing(),c=0;c<u&&c<h;){var l=this.getInteriorRingN(c),p=i.getInteriorRingN(c),f=l.compareToSameClass(p,r);if(0!==f)return f;c++}return c<u?1:c<h?-1:0}},r.prototype.apply=function(t){if(Ys(t,Fa)){this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(Ys(t,Au)){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(Ys(t,Tu))t.filter(this);else if(Ys(t,Ra)){t.filter(this),this._shell.apply(t);for(var r=0;r<this._holes.length;r++)this._holes[r].apply(t)}},r.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)},r.prototype.clone=function(){var t=s.prototype.clone.call(this);t._shell=this._shell.clone(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].clone();return t},r.prototype.getGeometryType=function(){return"Polygon"},r.prototype.copy=function(){for(var t=this._shell.copy(),e=new Array(this._holes.length).fill(null),n=0;n<e.length;n++)e[n]=this._holes[n].copy();return new r(t,e,this._factory)},r.prototype.getExteriorRing=function(){return this._shell},r.prototype.isEmpty=function(){return this._shell.isEmpty()},r.prototype.getInteriorRingN=function(t){return this._holes[t]},r.prototype.interfaces_=function(){return[Zu]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(r,t),r}(Ta),th=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n);var t={serialVersionUID:{configurable:!0}};return((r.prototype=Object.create(n&&n.prototype)).constructor=r).prototype.getSortIndex=function(){return Ta.SORTINDEX_MULTIPOINT},r.prototype.isValid=function(){return!0},r.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&n.prototype.equalsExact.call(this,t,e)},r.prototype.getCoordinate=function(){if(1!==arguments.length)return n.prototype.getCoordinate.apply(this,arguments);var t=arguments[0];return this._geometries[t].getCoordinate()},r.prototype.getBoundaryDimension=function(){return Ou.FALSE},r.prototype.getDimension=function(){return 0},r.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},r.prototype.getGeometryType=function(){return"MultiPoint"},r.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new r(t,this._factory)},r.prototype.interfaces_=function(){return[Wu]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(r,t),r}(Du),eh=function(n){function t(t,e){t instanceof Bs&&e instanceof mh&&(t=e.getCoordinateSequenceFactory().create(t)),n.call(this,t,e),this.validateConstruction()}n&&(t.__proto__=n);var e={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.getSortIndex=function(){return Ta.SORTINDEX_LINEARRING},t.prototype.getBoundaryDimension=function(){return Ou.FALSE},t.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},t.prototype.reverse=function(){var t=this._points.copy();return Hu.reverse(t),this.getFactory().createLinearRing(t)},t.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new Rs;if(1<=this.getCoordinateSequence().size()&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new Rs(this.getCoordinateSequence().size())},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},e.MINIMUM_VALID_SIZE.get=function(){return 4},e.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,e),t}(Ju),nh=function(n){function r(){n.apply(this,arguments)}n&&(r.__proto__=n);var t={serialVersionUID:{configurable:!0}};return((r.prototype=Object.create(n&&n.prototype)).constructor=r).prototype.getSortIndex=function(){return Ta.SORTINDEX_MULTIPOLYGON},r.prototype.equalsExact=function(){if(2!==arguments.length)return n.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&n.prototype.equalsExact.call(this,t,e)},r.prototype.getBoundaryDimension=function(){return 1},r.prototype.getDimension=function(){return 2},r.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)},r.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new $a,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},r.prototype.getGeometryType=function(){return"MultiPolygon"},r.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new r(t,this._factory)},r.prototype.interfaces_=function(){return[Zu]},r.prototype.getClass=function(){return r},t.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(r,t),r}(Du),rh={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Qu.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Qu.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Qu.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Du?this.editGeometryCollection(t,e):t instanceof $u?this.editPolygon(t,e):t instanceof Ku||t instanceof Ju?e.edit(t,this._factory):(ya.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Qu.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new $a,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===th?this._factory.createMultiPoint(r.toArray([])):n.getClass()===Fu?this._factory.createMultiLineString(r.toArray([])):n.getClass()===nh?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},Qu.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 r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new $a,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},Qu.prototype.interfaces_=function(){return[]},Qu.prototype.getClass=function(){return Qu},Qu.GeometryEditorOperation=function(){},rh.NoOpGeometryOperation.get=function(){return ih},rh.CoordinateOperation.get=function(){return oh},rh.CoordinateSequenceOperation.get=function(){return sh},Object.defineProperties(Qu,rh);var ih=function(){};ih.prototype.edit=function(t,e){return t},ih.prototype.interfaces_=function(){return[Qu.GeometryEditorOperation]},ih.prototype.getClass=function(){return ih};var oh=function(){};oh.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof eh?e.createLinearRing(n):t instanceof Ju?e.createLineString(n):t instanceof Ku?0<n.length?e.createPoint(n[0]):e.createPoint():t},oh.prototype.interfaces_=function(){return[Qu.GeometryEditorOperation]},oh.prototype.getClass=function(){return oh};var sh=function(){};sh.prototype.edit=function(t,e){return t instanceof eh?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Ju?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Ku?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},sh.prototype.interfaces_=function(){return[Qu.GeometryEditorOperation]},sh.prototype.getClass=function(){return sh};function ah(t,e){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(t instanceof Array)this._coordinates=t,this._dimension=3;else if(Number.isInteger(t)){var n=t;this._coordinates=new Array(n).fill(null);for(var r=0;r<n;r++)this._coordinates[r]=new Bs}else if(Ys(t,ea)){var i=t;if(null===i)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._coordinates=new Array(i.size()).fill(null);for(var o=0;o<this._coordinates.length;o++)this._coordinates[o]=i.getCoordinateCopy(o)}}else if(2===arguments.length)if(t instanceof Array&&Number.isInteger(e)){var s=t,a=e;this._coordinates=s,this._dimension=a,null===s&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(t)&&Number.isInteger(e)){var u=t,h=e;this._coordinates=new Array(u).fill(null),this._dimension=h;for(var c=0;c<u;c++)this._coordinates[c]=new Bs}}var uh={serialVersionUID:{configurable:!0}};ah.prototype.setOrdinate=function(t,e,n){switch(e){case ea.X:this._coordinates[t].x=n;break;case ea.Y:this._coordinates[t].y=n;break;case ea.Z:this._coordinates[t].z=n;break;default:throw new Rs}},ah.prototype.size=function(){return this._coordinates.length},ah.prototype.getOrdinate=function(t,e){switch(e){case ea.X:return this._coordinates[t].x;case ea.Y:return this._coordinates[t].y;case ea.Z:return this._coordinates[t].z}return Ts.NaN},ah.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}var e,n;2===arguments.length&&(e=arguments[0],(n=arguments[1]).x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z)},ah.prototype.getCoordinateCopy=function(t){return new Bs(this._coordinates[t])},ah.prototype.getDimension=function(){return this._dimension},ah.prototype.getX=function(t){return this._coordinates[t].x},ah.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 ah(t,this._dimension)},ah.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},ah.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 ah(t,this._dimension)},ah.prototype.toString=function(){if(0<this._coordinates.length){var t=new Ws(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"()"},ah.prototype.getY=function(t){return this._coordinates[t].y},ah.prototype.toCoordinateArray=function(){return this._coordinates},ah.prototype.interfaces_=function(){return[ea,Gs]},ah.prototype.getClass=function(){return ah},uh.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ah,uh);function hh(){}var ch={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};hh.prototype.readResolve=function(){return hh.instance()},hh.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new ah(arguments[0]);if(Ys(arguments[0],ea))return new ah(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return 3<e&&(e=3),e<2?new ah(t):new ah(t,e)}},hh.prototype.interfaces_=function(){return[js,Gs]},hh.prototype.getClass=function(){return hh},hh.instance=function(){return hh.instanceObject},ch.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},ch.instanceObject.get=function(){return new hh},Object.defineProperties(hh,ch);function lh(){var t,e,n;this._modelType=null,this._scale=null,0===arguments.length?this._modelType=lh.FLOATING:1===arguments.length&&(arguments[0]instanceof yh?(t=arguments[0],(this._modelType=t)===lh.FIXED&&this.setScale(1)):"number"==typeof arguments[0]?(e=arguments[0],this._modelType=lh.FIXED,this.setScale(e)):arguments[0]instanceof lh&&(n=arguments[0],this._modelType=n._modelType,this._scale=n._scale))}var ph,fh=((ph=au)&&(dh.__proto__=ph),((dh.prototype=Object.create(ph&&ph.prototype)).constructor=dh).prototype.get=function(t){return this.map_.get(t)||null},dh.prototype.put=function(t,e){return this.map_.set(t,e),e},dh.prototype.values=function(){for(var t=new $a,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},dh.prototype.entrySet=function(){var e=new du;return this.map_.entries().forEach(function(t){return e.add(t)}),e},dh.prototype.size=function(){return this.map_.size()},dh),gh={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};function dh(){ph.call(this),this.map_=new Map}lh.prototype.equals=function(t){if(!(t instanceof lh))return!1;return this._modelType===t._modelType&&this._scale===t._scale},lh.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new Js(n).compareTo(new Js(r))},lh.prototype.getScale=function(){return this._scale},lh.prototype.isFloating=function(){return this._modelType===lh.FLOATING||this._modelType===lh.FLOATING_SINGLE},lh.prototype.getType=function(){return this._modelType},lh.prototype.toString=function(){var t="UNKNOWN";return this._modelType===lh.FLOATING?t="Floating":this._modelType===lh.FLOATING_SINGLE?t="Floating-Single":this._modelType===lh.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},lh.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return!Ts.isNaN(t)&&this._modelType!==lh.FLOATING_SINGLE&&this._modelType===lh.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof Bs){var e=arguments[0];if(this._modelType===lh.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},lh.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===lh.FLOATING?t=16:this._modelType===lh.FLOATING_SINGLE?t=6:this._modelType===lh.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},lh.prototype.setScale=function(t){this._scale=Math.abs(t)},lh.prototype.interfaces_=function(){return[Gs,Ds]},lh.prototype.getClass=function(){return lh},lh.mostPrecise=function(t,e){return 0<=t.compareTo(e)?t:e},gh.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},gh.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(lh,gh);var yh=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},_h={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};yh.prototype.readResolve=function(){return yh.nameToTypeMap.get(this._name)},yh.prototype.toString=function(){return this._name},yh.prototype.interfaces_=function(){return[Gs]},yh.prototype.getClass=function(){return yh},_h.serialVersionUID.get=function(){return-552860263173159e4},_h.nameToTypeMap.get=function(){return new fh},Object.defineProperties(yh,_h),lh.Type=yh,lh.FIXED=new yh("FIXED"),lh.FLOATING=new yh("FLOATING"),lh.FLOATING_SINGLE=new yh("FLOATING SINGLE");var mh=function t(){this._precisionModel=new lh,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?Ys(arguments[0],js)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof lh&&(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]))},vh={serialVersionUID:{configurable:!0}};mh.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Bs(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Bs(t.getMinX(),t.getMinY()),new Bs(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Bs(t.getMinX(),t.getMinY()),new Bs(t.getMinX(),t.getMaxY()),new Bs(t.getMaxX(),t.getMaxY()),new Bs(t.getMaxX(),t.getMinY()),new Bs(t.getMinX(),t.getMinY())]),null)},mh.prototype.createLineString=function(t){return t?t instanceof Array?new Ju(this.getCoordinateSequenceFactory().create(t),this):Ys(t,ea)?new Ju(t,this):void 0:new Ju(this.getCoordinateSequenceFactory().create([]),this)},mh.prototype.createMultiLineString=function(){return 0===arguments.length?new Fu(null,this):1===arguments.length?new Fu(arguments[0],this):void 0},mh.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(mh.toGeometryArray(t));var a=t.iterator().next();if(1<t.size()){if(a instanceof $u)return this.createMultiPolygon(mh.toPolygonArray(t));if(a instanceof Ju)return this.createMultiLineString(mh.toLineStringArray(t));if(a instanceof Ku)return this.createMultiPoint(mh.toPointArray(t));ya.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},mh.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},mh.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Bs){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(Ys(arguments[0],ea))return new Ku(arguments[0],this)}},mh.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},mh.prototype.createPolygon=function(){if(0===arguments.length)return new $u(null,null,this);if(1===arguments.length){if(Ys(arguments[0],ea)){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 eh){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){return new $u(arguments[0],arguments[1],this)}},mh.prototype.getSRID=function(){return this._SRID},mh.prototype.createGeometryCollection=function(){return 0===arguments.length?new Du(null,this):1===arguments.length?new Du(arguments[0],this):void 0},mh.prototype.createGeometry=function(t){return new Qu(this).edit(t,{edit:function(t){if(2===arguments.length)return this._coordinateSequenceFactory.create(t)}})},mh.prototype.getPrecisionModel=function(){return this._precisionModel},mh.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(Ys(arguments[0],ea))return new eh(arguments[0],this)}},mh.prototype.createMultiPolygon=function(){return 0===arguments.length?new nh(null,this):1===arguments.length?new nh(arguments[0],this):void 0},mh.prototype.createMultiPoint=function(){if(0===arguments.length)return new th(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new th(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Ys(arguments[0],ea)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),r=0;r<e.size();r++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());Hu.copy(e,r,i,0,1),n[r]=this.createPoint(i)}return this.createMultiPoint(n)}}},mh.prototype.interfaces_=function(){return[Gs]},mh.prototype.getClass=function(){return mh},mh.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.getDefaultCoordinateSequenceFactory=function(){return hh.instance()},mh.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},mh.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},vh.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(mh,vh);function xh(t){this.geometryFactory=t||new mh}var Eh=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];xh.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!wh[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Eh.indexOf(n)?wh[n].apply(this,[e.coordinates]):"GeometryCollection"===n?wh[n].apply(this,[e.geometries]):wh[n].apply(this,[e])},xh.prototype.write=function(t){var e=t.getGeometryType();if(!bh[e])throw new Error("Geometry is not supported");return bh[e].apply(this,[t])};var wh={Feature:function(t){var e,n={};for(e in t)n[e]=t[e];if(t.geometry){var r=t.geometry.type;if(!wh[r])throw new Error("Unknown GeoJSON type: "+t.type);n.geometry=this.read(t.geometry)}return t.bbox&&(n.bbox=wh.bbox.apply(this,[t.bbox])),n},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 r=t[n];e.push(new Bs(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new Bs(t[0],t[1]),new Bs(t[2],t[1]),new Bs(t[2],t[3]),new Bs(t[0],t[3]),new Bs(t[0],t[1])])},Point:function(t){var e=new Bs(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(wh.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=wh.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(wh.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=wh.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=wh.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(wh.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},bh={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:bh.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=bh.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(bh.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=bh.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=bh.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=bh.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=bh.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(bh[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},Ih=function(t){this.geometryFactory=t||new mh,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new xh(this.geometryFactory)};Ih.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===lh.FIXED&&this.reducePrecision(e),e},Ih.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 Nh=function(){this.parser=new xh(this.geometryFactory)};Nh.prototype.write=function(t){return this.parser.write(t)};function Ch(){}var Sh={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function Mh(t){this.message=t||""}function Lh(){this.array_=[]}Ch.prototype.interfaces_=function(){return[]},Ch.prototype.getClass=function(){return Ch},Ch.opposite=function(t){return t===Ch.LEFT?Ch.RIGHT:t===Ch.RIGHT?Ch.LEFT:t},Sh.ON.get=function(){return 0},Sh.LEFT.get=function(){return 1},Sh.RIGHT.get=function(){return 2},Object.defineProperties(Ch,Sh),(Mh.prototype=new Error).name="EmptyStackException",(Lh.prototype=new Ha).add=function(t){return this.array_.push(t),!0},Lh.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},Lh.prototype.push=function(t){return this.array_.push(t),t},Lh.prototype.pop=function(t){if(0===this.array_.length)throw new Mh;return this.array_.pop()},Lh.prototype.peek=function(){if(0===this.array_.length)throw new Mh;return this.array_[this.array_.length-1]},Lh.prototype.empty=function(){return 0===this.array_.length},Lh.prototype.isEmpty=function(){return this.empty()},Lh.prototype.search=function(t){return this.array_.indexOf(t)},Lh.prototype.size=function(){return this.array_.length},Lh.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};function Ph(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}Ph.prototype.getCoordinate=function(){return this._minCoord},Ph.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},Ph.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();ya.isTrue(0<this._minIndex&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=Pa.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===Pa.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===Pa.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},Ph.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 r=Ch.LEFT;return n[e].y<n[e+1].y&&(r=Ch.RIGHT),r},Ph.prototype.getEdge=function(){return this._orientedDe},Ph.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])},Ph.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)},Ph.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}ya.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)===Ch.LEFT&&(this._orientedDe=this._minDe.getSym())},Ph.prototype.interfaces_=function(){return[]},Ph.prototype.getClass=function(){return Ph};function Oh(){this.array_=[]}var Rh,Th=((Rh=va)&&(Ah.__proto__=Rh),((Ah.prototype=Object.create(Rh&&Rh.prototype)).constructor=Ah).prototype.getCoordinate=function(){return this.pt},Ah.prototype.interfaces_=function(){return[]},Ah.prototype.getClass=function(){return Ah},Ah.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},Ah);function Ah(t,e){Rh.call(this,Ah.msgWithCoord(t,e)),this.pt=e?new Bs(e):null,this.name="TopologyException"}Oh.prototype.addLast=function(t){this.array_.push(t)},Oh.prototype.removeFirst=function(){return this.array_.shift()},Oh.prototype.isEmpty=function(){return 0===this.array_.length};function Dh(){this._finder=null,this._dirEdgeList=new $a,this._nodes=new $a,this._rightMostCoord=null,this._env=null,this._finder=new Ph}Dh.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Dh.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Dh.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new Th("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},Dh.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(Ch.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Dh.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Dh.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();1<=e.getDepth(Ch.RIGHT)&&e.getDepth(Ch.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Dh.prototype.computeDepths=function(t){var e=new du,n=new Oh,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s,a=o.next().getSym();a.isVisited()||(s=a.getNode(),e.contains(s)||(n.addLast(s),e.add(s)))}}},Dh.prototype.compareTo=function(t){return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0},Dh.prototype.getEnvelope=function(){if(null===this._env){for(var t=new ha,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},Dh.prototype.addReachable=function(t){var e=new Lh;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},Dh.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(Ch.LEFT,t.getDepth(Ch.RIGHT)),e.setDepth(Ch.RIGHT,t.getDepth(Ch.LEFT))},Dh.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},Dh.prototype.getNodes=function(){return this._nodes},Dh.prototype.getDirectedEdges=function(){return this._dirEdgeList},Dh.prototype.interfaces_=function(){return[Ds]},Dh.prototype.getClass=function(){return Dh};function Fh(){var t,e,n;if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var r=arguments[0];this.init(r.length)}else if(Number.isInteger(arguments[0])){var i=arguments[0];this.init(1),this.location[Ch.ON]=i}else if(arguments[0]instanceof Fh){var o=arguments[0];if(this.init(o.location.length),null!==o)for(var s=0;s<this.location.length;s++)this.location[s]=o.location[s]}}else 3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],this.init(3),this.location[Ch.ON]=t,this.location[Ch.LEFT]=e,this.location[Ch.RIGHT]=n)}Fh.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},Fh.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==Xs.NONE)return!1;return!0},Fh.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===Xs.NONE&&(this.location[e]=t)},Fh.prototype.isLine=function(){return 1===this.location.length},Fh.prototype.merge=function(t){var e;t.location.length>this.location.length&&((e=new Array(3).fill(null))[Ch.ON]=this.location[Ch.ON],e[Ch.LEFT]=Xs.NONE,e[Ch.RIGHT]=Xs.NONE,this.location=e);for(var n=0;n<this.location.length;n++)this.location[n]===Xs.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},Fh.prototype.getLocations=function(){return this.location},Fh.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[Ch.LEFT];this.location[Ch.LEFT]=this.location[Ch.RIGHT],this.location[Ch.RIGHT]=t},Fh.prototype.toString=function(){var t=new Ws;return 1<this.location.length&&t.append(Xs.toLocationSymbol(this.location[Ch.LEFT])),t.append(Xs.toLocationSymbol(this.location[Ch.ON])),1<this.location.length&&t.append(Xs.toLocationSymbol(this.location[Ch.RIGHT])),t.toString()},Fh.prototype.setLocations=function(t,e,n){this.location[Ch.ON]=t,this.location[Ch.LEFT]=e,this.location[Ch.RIGHT]=n},Fh.prototype.get=function(t){return t<this.location.length?this.location[t]:Xs.NONE},Fh.prototype.isArea=function(){return 1<this.location.length},Fh.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===Xs.NONE)return!0;return!1},Fh.prototype.setLocation=function(){var t,e,n;1===arguments.length?(t=arguments[0],this.setLocation(Ch.ON,t)):2===arguments.length&&(e=arguments[0],n=arguments[1],this.location[e]=n)},Fh.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(Xs.NONE)},Fh.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},Fh.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},Fh.prototype.interfaces_=function(){return[]},Fh.prototype.getClass=function(){return Fh};function qh(){var t,e,n,r,i,o,s,a,u,h,c;this.elt=new Array(2).fill(null),1===arguments.length?Number.isInteger(arguments[0])?(t=arguments[0],this.elt[0]=new Fh(t),this.elt[1]=new Fh(t)):arguments[0]instanceof qh&&(e=arguments[0],this.elt[0]=new Fh(e.elt[0]),this.elt[1]=new Fh(e.elt[1])):2===arguments.length?(n=arguments[0],r=arguments[1],this.elt[0]=new Fh(Xs.NONE),this.elt[1]=new Fh(Xs.NONE),this.elt[n].setLocation(r)):3===arguments.length?(i=arguments[0],o=arguments[1],s=arguments[2],this.elt[0]=new Fh(i,o,s),this.elt[1]=new Fh(i,o,s)):4===arguments.length&&(a=arguments[0],u=arguments[1],h=arguments[2],c=arguments[3],this.elt[0]=new Fh(Xs.NONE,Xs.NONE,Xs.NONE),this.elt[1]=new Fh(Xs.NONE,Xs.NONE,Xs.NONE),this.elt[a].setLocations(u,h,c))}qh.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},qh.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},qh.prototype.isNull=function(t){return this.elt[t].isNull()},qh.prototype.setAllLocationsIfNull=function(){var t,e,n;1===arguments.length?(t=arguments[0],this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)):2===arguments.length&&(e=arguments[0],n=arguments[1],this.elt[e].setAllLocationsIfNull(n))},qh.prototype.isLine=function(t){return this.elt[t].isLine()},qh.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new Fh(t.elt[e]):this.elt[e].merge(t.elt[e])},qh.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},qh.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(Ch.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},qh.prototype.toString=function(){var t=new Ws;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()},qh.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()}},qh.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},qh.prototype.setLocation=function(){var t,e,n,r,i;2===arguments.length?(t=arguments[0],e=arguments[1],this.elt[t].setLocation(Ch.ON,e)):3===arguments.length&&(n=arguments[0],r=arguments[1],i=arguments[2],this.elt[n].setLocation(r,i))},qh.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},qh.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},qh.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Fh(this.elt[t].location[0]))},qh.prototype.interfaces_=function(){return[]},qh.prototype.getClass=function(){return qh},qh.toLineLabel=function(t){for(var e=new qh(Xs.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};function Gh(t,e){this._startDe=null,this._maxNodeDegree=-1,this._edges=new $a,this._pts=new $a,this._label=new qh(Xs.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new $a,this._geometryFactory=null;var n=t;this._geometryFactory=e,this.computePoints(n),this.computeRing()}Gh.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=Pa.isCCW(this._ring.getCoordinates())},Gh.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Gh.prototype.computePoints=function(t){var e=this._startDe=t,n=!0;do{if(null===e)throw new Th("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new Th("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var r=e.getLabel();ya.isTrue(r.isArea()),this.mergeLabel(r),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)},Gh.prototype.getLinearRing=function(){return this._ring},Gh.prototype.getCoordinate=function(t){return this._pts.get(t)},Gh.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},Gh.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;0<=a;a--)this._pts.add(r[a])}},Gh.prototype.isHole=function(){return this._isHole},Gh.prototype.setInResult=function(){for(var t=this._startDe;t.getEdge().setInResult(!0),(t=t.getNext())!==this._startDe;);},Gh.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Pa.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},Gh.prototype.addHole=function(t){this._holes.add(t)},Gh.prototype.isShell=function(){return null===this._shell},Gh.prototype.getLabel=function(){return this._label},Gh.prototype.getEdges=function(){return this._edges},Gh.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Gh.prototype.getShell=function(){return this._shell},Gh.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[1],n=arguments[0].getLocation(e,Ch.RIGHT);if(n===Xs.NONE)return null;if(this._label.getLocation(e)===Xs.NONE)return this._label.setLocation(e,n),null}},Gh.prototype.setShell=function(t){null!==(this._shell=t)&&t.addHole(this)},Gh.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)},Gh.prototype.interfaces_=function(){return[]},Gh.prototype.getClass=function(){return Gh};function Bh(t){this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length||1===arguments.length&&(this._label=t)}var kh,zh,jh=((zh=Gh)&&(Yh.__proto__=zh),((Yh.prototype=Object.create(zh&&zh.prototype)).constructor=Yh).prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},Yh.prototype.getNext=function(t){return t.getNextMin()},Yh.prototype.interfaces_=function(){return[]},Yh.prototype.getClass=function(){return Yh},Yh),Xh=((kh=Gh)&&(Uh.__proto__=kh),((Uh.prototype=Object.create(kh&&kh.prototype)).constructor=Uh).prototype.buildMinimalRings=function(){var t,e=new $a,n=this._startDe;do{null===n.getMinEdgeRing()&&(t=new jh(n,this._geometryFactory),e.add(t)),n=n.getNext()}while(n!==this._startDe);return e},Uh.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},Uh.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){for(var t=this._startDe;t.getNode().getEdges().linkMinimalDirectedEdges(this),(t=t.getNext())!==this._startDe;);},Uh.prototype.getNext=function(t){return t.getNext()},Uh.prototype.interfaces_=function(){return[]},Uh.prototype.getClass=function(){return Uh},Uh);function Uh(){var t=arguments[0],e=arguments[1];kh.call(this,t,e)}function Yh(){var t=arguments[0],e=arguments[1];zh.call(this,t,e)}Bh.prototype.setVisited=function(t){this._isVisited=t},Bh.prototype.setInResult=function(t){this._isInResult=t},Bh.prototype.isCovered=function(){return this._isCovered},Bh.prototype.isCoveredSet=function(){return this._isCoveredSet},Bh.prototype.setLabel=function(t){this._label=t},Bh.prototype.getLabel=function(){return this._label},Bh.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Bh.prototype.updateIM=function(t){ya.isTrue(2<=this._label.getGeometryCount(),"found partial label"),this.computeIM(t)},Bh.prototype.isInResult=function(){return this._isInResult},Bh.prototype.isVisited=function(){return this._isVisited},Bh.prototype.interfaces_=function(){return[]},Bh.prototype.getClass=function(){return Bh};function Vh(t){this.nodeMap=new Nu,this.nodeFact=null,this.nodeFact=t}var Hh,Wh=((Hh=Bh)&&(Jh.__proto__=Hh),((Jh.prototype=Object.create(Hh&&Hh.prototype)).constructor=Jh).prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},Jh.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Jh.prototype.getCoordinate=function(){return this._coord},Jh.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},Jh.prototype.computeIM=function(t){},Jh.prototype.computeMergedLocation=function(t,e){var n,r=Xs.NONE,r=this._label.getLocation(e);return t.isNull(e)||(n=t.getLocation(e),r!==Xs.BOUNDARY&&(r=n)),r},Jh.prototype.setLabel=function(){if(2!==arguments.length)return Hh.prototype.setLabel.apply(this,arguments);var t=arguments[0],e=arguments[1];null===this._label?this._label=new qh(t,e):this._label.setLocation(t,e)},Jh.prototype.getEdges=function(){return this._edges},Jh.prototype.mergeLabel=function(){if(arguments[0]instanceof Jh){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof qh)for(var e=arguments[0],n=0;n<2;n++){var r=this.computeMergedLocation(e,n);this._label.getLocation(n)===Xs.NONE&&this._label.setLocation(n,r)}},Jh.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},Jh.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=Xs.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case Xs.BOUNDARY:n=Xs.INTERIOR;break;case Xs.INTERIOR:default:n=Xs.BOUNDARY}this._label.setLocation(t,n)},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh},Jh);function Jh(){Hh.call(this),this._coord=null,this._edges=null;var t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new qh(0,Xs.NONE)}Vh.prototype.find=function(t){return this.nodeMap.get(t)},Vh.prototype.addNode=function(){if(arguments[0]instanceof Bs){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 Wh){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},Vh.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},Vh.prototype.iterator=function(){return this.nodeMap.values().iterator()},Vh.prototype.values=function(){return this.nodeMap.values()},Vh.prototype.getBoundaryNodes=function(t){for(var e=new $a,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===Xs.BOUNDARY&&e.add(r)}return e},Vh.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Vh.prototype.interfaces_=function(){return[]},Vh.prototype.getClass=function(){return Vh};function Zh(){}var Kh={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Zh.prototype.interfaces_=function(){return[]},Zh.prototype.getClass=function(){return Zh},Zh.isNorthern=function(t){return t===Zh.NE||t===Zh.NW},Zh.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},Zh.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===(e<t?t:e)?3:n},Zh.isInHalfPlane=function(t,e){return e===Zh.SE?t===Zh.SE||t===Zh.SW:t===e||t===e+1},Zh.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 Rs;return 0<=t?0<=e?Zh.NE:Zh.SE:0<=e?Zh.NW:Zh.SW}if(arguments[0]instanceof Bs&&arguments[1]instanceof Bs){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new Rs;return r.x>=n.x?r.y>=n.y?Zh.NE:Zh.SE:r.y>=n.y?Zh.NW:Zh.SW}},Kh.NE.get=function(){return 0},Kh.NW.get=function(){return 1},Kh.SW.get=function(){return 2},Kh.SE.get=function(){return 3},Object.defineProperties(Zh,Kh);function Qh(t,e,n,r){var i,o,s,a,u;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?this._edge=t:3===arguments.length?(i=e,o=n,this._edge=t,this.init(i,o),this._label=null):4===arguments.length&&(s=e,a=n,u=r,this._edge=t,this.init(s,a),this._label=u)}Qh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:Pa.computeOrientation(t._p0,t._p1,this._p1)},Qh.prototype.getDy=function(){return this._dy},Qh.prototype.getCoordinate=function(){return this._p0},Qh.prototype.setNode=function(t){this._node=t},Qh.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},Qh.prototype.compareTo=function(t){return this.compareDirection(t)},Qh.prototype.getDirectedCoordinate=function(){return this._p1},Qh.prototype.getDx=function(){return this._dx},Qh.prototype.getLabel=function(){return this._label},Qh.prototype.getEdge=function(){return this._edge},Qh.prototype.getQuadrant=function(){return this._quadrant},Qh.prototype.getNode=function(){return this._node},Qh.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},Qh.prototype.computeLabel=function(t){},Qh.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=Zh.quadrant(this._dx,this._dy),ya.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},Qh.prototype.interfaces_=function(){return[Ds]},Qh.prototype.getClass=function(){return Qh};function $h(){}var tc,ec=((tc=Qh)&&(nc.__proto__=tc),((nc.prototype=Object.create(tc&&tc.prototype)).constructor=nc).prototype.getNextMin=function(){return this._nextMin},nc.prototype.getDepth=function(t){return this._depth[t]},nc.prototype.setVisited=function(t){this._isVisited=t},nc.prototype.computeDirectedLabel=function(){this._label=new qh(this._edge.getLabel()),this._isForward||this._label.flip()},nc.prototype.getNext=function(){return this._next},nc.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new Th("assigned depths do not match",this.getCoordinate());this._depth[t]=e},nc.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,Ch.LEFT)===Xs.INTERIOR&&this._label.getLocation(e,Ch.RIGHT)===Xs.INTERIOR||(t=!1);return t},nc.prototype.setNextMin=function(t){this._nextMin=t},nc.prototype.print=function(t){tc.prototype.print.call(this,t),t.print(" "+this._depth[Ch.LEFT]+"/"+this._depth[Ch.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")},nc.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},nc.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,Xs.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,Xs.EXTERIOR);return t&&e&&n},nc.prototype.setEdgeRing=function(t){this._edgeRing=t},nc.prototype.getMinEdgeRing=function(){return this._minEdgeRing},nc.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},nc.prototype.setInResult=function(t){this._isInResult=t},nc.prototype.getSym=function(){return this._sym},nc.prototype.isForward=function(){return this._isForward},nc.prototype.getEdge=function(){return this._edge},nc.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},nc.prototype.setSym=function(t){this._sym=t},nc.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},nc.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===Ch.LEFT&&(r=-1);var i=Ch.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},nc.prototype.getEdgeRing=function(){return this._edgeRing},nc.prototype.isInResult=function(){return this._isInResult},nc.prototype.setNext=function(t){this._next=t},nc.prototype.isVisited=function(){return this._isVisited},nc.prototype.interfaces_=function(){return[]},nc.prototype.getClass=function(){return nc},nc.depthFactor=function(t,e){return t===Xs.EXTERIOR&&e===Xs.INTERIOR?1:t===Xs.INTERIOR&&e===Xs.EXTERIOR?-1:0},nc);function nc(){var t,e=arguments[0],n=arguments[1];tc.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)?this.init(e.getCoordinate(0),e.getCoordinate(1)):(t=e.getNumPoints()-1,this.init(e.getCoordinate(t),e.getCoordinate(t-1))),this.computeDirectedLabel()}$h.prototype.createNode=function(t){return new Wh(t,null)},$h.prototype.interfaces_=function(){return[]},$h.prototype.getClass=function(){return $h};function rc(t){this._edges=new $a,this._nodes=null,this._edgeEndList=new $a,0===arguments.length?this._nodes=new Vh(new $h):1===arguments.length&&(this._nodes=new Vh(t))}rc.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)}},rc.prototype.find=function(t){return this._nodes.find(t)},rc.prototype.addNode=function(){if(arguments[0]instanceof Wh){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof Bs){var e=arguments[0];return this._nodes.addNode(e)}},rc.prototype.getNodeIterator=function(){return this._nodes.iterator()},rc.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},rc.prototype.debugPrintln=function(t){ia.out.println(t)},rc.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===Xs.BOUNDARY},rc.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},rc.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&Pa.computeOrientation(t,e,r)===Pa.COLLINEAR&&Zh.quadrant(t,e)===Zh.quadrant(n,r)},rc.prototype.getEdgeEnds=function(){return this._edgeEndList},rc.prototype.debugPrint=function(t){ia.out.print(t)},rc.prototype.getEdgeIterator=function(){return this._edges.iterator()},rc.prototype.findEdgeInSameDirection=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(this.matchInSameDirection(t,e,i[0],i[1]))return r;if(this.matchInSameDirection(t,e,i[i.length-1],i[i.length-2]))return r}return null},rc.prototype.insertEdge=function(t){this._edges.add(t)},rc.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},rc.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var r=new ec(n,!0),i=new ec(n,!1);r.setSym(i),i.setSym(r),this.add(r),this.add(i)}},rc.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},rc.prototype.getNodes=function(){return this._nodes.values()},rc.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},rc.prototype.interfaces_=function(){return[]},rc.prototype.getClass=function(){return rc},rc.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};function ic(t){this._geometryFactory=null,this._shellList=new $a,this._geometryFactory=t}ic.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},ic.prototype.computePolygons=function(t){for(var e=new $a,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},ic.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(null===r.getShell()){var i=this.findEdgeRingContaining(r,t);if(null===i)throw new Th("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},ic.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new $a,i=t.iterator();i.hasNext();){var o,s,a=i.next();2<a.getMaxNodeDegree()?(a.linkDirectedEdgesForMinimalEdgeRings(),o=a.buildMinimalRings(),null!==(s=this.findShell(o))?(this.placePolygonHoles(s,o),e.add(s)):n.addAll(o)):r.add(a)}return r},ic.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},ic.prototype.buildMaximalEdgeRings=function(t){for(var e=new $a,n=t.iterator();n.hasNext();){var r,i=n.next();i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()&&(r=new Xh(i,this._geometryFactory),e.add(r),r.setInResult())}return e},ic.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},ic.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},ic.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),h=u.getLinearRing(),c=h.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var l=!1;c.contains(r)&&Pa.isPointInRing(i,h.getCoordinates())&&(l=!0),l&&(null===o||s.contains(c))&&(o=u)}return o},ic.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return ya.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},ic.prototype.add=function(){var t,e,n,r,i;1===arguments.length?(t=arguments[0],this.add(t.getEdgeEnds(),t.getNodes())):2===arguments.length&&(e=arguments[0],rc.linkResultDirectedEdges(arguments[1]),n=this.buildMaximalEdgeRings(e),r=new $a,i=this.buildMinimalEdgeRings(n,this._shellList,r),this.sortShellsAndHoles(i,this._shellList,r),this.placeFreeHoles(this._shellList,r))},ic.prototype.interfaces_=function(){return[]},ic.prototype.getClass=function(){return ic};function oc(){}oc.prototype.getBounds=function(){},oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc};function sc(t,e){this._bounds=null,this._item=null;var n=e;this._bounds=t,this._item=n}sc.prototype.getItem=function(){return this._item},sc.prototype.getBounds=function(){return this._bounds},sc.prototype.interfaces_=function(){return[oc,Gs]},sc.prototype.getClass=function(){return sc};function ac(){this._size=null,this._items=null,this._size=0,this._items=new $a,this._items.add(null)}ac.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,this.reorder(1),t},ac.prototype.size=function(){return this._size},ac.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)},ac.prototype.clear=function(){this._size=0,this._items.clear()},ac.prototype.isEmpty=function(){return 0===this._size},ac.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)},ac.prototype.interfaces_=function(){return[]},ac.prototype.getClass=function(){return ac};function uc(){}uc.prototype.visitItem=function(t){},uc.prototype.interfaces_=function(){return[]},uc.prototype.getClass=function(){return uc};function hc(){}hc.prototype.insert=function(t,e){},hc.prototype.remove=function(t,e){},hc.prototype.query=function(){},hc.prototype.interfaces_=function(){return[]},hc.prototype.getClass=function(){return hc};function cc(t){this._childBoundables=new $a,this._bounds=null,this._level=null,0===arguments.length||1===arguments.length&&(this._level=t)}var lc={serialVersionUID:{configurable:!0}};cc.prototype.getLevel=function(){return this._level},cc.prototype.size=function(){return this._childBoundables.size()},cc.prototype.getChildBoundables=function(){return this._childBoundables},cc.prototype.addChildBoundable=function(t){ya.isTrue(null===this._bounds),this._childBoundables.add(t)},cc.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},cc.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},cc.prototype.interfaces_=function(){return[oc,Gs]},cc.prototype.getClass=function(){return cc},lc.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(cc,lc);function pc(){}pc.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},pc.min=function(t){return pc.sort(t),t.get(0)},pc.sort=function(t,e){var n=t.toArray();e?Pu.sort(n,e):Pu.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},pc.singletonList=function(t){var e=new $a;return e.add(t),e};function fc(t,e,n){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var r=e,i=n;this._boundable1=t,this._boundable2=r,this._itemDistance=i,this._distance=this.distance()}fc.prototype.expandToQueue=function(t,e){var n=fc.isComposite(this._boundable1),r=fc.isComposite(this._boundable2);if(n&&r)return fc.area(this._boundable1)>fc.area(this._boundable2)?this.expand(this._boundable1,this._boundable2,t,e):this.expand(this._boundable2,this._boundable1,t,e),null;if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new Rs},fc.prototype.isLeaves=function(){return!(fc.isComposite(this._boundable1)||fc.isComposite(this._boundable2))},fc.prototype.compareTo=function(t){return this._distance<t._distance?-1:this._distance>t._distance?1:0},fc.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new fc(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},fc.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},fc.prototype.getDistance=function(){return this._distance},fc.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},fc.prototype.interfaces_=function(){return[Ds]},fc.prototype.getClass=function(){return fc},fc.area=function(t){return t.getBounds().getArea()},fc.isComposite=function(t){return t instanceof cc};function gc(){var t,e;this._root=null,this._built=!1,this._itemBoundables=new $a,this._nodeCapacity=null,0===arguments.length?(t=gc.DEFAULT_NODE_CAPACITY,this._nodeCapacity=t):1===arguments.length&&(ya.isTrue(1<(e=arguments[0]),"Node capacity must be greater than 1"),this._nodeCapacity=e)}var dc={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};gc.prototype.getNodeCapacity=function(){return this._nodeCapacity},gc.prototype.lastNode=function(t){return t.get(t.size()-1)},gc.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 cc?t+=this.size(n):n instanceof sc&&(t+=1)}return t}},gc.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof sc&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},gc.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new $a:t}if(1===arguments.length){for(var e=arguments[0],n=new $a,r=e.getChildBoundables().iterator();r.hasNext();){var i,o=r.next();o instanceof cc?null!==(i=this.itemsTree(o))&&n.add(i):o instanceof sc?n.add(o.getItem()):ya.shouldNeverReachHere()}return n.size()<=0?null:n}},gc.prototype.insert=function(t,e){ya.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new sc(t,e))},gc.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new $a;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(ya.isTrue(-2<n),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof cc?this.boundablesAtLevel(n,s,i):(ya.isTrue(s instanceof sc),-1===n&&i.add(s))}return null}},gc.prototype.query=function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new $a;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e),e}if(2===arguments.length){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r)}else if(3===arguments.length)if(Ys(arguments[2],uc)&&arguments[0]instanceof Object&&arguments[1]instanceof cc)for(var i=arguments[0],o=arguments[2],s=arguments[1].getChildBoundables(),a=0;a<s.size();a++){var u=s.get(a);this.getIntersectsOp().intersects(u.getBounds(),i)&&(u instanceof cc?this.query(i,u,o):u instanceof sc?o.visitItem(u.getItem()):ya.shouldNeverReachHere())}else if(Ys(arguments[2],Ha)&&arguments[0]instanceof Object&&arguments[1]instanceof cc)for(var h=arguments[0],c=arguments[2],l=arguments[1].getChildBoundables(),p=0;p<l.size();p++){var f=l.get(p);this.getIntersectsOp().intersects(f.getBounds(),h)&&(f instanceof cc?this.query(h,f,c):f instanceof sc?c.add(f.getItem()):ya.shouldNeverReachHere())}},gc.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},gc.prototype.getRoot=function(){return this.build(),this._root},gc.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],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var s=null,a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&u instanceof cc&&(o=this.remove(n,u,i))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},gc.prototype.createHigherLevels=function(t,e){ya.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},gc.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,r=e.next();r instanceof cc&&(t<(n=this.depth(r))&&(t=n))}return t+1}},gc.prototype.createParentBoundables=function(t,e){ya.isTrue(!t.isEmpty());var n=new $a;n.add(this.createNode(e));var r=new $a(t);pc.sort(r,this.getComparator());for(var i=r.iterator();i.hasNext();){var o=i.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n},gc.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},gc.prototype.interfaces_=function(){return[Gs]},gc.prototype.getClass=function(){return gc},gc.compareDoubles=function(t,e){return e<t?1:t<e?-1:0},dc.IntersectsOp.get=function(){return _c},dc.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},dc.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(gc,dc);function yc(){}var _c=function(){};yc.prototype.distance=function(t,e){},yc.prototype.interfaces_=function(){return[]},yc.prototype.getClass=function(){return yc};function mc(){}var vc,xc=function(h){function d(t){t=t||d.DEFAULT_NODE_CAPACITY,h.call(this,t)}h&&(d.__proto__=h);var t={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return((d.prototype=Object.create(h&&h.prototype)).constructor=d).prototype.createParentBoundablesFromVerticalSlices=function(t,e){ya.isTrue(0<t.length);for(var n=new $a,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},d.prototype.createNode=function(t){return new Ec(t)},d.prototype.size=function(){return 0===arguments.length?h.prototype.size.call(this):h.prototype.size.apply(this,arguments)},d.prototype.insert=function(){if(2!==arguments.length)return h.prototype.insert.apply(this,arguments);var t=arguments[0],e=arguments[1];if(t.isNull())return null;h.prototype.insert.call(this,t,e)},d.prototype.getIntersectsOp=function(){return d.intersectsOp},d.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){r[o]=new $a;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},d.prototype.query=function(){if(1===arguments.length){var t=arguments[0];return h.prototype.query.call(this,t)}var e,n,r,i,o,s,a,u;2===arguments.length?(e=arguments[0],n=arguments[1],h.prototype.query.call(this,e,n)):3===arguments.length&&(Ys(arguments[2],uc)&&arguments[0]instanceof Object&&arguments[1]instanceof cc?(r=arguments[0],i=arguments[1],o=arguments[2],h.prototype.query.call(this,r,i,o)):Ys(arguments[2],Ha)&&arguments[0]instanceof Object&&arguments[1]instanceof cc&&(s=arguments[0],a=arguments[1],u=arguments[2],h.prototype.query.call(this,s,a,u)))},d.prototype.getComparator=function(){return d.yComparator},d.prototype.createParentBoundablesFromVerticalSlice=function(t,e){return h.prototype.createParentBoundables.call(this,t,e)},d.prototype.remove=function(){if(2!==arguments.length)return h.prototype.remove.apply(this,arguments);var t=arguments[0],e=arguments[1];return h.prototype.remove.call(this,t,e)},d.prototype.depth=function(){return 0===arguments.length?h.prototype.depth.call(this):h.prototype.depth.apply(this,arguments)},d.prototype.createParentBoundables=function(t,e){ya.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),r=new $a(t);pc.sort(r,d.xComparator);var i=this.verticalSlices(r,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(i,e)},d.prototype.nearestNeighbour=function(){if(1===arguments.length){if(Ys(arguments[0],yc)){var t=arguments[0],e=new fc(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof fc){var n=arguments[0];return this.nearestNeighbour(n,Ts.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof d&&Ys(arguments[1],yc)){var r=arguments[0],i=arguments[1],o=new fc(this.getRoot(),r.getRoot(),i);return this.nearestNeighbour(o)}if(arguments[0]instanceof fc&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1],u=null,h=new ac;for(h.add(s);!h.isEmpty()&&0<a;){var c=h.poll(),l=c.getDistance();if(a<=l)break;c.isLeaves()?(a=l,u=c):c.expandToQueue(h,a)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],f=new sc(arguments[0],arguments[1]),g=new fc(this.getRoot(),f,p);return this.nearestNeighbour(g)[0]}},d.prototype.interfaces_=function(){return[hc,Gs]},d.prototype.getClass=function(){return d},d.centreX=function(t){return d.avg(t.getMinX(),t.getMaxX())},d.avg=function(t,e){return(t+e)/2},d.centreY=function(t){return d.avg(t.getMinY(),t.getMaxY())},t.STRtreeNode.get=function(){return Ec},t.serialVersionUID.get=function(){return 0x39920f7d5f261e0},t.xComparator.get=function(){return{interfaces_:function(){return[qs]},compare:function(t,e){return h.compareDoubles(d.centreX(t.getBounds()),d.centreX(e.getBounds()))}}},t.yComparator.get=function(){return{interfaces_:function(){return[qs]},compare:function(t,e){return h.compareDoubles(d.centreY(t.getBounds()),d.centreY(e.getBounds()))}}},t.intersectsOp.get=function(){return{interfaces_:function(){return[h.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},t.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(d,t),d}(gc),Ec=((vc=cc)&&(wc.__proto__=vc),((wc.prototype=Object.create(vc&&vc.prototype)).constructor=wc).prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new ha(n.getBounds()):t.expandToInclude(n.getBounds())}return t},wc.prototype.interfaces_=function(){return[]},wc.prototype.getClass=function(){return wc},wc);function wc(){var t=arguments[0];vc.call(this,t)}mc.prototype.interfaces_=function(){return[]},mc.prototype.getClass=function(){return mc},mc.relativeSign=function(t,e){return t<e?-1:e<t?1:0},mc.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=mc.relativeSign(e.x,n.x),i=mc.relativeSign(e.y,n.y);switch(t){case 0:return mc.compareValue(r,i);case 1:return mc.compareValue(i,r);case 2:return mc.compareValue(i,-r);case 3:return mc.compareValue(-r,i);case 4:return mc.compareValue(-r,-i);case 5:return mc.compareValue(-i,-r);case 6:return mc.compareValue(-i,r);case 7:return mc.compareValue(r,-i)}return ya.shouldNeverReachHere("invalid octant value"),0},mc.compareValue=function(t,e){return t<0?-1:0<t?1:e<0?-1:0<e?1:0};function bc(t,e,n,r){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var i=t,o=e,s=n,a=r;this._segString=i,this.coord=new Bs(o),this.segmentIndex=s,this._segmentOctant=a,this._isInterior=!o.equals2D(i.getCoordinate(s))}bc.prototype.getCoordinate=function(){return this.coord},bc.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},bc.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:mc.compare(this._segmentOctant,this.coord,e.coord)},bc.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},bc.prototype.isInterior=function(){return this._isInterior},bc.prototype.interfaces_=function(){return[Ds]},bc.prototype.getClass=function(){return bc};function Ic(t){this._nodeMap=new Nu,this._edge=null,this._edge=t}Ic.prototype.getSplitCoordinates=function(){var t=new eu;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},Ic.prototype.addCollapsedNodes=function(){var t=new $a;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)}},Ic.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Ic.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new Js(e+1))}},Ic.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new Bs(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new Bs(e.coord))},Ic.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ic.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},Ic.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},Ic.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new Js(e[0])),r=i}},Ic.prototype.getEdge=function(){return this._edge},Ic.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Ic.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new Bs(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new Bs(e.coord)),new Mc(o,this._edge.getData())},Ic.prototype.add=function(t,e){var n=new bc(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(ya.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},Ic.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new va("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new va("bad split edge end point at "+i)},Ic.prototype.interfaces_=function(){return[]},Ic.prototype.getClass=function(){return Ic};function Nc(){}Nc.prototype.interfaces_=function(){return[]},Nc.prototype.getClass=function(){return Nc},Nc.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 Rs;var n=Math.abs(t),r=Math.abs(e);return 0<=t?0<=e?r<=n?0:1:r<=n?7:6:0<=e?r<=n?3:2:r<=n?4:5}if(arguments[0]instanceof Bs&&arguments[1]instanceof Bs){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0==s&&0==a)throw new Rs;return Nc.octant(s,a)}};function Cc(){}Cc.prototype.getCoordinates=function(){},Cc.prototype.size=function(){},Cc.prototype.getCoordinate=function(t){},Cc.prototype.isClosed=function(){},Cc.prototype.setData=function(t){},Cc.prototype.getData=function(){},Cc.prototype.interfaces_=function(){return[]},Cc.prototype.getClass=function(){return Cc};function Sc(){}Sc.prototype.addIntersection=function(t,e){},Sc.prototype.interfaces_=function(){return[Cc]},Sc.prototype.getClass=function(){return Sc};var Mc=function(t,e){this._nodeList=new Ic(this),this._pts=null,this._data=null;var n=e;this._pts=t,this._data=n};Mc.prototype.getCoordinates=function(){return this._pts},Mc.prototype.size=function(){return this._pts.length},Mc.prototype.getCoordinate=function(t){return this._pts[t]},Mc.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Mc.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Mc.prototype.setData=function(t){this._data=t},Mc.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Nc.octant(t,e)},Mc.prototype.getData=function(){return this._data},Mc.prototype.addIntersection=function(){var t,e,n,r,i;2===arguments.length?(t=arguments[0],e=arguments[1],this.addIntersectionNode(t,e)):4===arguments.length&&(n=arguments[1],r=arguments[3],i=new Bs(arguments[0].getIntersection(r)),this.addIntersection(i,n))},Mc.prototype.toString=function(){return fa.toLineString(new ah(this._pts))},Mc.prototype.getNodeList=function(){return this._nodeList},Mc.prototype.addIntersectionNode=function(t,e){var n,r=e,i=r+1;return i<this._pts.length&&(n=this._pts[i],t.equals2D(n)&&(r=i)),this._nodeList.add(t,r)},Mc.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},Mc.prototype.interfaces_=function(){return[Sc]},Mc.prototype.getClass=function(){return Mc},Mc.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new $a;return Mc.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();)r.next().getNodeList().addSplitEdges(n)};function Lc(t,e,n,r){var i,o,s;this.p0=null,this.p1=null,0===arguments.length?(this.p0=new Bs,this.p1=new Bs):1===arguments.length?(i=t,this.p0=new Bs(i.p0),this.p1=new Bs(i.p1)):2===arguments.length?(this.p0=t,this.p1=e):4===arguments.length&&(o=n,s=r,this.p0=new Bs(t,e),this.p1=new Bs(o,s))}var Pc={serialVersionUID:{configurable:!0}};Lc.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Lc.prototype.orientationIndex=function(){if(arguments[0]instanceof Lc){var t=arguments[0],e=Pa.orientationIndex(this.p0,this.p1,t.p0),n=Pa.orientationIndex(this.p0,this.p1,t.p1);return 0<=e&&0<=n||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof Bs){var r=arguments[0];return Pa.orientationIndex(this.p0,this.p1,r)}},Lc.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Lc.prototype.isVertical=function(){return this.p0.x===this.p1.x},Lc.prototype.equals=function(t){if(!(t instanceof Lc))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Lc.prototype.intersection=function(t){var e=new Sa;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Lc.prototype.project=function(){if(arguments[0]instanceof Bs){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Bs(t);var e=this.projectionFactor(t),n=new Bs;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 Lc){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(1<=i&&1<=o)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),1<i&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),1<o&&(a=this.p1),new Lc(s,a)}},Lc.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Lc.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Lc.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Lc.prototype.distancePerpendicular=function(t){return Pa.distancePointLinePerpendicular(t,this.p0,this.p1)},Lc.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Lc.prototype.midPoint=function(){return Lc.midPoint(this.p0,this.p1)},Lc.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,r=e*e+n*n;return r<=0?Ts.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},Lc.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=Ts.MAX_VALUE,i=null,o=this.closestPoint(t.p0),r=o.distance(t.p0);n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},Lc.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return 0<e&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},Lc.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Lc.prototype.getLength=function(){return this.p0.distance(this.p1)},Lc.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},Lc.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Lc.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)},Lc.prototype.lineIntersection=function(t){try{return ua.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof sa))throw t}return null},Lc.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Lc.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+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*i/s,u=e*o/s}return new Bs(n-u,r+a)},Lc.prototype.setCoordinates=function(){var t,e,n;1===arguments.length?(t=arguments[0],this.setCoordinates(t.p0,t.p1)):2===arguments.length&&(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)},Lc.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(1<e||Ts.isNaN(e))&&(e=1),e},Lc.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Lc.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Lc.prototype.distance=function(){if(arguments[0]instanceof Lc){var t=arguments[0];return Pa.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Bs){var e=arguments[0];return Pa.distancePointLine(e,this.p0,this.p1)}},Lc.prototype.pointAlong=function(t){var e=new Bs;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},Lc.prototype.hashCode=function(){var t=Ts.doubleToLongBits(this.p0.x);t^=31*Ts.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=Ts.doubleToLongBits(this.p1.x);return n^=31*Ts.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},Lc.prototype.interfaces_=function(){return[Ds,Gs]},Lc.prototype.getClass=function(){return Lc},Lc.midPoint=function(t,e){return new Bs((t.x+e.x)/2,(t.y+e.y)/2)},Pc.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Lc,Pc);function Oc(){this.tempEnv1=new ha,this.tempEnv2=new ha,this._overlapSeg1=new Lc,this._overlapSeg2=new Lc}Oc.prototype.overlap=function(){var t,e,n;2===arguments.length||4===arguments.length&&(t=arguments[1],e=arguments[2],n=arguments[3],arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(n,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2))},Oc.prototype.interfaces_=function(){return[]},Oc.prototype.getClass=function(){return Oc};function Rc(t,e,n,r){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var i=e,o=n,s=r;this._pts=t,this._start=i,this._end=o,this._context=s}Rc.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Rc.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},Rc.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},Rc.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Rc.prototype.setId=function(t){this._id=t},Rc.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Rc.prototype.getEnvelope=function(){var t,e;return null===this._env&&(t=this._pts[this._start],e=this._pts[this._end],this._env=new ha(t,e)),this._env},Rc.prototype.getEndIndex=function(){return this._end},Rc.prototype.getStartIndex=function(){return this._start},Rc.prototype.getContext=function(){return this._context},Rc.prototype.getId=function(){return this._id},Rc.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],h=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,h),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),l=Math.trunc((r+i)/2);t<c&&(r<l&&this.computeOverlapsInternal(t,c,n,r,l,o),l<i&&this.computeOverlapsInternal(t,c,n,l,i,o)),c<e&&(r<l&&this.computeOverlapsInternal(c,e,n,r,l,o),l<i&&this.computeOverlapsInternal(c,e,n,l,i,o))},Rc.prototype.interfaces_=function(){return[]},Rc.prototype.getClass=function(){return Rc};function Tc(){}Tc.prototype.interfaces_=function(){return[]},Tc.prototype.getClass=function(){return Tc},Tc.getChainStartIndices=function(t){var e=0,n=new $a;n.add(new Js(e));do{var r=Tc.findChainEnd(t,e);n.add(new Js(r)),e=r}while(e<t.length-1);return Tc.toIntArray(n)},Tc.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 r=Zh.quadrant(t[n],t[n+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||Zh.quadrant(t[i-1],t[i])===r);)i++;return i-1},Tc.getChains=function(){if(1===arguments.length)return Tc.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=new $a,r=Tc.getChainStartIndices(t),i=0;i<r.length-1;i++){var o=new Rc(t,r[i],r[i+1],e);n.add(o)}return n}},Tc.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};function Ac(){}Ac.prototype.computeNodes=function(t){},Ac.prototype.getNodedSubstrings=function(){},Ac.prototype.interfaces_=function(){return[]},Ac.prototype.getClass=function(){return Ac};function Dc(t){this._segInt=null,0===arguments.length||1===arguments.length&&this.setSegmentIntersector(t)}Dc.prototype.setSegmentIntersector=function(t){this._segInt=t},Dc.prototype.interfaces_=function(){return[Ac]},Dc.prototype.getClass=function(){return Dc};function Fc(){var t,e,n,r,i,o,s;this._quadrantSegments=Fc.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=Fc.CAP_ROUND,this._joinStyle=Fc.JOIN_ROUND,this._mitreLimit=Fc.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=Fc.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length||(1===arguments.length?(t=arguments[0],this.setQuadrantSegments(t)):2===arguments.length?(e=arguments[0],n=arguments[1],this.setQuadrantSegments(e),this.setEndCapStyle(n)):4===arguments.length&&(r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],this.setQuadrantSegments(r),this.setEndCapStyle(i),this.setJoinStyle(o),this.setMitreLimit(s)))}var qc,Gc=function(e){function t(t){t?e.call(this,t):e.call(this),this._monoChains=new $a,this._index=new xc,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}e&&(t.__proto__=e);var n={SegmentOverlapAction:{configurable:!0}};return((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.getMonotoneChains=function(){return this._monoChains},t.prototype.getNodedSubstrings=function(){return Mc.getNodedSubstrings(this._nodedSegStrings)},t.prototype.getIndex=function(){return this._index},t.prototype.add=function(t){for(var e=Tc.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)}},t.prototype.computeNodes=function(t){for(var e=(this._nodedSegStrings=t).iterator();e.hasNext();)this.add(e.next());this.intersectChains()},t.prototype.intersectChains=function(){for(var t=new Bc(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),r=this._index.query(n.getEnvelope()).iterator();r.hasNext();){var i=r.next();if(i.getId()>n.getId()&&(n.computeOverlaps(i,t),this._nOverlaps++),this._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return Bc},Object.defineProperties(t,n),t}(Dc),Bc=((qc=Oc)&&(zc.__proto__=qc),((zc.prototype=Object.create(qc&&qc.prototype)).constructor=zc).prototype.overlap=function(){if(4!==arguments.length)return qc.prototype.overlap.apply(this,arguments);var t=arguments[1],e=arguments[2],n=arguments[3],r=arguments[0].getContext(),i=e.getContext();this._si.processIntersections(r,t,i,n)},zc.prototype.interfaces_=function(){return[]},zc.prototype.getClass=function(){return zc},zc),kc={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}};function zc(){qc.call(this),this._si=null;var t=arguments[0];this._si=t}Fc.prototype.getEndCapStyle=function(){return this._endCapStyle},Fc.prototype.isSingleSided=function(){return this._isSingleSided},Fc.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=Fc.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Fc.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Fc.JOIN_ROUND&&(this._quadrantSegments=Fc.DEFAULT_QUADRANT_SEGMENTS)},Fc.prototype.getJoinStyle=function(){return this._joinStyle},Fc.prototype.setJoinStyle=function(t){this._joinStyle=t},Fc.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Fc.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Fc.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Fc.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Fc.prototype.getMitreLimit=function(){return this._mitreLimit},Fc.prototype.setMitreLimit=function(t){this._mitreLimit=t},Fc.prototype.setSingleSided=function(t){this._isSingleSided=t},Fc.prototype.interfaces_=function(){return[]},Fc.prototype.getClass=function(){return Fc},Fc.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},kc.CAP_ROUND.get=function(){return 1},kc.CAP_FLAT.get=function(){return 2},kc.CAP_SQUARE.get=function(){return 3},kc.JOIN_ROUND.get=function(){return 1},kc.JOIN_MITRE.get=function(){return 2},kc.JOIN_BEVEL.get=function(){return 3},kc.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},kc.DEFAULT_MITRE_LIMIT.get=function(){return 5},kc.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(Fc,kc);function jc(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Pa.COUNTERCLOCKWISE,this._inputLine=t||null}var Xc={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};jc.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r)},jc.prototype.deleteShallowConcavities=function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),r=!1;n<this._inputLine.length;){var i=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=jc.DELETE,r=i=!0),t=i?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r},jc.prototype.isShallowConcavity=function(t,e,n,r){return Pa.computeOrientation(t,e,n)===this._angleOrientation&&Pa.distancePointLine(e,t,n)<r},jc.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/jc.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},jc.prototype.isConcave=function(t,e,n){return Pa.computeOrientation(t,e,n)===this._angleOrientation},jc.prototype.simplify=function(t){for(this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=Pa.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);this.deleteShallowConcavities(););return this.collapseLine()},jc.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===jc.DELETE;)e++;return e},jc.prototype.isShallow=function(t,e,n,r){return Pa.distancePointLine(e,t,n)<r},jc.prototype.collapseLine=function(){for(var t=new eu,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==jc.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},jc.prototype.interfaces_=function(){return[]},jc.prototype.getClass=function(){return jc},jc.simplify=function(t,e){return new jc(t).simplify(e)},Xc.INIT.get=function(){return 0},Xc.DELETE.get=function(){return 1},Xc.KEEP.get=function(){return 1},Xc.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(jc,Xc);function Uc(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new $a}var Yc={COORDINATE_ARRAY_TYPE:{configurable:!0}};Uc.prototype.getCoordinates=function(){return this._ptList.toArray(Uc.COORDINATE_ARRAY_TYPE)},Uc.prototype.setPrecisionModel=function(t){this._precisionModel=t},Uc.prototype.addPt=function(t){var e=new Bs(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Uc.prototype.revere=function(){},Uc.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;0<=r;r--)this.addPt(t[r])},Uc.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},Uc.prototype.toString=function(){return(new mh).createLineString(this.getCoordinates()).toString()},Uc.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new Bs(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Uc.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Uc.prototype.interfaces_=function(){return[]},Uc.prototype.getClass=function(){return Uc},Yc.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Uc,Yc);function Vc(){}var Hc={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Vc.prototype.interfaces_=function(){return[]},Vc.prototype.getClass=function(){return Vc},Vc.toDegrees=function(t){return 180*t/Math.PI},Vc.normalize=function(t){for(;t>Math.PI;)t-=Vc.PI_TIMES_2;for(;t<=-Math.PI;)t+=Vc.PI_TIMES_2;return t},Vc.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],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},Vc.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return 0<r*(n.x-e.x)+i*(n.y-e.y)},Vc.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},Vc.interiorAngle=function(t,e,n){var r=Vc.angle(e,t),i=Vc.angle(e,n);return Math.abs(i-r)},Vc.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Vc.PI_TIMES_2;Vc.PI_TIMES_2<=t&&(t=0)}else{for(;Vc.PI_TIMES_2<=t;)t-=Vc.PI_TIMES_2;t<0&&(t=0)}return t},Vc.angleBetween=function(t,e,n){var r=Vc.angle(e,t),i=Vc.angle(e,n);return Vc.diff(r,i)},Vc.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},Vc.toRadians=function(t){return t*Math.PI/180},Vc.getTurn=function(t,e){var n=Math.sin(e-t);return 0<n?Vc.COUNTERCLOCKWISE:n<0?Vc.CLOCKWISE:Vc.NONE},Vc.angleBetweenOriented=function(t,e,n){var r=Vc.angle(e,t),i=Vc.angle(e,n)-r;return i<=-Math.PI?i+Vc.PI_TIMES_2:i>Math.PI?i-Vc.PI_TIMES_2:i},Hc.PI_TIMES_2.get=function(){return 2*Math.PI},Hc.PI_OVER_2.get=function(){return Math.PI/2},Hc.PI_OVER_4.get=function(){return Math.PI/4},Hc.COUNTERCLOCKWISE.get=function(){return Pa.COUNTERCLOCKWISE},Hc.CLOCKWISE.get=function(){return Pa.CLOCKWISE},Hc.NONE.get=function(){return Pa.COLLINEAR},Object.defineProperties(Vc,Hc);function Wc(){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 Lc,this._seg1=new Lc,this._offset0=new Lc,this._offset1=new Lc,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 Sa,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),8<=e.getQuadrantSegments()&&e.getJoinStyle()===Fc.JOIN_ROUND&&(this._closingSegLengthFactor=Wc.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}var Jc={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}};Wc.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=Pa.computeOrientation(this._s0,this._s1,this._s2),r=n===Pa.CLOCKWISE&&this._side===Ch.LEFT||n===Pa.COUNTERCLOCKWISE&&this._side===Ch.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Wc.prototype.addLineEndCap=function(t,e){var n=new Lc(t,e),r=new Lc;this.computeOffsetSegment(n,Ch.LEFT,this._distance,r);var i=new Lc;this.computeOffsetSegment(n,Ch.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Fc.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,Pa.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Fc.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Fc.CAP_SQUARE:var u=new Bs;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var h=new Bs(r.p1.x+u.x,r.p1.y+u.y),c=new Bs(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(h),this._segList.addPt(c)}},Wc.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Wc.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=ua.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof sa))throw t;o=new Bs(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Wc.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,h=n.y-t.y,c=Math.atan2(h,u);r===Pa.CLOCKWISE?a<=c&&(a+=2*Math.PI):c<=a&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},Wc.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Wc.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Fc.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Fc.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))},Wc.prototype.createSquare=function(t){this._segList.addPt(new Bs(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new Bs(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new Bs(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new Bs(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Wc.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Wc.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Wc.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Wc.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)},Wc.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=Vc.angle(i,this._seg0.p0),s=Vc.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=Vc.normalize(o+s),u=Vc.normalize(a+Math.PI),h=r*n,c=n-h*Math.abs(Math.sin(s)),l=i.x+h*Math.cos(u),p=i.y+h*Math.sin(u),f=new Bs(l,p),g=new Lc(i,f),d=g.pointAlongOffset(1,c),y=g.pointAlongOffset(1,-c);this._side===Ch.LEFT?(this._segList.addPt(d),this._segList.addPt(y)):(this._segList.addPt(y),this._segList.addPt(d))},Wc.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===Ch.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=i*n*o/a,h=i*n*s/a;r.p0.x=t.p0.x-h,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-h,r.p1.y=t.p1.y+u},Wc.prototype.addFilletArc=function(t,e,n,r,i){var o=r===Pa.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,h=0,c=new Bs;h<s;){var l=e+o*h;c.x=t.x+i*Math.cos(l),c.y=t.y+i*Math.sin(l),this._segList.addPt(c),h+=u}},Wc.prototype.addInsideTurn=function(t,e){var n,r;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)):(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Wc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR?this._segList.addPt(this._offset0.p1):(this._segList.addPt(this._offset0.p1),0<this._closingSegLengthFactor?(n=new Bs((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),r=new Bs((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(r)):this._segList.addPt(this._s1),this._segList.addPt(this._offset1.p0)))},Wc.prototype.createCircle=function(t){var e=new Bs(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Wc.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Wc.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Uc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Wc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Wc.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),2<=this._li.getIntersectionNum()&&(this._bufParams.getJoinStyle()===Fc.JOIN_BEVEL||this._bufParams.getJoinStyle()===Fc.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,Pa.CLOCKWISE,this._distance))},Wc.prototype.closeRing=function(){this._segList.closeRing()},Wc.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Wc.prototype.interfaces_=function(){return[]},Wc.prototype.getClass=function(){return Wc},Jc.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Jc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Jc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Jc.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Wc,Jc);function Zc(t,e){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=e;this._precisionModel=t,this._bufParams=n}Zc.prototype.getOffsetCurve=function(t,e){if(0===(this._distance=e))return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&Za.reverse(o),o},Zc.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=jc.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ch.LEFT),n.addFirstSegment();for(var s=o-2;0<=s;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=jc.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Ch.LEFT),n.addFirstSegment();for(var h=2;h<=u;h++)n.addNextSegment(a[h],!0)}n.addLastSegment(),n.closeRing()},Zc.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===Ch.RIGHT&&(r=-r);var i=jc.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},Zc.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=jc.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],Ch.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=jc.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],Ch.LEFT);for(var u=a-2;0<=u;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Zc.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Fc.CAP_ROUND:e.createCircle(t);break;case Fc.CAP_SQUARE:e.createSquare(t)}},Zc.prototype.getLineCurve=function(t,e){if((this._distance=e)<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n,r=Math.abs(e),i=this.getSegGen(r);return t.length<=1?this.computePointCurve(t[0],i):this._bufParams.isSingleSided()?(n=e<0,this.computeSingleSidedBufferCurve(t,n,i)):this.computeLineBufferCurve(t,i),i.getCoordinates()},Zc.prototype.getBufferParameters=function(){return this._bufParams},Zc.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Zc.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Zc.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},Zc.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=jc.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],Ch.LEFT),n.addFirstSegment();for(var s=o-2;0<=s;s--)n.addNextSegment(i[s],!0)}else{var a=jc.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],Ch.LEFT),n.addFirstSegment();for(var h=2;h<=u;h++)n.addNextSegment(a[h],!0)}n.addLastSegment()},Zc.prototype.getSegGen=function(t){return new Wc(this._precisionModel,this._bufParams,t)},Zc.prototype.interfaces_=function(){return[]},Zc.prototype.getClass=function(){return Zc},Zc.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new Bs(t[n]);return e};function Kc(t){this._subgraphs=null,this._seg=new Lc,this._cga=new Pa,this._subgraphs=t}var Qc={DepthSegment:{configurable:!0}};Kc.prototype.findStabbedSegments=function(){var t,e,n=this;if(1===arguments.length){for(var r=arguments[0],i=new $a,o=this._subgraphs.iterator();o.hasNext();){var s=o.next(),a=s.getEnvelope();r.y<a.getMinY()||r.y>a.getMaxY()||n.findStabbedSegments(r,s.getDirectedEdges(),i)}return i}if(3===arguments.length)if(Ys(arguments[2],Ha)&&arguments[0]instanceof Bs&&arguments[1]instanceof ec)for(var u=arguments[0],h=arguments[1],c=arguments[2],l=h.getEdge().getCoordinates(),p=0;p<l.length-1;p++){n._seg.p0=l[p],n._seg.p1=l[p+1],n._seg.p0.y>n._seg.p1.y&&n._seg.reverse(),Math.max(n._seg.p0.x,n._seg.p1.x)<u.x||n._seg.isHorizontal()||u.y<n._seg.p0.y||u.y>n._seg.p1.y||Pa.computeOrientation(n._seg.p0,n._seg.p1,u)===Pa.RIGHT||(t=h.getDepth(Ch.LEFT),n._seg.p0.equals(l[p])||(t=h.getDepth(Ch.RIGHT)),e=new $c(n._seg,t),c.add(e))}else if(Ys(arguments[2],Ha)&&arguments[0]instanceof Bs&&Ys(arguments[1],Ha))for(var f=arguments[0],g=arguments[2],d=arguments[1].iterator();d.hasNext();){var y=d.next();y.isForward()&&n.findStabbedSegments(f,y,g)}},Kc.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:pc.min(e)._leftDepth},Kc.prototype.interfaces_=function(){return[]},Kc.prototype.getClass=function(){return Kc},Qc.DepthSegment.get=function(){return $c},Object.defineProperties(Kc,Qc);var $c=function(t,e){this._upwardSeg=null,this._leftDepth=null;var n=e;this._upwardSeg=new Lc(t),this._leftDepth=n};$c.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||0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},$c.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},$c.prototype.toString=function(){return this._upwardSeg.toString()},$c.prototype.interfaces_=function(){return[Ds]},$c.prototype.getClass=function(){return $c};function tl(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null}tl.prototype.area=function(){return tl.area(this.p0,this.p1,this.p2)},tl.prototype.signedArea=function(){return tl.signedArea(this.p0,this.p1,this.p2)},tl.prototype.interpolateZ=function(t){if(null===t)throw new Rs;return tl.interpolateZ(t,this.p0,this.p1,this.p2)},tl.prototype.longestSideLength=function(){return tl.longestSideLength(this.p0,this.p1,this.p2)},tl.prototype.isAcute=function(){return tl.isAcute(this.p0,this.p1,this.p2)},tl.prototype.circumcentre=function(){return tl.circumcentre(this.p0,this.p1,this.p2)},tl.prototype.area3D=function(){return tl.area3D(this.p0,this.p1,this.p2)},tl.prototype.centroid=function(){return tl.centroid(this.p0,this.p1,this.p2)},tl.prototype.inCentre=function(){return tl.inCentre(this.p0,this.p1,this.p2)},tl.prototype.interfaces_=function(){return[]},tl.prototype.getClass=function(){return tl},tl.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)},tl.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},tl.det=function(t,e,n,r){return t*r-e*n},tl.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,h=r.y-o,c=s*h-a*u,l=t.x-i,p=t.y-o,f=(h*l-a*p)/c,g=(-u*l+s*p)/c;return e.z+f*(n.z-e.z)+g*(r.z-e.z)},tl.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return s<i&&(s=i),s<o&&(s=o),s},tl.isAcute=function(t,e,n){return!!Vc.isAcute(t,e,n)&&!!Vc.isAcute(e,n,t)&&!!Vc.isAcute(n,t,e)},tl.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,h=2*tl.det(o,s,a,u),c=tl.det(s,o*o+s*s,u,a*a+u*u),l=tl.det(o,o*o+s*s,a,a*a+u*u);return new Bs(r-c/h,i+l/h)},tl.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new ua(t.x+n/2,t.y+r/2,1),o=new ua(t.x-r+n/2,t.y+n+r/2,1);return new ua(i,o)},tl.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new Bs(t.x+i*o,t.y+i*s)},tl.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,h=i*u-o*a,c=o*s-r*u,l=r*a-i*s,p=h*h+c*c+l*l;return Math.sqrt(p)/2},tl.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Bs(r,i)},tl.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new Bs(a,u)};function el(t,e,n){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new $a;var r=e,i=n;this._inputGeom=t,this._distance=r,this._curveBuilder=i}el.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Xs.EXTERIOR,Xs.INTERIOR)},el.prototype.addPolygon=function(t){var e=this._distance,n=Ch.LEFT;this._distance<0&&(e=-this._distance,n=Ch.RIGHT);var r=t.getExteriorRing(),i=Za.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance))return null;if(this._distance<=0&&i.length<3)return null;this.addPolygonRing(i,e,n,Xs.EXTERIOR,Xs.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=Za.removeRepeatedPoints(s.getCoordinates());0<this._distance&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,Ch.opposite(n),Xs.INTERIOR,Xs.EXTERIOR)}},el.prototype.isTriangleErodedCompletely=function(t,e){var n=new tl(t[0],t[1],t[2]),r=n.inCentre();return Pa.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},el.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=Za.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,Xs.EXTERIOR,Xs.INTERIOR)},el.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new Mc(t,new qh(0,Xs.BOUNDARY,e,n));this._curveList.add(r)},el.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},el.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<eh.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=eh.MINIMUM_VALID_SIZE&&Pa.isCCW(t)&&(o=i,s=r,n=Ch.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},el.prototype.add=function(t){if(t.isEmpty())return null;t instanceof $u?this.addPolygon(t):t instanceof Ju?this.addLineString(t):t instanceof Ku?this.addPoint(t):(t instanceof th||t instanceof Fu||t instanceof nh||t instanceof Du)&&this.addCollection(t)},el.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 r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},el.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},el.prototype.interfaces_=function(){return[]},el.prototype.getClass=function(){return el};function nl(){}nl.prototype.locate=function(t){},nl.prototype.interfaces_=function(){return[]},nl.prototype.getClass=function(){return nl};function rl(t){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var e=t;this._parent=e,this._atStart=!0,this._index=0,this._max=e.getNumGeometries()}rl.prototype.next=function(){if(this._atStart)return this._atStart=!1,rl.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 Ja;var t=this._parent.getGeometryN(this._index++);return t instanceof Du?(this._subcollectionIterator=new rl(t),this._subcollectionIterator.next()):t},rl.prototype.remove=function(){throw new Error(this.getClass().getName())},rl.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)},rl.prototype.interfaces_=function(){return[Ua]},rl.prototype.getClass=function(){return rl},rl.isAtomic=function(t){return!(t instanceof Du)};function il(t){this._geom=null,this._geom=t}il.prototype.locate=function(t){return il.locate(t,this._geom)},il.prototype.interfaces_=function(){return[nl]},il.prototype.getClass=function(){return il},il.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&Pa.isPointInRing(t,e.getCoordinates())},il.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!il.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(il.isPointInRing(t,i))return!1}return!0},il.containsPoint=function(t,e){if(e instanceof $u)return il.containsPointInPolygon(t,e);if(e instanceof Du)for(var n=new rl(e);n.hasNext();){var r=n.next();if(r!==e&&il.containsPoint(t,r))return!0}return!1},il.locate=function(t,e){return!e.isEmpty()&&il.containsPoint(t,e)?Xs.INTERIOR:Xs.EXTERIOR};function ol(){this._edgeMap=new Nu,this._edgeList=null,this._ptInAreaLocation=[Xs.NONE,Xs.NONE]}ol.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)},ol.prototype.propagateSideLabels=function(t){for(var e=Xs.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,Ch.LEFT)!==Xs.NONE&&(e=r.getLocation(t,Ch.LEFT))}if(e===Xs.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,Ch.ON)===Xs.NONE&&a.setLocation(t,Ch.ON,i),a.isArea(t)){var u=a.getLocation(t,Ch.LEFT),h=a.getLocation(t,Ch.RIGHT);if(h!==Xs.NONE){if(h!==i)throw new Th("side location conflict",s.getCoordinate());u===Xs.NONE&&ya.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else ya.isTrue(a.getLocation(t,Ch.LEFT)===Xs.NONE,"found single null side"),a.setLocation(t,Ch.RIGHT,i),a.setLocation(t,Ch.LEFT,i)}}},ol.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},ol.prototype.print=function(t){ia.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},ol.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ol.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,Ch.LEFT);ya.isTrue(r!==Xs.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();ya.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,Ch.LEFT),u=s.getLocation(t,Ch.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},ol.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},ol.prototype.iterator=function(){return this.getEdges().iterator()},ol.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new $a(this._edgeMap.values())),this._edgeList},ol.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===Xs.NONE&&(this._ptInAreaLocation[t]=il.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},ol.prototype.toString=function(){var t=new Ws;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()},ol.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},ol.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 r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===Xs.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s,a,u=o.next(),h=u.getLabel(),c=0;c<2;c++){h.isAnyNull(c)&&(a=Xs.NONE,a=e[c]?Xs.EXTERIOR:(s=u.getCoordinate(),this.getLocation(c,s,t)),h.setAllLocationsIfNull(c,a))}},ol.prototype.getDegree=function(){return this._edgeMap.size()},ol.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},ol.prototype.interfaces_=function(){return[]},ol.prototype.getClass=function(){return ol};function sl(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=sl.orientation(t)}var al,ul,hl=((ul=ol)&&(pl.__proto__=ul),((pl.prototype=Object.create(ul&&ul.prototype)).constructor=pl).prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,r=0;r<this._resultAreaEdgeList.size();r++){var i=this._resultAreaEdgeList.get(r),o=i.getSym();if(i.getLabel().isArea())switch(null===t&&i.isInResult()&&(t=i),n){case this._SCANNING_FOR_INCOMING:if(!o.isInResult())continue;e=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!i.isInResult())continue;e.setNext(i),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new Th("no outgoing dirEdge found",this.getCoordinate());ya.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},pl.prototype.insert=function(t){this.insertEdgeEnd(t,t)},pl.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 r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return Zh.isNorthern(i)&&Zh.isNorthern(o)?n:Zh.isNorthern(i)||Zh.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(ya.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},pl.prototype.print=function(t){ia.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()}},pl.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new $a;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},pl.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))}},pl.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;0<=n;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},pl.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(Ch.LEFT),r=t.getDepth(Ch.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new Th("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(Ch.RIGHT,s),s=u.getDepth(Ch.LEFT)}return s}},pl.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},pl.prototype.linkMinimalDirectedEdges=function(t){for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=this._resultAreaEdgeList.size()-1;0<=i;i--){var o=this._resultAreaEdgeList.get(i),s=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),r){case this._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,r=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(o.getEdgeRing()!==t)continue;n.setNextMin(o),r=this._SCANNING_FOR_INCOMING}}r===this._LINKING_TO_OUTGOING&&(ya.isTrue(null!==e,"found null for first outgoing dirEdge"),ya.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},pl.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],r=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===n&&r++;return r}},pl.prototype.getLabel=function(){return this._label},pl.prototype.findCoveredLineEdges=function(){for(var t=Xs.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=Xs.INTERIOR;break}if(r.isInResult()){t=Xs.EXTERIOR;break}}}if(t===Xs.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===Xs.INTERIOR):(s.isInResult()&&(i=Xs.EXTERIOR),a.isInResult()&&(i=Xs.INTERIOR))}},pl.prototype.computeLabelling=function(t){ul.prototype.computeLabelling.call(this,t),this._label=new qh(Xs.NONE);for(var e=this.iterator();e.hasNext();)for(var n=e.next().getEdge().getLabel(),r=0;r<2;r++){var i=n.getLocation(r);i!==Xs.INTERIOR&&i!==Xs.BOUNDARY||this._label.setLocation(r,Xs.INTERIOR)}},pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl},pl),cl=((al=$h)&&(ll.__proto__=al),((ll.prototype=Object.create(al&&al.prototype)).constructor=ll).prototype.createNode=function(t){return new Wh(t,new hl)},ll.prototype.interfaces_=function(){return[]},ll.prototype.getClass=function(){return ll},ll);function ll(){al.apply(this,arguments)}function pl(){ul.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}sl.prototype.compareTo=function(t){return sl.compareOriented(this._pts,this._orientation,t._pts,t._orientation)},sl.prototype.interfaces_=function(){return[Ds]},sl.prototype.getClass=function(){return sl},sl.orientation=function(t){return 1===Za.increasingDirection(t)},sl.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,h=r?0:n.length-1;;){var c=t[u].compareTo(n[h]);if(0!==c)return c;var l=(u+=i)===s,p=(h+=o)===a;if(l&&!p)return-1;if(!l&&p)return 1;if(l&&p)return 0}};function fl(){this._edges=new $a,this._ocaMap=new Nu}fl.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);0<e&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)0<i&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},fl.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},fl.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},fl.prototype.iterator=function(){return this._edges.iterator()},fl.prototype.getEdges=function(){return this._edges},fl.prototype.get=function(t){return this._edges.get(t)},fl.prototype.findEqualEdge=function(t){var e=new sl(t.getCoordinates());return this._ocaMap.get(e)},fl.prototype.add=function(t){this._edges.add(t);var e=new sl(t.getCoordinates());this._ocaMap.put(e,t)},fl.prototype.interfaces_=function(){return[]},fl.prototype.getClass=function(){return fl};function gl(){}gl.prototype.processIntersections=function(t,e,n,r){},gl.prototype.isDone=function(){},gl.prototype.interfaces_=function(){return[]},gl.prototype.getClass=function(){return gl};function dl(){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;var t=arguments[this.numTests=0];this._li=t}dl.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(dl.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},dl.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},dl.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},dl.prototype.getLineIntersector=function(){return this._li},dl.prototype.hasProperIntersection=function(){return this._hasProper},dl.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},dl.prototype.hasIntersection=function(){return this._hasIntersection},dl.prototype.isDone=function(){return!1},dl.prototype.hasInteriorIntersection=function(){return this._hasInterior},dl.prototype.interfaces_=function(){return[gl]},dl.prototype.getClass=function(){return dl},dl.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};function yl(t,e,n){this.coord=null,this.segmentIndex=null,this.dist=null;var r=e,i=n;this.coord=new Bs(t),this.segmentIndex=r,this.dist=i}yl.prototype.getSegmentIndex=function(){return this.segmentIndex},yl.prototype.getCoordinate=function(){return this.coord},yl.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},yl.prototype.compareTo=function(t){return this.compare(t.segmentIndex,t.dist)},yl.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},yl.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},yl.prototype.getDistance=function(){return this.dist},yl.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},yl.prototype.interfaces_=function(){return[Ds]},yl.prototype.getClass=function(){return yl};var _l=function(t){this._nodeMap=new Nu,this.edge=null;this.edge=t};_l.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},_l.prototype.iterator=function(){return this._nodeMap.values().iterator()},_l.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},_l.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)},_l.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=0<e.dist||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new Bs(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Il(o,new qh(this.edge._label))},_l.prototype.add=function(t,e,n){var r=new yl(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},_l.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},_l.prototype.interfaces_=function(){return[]},_l.prototype.getClass=function(){return _l};function ml(){}ml.prototype.getChainStartIndices=function(t){var e=0,n=new $a;n.add(new Js(e));do{var r=this.findChainEnd(t,e);n.add(new Js(r)),e=r}while(e<t.length-1);return ml.toIntArray(n)},ml.prototype.findChainEnd=function(t,e){for(var n=Zh.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&Zh.quadrant(t[r-1],t[r])===n;)r++;return r-1},ml.prototype.interfaces_=function(){return[]},ml.prototype.getClass=function(){return ml},ml.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};function vl(t){this.e=null,this.pts=null,this.startIndex=null,this.env1=new ha,this.env2=new ha;var e=t;this.e=e,this.pts=e.getCoordinates();var n=new ml;this.startIndex=n.getChainStartIndices(this.pts)}vl.prototype.getCoordinates=function(){return this.pts},vl.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return n<e?e:n},vl.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},vl.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],h=arguments[5],c=this.pts[i],l=this.pts[o],p=s.pts[a],f=s.pts[u];if(o-i==1&&u-a==1)return h.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,l),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),d=Math.trunc((a+u)/2);i<g&&(a<d&&this.computeIntersectsForChain(i,g,s,a,d,h),d<u&&this.computeIntersectsForChain(i,g,s,d,u,h)),g<o&&(a<d&&this.computeIntersectsForChain(g,o,s,a,d,h),d<u&&this.computeIntersectsForChain(g,o,s,d,u,h))}},vl.prototype.getStartIndexes=function(){return this.startIndex},vl.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},vl.prototype.interfaces_=function(){return[]},vl.prototype.getClass=function(){return vl};var xl=function t(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},El={NULL_VALUE:{configurable:!0}};xl.prototype.getDepth=function(t,e){return this._depth[t][e]},xl.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},xl.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]!==xl.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===xl.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===xl.NULL_VALUE}},xl.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 r=0;this._depth[t][n]>e&&(r=1),this._depth[t][n]=r}}},xl.prototype.getDelta=function(t){return this._depth[t][Ch.RIGHT]-this._depth[t][Ch.LEFT]},xl.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?Xs.EXTERIOR:Xs.INTERIOR},xl.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},xl.prototype.add=function(){var t,e;if(1===arguments.length)for(var n=arguments[0],r=0;r<2;r++)for(var i=1;i<3;i++){var o=n.getLocation(r,i);o!==Xs.EXTERIOR&&o!==Xs.INTERIOR||(this.isNull(r,i)?this._depth[r][i]=xl.depthAtLocation(o):this._depth[r][i]+=xl.depthAtLocation(o))}else 3===arguments.length&&(t=arguments[0],e=arguments[1],arguments[2]===Xs.INTERIOR&&this._depth[t][e]++)},xl.prototype.interfaces_=function(){return[]},xl.prototype.getClass=function(){return xl},xl.depthAtLocation=function(t){return t===Xs.EXTERIOR?0:t===Xs.INTERIOR?1:xl.NULL_VALUE},El.NULL_VALUE.get=function(){return-1},Object.defineProperties(xl,El);function wl(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new fl,this._bufParams=t||null}var bl,Il=((bl=Bh)&&(Nl.__proto__=bl),((Nl.prototype=Object.create(bl&&bl.prototype)).constructor=Nl).prototype.getDepth=function(){return this._depth},Nl.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new Nl(t,qh.toLineLabel(this._label))},Nl.prototype.isIsolated=function(){return this._isIsolated},Nl.prototype.getCoordinates=function(){return this.pts},Nl.prototype.setIsolated=function(t){this._isIsolated=t},Nl.prototype.setName=function(t){this._name=t},Nl.prototype.equals=function(t){if(!(t instanceof Nl))return!1;var e=t;if(this.pts.length!==e.pts.length)return!1;for(var n=!0,r=!0,i=this.pts.length,o=0;o<this.pts.length;o++)if(this.pts[o].equals2D(e.pts[o])||(n=!1),this.pts[o].equals2D(e.pts[--i])||(r=!1),!n&&!r)return!1;return!0},Nl.prototype.getCoordinate=function(){if(0===arguments.length)return 0<this.pts.length?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},Nl.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)0<e&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},Nl.prototype.computeIM=function(t){Nl.updateIM(this._label,t)},Nl.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},Nl.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},Nl.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},Nl.prototype.getDepthDelta=function(){return this._depthDelta},Nl.prototype.getNumPoints=function(){return this.pts.length},Nl.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;0<=e;e--)t.print(this.pts[e]+" ");t.println("")},Nl.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new vl(this)),this._mce},Nl.prototype.getEnvelope=function(){if(null===this._env){this._env=new ha;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},Nl.prototype.addIntersection=function(t,e,n,r){var i,o=new Bs(t.getIntersection(r)),s=e,a=t.getEdgeDistance(n,r),u=s+1;u<this.pts.length&&(i=this.pts[u],o.equals2D(i)&&(s=u,a=0)),this.eiList.add(o,s,a)},Nl.prototype.toString=function(){var t=new Ws;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)0<e&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},Nl.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},Nl.prototype.setDepthDelta=function(t){this._depthDelta=t},Nl.prototype.getEdgeIntersectionList=function(){return this.eiList},Nl.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},Nl.prototype.interfaces_=function(){return[]},Nl.prototype.getClass=function(){return Nl},Nl.updateIM=function(){if(2!==arguments.length)return bl.prototype.updateIM.apply(this,arguments);var t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,Ch.ON),t.getLocation(1,Ch.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,Ch.LEFT),t.getLocation(1,Ch.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,Ch.RIGHT),t.getLocation(1,Ch.RIGHT),2))},Nl);function Nl(){var t,e,n;bl.call(this),this.pts=null,this._env=null,this.eiList=new _l(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new xl,this._depthDelta=0,1===arguments.length?(t=arguments[0],Nl.call(this,t,null)):2===arguments.length&&(e=arguments[0],n=arguments[1],this.pts=e,this._label=n)}wl.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},wl.prototype.insertUniqueEdge=function(t){var e,n,r,i,o=this._edgeList.findEqualEdge(t);null!==o?(e=o.getLabel(),n=t.getLabel(),o.isPointwiseEqual(t)||(n=new qh(t.getLabel())).flip(),e.merge(n),r=wl.depthDelta(n),i=o.getDepthDelta()+r,o.setDepthDelta(i)):(this._edgeList.add(t),t.setDepthDelta(wl.depthDelta(t.getLabel())))},wl.prototype.buildSubgraphs=function(t,e){for(var n=new $a,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new Kc(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},wl.prototype.createSubgraphs=function(t){for(var e=new $a,n=t.getNodes().iterator();n.hasNext();){var r,i=n.next();i.isVisited()||((r=new Dh).create(i),e.add(r))}return pc.sort(e,pc.reverseOrder()),e},wl.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},wl.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new Gc,n=new Sa;return n.setPrecisionModel(t),e.setSegmentIntersector(new dl(n)),e},wl.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new Zc(n,this._bufParams),i=new el(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new rc(new cl),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new ic(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},wl.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i,o,s=r.next(),a=s.getCoordinates();2===a.length&&a[0].equals2D(a[1])||(i=s.getData(),o=new Il(s.getCoordinates(),new qh(i)),this.insertUniqueEdge(o))}},wl.prototype.setNoder=function(t){this._workingNoder=t},wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl},wl.depthDelta=function(t){var e=t.getLocation(0,Ch.LEFT),n=t.getLocation(0,Ch.RIGHT);return e===Xs.INTERIOR&&n===Xs.EXTERIOR?1:e===Xs.EXTERIOR&&n===Xs.INTERIOR?-1:0},wl.convertSegStrings=function(t){for(var e=new mh,n=new $a;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};function Cl(t,e,n,r){var i,o,s,a;this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length?(i=e,this._noder=t,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()):4===arguments.length&&(o=e,s=n,a=r,this._noder=t,this._scaleFactor=o,this._offsetX=s,this._offsetY=a,this._isScaled=!this.isIntegerPrecision())}Cl.prototype.rescale=function(){if(Ys(arguments[0],Xa))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],r=0;r<n.length;r++)n[r].x=n[r].x/this._scaleFactor+this._offsetX,n[r].y=n[r].y/this._scaleFactor+this._offsetY;2===n.length&&n[0].equals2D(n[1])&&ia.out.println(n)}},Cl.prototype.scale=function(){if(Ys(arguments[0],Xa)){for(var t=arguments[0],e=new $a,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Mc(this.scale(r.getCoordinates()),r.getData()))}return e}if(arguments[0]instanceof Array){for(var i=arguments[0],o=new Array(i.length).fill(null),s=0;s<i.length;s++)o[s]=new Bs(Math.round((i[s].x-this._offsetX)*this._scaleFactor),Math.round((i[s].y-this._offsetY)*this._scaleFactor),i[s].z);return Za.removeRepeatedPoints(o)}},Cl.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Cl.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Cl.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Cl.prototype.interfaces_=function(){return[Ac]},Cl.prototype.getClass=function(){return Cl};function Sl(t){this._li=new Sa,this._segStrings=null,this._segStrings=t}var Ml={fact:{configurable:!0}};Sl.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],r=arguments[1].iterator();r.hasNext();)for(var i=r.next().getCoordinates(),o=1;o<i.length-1;o++)if(i[o].equals(n))throw new va("found endpt/interior pt intersection at index "+o+" :pt "+n)},Sl.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 r=n.next();this.checkInteriorIntersections(e,r)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var h=0;h<a.length-1;h++)this.checkInteriorIntersections(i,u,o,h);else if(4===arguments.length){var c=arguments[0],l=arguments[1],p=arguments[2],f=arguments[3];if(c===p&&l===f)return null;var g=c.getCoordinates()[l],d=c.getCoordinates()[l+1],y=p.getCoordinates()[f],_=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 va("found non-noded intersection at "+g+"-"+d+" and "+y+"-"+_)}},Sl.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Sl.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(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])},Sl.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},Sl.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new va("found non-noded collapse at "+Sl.fact.createLineString([t,e,n]))},Sl.prototype.interfaces_=function(){return[]},Sl.prototype.getClass=function(){return Sl},Ml.fact.get=function(){return new mh},Object.defineProperties(Sl,Ml);function Ll(t,e,n){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 r=t,i=e,o=n;if(this._originalPt=r,this._pt=r,this._scaleFactor=i,this._li=o,i<=0)throw new Rs;1!==i&&(this._pt=new Bs(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new Bs,this._p1Scaled=new Bs),this.initCorners(this._pt)}var Pl={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Ll.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return ya.isTrue(!(s&&a),"Found bad envelope test"),a},Ll.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 Bs(this._maxx,this._maxy),this._corner[1]=new Bs(this._minx,this._maxy),this._corner[2]=new Bs(this._minx,this._miny),this._corner[3]=new Bs(this._maxx,this._miny)},Ll.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))},Ll.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Ll.prototype.getCoordinate=function(){return this._originalPt},Ll.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Ll.prototype.getSafeEnvelope=function(){var t;return null===this._safeEnv&&(t=Ll.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor,this._safeEnv=new ha(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)),this._safeEnv},Ll.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()))))},Ll.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!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()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||n&&r||t.equals(this._pt)||e.equals(this._pt)))))},Ll.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},Ll.prototype.interfaces_=function(){return[]},Ll.prototype.getClass=function(){return Ll},Pl.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Ll,Pl);function Ol(){this.tempEnv1=new ha,this.selectedSegment=new Lc}Ol.prototype.select=function(){var t;1===arguments.length||2===arguments.length&&(t=arguments[1],arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment))},Ol.prototype.interfaces_=function(){return[]},Ol.prototype.getClass=function(){return Ol};function Rl(t){this._index=null,this._index=t}var Tl={HotPixelSnapAction:{configurable:!0}};Rl.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],r=arguments[2],i=e.getSafeEnvelope(),o=new Fl(e,n,r);return this._index.query(i,{interfaces_:function(){return[uc]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},Rl.prototype.interfaces_=function(){return[]},Rl.prototype.getClass=function(){return Rl},Tl.HotPixelSnapAction.get=function(){return Fl},Object.defineProperties(Rl,Tl);function Al(t){this._li=null,this._interiorIntersections=null,this._li=t,this._interiorIntersections=new $a}var Dl,Fl=((Dl=Ol)&&(ql.__proto__=Dl),((ql.prototype=Object.create(Dl&&Dl.prototype)).constructor=ql).prototype.isNodeAdded=function(){return this._isNodeAdded},ql.prototype.select=function(){if(2!==arguments.length)return Dl.prototype.select.apply(this,arguments);var t=arguments[1],e=arguments[0].getContext();if(null!==this._parentEdge&&e===this._parentEdge&&t===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(e,t)},ql.prototype.interfaces_=function(){return[]},ql.prototype.getClass=function(){return ql},ql);function ql(){Dl.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._hotPixel=t,this._parentEdge=e,this._hotPixelVertexIndex=n}Al.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,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,r,1)}},Al.prototype.isDone=function(){return!1},Al.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Al.prototype.interfaces_=function(){return[gl]},Al.prototype.getClass=function(){return Al};function Gl(t){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var e=t;this._pm=e,this._li=new Sa,this._li.setPrecisionModel(e),this._scaleFactor=e.getScale()}Gl.prototype.checkCorrectness=function(t){var e=Mc.getNodedSubstrings(t),n=new Sl(e);try{n.checkValid()}catch(t){if(!(t instanceof ra))throw t;t.printStackTrace()}},Gl.prototype.getNodedSubstrings=function(){return Mc.getNodedSubstrings(this._nodedSegStrings)},Gl.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},Gl.prototype.findInteriorIntersections=function(t,e){var n=new Al(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},Gl.prototype.computeVertexSnaps=function(){if(Ys(arguments[0],Xa))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof Mc)for(var n=arguments[0],r=n.getCoordinates(),i=0;i<r.length;i++){var o=new Ll(r[i],this._scaleFactor,this._li);this._pointSnapper.snap(o,n,i)&&n.addIntersection(r[i],i)}},Gl.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Gc,this._pointSnapper=new Rl(this._noder.getIndex()),this.snapRound(t,this._li)},Gl.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=new Ll(n,this._scaleFactor,this._li);this._pointSnapper.snap(r)}},Gl.prototype.interfaces_=function(){return[Ac]},Gl.prototype.getClass=function(){return Gl};var Bl=function(t,e){var n;this._argGeom=null,this._distance=null,this._bufParams=new Fc,this._resultGeometry=null,this._saveException=null,1===arguments.length?this._argGeom=t:2===arguments.length&&(n=e,this._argGeom=t,this._bufParams=n)},kl={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Bl.prototype.bufferFixedPrecision=function(t){var e=new Cl(new Gl(new lh(1)),t.getScale()),n=new wl(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},Bl.prototype.bufferReducedPrecision=function(){var t,e,n;if(0===arguments.length){for(var r=Bl.MAX_PRECISION_DIGITS;0<=r;r--){try{this.bufferReducedPrecision(r)}catch(r){if(!(r instanceof Th))throw r;this._saveException=r}if(null!==this._resultGeometry)return null}throw this._saveException}1===arguments.length&&(t=arguments[0],e=Bl.precisionScaleFactor(this._argGeom,this._distance,t),n=new lh(e),this.bufferFixedPrecision(n))},Bl.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===lh.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Bl.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Bl.prototype.bufferOriginalPrecision=function(){try{var t=new wl(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof va))throw t;this._saveException=t}},Bl.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Bl.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Bl.prototype.interfaces_=function(){return[]},Bl.prototype.getClass=function(){return Bl},Bl.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new Bl(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ta&&"number"==typeof arguments[1]){var e=arguments[1],n=arguments[2],r=new Bl(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof Fc&&arguments[0]instanceof Ta&&"number"==typeof arguments[1]){var i=arguments[1];return new Bl(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new Bl(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},Bl.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Vs.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(0<e?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},kl.CAP_ROUND.get=function(){return Fc.CAP_ROUND},kl.CAP_BUTT.get=function(){return Fc.CAP_FLAT},kl.CAP_FLAT.get=function(){return Fc.CAP_FLAT},kl.CAP_SQUARE.get=function(){return Fc.CAP_SQUARE},kl.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Bl,kl);function zl(){this._pt=[new Bs,new Bs],this._distance=Ts.NaN,this._isNull=!0}zl.prototype.getCoordinates=function(){return this._pt},zl.prototype.getCoordinate=function(t){return this._pt[t]},zl.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 r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},zl.prototype.initialize=function(){var t,e,n,r,i;0===arguments.length?this._isNull=!0:2===arguments.length?(t=arguments[0],e=arguments[1],this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1):3===arguments.length&&(n=arguments[0],r=arguments[1],i=arguments[2],this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1)},zl.prototype.getDistance=function(){return this._distance},zl.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 r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},zl.prototype.interfaces_=function(){return[]},zl.prototype.getClass=function(){return zl};function jl(){}jl.prototype.interfaces_=function(){return[]},jl.prototype.getClass=function(){return jl},jl.computeDistance=function(){if(arguments[2]instanceof zl&&arguments[0]instanceof Ju&&arguments[1]instanceof Bs)for(var t=arguments[1],e=arguments[2],n=arguments[0].getCoordinates(),r=new Lc,i=0;i<n.length-1;i++){r.setCoordinates(n[i],n[i+1]);var o=r.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof zl&&arguments[0]instanceof $u&&arguments[1]instanceof Bs){var s=arguments[0],a=arguments[1],u=arguments[2];jl.computeDistance(s.getExteriorRing(),a,u);for(var h=0;h<s.getNumInteriorRing();h++)jl.computeDistance(s.getInteriorRingN(h),a,u)}else if(arguments[2]instanceof zl&&arguments[0]instanceof Ta&&arguments[1]instanceof Bs){var c=arguments[0],l=arguments[1],p=arguments[2];if(c instanceof Ju)jl.computeDistance(c,l,p);else if(c instanceof $u)jl.computeDistance(c,l,p);else if(c instanceof Du)for(var f=c,g=0;g<f.getNumGeometries();g++){var d=f.getGeometryN(g);jl.computeDistance(d,l,p)}else p.setMinimum(c.getCoordinate(),l)}else{var y,_,m;arguments[2]instanceof zl&&arguments[0]instanceof Lc&&arguments[1]instanceof Bs&&(y=arguments[1],_=arguments[2],m=arguments[0].closestPoint(y),_.setMinimum(m,y))}};function Xl(t){this._maxPtDist=new zl,this._inputGeom=t||null}var Ul={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Xl.prototype.computeMaxMidpointDistance=function(t){var e=new Vl(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Xl.prototype.computeMaxVertexDistance=function(t){var e=new Yl(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Xl.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Xl.prototype.getDistancePoints=function(){return this._maxPtDist},Xl.prototype.interfaces_=function(){return[]},Xl.prototype.getClass=function(){return Xl},Ul.MaxPointDistanceFilter.get=function(){return Yl},Ul.MaxMidpointDistanceFilter.get=function(){return Vl},Object.defineProperties(Xl,Ul);var Yl=function(t){this._maxPtDist=new zl,this._minPtDist=new zl,this._geom=t||null};Yl.prototype.filter=function(t){this._minPtDist.initialize(),jl.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Yl.prototype.getMaxPointDistance=function(){return this._maxPtDist},Yl.prototype.interfaces_=function(){return[Fa]},Yl.prototype.getClass=function(){return Yl};var Vl=function(t){this._maxPtDist=new zl,this._minPtDist=new zl,this._geom=t||null};Vl.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new Bs((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),jl.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Vl.prototype.isDone=function(){return!1},Vl.prototype.isGeometryChanged=function(){return!1},Vl.prototype.getMaxPointDistance=function(){return this._maxPtDist},Vl.prototype.interfaces_=function(){return[Au]},Vl.prototype.getClass=function(){return Vl};function Hl(t){this._comps=t||null}Hl.prototype.filter=function(t){t instanceof $u&&this._comps.add(t)},Hl.prototype.interfaces_=function(){return[Tu]},Hl.prototype.getClass=function(){return Hl},Hl.getPolygons=function(){if(1===arguments.length)return Hl.getPolygons(arguments[0],new $a);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof $u?e.add(t):t instanceof Du&&t.apply(new Hl(e)),e}};function Wl(t,e){var n;this._lines=null,this._isForcedToLineString=!1,1===arguments.length?this._lines=t:2===arguments.length&&(n=e,this._lines=t,this._isForcedToLineString=n)}Wl.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof eh){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Ju&&this._lines.add(t)},Wl.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Wl.prototype.interfaces_=function(){return[Ra]},Wl.prototype.getClass=function(){return Wl},Wl.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(Wl.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(Wl.getLines(e,n))}},Wl.getLines=function(){if(1===arguments.length)return Wl.getLines(arguments[0],!1);if(2===arguments.length){if(Ys(arguments[0],Xa)&&Ys(arguments[1],Xa)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var n=e.next();Wl.getLines(n,t)}return t}if(arguments[0]instanceof Ta&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1],o=new $a;return r.apply(new Wl(o,i)),o}if(arguments[0]instanceof Ta&&Ys(arguments[1],Xa)){var s=arguments[0],a=arguments[1];return s instanceof Ju?a.add(s):s.apply(new Wl(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&Ys(arguments[0],Xa)&&Ys(arguments[1],Xa)){for(var u=arguments[1],h=arguments[2],c=arguments[0].iterator();c.hasNext();){var l=c.next();Wl.getLines(l,u,h)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Ta&&Ys(arguments[1],Xa)){var p=arguments[1],f=arguments[2];return arguments[0].apply(new Wl(p,f)),p}}};function Jl(t){if(this._boundaryRule=qa.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0!==arguments.length&&1===arguments.length){if(null===t)throw new Rs;this._boundaryRule=t}}Jl.prototype.locateInternal=function(){if(arguments[0]instanceof Bs&&arguments[1]instanceof $u){var t=arguments[0],e=arguments[1];if(e.isEmpty())return Xs.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===Xs.EXTERIOR)return Xs.EXTERIOR;if(r===Xs.BOUNDARY)return Xs.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===Xs.INTERIOR)return Xs.EXTERIOR;if(s===Xs.BOUNDARY)return Xs.BOUNDARY}return Xs.INTERIOR}if(arguments[0]instanceof Bs&&arguments[1]instanceof Ju){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return Xs.EXTERIOR;var h=u.getCoordinates();return u.isClosed()||!a.equals(h[0])&&!a.equals(h[h.length-1])?Pa.isOnLine(a,h)?Xs.INTERIOR:Xs.EXTERIOR:Xs.BOUNDARY}if(arguments[0]instanceof Bs&&arguments[1]instanceof Ku){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?Xs.INTERIOR:Xs.EXTERIOR}},Jl.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?Pa.locatePointInRing(t,e.getCoordinates()):Xs.EXTERIOR},Jl.prototype.intersects=function(t,e){return this.locate(t,e)!==Xs.EXTERIOR},Jl.prototype.updateLocationInfo=function(t){t===Xs.INTERIOR&&(this._isIn=!0),t===Xs.BOUNDARY&&this._numBoundaries++},Jl.prototype.computeLocation=function(t,e){if(e instanceof Ku&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Ju)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof $u)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Fu)for(var n=e,r=0;r<n.getNumGeometries();r++){var i=n.getGeometryN(r);this.updateLocationInfo(this.locateInternal(t,i))}else if(e instanceof nh)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 Du)for(var u=new rl(e);u.hasNext();){var h=u.next();h!==e&&this.computeLocation(t,h)}},Jl.prototype.locate=function(t,e){return e.isEmpty()?Xs.EXTERIOR:e instanceof Ju||e instanceof $u?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?Xs.BOUNDARY:0<this._numBoundaries||this._isIn?Xs.INTERIOR:Xs.EXTERIOR)},Jl.prototype.interfaces_=function(){return[]},Jl.prototype.getClass=function(){return Jl};function Zl(){var t,e,n;this._component=null,this._segIndex=null,this._pt=null,2===arguments.length?Zl.call(this,arguments[0],Zl.INSIDE_AREA,arguments[1]):3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],this._component=t,this._segIndex=e,this._pt=n)}var Kl={INSIDE_AREA:{configurable:!0}};Zl.prototype.isInsideArea=function(){return this._segIndex===Zl.INSIDE_AREA},Zl.prototype.getCoordinate=function(){return this._pt},Zl.prototype.getGeometryComponent=function(){return this._component},Zl.prototype.getSegmentIndex=function(){return this._segIndex},Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl},Kl.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Zl,Kl);function Ql(t){this._pts=t||null}Ql.prototype.filter=function(t){t instanceof Ku&&this._pts.add(t)},Ql.prototype.interfaces_=function(){return[Tu]},Ql.prototype.getClass=function(){return Ql},Ql.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Ku?pc.singletonList(t):Ql.getPoints(t,new $a)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Ku?n.add(e):e instanceof Du&&e.apply(new Ql(n)),n}};function $l(t){this._locations=null,this._locations=t}$l.prototype.filter=function(t){(t instanceof Ku||t instanceof Ju||t instanceof $u)&&this._locations.add(new Zl(t,0,t.getCoordinate()))},$l.prototype.interfaces_=function(){return[Tu]},$l.prototype.getClass=function(){return $l},$l.getLocations=function(t){var e=new $a;return t.apply(new $l(e)),e};function tp(t,e,n){var r,i,o;this._geom=null,this._terminateDistance=0,this._ptLocator=new Jl,this._minDistanceLocation=null,this._minDistance=Ts.MAX_VALUE,2===arguments.length?(this._geom=[t,e],this._terminateDistance=0):3===arguments.length&&(r=t,i=e,o=n,this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=i,this._terminateDistance=o)}tp.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],r=1-e,i=Hl.getPolygons(this._geom[e]);if(0<i.size()){var o=$l.getLocations(this._geom[r]);if(this.computeContainmentDistance(o,i,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&Ys(arguments[0],Ha)&&Ys(arguments[1],Ha)){for(var s=arguments[0],a=arguments[1],u=arguments[2],h=0;h<s.size();h++)for(var c=s.get(h),l=0;l<a.size();l++)if(this.computeContainmentDistance(c,a.get(l),u),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Zl&&arguments[1]instanceof $u){var p=arguments[0],f=arguments[1],g=arguments[2],d=p.getCoordinate();if(Xs.EXTERIOR!==this._ptLocator.locate(d,f))return g[this._minDistance=0]=p,g[1]=new Zl(f,d),null}},tp.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},tp.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=Wl.getLines(this._geom[0]),n=Wl.getLines(this._geom[1]),r=Ql.getPoints(this._geom[0]),i=Ql.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,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},tp.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},tp.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;this._minDistanceLocation[1]=e?(this._minDistanceLocation[0]=t[1],t[0]):(this._minDistanceLocation[0]=t[0],t[1])},tp.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},tp.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 Ju&&arguments[1]instanceof Ku){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this._minDistance)return null;for(var r=t.getCoordinates(),i=e.getCoordinate(),o=0;o<r.length-1;o++){var s,a=Pa.distancePointLine(i,r[o],r[o+1]);if(a<this._minDistance&&(this._minDistance=a,s=new Lc(r[o],r[o+1]).closestPoint(i),n[0]=new Zl(t,o,s),n[1]=new Zl(e,0,i)),this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ju&&arguments[1]instanceof Ju){var u=arguments[0],h=arguments[1],c=arguments[2];if(u.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this._minDistance)return null;for(var l=u.getCoordinates(),p=h.getCoordinates(),f=0;f<l.length-1;f++)for(var g=0;g<p.length-1;g++){var d,y,_,m=Pa.distanceLineLine(l[f],l[f+1],p[g],p[g+1]);if(m<this._minDistance&&(this._minDistance=m,d=new Lc(l[f],l[f+1]),y=new Lc(p[g],p[g+1]),_=d.closestPoints(y),c[0]=new Zl(u,f,_[0]),c[1]=new Zl(h,g,_[1])),this._minDistance<=this._terminateDistance)return null}}},tp.prototype.computeMinDistancePoints=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o),a=i.getCoordinate().distance(s.getCoordinate());if(a<this._minDistance&&(this._minDistance=a,n[0]=new Zl(i,0,i.getCoordinate()),n[1]=new Zl(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},tp.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new Rs;return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},tp.prototype.computeMinDistanceLines=function(t,e,n){for(var r=0;r<t.size();r++)for(var i=t.get(r),o=0;o<e.size();o++){var s=e.get(o);if(this.computeMinDistance(i,s,n),this._minDistance<=this._terminateDistance)return null}},tp.prototype.interfaces_=function(){return[]},tp.prototype.getClass=function(){return tp},tp.distance=function(t,e){return new tp(t,e).distance()},tp.isWithinDistance=function(t,e,n){return new tp(t,e,n).distance()<=n},tp.nearestPoints=function(t,e){return new tp(t,e).nearestPoints()};function ep(){this._pt=[new Bs,new Bs],this._distance=Ts.NaN,this._isNull=!0}ep.prototype.getCoordinates=function(){return this._pt},ep.prototype.getCoordinate=function(t){return this._pt[t]},ep.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 r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},ep.prototype.initialize=function(){var t,e,n,r,i;0===arguments.length?this._isNull=!0:2===arguments.length?(t=arguments[0],e=arguments[1],this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1):3===arguments.length&&(n=arguments[0],r=arguments[1],i=arguments[2],this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1)},ep.prototype.toString=function(){return fa.toLineString(this._pt[0],this._pt[1])},ep.prototype.getDistance=function(){return this._distance},ep.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 r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},ep.prototype.interfaces_=function(){return[]},ep.prototype.getClass=function(){return ep};function np(){}np.prototype.interfaces_=function(){return[]},np.prototype.getClass=function(){return np},np.computeDistance=function(){if(arguments[2]instanceof ep&&arguments[0]instanceof Ju&&arguments[1]instanceof Bs)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Lc,i=t.getCoordinates(),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 ep&&arguments[0]instanceof $u&&arguments[1]instanceof Bs){var a=arguments[0],u=arguments[1],h=arguments[2];np.computeDistance(a.getExteriorRing(),u,h);for(var c=0;c<a.getNumInteriorRing();c++)np.computeDistance(a.getInteriorRingN(c),u,h)}else if(arguments[2]instanceof ep&&arguments[0]instanceof Ta&&arguments[1]instanceof Bs){var l=arguments[0],p=arguments[1],f=arguments[2];if(l instanceof Ju)np.computeDistance(l,p,f);else if(l instanceof $u)np.computeDistance(l,p,f);else if(l instanceof Du)for(var g=l,d=0;d<g.getNumGeometries();d++){var y=g.getGeometryN(d);np.computeDistance(y,p,f)}else f.setMinimum(l.getCoordinate(),p)}else{var _,m,v;arguments[2]instanceof ep&&arguments[0]instanceof Lc&&arguments[1]instanceof Bs&&(_=arguments[1],m=arguments[2],v=arguments[0].closestPoint(_),m.setMinimum(v,_))}};function rp(t,e){this._g0=null,this._g1=null,this._ptDist=new ep;var n=arguments[this._densifyFrac=0],r=e;this._g0=n,this._g1=r}var ip={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};rp.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},rp.prototype.setDensifyFraction=function(t){if(1<t||t<=0)throw new Rs;this._densifyFrac=t},rp.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},rp.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},rp.prototype.computeOrientedDistance=function(t,e,n){var r,i=new op(e);t.apply(i),n.setMaximum(i.getMaxPointDistance()),0<this._densifyFrac&&(r=new sp(e,this._densifyFrac),t.apply(r),n.setMaximum(r.getMaxPointDistance()))},rp.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},rp.prototype.interfaces_=function(){return[]},rp.prototype.getClass=function(){return rp},rp.distance=function(){if(2===arguments.length)return new rp(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new rp(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},ip.MaxPointDistanceFilter.get=function(){return op},ip.MaxDensifiedByFractionDistanceFilter.get=function(){return sp},Object.defineProperties(rp,ip);var op=function(t){this._maxPtDist=new ep,this._minPtDist=new ep,this._euclideanDist=new np,this._geom=null;this._geom=t};op.prototype.filter=function(t){this._minPtDist.initialize(),np.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},op.prototype.getMaxPointDistance=function(){return this._maxPtDist},op.prototype.interfaces_=function(){return[Fa]},op.prototype.getClass=function(){return op};var sp=function(t,e){this._maxPtDist=new ep,this._minPtDist=new ep,this._geom=null;var n=arguments[this._numSubSegs=0],r=e;this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/r))};sp.prototype.filter=function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=(r.x-n.x)/this._numSubSegs,o=(r.y-n.y)/this._numSubSegs,s=0;s<this._numSubSegs;s++){var a=n.x+s*i,u=n.y+s*o,h=new Bs(a,u);this._minPtDist.initialize(),np.computeDistance(this._geom,h,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},sp.prototype.isDone=function(){return!1},sp.prototype.isGeometryChanged=function(){return!1},sp.prototype.getMaxPointDistance=function(){return this._maxPtDist},sp.prototype.interfaces_=function(){return[Au]},sp.prototype.getClass=function(){return sp};function ap(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}var up={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};ap.prototype.checkMaximumDistance=function(t,e,n){var r,i=new rp(e,t);i.setDensifyFraction(.25),this._maxDistanceFound=i.orientedDistance(),this._maxDistanceFound>n&&(this._isValid=!1,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 "+fa.toLineString(r[0],r[1])+")")},ap.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=ap.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(0<this._bufDistance?this.checkPositiveValid():this.checkNegativeValid(),ap.VERBOSE&&ia.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},ap.prototype.checkNegativeValid=function(){if(!(this._input instanceof $u||this._input instanceof nh||this._input instanceof Du))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)},ap.prototype.getErrorIndicator=function(){return this._errorIndicator},ap.prototype.checkMinimumDistance=function(t,e,n){var r,i=new tp(t,e,n);this._minDistanceFound=i.distance(),this._minDistanceFound<n&&(this._isValid=!1,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 "+fa.toLineString(r[0],r[1])+" )")},ap.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)},ap.prototype.getErrorLocation=function(){return this._errorLocation},ap.prototype.getPolygonLines=function(t){for(var e=new $a,n=new Wl(e),r=Hl.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},ap.prototype.getErrorMessage=function(){return this._errMsg},ap.prototype.interfaces_=function(){return[]},ap.prototype.getClass=function(){return ap},up.VERBOSE.get=function(){return!1},up.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(ap,up);function hp(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}var cp={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};hp.prototype.isValid=function(){return this.checkPolygonal(),this._isValid&&(this.checkExpectedEmpty(),this._isValid&&(this.checkEnvelope(),this._isValid&&(this.checkArea(),this._isValid&&this.checkDistance()))),this._isValid},hp.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*hp.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new ha(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new ha(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")},hp.prototype.checkDistance=function(){var t=new ap(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")},hp.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();0<this._distance&&e<t&&(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")},hp.prototype.checkPolygonal=function(){this._result instanceof $u||this._result instanceof nh||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},hp.prototype.getErrorIndicator=function(){return this._errorIndicator},hp.prototype.getErrorLocation=function(){return this._errorLocation},hp.prototype.checkExpectedEmpty=function(){return 2<=this._input.getDimension()||0<this._distance?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},hp.prototype.report=function(t){if(!hp.VERBOSE)return null;ia.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},hp.prototype.getErrorMessage=function(){return this._errorMsg},hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},hp.isValidMsg=function(t,e,n){var r=new hp(t,e,n);return r.isValid()?null:r.getErrorMessage()},hp.isValid=function(t,e,n){return!!new hp(t,e,n).isValid()},cp.VERBOSE.get=function(){return!1},cp.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(hp,cp);function lp(t,e){this._pts=null,this._data=null;var n=e;this._pts=t,this._data=n}lp.prototype.getCoordinates=function(){return this._pts},lp.prototype.size=function(){return this._pts.length},lp.prototype.getCoordinate=function(t){return this._pts[t]},lp.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},lp.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Nc.octant(this.getCoordinate(t),this.getCoordinate(t+1))},lp.prototype.setData=function(t){this._data=t},lp.prototype.getData=function(){return this._data},lp.prototype.toString=function(){return fa.toLineString(new ah(this._pts))},lp.prototype.interfaces_=function(){return[Cc]},lp.prototype.getClass=function(){return lp};function pp(t){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new $a,this._intersectionCount=0,this._keepIntersections=!0,this._li=t,this._interiorIntersection=null}pp.prototype.getInteriorIntersection=function(){return this._interiorIntersection},pp.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},pp.prototype.getIntersectionSegments=function(){return this._intSegments},pp.prototype.count=function(){return this._intersectionCount},pp.prototype.getIntersections=function(){return this._intersections},pp.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},pp.prototype.setKeepIntersections=function(t){this._keepIntersections=t},pp.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(n,r))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,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++)},pp.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},pp.prototype.hasIntersection=function(){return null!==this._interiorIntersection},pp.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},pp.prototype.interfaces_=function(){return[gl]},pp.prototype.getClass=function(){return pp},pp.createAllIntersectionsFinder=function(t){var e=new pp(t);return e.setFindAllIntersections(!0),e},pp.createAnyIntersectionFinder=function(t){return new pp(t)},pp.createIntersectionCounter=function(t){var e=new pp(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};function fp(t){this._li=new Sa,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0,this._segStrings=t}fp.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},fp.prototype.getIntersections=function(){return this._segInt.getIntersections()},fp.prototype.isValid=function(){return this.execute(),this._isValid},fp.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},fp.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new pp(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Gc;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},fp.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Th(this.getErrorMessage(),this._segInt.getInteriorIntersection())},fp.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fa.toLineString(t[0],t[1])+" and "+fa.toLineString(t[2],t[3])},fp.prototype.interfaces_=function(){return[]},fp.prototype.getClass=function(){return fp},fp.computeIntersections=function(t){var e=new fp(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};function gp(){this._nv=null;var t=arguments[0];this._nv=new fp(gp.toSegmentStrings(t))}gp.prototype.checkValid=function(){this._nv.checkValid()},gp.prototype.interfaces_=function(){return[]},gp.prototype.getClass=function(){return gp},gp.toSegmentStrings=function(t){for(var e=new $a,n=t.iterator();n.hasNext();){var r=n.next();e.add(new lp(r.getCoordinates(),r))}return e},gp.checkValid=function(t){new gp(t).checkValid()};function dp(t){this._mapOp=t}dp.prototype.map=function(t){for(var e=new $a,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(mh.toGeometryArray(e))},dp.prototype.interfaces_=function(){return[]},dp.prototype.getClass=function(){return dp},dp.map=function(t,e){return new dp(e).map(t)};function yp(t,e,n){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new $a,this._resultLineList=new $a;var r=e,i=n;this._op=t,this._geometryFactory=r,this._ptLocator=i}yp.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)}},yp.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},yp.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},yp.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!uf.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},yp.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,r=e.next(),i=r.getEdge();r.isLineEdge()&&!i.isCoveredSet()&&(n=this._op.isCoveredByA(r.getCoordinate()),i.setCovered(n))}},yp.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},yp.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},yp.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(ya.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(uf.isResultOfOp(r,e)&&e===uf.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},yp.prototype.interfaces_=function(){return[]},yp.prototype.getClass=function(){return yp};function _p(t,e){this._op=null,this._geometryFactory=null,this._resultPointList=new $a;var n=e;this._op=t,this._geometryFactory=n}_p.prototype.filterCoveredNodeToPoint=function(t){var e,n=t.getCoordinate();this._op.isCoveredByLA(n)||(e=this._geometryFactory.createPoint(n),this._resultPointList.add(e))},_p.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n,r=e.next();r.isInResult()||r.isIncidentEdgeInResult()||0!==r.getEdges().getDegree()&&t!==uf.INTERSECTION||(n=r.getLabel(),uf.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r))}},_p.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},_p.prototype.interfaces_=function(){return[]},_p.prototype.getClass=function(){return _p};function mp(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}mp.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},mp.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof eh&&!r.isEmpty()||(n=!1);for(var i=new $a,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof eh||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new $a;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},mp.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},mp.prototype.getInputGeometry=function(){return this._inputGeom},mp.prototype.transformMultiLineString=function(t,e){for(var n=new $a,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},mp.prototype.transformCoordinates=function(t,e){return this.copy(t)},mp.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},mp.prototype.transformMultiPoint=function(t,e){for(var n=new $a,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},mp.prototype.transformMultiPolygon=function(t,e){for(var n=new $a,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},mp.prototype.copy=function(t){return t.copy()},mp.prototype.transformGeometryCollection=function(t,e){for(var n=new $a,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(mh.toGeometryArray(n)):this._factory.buildGeometry(n)},mp.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Ku)return this.transformPoint(t,null);if(t instanceof th)return this.transformMultiPoint(t,null);if(t instanceof eh)return this.transformLinearRing(t,null);if(t instanceof Ju)return this.transformLineString(t,null);if(t instanceof Fu)return this.transformMultiLineString(t,null);if(t instanceof $u)return this.transformPolygon(t,null);if(t instanceof nh)return this.transformMultiPolygon(t,null);if(t instanceof Du)return this.transformGeometryCollection(t,null);throw new Rs(t.getClass().getName())},mp.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return 0<r&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},mp.prototype.interfaces_=function(){return[]},mp.prototype.getClass=function(){return mp};function vp(){var t,e,n;this._snapTolerance=0,this._srcPts=null,this._seg=new Lc,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Ju&&"number"==typeof arguments[1]?(t=arguments[1],vp.call(this,arguments[0].getCoordinates(),t)):arguments[0]instanceof Array&&"number"==typeof arguments[1]&&(e=arguments[0],n=arguments[1],this._srcPts=e,this._isClosed=vp.isClosed(e),this._snapTolerance=n)}vp.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new Bs(o)),0===r&&this._isClosed&&t.set(t.size()-1,new Bs(o)))}},vp.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},vp.prototype.snapTo=function(t){var e=new eu(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},vp.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 r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);0<=o&&t.add(o+1,new Bs(i),!1)}},vp.prototype.findSegmentIndexToSnap=function(t,e){for(var n=Ts.MAX_VALUE,r=-1,i=0;i<e.size()-1;i++){if(this._seg.p0=e.get(i),this._seg.p1=e.get(i+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,r=i)}return r},vp.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},vp.prototype.interfaces_=function(){return[]},vp.prototype.getClass=function(){return vp},vp.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};function xp(t){this._srcGeom=t||null}var Ep={SNAP_PRECISION_FACTOR:{configurable:!0}};xp.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Ip(e,n).transform(this._srcGeom)},xp.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Ip(t,n,!0).transform(this._srcGeom),i=r;return e&&Ys(i,Zu)&&(i=r.buffer(0)),i},xp.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},xp.prototype.extractTargetCoordinates=function(t){for(var e=new Mu,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},xp.prototype.computeMinimumSegmentLength=function(t){for(var e=Ts.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},xp.prototype.interfaces_=function(){return[]},xp.prototype.getClass=function(){return xp},xp.snap=function(t,e,n){var r=new Array(2).fill(null),i=new xp(t);r[0]=i.snapTo(e,n);var o=new xp(e);return r[1]=o.snapTo(r[0],n),r},xp.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t,e=arguments[0],n=xp.computeSizeBasedSnapTolerance(e),r=e.getPrecisionModel();return r.getType()!==lh.FIXED||n<(t=1/r.getScale()*2/1.415)&&(n=t),n}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(xp.computeOverlaySnapTolerance(i),xp.computeOverlaySnapTolerance(o))}},xp.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*xp.SNAP_PRECISION_FACTOR},xp.snapToSelf=function(t,e,n){return new xp(t).snapToSelf(e,n)},Ep.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(xp,Ep);function wp(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null}var bp,Ip=((bp=mp)&&(Np.__proto__=bp),((Np.prototype=Object.create(bp&&bp.prototype)).constructor=Np).prototype.snapLine=function(t,e){var n=new vp(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},Np.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},Np.prototype.interfaces_=function(){return[]},Np.prototype.getClass=function(){return Np},Np);function Np(t,e,n){bp.call(this),this._snapTolerance=t||null,this._snapPts=e||null,this._isSelfSnap=void 0!==n&&n}wp.prototype.getCommon=function(){return Ts.longBitsToDouble(this._commonBits)},wp.prototype.add=function(t){var e=Ts.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=wp.signExpBits(this._commonBits),this._isFirst=!1,null):wp.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=wp.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=wp.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},wp.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Ts.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+Ts.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},wp.prototype.interfaces_=function(){return[]},wp.prototype.getClass=function(){return wp},wp.getBit=function(t,e){return 0!=(t&1<<e)?1:0},wp.signExpBits=function(t){return t>>52},wp.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},wp.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;0<=r;r--){if(wp.getBit(t,r)!==wp.getBit(e,r))return n;n++}return 52};function Cp(){this._commonCoord=null,this._ccFilter=new Mp}var Sp={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Cp.prototype.addCommonBits=function(t){var e=new Lp(this._commonCoord);t.apply(e),t.geometryChanged()},Cp.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new Bs(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new Lp(e);return t.apply(n),t.geometryChanged(),t},Cp.prototype.getCommonCoordinate=function(){return this._commonCoord},Cp.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Cp.prototype.interfaces_=function(){return[]},Cp.prototype.getClass=function(){return Cp},Sp.CommonCoordinateFilter.get=function(){return Mp},Sp.Translater.get=function(){return Lp},Object.defineProperties(Cp,Sp);var Mp=function(){this._commonBitsX=new wp,this._commonBitsY=new wp};Mp.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Mp.prototype.getCommonCoordinate=function(){return new Bs(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Mp.prototype.interfaces_=function(){return[Fa]},Mp.prototype.getClass=function(){return Mp};var Lp=function(t){this.trans=null;this.trans=t};Lp.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},Lp.prototype.isDone=function(){return!1},Lp.prototype.isGeometryChanged=function(){return!0},Lp.prototype.interfaces_=function(){return[Au]},Lp.prototype.getClass=function(){return Lp};function Pp(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()}Pp.prototype.selfSnap=function(t){return new xp(t).snapTo(t,this._snapTolerance)},Pp.prototype.removeCommonBits=function(t){this._cbr=new Cp,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},Pp.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Pp.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=uf.overlayOp(e[0],e[1],t);return this.prepareResult(n)},Pp.prototype.checkValid=function(t){t.isValid()||ia.out.println("Snapped geometry is invalid")},Pp.prototype.computeSnapTolerance=function(){this._snapTolerance=xp.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Pp.prototype.snap=function(t){var e=this.removeCommonBits(t);return xp.snap(e[0],e[1],this._snapTolerance)},Pp.prototype.interfaces_=function(){return[]},Pp.prototype.getClass=function(){return Pp},Pp.overlayOp=function(t,e,n){return new Pp(t,e).getResultGeometry(n)},Pp.union=function(t,e){return Pp.overlayOp(t,e,uf.UNION)},Pp.intersection=function(t,e){return Pp.overlayOp(t,e,uf.INTERSECTION)},Pp.symDifference=function(t,e){return Pp.overlayOp(t,e,uf.SYMDIFFERENCE)},Pp.difference=function(t,e){return Pp.overlayOp(t,e,uf.DIFFERENCE)};function Op(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e}Op.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=uf.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof va))throw t;r=t}if(!n)try{e=Pp.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof va?r:t}return e},Op.prototype.interfaces_=function(){return[]},Op.prototype.getClass=function(){return Op},Op.overlayOp=function(t,e,n){return new Op(t,e).getResultGeometry(n)},Op.union=function(t,e){return Op.overlayOp(t,e,uf.UNION)},Op.intersection=function(t,e){return Op.overlayOp(t,e,uf.INTERSECTION)},Op.symDifference=function(t,e){return Op.overlayOp(t,e,uf.SYMDIFFERENCE)},Op.difference=function(t,e){return Op.overlayOp(t,e,uf.DIFFERENCE)};function Rp(t,e){this.mce=null,this.chainIndex=null;var n=e;this.mce=t,this.chainIndex=n}Rp.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Rp.prototype.interfaces_=function(){return[]},Rp.prototype.getClass=function(){return Rp};function Tp(){var t,e,n,r,i;this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length?(t=arguments[0],e=arguments[1],this._eventType=Tp.DELETE,this._xValue=t,this._insertEvent=e):3===arguments.length&&(n=arguments[0],r=arguments[1],i=arguments[2],this._eventType=Tp.INSERT,this._label=n,this._xValue=r,this._obj=i)}var Ap={INSERT:{configurable:!0},DELETE:{configurable:!0}};Tp.prototype.isDelete=function(){return this._eventType===Tp.DELETE},Tp.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},Tp.prototype.getObject=function(){return this._obj},Tp.prototype.compareTo=function(t){return this._xValue<t._xValue?-1:this._xValue>t._xValue?1:this._eventType<t._eventType?-1:this._eventType>t._eventType?1:0},Tp.prototype.getInsertEvent=function(){return this._insertEvent},Tp.prototype.isInsert=function(){return this._eventType===Tp.INSERT},Tp.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},Tp.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Tp.prototype.interfaces_=function(){return[Ds]},Tp.prototype.getClass=function(){return Tp},Ap.INSERT.get=function(){return 1},Ap.DELETE.get=function(){return 2},Object.defineProperties(Tp,Ap);function Dp(){}Dp.prototype.interfaces_=function(){return[]},Dp.prototype.getClass=function(){return Dp};function Fp(t,e,n){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 r=e,i=n;this._li=t,this._includeProper=r,this._recordIsolated=i}Fp.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(Fp.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},Fp.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Fp.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Fp.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Fp.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},Fp.prototype.hasProperIntersection=function(){return this._hasProper},Fp.prototype.hasIntersection=function(){return this._hasIntersection},Fp.prototype.isDone=function(){return this._isDone},Fp.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},Fp.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},Fp.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,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))))},Fp.prototype.interfaces_=function(){return[]},Fp.prototype.getClass=function(){return Fp},Fp.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};function qp(){this._min=Ts.POSITIVE_INFINITY,this._max=Ts.NEGATIVE_INFINITY}var Gp,Bp=((Gp=Dp)&&(zp.__proto__=Gp),((zp.prototype=Object.create(Gp&&Gp.prototype)).constructor=zp).prototype.prepareEvents=function(){pc.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},zp.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{var r,i,o,s,a;3===arguments.length&&(arguments[2]instanceof Fp&&Ys(arguments[0],Ha)&&Ys(arguments[1],Ha)?(r=arguments[0],i=arguments[1],o=arguments[2],this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)):"boolean"==typeof arguments[2]&&Ys(arguments[0],Ha)&&arguments[1]instanceof Fp&&(s=arguments[0],a=arguments[1],arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)))}},zp.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new Rp(n,i),s=new Tp(e,n.getMinX(i),o);this.events.add(s),this.events.add(new Tp(n.getMaxX(i),s))}},zp.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s,a=this.events.get(o);a.isInsert()&&(s=a.getObject(),n.isSameLabel(a)||(i.computeIntersections(s,r),this.nOverlaps++))}},zp.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[1],r=arguments[0].iterator();r.hasNext();){var i=r.next();this.addEdge(i,n)}},zp.prototype.interfaces_=function(){return[]},zp.prototype.getClass=function(){return zp},zp),kp={NodeComparator:{configurable:!0}};function zp(){Gp.call(this),this.events=new $a,this.nOverlaps=null}qp.prototype.getMin=function(){return this._min},qp.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},qp.prototype.getMax=function(){return this._max},qp.prototype.toString=function(){return fa.toLineString(new Bs(this._min,0),new Bs(this._max,0))},qp.prototype.interfaces_=function(){return[]},qp.prototype.getClass=function(){return qp},kp.NodeComparator.get=function(){return jp},Object.defineProperties(qp,kp);var jp=function(){};jp.prototype.compare=function(t,e){var n=(t._min+t._max)/2,r=(e._min+e._max)/2;return n<r?-1:r<n?1:0},jp.prototype.interfaces_=function(){return[qs]},jp.prototype.getClass=function(){return jp};function Xp(){this._leaves=new $a,this._root=null,this._level=0}var Up,Yp,Vp=((Yp=qp)&&(Jp.__proto__=Yp),((Jp.prototype=Object.create(Yp&&Yp.prototype)).constructor=Jp).prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},Jp.prototype.interfaces_=function(){return[]},Jp.prototype.getClass=function(){return Jp},Jp),Hp=((Up=qp)&&(Wp.__proto__=Up),((Wp.prototype=Object.create(Up&&Up.prototype)).constructor=Wp).prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},Wp.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)},Wp.prototype.interfaces_=function(){return[]},Wp.prototype.getClass=function(){return Wp},Wp);function Wp(){Up.call(this),this._node1=null,this._node2=null;var t=arguments[0],e=arguments[1];this._node1=t,this._node2=e,this.buildExtent(this._node1,this._node2)}function Jp(){Yp.call(this),this._item=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._min=t,this._max=e,this._item=n}Xp.prototype.buildTree=function(){pc.sort(this._leaves,new qp.NodeComparator);for(var t,e=this._leaves,n=new $a;;){if(this.buildLevel(e,n),1===n.size())return n.get(0);t=e,e=n,n=t}},Xp.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 Vp(t,e,n))},Xp.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Xp.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Xp.prototype.printNode=function(t){ia.out.println(fa.toLineString(new Bs(t._min,this._level),new Bs(t._max,this._level)))},Xp.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Xp.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r,i=t.get(n);null===(n+1<t.size()?t.get(n):null)?e.add(i):(r=new Hp(t.get(n),t.get(n+1)),e.add(r))}},Xp.prototype.interfaces_=function(){return[]},Xp.prototype.getClass=function(){return Xp};function Zp(){this._items=new $a}Zp.prototype.visitItem=function(t){this._items.add(t)},Zp.prototype.getItems=function(){return this._items},Zp.prototype.interfaces_=function(){return[uc]},Zp.prototype.getClass=function(){return Zp};function Kp(t){this._index=null;var e=t;if(!Ys(e,Zu))throw new Rs;this._index=new tf(e)}var Qp={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Kp.prototype.locate=function(t){var e=new La(t),n=new $p(e);return this._index.query(t.y,t.y,n),e.getLocation()},Kp.prototype.interfaces_=function(){return[nl]},Kp.prototype.getClass=function(){return Kp},Qp.SegmentVisitor.get=function(){return $p},Qp.IntervalIndexedGeometry.get=function(){return tf},Object.defineProperties(Kp,Qp);var $p=function(t){this._counter=null;this._counter=t};$p.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},$p.prototype.interfaces_=function(){return[uc]},$p.prototype.getClass=function(){return $p};var tf=function(t){this._index=new Xp;this.init(t)};tf.prototype.init=function(t){for(var e=Wl.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},tf.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new Lc(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},tf.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Zp;return this._index.query(t,e,n),n.getItems()}var r,i,o;3===arguments.length&&(r=arguments[0],i=arguments[1],o=arguments[2],this._index.query(r,i,o))},tf.prototype.interfaces_=function(){return[]},tf.prototype.getClass=function(){return tf};function ef(t,e,n){var r,i,o,s,a,u,h;this._li=new Sa,this._resultPrecisionModel=null,this._arg=null,1===arguments.length?(r=t,this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new rf(0,r)):2===arguments.length?(o=e,s=qa.OGC_SFS_BOUNDARY_RULE,0<=(i=t).getPrecisionModel().compareTo(o.getPrecisionModel())?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new rf(0,i,s),this._arg[1]=new rf(1,o,s)):3===arguments.length&&(u=e,h=n,0<=(a=t).getPrecisionModel().compareTo(u.getPrecisionModel())?this.setComputationPrecision(a.getPrecisionModel()):this.setComputationPrecision(u.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new rf(0,a,h),this._arg[1]=new rf(1,u,h))}var nf,rf=((nf=rc)&&(of.__proto__=nf),((of.prototype=Object.create(nf&&nf.prototype)).constructor=of).prototype.insertBoundaryPoint=function(t,e){var n=this._nodes.addNode(e).getLabel(),r=1;n.getLocation(t,Ch.ON)===Xs.BOUNDARY&&r++;var i=of.determineBoundary(this._boundaryNodeRule,r);n.setLocation(t,i)},of.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[1],r=arguments[2],i=new Fp(arguments[0],!0,!1);i.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof eh||this._parentGeom instanceof $u||this._parentGeom instanceof nh,a=n||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},of.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},of.prototype.computeEdgeIntersections=function(t,e,n){var r=new Fp(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},of.prototype.getGeometry=function(){return this._parentGeom},of.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},of.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},of.prototype.addPoint=function(){var t,e;arguments[0]instanceof Ku?(t=arguments[0].getCoordinate(),this.insertPoint(this._argIndex,t,Xs.INTERIOR)):arguments[0]instanceof Bs&&(e=arguments[0],this.insertPoint(this._argIndex,e,Xs.INTERIOR))},of.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),Xs.EXTERIOR,Xs.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,Xs.INTERIOR,Xs.EXTERIOR)}},of.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],Xs.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],Xs.BOUNDARY)},of.prototype.addLineString=function(t){var e=Za.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new Il(e,new qh(this._argIndex,Xs.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),ya.isTrue(2<=e.length,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},of.prototype.getInvalidPoint=function(){return this._invalidPoint},of.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=i.getCoordinate().copy()}return e},of.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},of.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===Xs.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},of.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=Za.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;Pa.isCCW(r)&&(i=n,o=e);var s=new Il(r,new qh(this._argIndex,Xs.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],Xs.BOUNDARY)},of.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new qh(t,n):i.setLocation(t,n)},of.prototype.createEdgeSetIntersector=function(){return new Bp},of.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},of.prototype.add=function(){if(1!==arguments.length)return nf.prototype.add.apply(this,arguments);var t=arguments[0];if(t.isEmpty())return null;if(t instanceof nh&&(this._useBoundaryDeterminationRule=!1),t instanceof $u)this.addPolygon(t);else if(t instanceof Ju)this.addLineString(t);else if(t instanceof Ku)this.addPoint(t);else if(t instanceof th)this.addCollection(t);else if(t instanceof Fu)this.addCollection(t);else if(t instanceof nh)this.addCollection(t);else{if(!(t instanceof Du))throw new Error(t.getClass().getName());this.addCollection(t)}},of.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},of.prototype.locate=function(t){return Ys(this._parentGeom,Zu)&&50<this._parentGeom.getNumGeometries()?(null===this._areaPtLocator&&(this._areaPtLocator=new Kp(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},of.prototype.findEdge=function(){if(1!==arguments.length)return nf.prototype.findEdge.apply(this,arguments);var t=arguments[0];return this._lineEdgeMap.get(t)},of.prototype.interfaces_=function(){return[]},of.prototype.getClass=function(){return of},of.determineBoundary=function(t,e){return t.isInBoundary(e)?Xs.BOUNDARY:Xs.INTERIOR},of);function of(){var t,e,n,r,i,o;nf.call(this),this._parentGeom=null,this._lineEdgeMap=new fh,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Jl,2===arguments.length?(t=arguments[0],e=arguments[1],n=qa.OGC_SFS_BOUNDARY_RULE,this._argIndex=t,this._parentGeom=e,this._boundaryNodeRule=n,null!==e&&this.add(e)):3===arguments.length&&(r=arguments[0],i=arguments[1],o=arguments[2],this._argIndex=r,this._parentGeom=i,this._boundaryNodeRule=o,null!==i&&this.add(i))}ef.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},ef.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},ef.prototype.interfaces_=function(){return[]},ef.prototype.getClass=function(){return ef};function sf(){}sf.prototype.interfaces_=function(){return[]},sf.prototype.getClass=function(){return sf},sf.map=function(){if(arguments[0]instanceof Ta&&Ys(arguments[1],sf.MapOp)){for(var t=arguments[0],e=arguments[1],n=new $a,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(Ys(arguments[0],Xa)&&Ys(arguments[1],sf.MapOp)){for(var o=arguments[0],s=arguments[1],a=new $a,u=o.iterator();u.hasNext();){var h=u.next(),c=s.map(h);null!==c&&a.add(c)}return a}},sf.MapOp=function(){};var af,uf=((af=ef)&&(hf.__proto__=af),((hf.prototype=Object.create(af&&af.prototype)).constructor=hf).prototype.insertUniqueEdge=function(t){var e,n,r,i=this._edgeList.findEqualEdge(t);null!==i?(e=i.getLabel(),n=t.getLabel(),i.isPointwiseEqual(t)||(n=new qh(t.getLabel())).flip(),(r=i.getDepth()).isNull()&&r.add(e),r.add(n),e.merge(n)):this._edgeList.add(t)},hf.prototype.getGraph=function(){return this._graph},hf.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))}},hf.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},hf.prototype.computeGeometry=function(t,e,n,r){var i=new $a;return i.addAll(t),i.addAll(e),i.addAll(n),i.isEmpty()?hf.createEmptyResult(r,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(i)},hf.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},hf.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==Xs.EXTERIOR)return!0}return!1},hf.prototype.replaceCollapsedEdges=function(){for(var t=new $a,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},hf.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},hf.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},hf.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},hf.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 $a;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),gp.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new ic(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new yp(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new _p(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},hf.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},hf.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))}},hf.prototype.findResultAreaEdges=function(t){for(var e=this._graph.getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getLabel();r.isArea()&&!n.isInteriorAreaEdge()&&hf.isResultOfOp(r.getLocation(0,Ch.RIGHT),r.getLocation(1,Ch.RIGHT),t)&&n.setInResult(!0)}},hf.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),r=e.getDepth();if(!r.isNull()){r.normalize();for(var i=0;i<2;i++)n.isNull(i)||!n.isArea()||r.isNull(i)||(0===r.getDelta(i)?n.toLine(i):(ya.isTrue(!r.isNull(i,Ch.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,Ch.LEFT,r.getLocation(i,Ch.LEFT)),ya.isTrue(!r.isNull(i,Ch.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,Ch.RIGHT,r.getLocation(i,Ch.RIGHT))))}}},hf.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},hf.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)}},hf.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},hf.prototype.interfaces_=function(){return[]},hf.prototype.getClass=function(){return hf},hf);function hf(){var t=arguments[0],e=arguments[1];af.call(this,t,e),this._ptLocator=new Jl,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new fl,this._resultPolyList=new $a,this._resultLineList=new $a,this._resultPointList=new $a,this._graph=new rc(new cl),this._geomFact=t.getFactory()}uf.overlayOp=function(t,e,n){return new uf(t,e).getResultGeometry(n)},uf.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return uf.createEmptyResult(uf.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return dp.map(t,{interfaces_:function(){return[sf.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Op.overlayOp(t,e,uf.INTERSECTION)},uf.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return uf.createEmptyResult(uf.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Op.overlayOp(t,e,uf.SYMDIFFERENCE)},uf.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case uf.INTERSECTION:o=Math.min(r,i);break;case uf.UNION:o=Math.max(r,i);break;case uf.DIFFERENCE:o=r;break;case uf.SYMDIFFERENCE:o=Math.max(r,i)}return o},uf.createEmptyResult=function(t,e,n,r){var i=null;switch(uf.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},uf.difference=function(t,e){return t.isEmpty()?uf.createEmptyResult(uf.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Op.overlayOp(t,e,uf.DIFFERENCE))},uf.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return uf.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===Xs.BOUNDARY&&(i=Xs.INTERIOR),o===Xs.BOUNDARY&&(o=Xs.INTERIOR),arguments[2]){case uf.INTERSECTION:return i===Xs.INTERIOR&&o===Xs.INTERIOR;case uf.UNION:return i===Xs.INTERIOR||o===Xs.INTERIOR;case uf.DIFFERENCE:return i===Xs.INTERIOR&&o!==Xs.INTERIOR;case uf.SYMDIFFERENCE:return i===Xs.INTERIOR&&o!==Xs.INTERIOR||i!==Xs.INTERIOR&&o===Xs.INTERIOR}return!1}},uf.INTERSECTION=1,uf.UNION=2,uf.DIFFERENCE=3,uf.SYMDIFFERENCE=4;function cf(t,e){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Jl,this._seg=new Lc;var n=t,r=e;this._g=n,this._boundaryDistanceTolerance=r,this._linework=this.extractLinework(n)}cf.prototype.isWithinToleranceOfBoundary=function(t){for(var e=0;e<this._linework.getNumGeometries();e++)for(var n=this._linework.getGeometryN(e).getCoordinateSequence(),r=0;r<n.size()-1;r++)if(n.getCoordinate(r,this._seg.p0),n.getCoordinate(r+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},cf.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?Xs.BOUNDARY:this._ptLocator.locate(t,this._g)},cf.prototype.extractLinework=function(t){var e=new lf;t.apply(e);var n=e.getLinework(),r=mh.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf};var lf=function(){this._linework=null,this._linework=new $a};lf.prototype.getLinework=function(){return this._linework},lf.prototype.filter=function(t){if(t instanceof $u){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},lf.prototype.interfaces_=function(){return[Tu]},lf.prototype.getClass=function(){return lf};function pf(t){this._g=null,this._doLeft=!0,this._doRight=!0,this._g=t}pf.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},pf.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},pf.prototype.getPoints=function(t){for(var e=new $a,n=Wl.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},pf.prototype.computeOffsetPoints=function(t,e,n,r){var i,o,s=e.x-t.x,a=e.y-t.y,u=Math.sqrt(s*s+a*a),h=n*s/u,c=n*a/u,l=(e.x+t.x)/2,p=(e.y+t.y)/2;this._doLeft&&(i=new Bs(l-c,p+h),r.add(i)),this._doRight&&(o=new Bs(l+c,p-h),r.add(o))},pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf};function ff(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=ff.TOLERANCE,this._testCoords=new $a;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=ff.computeBoundaryDistanceTolerance(t,e),this._geom=[t,e,n],this._locFinder=[new cf(this._geom[0],this._boundaryDistanceTolerance),new cf(this._geom[1],this._boundaryDistanceTolerance),new cf(this._geom[2],this._boundaryDistanceTolerance)]}var gf={TOLERANCE:{configurable:!0}};ff.prototype.reportResult=function(t,e,n){ia.out.println("Overlay result invalid - A:"+Xs.toLocationSymbol(e[0])+" B:"+Xs.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+Xs.toLocationSymbol(e[2]))},ff.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},ff.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 r=arguments[0],i=arguments[1];return this._location[0]=this._locFinder[0].getLocation(i),this._location[1]=this._locFinder[1].getLocation(i),this._location[2]=this._locFinder[2].getLocation(i),!!ff.hasLocation(this._location,Xs.BOUNDARY)||this.isValidResult(r,this._location)}},ff.prototype.addTestPts=function(t){var e=new pf(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},ff.prototype.isValidResult=function(t,e){var n=uf.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===Xs.INTERIOR);return r||this.reportResult(t,e,n),r},ff.prototype.getInvalidLocation=function(){return this._invalidLocation},ff.prototype.interfaces_=function(){return[]},ff.prototype.getClass=function(){return ff},ff.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},ff.computeBoundaryDistanceTolerance=function(t,e){return Math.min(xp.computeSizeBasedSnapTolerance(t),xp.computeSizeBasedSnapTolerance(e))},ff.isValid=function(t,e,n,r){return new ff(t,e,r).isValid(n)},gf.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ff,gf);function df(t){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=df.extractFactory(t),this._inputGeoms=t}df.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},df.prototype.combine=function(){for(var t=new $a,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)},df.prototype.interfaces_=function(){return[]},df.prototype.getClass=function(){return df},df.combine=function(){return 1===arguments.length?new df(arguments[0]).combine():2===arguments.length?new df(df.createList(arguments[0],arguments[1])).combine():3===arguments.length?new df(df.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},df.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},df.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new $a;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new $a;return s.add(r),s.add(i),s.add(o),s}};function yf(t){this._inputPolys=null,this._geomFactory=null,this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new $a)}var _f={STRTREE_NODE_CAPACITY:{configurable:!0}};yf.prototype.reduceToGeometries=function(t){for(var e=new $a,n=t.iterator();n.hasNext();){var r=n.next(),i=null;Ys(r,Ha)?i=this.unionTree(r):r instanceof Ta&&(i=r),e.add(i)}return e},yf.prototype.extractByEnvelope=function(t,e,n){for(var r=new $a,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},yf.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return df.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},yf.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 xc(yf.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},yf.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],r=arguments[2];if(r-n<=1){var i=yf.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(yf.getGeometry(e,n),yf.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},yf.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();)var r=n.next(),e=null===e?r.copy():e.union(r);return e},yf.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},yf.prototype.unionActual=function(t,e){return yf.restrictToPolygons(t.union(e))},yf.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},yf.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new $a,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),df.combine(r)},yf.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)}},yf.prototype.interfaces_=function(){return[]},yf.prototype.getClass=function(){return yf},yf.restrictToPolygons=function(t){if(Ys(t,Zu))return t;var e=Hl.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(mh.toPolygonArray(e))},yf.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},yf.union=function(t){return new yf(t).union()},_f.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(yf,_f);var mf=function(){};function vf(t){switch(t.type){case"Polygon":return 1<Xn(t)?t:null;case"MultiPolygon":var e=[];if(A(t,function(t){1<Xn(t)&&e.push(t.geometry.coordinates)}),e.length)return{type:"MultiPolygon",coordinates:e}}}mf.prototype.interfaces_=function(){return[]},mf.prototype.getClass=function(){return mf},mf.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return uf.createEmptyResult(uf.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Op.overlayOp(t,e,uf.UNION)};function xf(){return new Ef}function Ef(){this.reset()}Ef.prototype={constructor:Ef,reset:function(){this.s=this.t=0},add:function(t){bf(wf,t,this.t),bf(this,wf.s,this.s),this.s?this.t+=wf.t:this.s=wf.t},valueOf:function(){return this.s}};var wf=new Ef;function bf(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var If=1e-6,Nf=Math.PI,Cf=Nf/2,Sf=Nf/4,Mf=2*Nf,Lf=180/Nf,Pf=Nf/180,Of=Math.abs,Rf=Math.atan,Tf=Math.atan2,Af=Math.cos,Df=Math.exp,Ff=Math.log,qf=Math.sin,Gf=Math.sqrt,Bf=Math.tan;function kf(t){return 1<t?Cf:t<-1?-Cf:Math.asin(t)}function zf(){}function jf(t,e){t&&Uf.hasOwnProperty(t.type)&&Uf[t.type](t,e)}var Xf={Feature:function(t,e){jf(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)jf(n[r].geometry,e)}},Uf={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Yf(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Yf(n[r],e,0)},Polygon:function(t,e){Vf(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Vf(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)jf(n[r],e)}};function Yf(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Vf(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Yf(t[n],e,1);e.polygonEnd()}var Hf=function(t,e){t&&Xf.hasOwnProperty(t.type)?Xf[t.type](t,e):jf(t,e)};function Wf(t){return[Tf(t[1],t[0]),kf(t[2])]}function Jf(t){var e=t[0],n=t[1],r=Af(n);return[r*Af(e),r*qf(e),qf(n)]}function Zf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Kf(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Qf(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function $f(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function tg(t){var e=Gf(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}xf(),xf(),xf();var eg=function(n,r){function t(t,e){return t=n(t,e),r(t[0],t[1])}return n.invert&&r.invert&&(t.invert=function(t,e){return(t=r.invert(t,e))&&n.invert(t[0],t[1])}),t};function ng(t,e){return[Nf<t?t-Mf:t<-Nf?t+Mf:t,e]}function rg(t,e,n){return(t%=Mf)?e||n?eg(og(t),sg(e,n)):og(t):e||n?sg(e,n):ng}function ig(n){return function(t,e){return[Nf<(t+=n)?t-Mf:t<-Nf?t+Mf:t,e]}}function og(t){var e=ig(t);return e.invert=ig(-t),e}function sg(t,e){var a=Af(t),u=qf(t),h=Af(e),c=qf(e);function n(t,e){var n=Af(e),r=Af(t)*n,i=qf(t)*n,o=qf(e),s=o*a+r*u;return[Tf(i*h-s*c,r*a-o*u),kf(s*h+i*c)]}return n.invert=function(t,e){var n=Af(e),r=Af(t)*n,i=qf(t)*n,o=qf(e),s=o*h-i*c;return[Tf(i*h+o*c,r*a+s*u),kf(s*a-r*u)]},n}function ag(t,e){(e=Jf(e))[0]-=t,tg(e);var n,r=1<(n=-e[1])?0:n<-1?Nf:Math.acos(n);return((-e[2]<0?-r:r)+Mf-If)%Mf}ng.invert=ng;function ug(t,e){return Of(t[0]-e[0])<If&&Of(t[1]-e[1])<If}var hg=function(){var n,e=[];return{point:function(t,e){n.push([t,e])},lineStart:function(){e.push(n=[])},lineEnd:zf,rejoin:function(){1<e.length&&e.push(e.pop().concat(e.shift()))},result:function(){var t=e;return e=[],n=null,t}}},cg=function(t,e,n,r,i,o){var s=t[0],a=t[1],u=0,h=1,c=e[0]-s,l=e[1]-a,p=n-s;if(c||!(0<p)){if(p/=c,c<0){if(p<u)return;p<h&&(h=p)}else if(0<c){if(h<p)return;u<p&&(u=p)}if(p=i-s,c||!(p<0)){if(p/=c,c<0){if(h<p)return;u<p&&(u=p)}else if(0<c){if(p<u)return;p<h&&(h=p)}if(p=r-a,l||!(0<p)){if(p/=l,l<0){if(p<u)return;p<h&&(h=p)}else if(0<l){if(h<p)return;u<p&&(u=p)}if(p=o-a,l||!(p<0)){if(p/=l,l<0){if(h<p)return;u<p&&(u=p)}else if(0<l){if(p<u)return;p<h&&(h=p)}return 0<u&&(t[0]=s+u*c,t[1]=a+u*l),h<1&&(e[0]=s+h*c,e[1]=a+h*l),!0}}}}};function lg(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}var pg=function(t,e,n,r,o){var s,i,a=[],u=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],i=t[e];if(ug(r,i)){for(o.lineStart(),s=0;s<e;++s)o.point((r=t[s])[0],r[1]);o.lineEnd()}else a.push(n=new lg(r,t,null,!0)),u.push(n.o=new lg(r,null,n,!1)),a.push(n=new lg(i,t,null,!1)),u.push(n.o=new lg(i,null,n,!0))}}),a.length){for(u.sort(e),fg(a),fg(u),s=0,i=u.length;s<i;++s)u[s].e=n=!n;for(var h,c,l=a[0];;){for(var p=l,f=!0;p.v;)if((p=p.n)===l)return;h=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(s=0,i=h.length;s<i;++s)o.point((c=h[s])[0],c[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(f)for(h=p.p.z,s=h.length-1;0<=s;--s)o.point((c=h[s])[0],c[1]);else r(p.x,p.p.x,-1,o);p=p.p}h=(p=p.o).z,f=!f}while(!p.v);o.lineEnd()}}};function fg(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function gg(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}var dg=function(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);0<=--i;)for(e=(r=t[i]).length;0<=--e;)n[--s]=r[e];return n},yg=1e9,_g=-yg;var mg=xf(),vg=(xf(),function(t){return t}),xg=(xf(),xf(),1/0),Eg=xg,wg=-xg,bg=wg,Ig={point:function(t,e){t<xg&&(xg=t),wg<t&&(wg=t),e<Eg&&(Eg=e),bg<e&&(bg=e)},lineStart:zf,lineEnd:zf,polygonStart:zf,polygonEnd:zf,result:function(){var t=[[xg,Eg],[wg,bg]];return wg=bg=-(Eg=xg=1/0),t}};xf();function Ng(_,m,v,x){return function(r,a){var u,h,c,i=m(a),L=r.invert(x[0],x[1]),l=hg(),p=m(l),f=!1,e={point:n,lineStart:o,lineEnd:s,polygonStart:function(){e.point=g,e.lineStart=d,e.lineEnd=y,h=[],u=[]},polygonEnd:function(){e.point=n,e.lineStart=o,e.lineEnd=s,h=dg(h);var t=function(t){var e=L[0],n=L[1],r=[qf(e),-Af(e),0],i=0,o=0;mg.reset();for(var s=0,a=t.length;s<a;++s)if(h=(u=t[s]).length)for(var u,h,c=u[h-1],l=c[0],p=c[1]/2+Sf,f=qf(p),g=Af(p),d=0;d<h;++d,l=x,f=w,g=b,c=v){var y,_,m,v=u[d],x=v[0],E=v[1]/2+Sf,w=qf(E),b=Af(E),I=x-l,N=0<=I?1:-1,C=N*I,S=Nf<C,M=f*w;mg.add(Tf(M*N*qf(C),g*b+M*Af(C))),i+=S?I+N*Mf:I,S^e<=l^e<=x&&(tg(y=Kf(Jf(c),Jf(v))),tg(_=Kf(r,y)),((m=(S^0<=I?-1:1)*kf(_[2]))<n||n===m&&(y[0]||y[1]))&&(o+=S^0<=I?1:-1))}return(i<-If||i<If&&mg<-If)^1&o}(u);h.length?(f||(a.polygonStart(),f=!0),pg(h,Sg,t,v,a)):t&&(f||(a.polygonStart(),f=!0),a.lineStart(),v(null,null,1,a),a.lineEnd()),f&&(a.polygonEnd(),f=!1),h=u=null},sphere:function(){a.polygonStart(),a.lineStart(),v(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function n(t,e){var n=r(t,e);_(t=n[0],e=n[1])&&a.point(t,e)}function t(t,e){var n=r(t,e);i.point(n[0],n[1])}function o(){e.point=t,i.lineStart()}function s(){e.point=n,i.lineEnd()}function g(t,e){c.push([t,e]);var n=r(t,e);p.point(n[0],n[1])}function d(){p.lineStart(),c=[]}function y(){g(c[0][0],c[0][1]),p.lineEnd();var t,e,n,r,i=p.clean(),o=l.result(),s=o.length;if(c.pop(),u.push(c),c=null,s)if(1&i){if(0<(e=(n=o[0]).length-1)){for(f||(a.polygonStart(),f=!0),a.lineStart(),t=0;t<e;++t)a.point((r=n[t])[0],r[1]);a.lineEnd()}}else 1<s&&2&i&&o.push(o.pop().concat(o.shift())),h.push(o.filter(Cg))}return e}}function Cg(t){return 1<t.length}function Sg(t,e){return((t=t.x)[0]<0?t[1]-Cf-If:Cf-t[1])-((e=e.x)[0]<0?e[1]-Cf-If:Cf-e[1])}var Mg=Ng(function(){return 1},function(l){var p,f=NaN,g=NaN,d=NaN;return{lineStart:function(){l.lineStart(),p=1},point:function(t,e){var n,r,i,o,s,a,u,h=0<t?Nf:-Nf,c=Of(t-f);Of(c-Nf)<If?(l.point(f,g=0<(g+e)/2?Cf:-Cf),l.point(d,g),l.lineEnd(),l.lineStart(),l.point(h,g),l.point(t,g),p=0):d!==h&&Nf<=c&&(Of(f-d)<If&&(f-=d*If),Of(t-h)<If&&(t-=h*If),r=g,o=e,u=qf((n=f)-(i=t)),g=Of(u)>If?Rf((qf(r)*(a=Af(o))*qf(i)-qf(o)*(s=Af(r))*qf(n))/(s*a*u)):(r+o)/2,l.point(d,g),l.lineEnd(),l.lineStart(),l.point(h,g),p=0),l.point(f=t,g=e),d=h},lineEnd:function(){l.lineEnd(),f=g=NaN},clean:function(){return 2-p}}},function(t,e,n,r){var i,o;null==t?(o=n*Cf,r.point(-Nf,o),r.point(0,o),r.point(Nf,o),r.point(Nf,0),r.point(Nf,-o),r.point(0,-o),r.point(-Nf,-o),r.point(-Nf,0),r.point(-Nf,o)):Of(t[0]-e[0])>If?(o=n*(i=t[0]<e[0]?Nf:-Nf)/2,r.point(-i,o),r.point(0,o),r.point(i,o)):r.point(e[0],e[1])},[-Nf,-Cf]),Lg=function(i,o){var C=Af(i),f=0<C,g=Of(C)>If;function d(t,e){return Af(t)*Af(e)>C}function y(t,e,n){var r=[1,0,0],i=Kf(Jf(t),Jf(e)),o=Zf(i,i),s=i[0],a=o-s*s;if(!a)return!n&&t;var u=C*o/a,h=-C*s/a,c=Kf(r,i),l=$f(r,u);Qf(l,$f(i,h));var p=c,f=Zf(l,p),g=Zf(p,p),d=f*f-g*(Zf(l,l)-1);if(!(d<0)){var y=Gf(d),_=$f(p,(-f-y)/g);if(Qf(_,l),_=Wf(_),!n)return _;var m,v=t[0],x=e[0],E=t[1],w=e[1];x<v&&(m=v,v=x,x=m);var b=x-v,I=Of(b-Nf)<If;if(!I&&w<E&&(m=E,E=w,w=m),I||b<If?I?0<E+w^_[1]<(Of(_[0]-v)<If?E:w):E<=_[1]&&_[1]<=w:Nf<b^(v<=_[0]&&_[0]<=x)){var N=$f(p,(-f+y)/g);return Qf(N,l),[_,Wf(N)]}}}function _(t,e){var n=f?i:Nf-i,r=0;return t<-n?r|=1:n<t&&(r|=2),e<-n?r|=4:n<e&&(r|=8),r}return Ng(d,function(a){var u,h,c,l,p;return{lineStart:function(){l=c=!1,p=1},point:function(t,e){var n,r,i=[t,e],o=d(t,e),s=f?o?0:_(t,e):o?_(t+(t<0?Nf:-Nf),e):0;!u&&(l=c=o)&&a.lineStart(),o===c||(n=y(u,i))&&!ug(u,n)&&!ug(i,n)||(i[0]+=If,i[1]+=If,o=d(i[0],i[1])),o!==c?(p=0,o?(a.lineStart(),n=y(i,u),a.point(n[0],n[1])):(n=y(u,i),a.point(n[0],n[1]),a.lineEnd()),u=n):g&&u&&f^o&&(s&h||!(r=y(i,u,!0))||(p=0,f?(a.lineStart(),a.point(r[0][0],r[0][1]),a.point(r[1][0],r[1][1]),a.lineEnd()):(a.point(r[1][0],r[1][1]),a.lineEnd(),a.lineStart(),a.point(r[0][0],r[0][1])))),!o||u&&ug(u,i)||a.point(i[0],i[1]),u=i,c=o,h=s},lineEnd:function(){c&&a.lineEnd(),u=null},clean:function(){return p|(l&&c)<<1}}},function(t,e,n,r){!function(t,e,n,r,i,o){if(n){var s=Af(e),a=qf(e),u=r*n;null==i?(i=e+r*Mf,o=e-u/2):(i=ag(s,i),o=ag(s,o),(0<r?i<o:o<i)&&(i+=r*Mf));for(var h,c=i;0<r?o<c:c<o;c-=u)h=Wf([s,-a*Af(c),-a*qf(c)]),t.point(h[0],h[1])}}(r,i,o,n,t,e)},f?[0,-i]:[-Nf,i-Nf])};function Pg(r){return function(t){var e,n=new Og;for(e in r)n[e]=r[e];return n.stream=t,n}}function Og(){}function Rg(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),Hf(n,t.stream(Ig));var s=Ig.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,h=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,h])}Og.prototype={constructor:Og,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Tg=Af(30*Pf),Ag=function(t,e){return+e?(P=t,O=e,function(i){var n,r,o,s,a,u,h,c,l,p,f,g,d={point:t,lineStart:e,lineEnd:_,polygonStart:function(){i.polygonStart(),d.lineStart=m},polygonEnd:function(){i.polygonEnd(),d.lineStart=e}};function t(t,e){t=P(t,e),i.point(t[0],t[1])}function e(){c=NaN,d.point=y,i.lineStart()}function y(t,e){var n=Jf([t,e]),r=P(t,e);L(c,l,h,p,f,g,c=r[0],l=r[1],h=t,p=n[0],f=n[1],g=n[2],16,i),i.point(c,l)}function _(){d.point=t,i.lineEnd()}function m(){e(),d.point=v,d.lineEnd=x}function v(t,e){y(n=t,e),r=c,o=l,s=p,a=f,u=g,d.point=y}function x(){L(c,l,h,p,f,g,r,o,n,s,a,u,16,i),(d.lineEnd=_)()}return d}):(n=t,Pg({point:function(t,e){t=n(t,e),this.stream.point(t[0],t[1])}}));function L(t,e,n,r,i,o,s,a,u,h,c,l,p,f){var g,d,y,_,m,v,x,E,w,b,I,N,C=s-t,S=a-e,M=C*C+S*S;4*O<M&&p--&&(y=o+l,m=kf(y/=_=Gf((g=r+h)*g+(d=i+c)*d+y*y)),v=Of(Of(y)-1)<If||Of(n-u)<If?(n+u)/2:Tf(d,g),E=(x=P(v,m))[0],w=x[1],(O<(N=S*(b=E-t)-C*(I=w-e))*N/M||.3<Of((C*b+S*I)/M-.5)||r*h+i*c+o*l<Tg)&&(L(t,e,n,r,i,o,E,w,v,g/=_,d/=_,y,p,f),f.point(E,w),L(E,w,v,g,d,y,s,a,u,h,c,l,p,f)))}var P,O,n},Dg=Pg({point:function(t,e){this.stream.point(t*Pf,e*Pf)}});function Fg(t){return y=150,_=480,m=250,b=w=E=x=v=0,N=Mg,C=I=null,S=vg,L=Ag(r,M=.5),n.stream=function(t){return g&&d===t?g:g=Dg(N(h,L(S(d=t))))},n.clipAngle=function(t){return arguments.length?(N=+t?Lg(I=t*Pf,6*Pf):(I=null,Mg),o()):I*Lf},n.clipExtent=function(t){return arguments.length?(S=null==t?(C=l=p=f=null,vg):(x=C=+t[0][0],E=l=+t[0][1],w=p=+t[1][0],b=f=+t[1][1],function(r){var i,l,o,s,a,u,h,c,p,f,g,d=r,t=hg(),e={point:n,lineStart:function(){e.point=y,l&&l.push(o=[]),p=!(f=!0),h=c=NaN},lineEnd:function(){i&&(y(s,a),u&&p&&t.rejoin(),i.push(t.result())),e.point=n,p&&d.lineEnd()},polygonStart:function(){d=t,i=[],l=[],g=!0},polygonEnd:function(){var t=function(){for(var t=0,e=0,n=l.length;e<n;++e)for(var r,i,o=l[e],s=1,a=o.length,u=o[0],h=u[0],c=u[1];s<a;++s)r=h,i=c,h=(u=o[s])[0],c=u[1],i<=b?b<c&&(c-i)*(x-r)<(h-r)*(b-i)&&++t:c<=b&&(h-r)*(b-i)<(c-i)*(x-r)&&--t;return t}(),e=g&&t,n=(i=dg(i)).length;(e||n)&&(r.polygonStart(),e&&(r.lineStart(),m(null,null,1,r),r.lineEnd()),n&&pg(i,v,t,m,r),r.polygonEnd()),d=r,i=l=o=null}};function n(t,e){_(t,e)&&d.point(t,e)}function y(t,e){var n,r,i=_(t,e);l&&o.push([t,e]),f?(s=t,a=e,f=!1,(u=i)&&(d.lineStart(),d.point(t,e))):i&&p?d.point(t,e):(n=[h=Math.max(_g,Math.min(yg,h)),c=Math.max(_g,Math.min(yg,c))],r=[t=Math.max(_g,Math.min(yg,t)),e=Math.max(_g,Math.min(yg,e))],cg(n,r,x,E,w,b)?(p||(d.lineStart(),d.point(n[0],n[1])),d.point(r[0],r[1]),i||d.lineEnd(),g=!1):i&&(d.lineStart(),d.point(t,e),g=!1)),h=t,c=e,p=i}return e}),o()):null==C?null:[[C,l],[p,f]];function _(t,e){return x<=t&&t<=w&&E<=e&&e<=b}function m(t,e,n,r){var i=0,o=0;if(null==t||(i=s(t,n))!==(o=s(e,n))||a(t,e)<0^0<n)for(;r.point(0===i||3===i?x:w,1<i?b:E),(i=(i+n+4)%4)!==o;);else r.point(e[0],e[1])}function s(t,e){return Of(t[0]-x)<If?0<e?0:3:Of(t[0]-w)<If?0<e?2:1:Of(t[1]-E)<If?0<e?1:0:0<e?3:2}function v(t,e){return a(t.x,e.x)}function a(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}var x,E,w,b},n.scale=function(t){return arguments.length?(y=+t,i()):y},n.translate=function(t){return arguments.length?(_=+t[0],m=+t[1],i()):[_,m]},n.center=function(t){return arguments.length?(v=t[0]%360*Pf,x=t[1]%360*Pf,i()):[v*Lf,x*Lf]},n.rotate=function(t){return arguments.length?(E=t[0]%360*Pf,w=t[1]%360*Pf,b=2<t.length?t[2]%360*Pf:0,i()):[E*Lf,w*Lf,b*Lf]},n.precision=function(t){return arguments.length?(L=Ag(r,M=t*t),o()):Gf(M)},n.fitExtent=function(t,e){return Rg(n,t,e)},n.fitSize=function(t,e){return Rg(n,[[0,0],t],e)},function(){return s=function(){return t}.apply(this,arguments),n.invert=s.invert&&e,i()}();function n(t){return[(t=c(t[0]*Pf,t[1]*Pf))[0]*y+a,u-t[1]*y]}function e(t){return(t=c.invert((t[0]-a)/y,(u-t[1])/y))&&[t[0]*Lf,t[1]*Lf]}function r(t,e){return[(t=s(t,e))[0]*y+a,u-t[1]*y]}function i(){c=eg(h=rg(E,w,b),s);var t=s(v,x);return a=_-t[0]*y,u=m+t[1]*y,o()}function o(){return g=d=null,n}var s,a,u,h,c,l,p,f,g,d,y,_,m,v,x,E,w,b,I,N,C,S,M,L}function qg(t,e){return[t,Ff(Bf((Cf+e)/2))]}function Gg(r){var i,o,s,a=Fg(r),e=a.center,u=a.scale,n=a.translate,h=a.clipExtent,c=null;function l(){var e,t=Nf*u(),n=a((e=rg((e=a.rotate())[0]*Pf,e[1]*Pf,2<e.length?e[2]*Pf:0),function(t){return(t=e.invert(t[0]*Pf,t[1]*Pf))[0]*=Lf,t[1]*=Lf,t}([0,0])));return h(null==c?[[n[0]-t,n[1]-t],[n[0]+t,n[1]+t]]:r===qg?[[Math.max(n[0]-t,c),i],[Math.min(n[0]+t,o),s]]:[[c,Math.max(n[1]-t,i)],[o,Math.min(n[1]+t,s)]])}return a.scale=function(t){return arguments.length?(u(t),l()):u()},a.translate=function(t){return arguments.length?(n(t),l()):n()},a.center=function(t){return arguments.length?(e(t),l()):e()},a.clipExtent=function(t){return arguments.length?(null==t?c=i=o=s=null:(c=+t[0][0],i=+t[0][1],o=+t[1][0],s=+t[1][1]),l()):null==c?null:[[c,i],[o,s]]},l()}function Bg(t,e){return[Ff(Bf((Cf+e)/2)),-t]}qg.invert=function(t,e){return[t,2*Rf(Df(e))-Cf]},Bg.invert=function(t,e){return[-e,2*Rf(Df(t))-Cf]};var kg=function(){var t=Gg(Bg),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],2<t.length?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)};function zg(t,n,r,i){var e=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return R(t,function(t){var e=zg(t,n,r,i);e&&s.push(e)}),Y(s)}var a,u=W(t),h=50<u[1]&&50<u[3],c=h?{type:o.type,coordinates:function e(t,n){return"object"!=_typeof(t[0])?n(t):t.map(function(t){return e(t,n)})}(o.coordinates,jg(o))}:Tn(o),l=(new Ih).read(c),p=g(d(n,r),"meters"),f=Bl.bufferOp(l,p);if(!function t(e){return(Array.isArray(e[0])?t:isNaN)(e[0])}((f=(new Nh).write(f)).coordinates))return(a=h?{type:f.type,coordinates:function e(t,n){return"object"!=_typeof(t[0])?n.invert(t):t.map(function(t){return e(t,n)})}(f.coordinates,jg(o))}:An(f)).geometry?a:j(a,e)}function jg(t){var e=Be(t).geometry.coordinates.reverse(),n=e.map(function(t){return-t});return kg().center(e).rotate(n).scale(p)}function Xg(){for(var t=new Ih,e=t.read(JSON.stringify(arguments[0].geometry)),n=1;n<arguments.length;n++)e=mf.union(e,t.read(JSON.stringify(arguments[n].geometry)));return{type:"Feature",geometry:e=(new Nh).write(e),properties:arguments[0].properties}}function Ug(t,e){var n=et(t),r=et(e);if(Ne(er(r,{precision:4})).coordinates[0].length<4)return null;if(Ne(er(n,{precision:4})).coordinates[0].length<4)return null;var i=new Ih,o=i.read(er(n)),s=i.read(er(r)),a=uf.intersection(o,s);return a.isEmpty()?null:j((new Nh).write(a))}function Yg(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.properties||{},i=n.triangles,o=n.mask;if(null==e)throw new Error("cellSide is required");if(!V(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(o&&-1===["Polygon","MultiPolygon"].indexOf(rt(o)))throw new Error("options.mask must be a (Multi)Polygon");var s=t[0],a=t[1],u=t[2],h=t[3],c=(a+h)/2,l=(s+u)/2,p=2*e/ne([s,c],[u,c],n)*(u-s),f=2*e/ne([l,a],[l,h],n)*(h-a),g=p/2,d=2*g,y=Math.sqrt(3)/2*f,_=u-s,m=h-a,v=.75*d,x=y,E=(_-d)/(d-g/2),w=Math.floor(E),b=(w*v-g/2-_)/2-g/2+v/2,I=Math.floor((m-y)/y),N=(m-I*y)/2,C=y/2<I*y-m;C&&(N-=y/4);for(var S=[],M=[],L=0;L<6;L++){var P=2*Math.PI/6*L;S.push(Math.cos(P)),M.push(Math.sin(P))}for(var O=[],R=0;R<=w;R++)for(var T=0;T<=I;T++){var A,D,F,q=R%2==1;0===T&&q||0===T&&C||(A=R*v+s-b,D=T*x+a+N,q&&(D-=y/2),!0===i?function(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(G([u],r))}return s}([A,D],p/2,f/2,r,S,M).forEach(function(t){o&&!Ug(o,t)||O.push(t)}):(F=function(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],h=t[1]+n*o[a];s.push([u,h])}return s.push(s[0].slice()),G([s],r)}([A,D],p/2,f/2,r,S,M),o&&!Ug(o,F)||O.push(F)))}return Y(O)}function Vg(t){if(t.features.length<=1)return t;var e,n,r,o=(e=t,n=ft(),r=[],A(e,function(t,e){var n=W(t);r.push({minX:n[0],minY:n[1],maxX:n[2],maxY:n[3],geojson:t,index:e})}),n.load(r),n),s=[],a={};return A(t,function(t,e){if(a[e])return!0;for(o.remove({index:e},Hg),a[e]=!0;;){var n,r=W(t),i=o.search({minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]});if(0<i.length&&((n=i.map(function(t){return a[t.index]=!0,o.remove({index:t.index},Hg),t.geojson})).push(t),t=Xg.apply(this,n)),0===i.length)break}s.push(t)}),Y(s)}function Hg(t,e){return t.index===e.index}function Wg(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.mask,o=[];if(null==e)throw new Error("cellSide is required");if(!V(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(i&&-1===["Polygon","MultiPolygon"].indexOf(rt(i)))throw new Error("options.mask must be a (Multi)Polygon");for(var s=t[0],a=t[1],u=t[2],h=t[3],c=e/ne([s,a],[u,a],n)*(u-s),l=e/ne([s,a],[s,h],n)*(h-a),p=u-s,f=h-a,g=Math.floor(p/c),d=Math.floor(f/l),y=(f-d*l)/2,_=s+(p-g*c)/2,m=0;m<g;m++){for(var v=a+y,x=0;x<d;x++){var E=G([[[_,v],[_,v+l],[_+c,v+l],[_+c,v],[_,v]]],r);i&&!Ug(i,E)||o.push(E),v+=l}_+=c}return Y(o)}function Jg(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.mask,o=[];if(null==e)throw new Error("cellSide is required");if(!V(e))throw new Error("cellSide is invalid");if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be array");if(4!==t.length)throw new Error("bbox must contain 4 numbers");if(i&&-1===["Polygon","MultiPolygon"].indexOf(rt(i)))throw new Error("options.mask must be a (Multi)Polygon");for(var s=e/ne([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),a=e/ne([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),u=0,h=t[0];h<=t[2];){for(var c=0,l=t[1];l<=t[3];){var p=null,f=null;u%2==0&&c%2==0?(p=G([[[h,l],[h,l+a],[h+s,l],[h,l]]],r),f=G([[[h,l+a],[h+s,l+a],[h+s,l],[h,l+a]]],r)):u%2==0&&c%2==1?(p=G([[[h,l],[h+s,l+a],[h+s,l],[h,l]]],r),f=G([[[h,l],[h,l+a],[h+s,l+a],[h,l]]],r)):c%2==0&&u%2==1?(p=G([[[h,l],[h,l+a],[h+s,l+a],[h,l]]],r),f=G([[[h,l],[h+s,l+a],[h+s,l],[h,l]]],r)):c%2==1&&u%2==1&&(p=G([[[h,l],[h,l+a],[h+s,l],[h,l]]],r),f=G([[[h,l+a],[h+s,l+a],[h+s,l],[h,l+a]]],r)),i?(Ug(i,p)&&o.push(p),Ug(i,f)&&o.push(f)):(o.push(p),o.push(f)),l+=a,c++}u++,h+=s}return Y(o)}t.projection=Gn,t.random=ws,t.clusters=Ps,t.helpers=I,t.invariant=it,t.meta=z,t.isolines=function(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(tt(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!H(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s,a,u,h,c,l,p,f,g,d,y,_,m=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;tt(t,"Point","input must contain Points");for(var o,s,a=(o=r,s={},L(t,function(t){var e=Z(t)[1];s[e]||(s[e]=[]),s[e].push(t)}),Object.keys(s).map(function(t){return s[t].sort(function(t,e){return Z(t)[0]-Z(e)[0]})}).sort(function(t,e){return o?Z(t[0])[1]-Z(e[0])[1]:Z(e[0])[1]-Z(t[0])[1]})),u=[],h=0;h<a.length;h++){for(var c=a[h],l=[],p=0;p<c.length;p++){var f=c[p];f.properties[n]?l.push(f.properties[n]):l.push(0),!0===i&&(f.properties.matrixPosition=[h,p])}u.push(l)}return u}(t,{zProperty:r,flip:!0});return Y((s=function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Object.assign({},r,i[s]),h=v(function(t,e,n){n=n||{};for(var r=Object.keys(ot),i=0;i<r.length;i++){var o=r[i],s=null!=(s=n[o])?s:ot[o];st[o]=s}st.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var h,c,l,a=(h=function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=0;o<n;++o){i.cells[o]=[];for(var s=0;s<r;++s){var a,u,h,c,l,p,f=0,g=t[o+1][s],d=t[o+1][s+1],y=t[o][s+1],_=t[o][s];isNaN(g)||isNaN(d)||isNaN(y)||isNaN(_)||(f|=e<=g?8:0,f|=e<=d?4:0,f|=e<=y?2:0,l=!1,5!=(f|=e<=_?1:0)&&10!==f||(p=(g+d+y+_)/4,5===f&&p<e?(f=10,l=!0):10===f&&p<e&&(f=5,l=!0)),0!==f&&15!==f&&(a=u=h=c=.5,1===f?(h=1-at(e,g,_),u=1-at(e,y,_)):2===f?(u=at(e,_,y),c=1-at(e,d,y)):3===f?(h=1-at(e,g,_),c=1-at(e,d,y)):4===f?(a=at(e,g,d),c=at(e,y,d)):5===f?(a=at(e,g,d),c=at(e,y,d),u=1-at(e,y,_),h=1-at(e,g,_)):6===f?(u=at(e,_,y),a=at(e,g,d)):7===f?(h=1-at(e,g,_),a=at(e,g,d)):8===f?(h=at(e,_,g),a=1-at(e,d,g)):9===f?(u=1-at(e,y,_),a=1-at(e,d,g)):10===f?(a=1-at(e,d,g),c=1-at(e,d,y),u=at(e,_,y),h=at(e,_,g)):11===f?(a=1-at(e,d,g),c=1-at(e,d,y)):12===f?(h=at(e,_,g),c=at(e,y,d)):13===f?(u=1-at(e,y,_),c=at(e,y,d)):14===f?(h=at(e,_,g),u=at(e,_,y)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+f),i.cells[o][s]={cval:f,flipped:l,top:a,right:c,bottom:u,left:h}))}}return i}(t,e),c=[],l=0,h.rows,h.cols,h.cells.forEach(function(t,u){t.forEach(function(t,e){if(void 0!==t&&5!==t.cval&&10!==t.cval&&!ut(t)){var n=function(t,e,n){var r,i,o,s=t.length,a=[],u=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],h=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],c=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],l=(t[e][n],t[e][n]),p=l.cval,f=ct(l,o=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"][p]);a.push([n+f[0],e+f[1]]),f=ct(l,o=c[p]),a.push([n+f[0],e+f[1]]),ht(l);for(var g=n+u[p],d=e+h[p],y=p;0<=g&&0<=d&&d<s&&(g!=n||d!=e)&&void 0!==(l=t[d][g]);){if(0===(p=l.cval)||15===p)return{path:a,info:"mergeable"};o=c[p],r=u[p],i=h[p],5!==p&&10!==p||(5===p?l.flipped?(r=-1===h[y]?(o="left",-1):(o="right",1),i=0):-1===u[y]&&(o="bottom",r=0,i=-1):10===p&&(l.flipped?i=-1===u[y]?(o="top",r=0,1):(o="bottom",r=0,-1):1===h[y]&&(o="left",r=-1,i=0))),f=ct(l,o),a.push([g+f[0],d+f[1]]),ht(l),g+=r,d+=i,y=p}return{path:a,info:"closed"}}(h.cells,u,e),r=!1;if("mergeable"===n.info)for(var i=n.path[n.path.length-1][0],o=n.path[n.path.length-1][1],s=l-1;0<=s;s--)if(Math.abs(c[s][0][0]-i)<=1e-7&&Math.abs(c[s][0][1]-o)<=1e-7){for(var a=n.path.length-2;0<=a;--a)c[s].unshift(n.path[a]);r=!0;break}r||(c[l++]=n.path)}})}),c);return"function"==typeof st.successCallback&&st.successCallback(a),a}(t,u[n]=a),u);o.push(h)}return o}(m,e,r,i,o),a=m,h=(u=W(t))[2]-u[0],c=u[3]-u[1],l=u[0],p=u[1],f=a[0].length-1,g=a.length-1,d=h/f,y=c/g,_=function(t){t[0]=t[0]*d+l,t[1]=t[1]*y+p},s.forEach(function(t){N(t,_)}),s))},t.convex=Jt,t.pointsWithinPolygon=Qt,t.concave=function(t,a){if(!H(a=a||{}))throw new Error("options is invalid");if(!t)throw new Error("points is required");var u=a.maxEdge||1/0;if(!V(u))throw new Error("maxEdge is invalid");var n,r,e=$t((n=[],r={},L(t,function(t){var e;t.geometry&&(e=t.geometry.coordinates.join("-"),r.hasOwnProperty(e)||(n.push(t),r[e]=!0))}),Y(n)));if(e.features=e.features.filter(function(t){var e=t.geometry.coordinates[0][0],n=t.geometry.coordinates[0][1],r=t.geometry.coordinates[0][2],i=ne(e,n,a),o=ne(n,r,a),s=ne(e,r,a);return i<=u&&o<=u&&s<=u}),e.features.length<1)return null;var i=Ie(e,a);return 1===i.coordinates.length&&(i.coordinates=i.coordinates[0],i.type="Polygon"),j(i)},t.collect=function(t,e,n,i){var o=ft(6),r=e.features.map(function(t){return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:t.properties[n]}});return o.load(r),t.features.forEach(function(e){e.properties||(e.properties={});var t=W(e),n=o.search({minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}),r=[];n.forEach(function(t){Zt([t.minX,t.minY],e)&&r.push(t.property)}),e.properties[i]=r}),t},t.flip=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return!1!==n&&void 0!==n||(t=re(t)),N(t,function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e}),t},t.simplify=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=void 0!==e.tolerance?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(n&&n<0)throw new Error("invalid tolerance");return!0!==i&&(t=re(t)),R(t,function(t){!function(t,e,n){var r=t.type;if("Point"!==r&&"MultiPoint"!==r){Ne(t,!0);var i=t.coordinates;switch(r){case"LineString":t.coordinates=Le(i,e,n);break;case"MultiLineString":t.coordinates=i.map(function(t){return Le(t,e,n)});break;case"Polygon":t.coordinates=Pe(i,e,n);break;case"MultiPolygon":t.coordinates=i.map(function(t){return Pe(t,e,n)})}}}(t,n,r)}),t},t.bezierSpline=Re,t.tag=function(t,n,r,i){return t=re(t),n=re(n),L(t,function(e){e.properties||(e.properties={}),L(n,function(t){void 0===e.properties[i]&&Zt(e,t)&&(e.properties[i]=t.properties[r])})}),t},t.sample=function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");return Y(function(t,e){for(var n,r,i=t.slice(0),o=t.length,s=o-e;o-- >s;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(s)}(t.features,e))},t.envelope=Ae,t.square=De,t.circle=qe,t.midpoint=function(t,e){return Fe(t,ne(t,e)/2,Ge(t,e))},t.center=Be,t.centerOfMass=function t(e,n){switch(rt(e)){case"Point":return e;case"Polygon":var r=[];N(e,function(t){r.push(t)});for(var i,o,s,a,u,h,c,l=ke(e,n),p=l.geometry.coordinates,f=0,g=0,d=0,y=r.map(function(t){return[t[0]-p[0],t[1]-p[1]]}),_=0;_<r.length-1;_++)s=(i=y[_])[0],u=i[1],a=(o=y[_+1])[0],d+=c=s*(h=o[1])-a*u,f+=(s+a)*c,g+=(u+h)*c;if(0===d)return l;var m=1/(.5*d*6);return X([p[0]+m*f,p[1]+m*g],n);default:var v=Jt(e);return v?t(v,n):ke(e,n)}},t.centroid=ke,t.combine=function(t){var r={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}},e=Object.keys(r).reduce(function(t,e){return t[e.replace("Multi","")]=e,t},{});function n(t,e,n){n?r[e].coordinates=r[e].coordinates.concat(t.geometry.coordinates):r[e].coordinates.push(t.geometry.coordinates),r[e].properties.push(t.properties)}return L(t,function(t){t.geometry&&(r[t.geometry.type]?n(t,t.geometry.type,!0):e[t.geometry.type]&&n(t,e[t.geometry.type],!1))}),Y(Object.keys(r).filter(function(t){return r[t].coordinates.length}).sort().map(function(t){return j({type:t,coordinates:r[t].coordinates},{collectedProperties:r[t].properties})}))},t.distance=ne,t.explode=ze,t.bbox=W,t.tesselate=function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=an(t.geometry.coordinates):t.geometry.coordinates.forEach(function(t){e.features=e.features.concat(an(t))}),e},t.bboxPolygon=Te,t.booleanPointInPolygon=Zt,t.nearestPoint=un,t.nearestPointOnLine=Ln,t.nearestPointToLine=function(t,n,e){if(!H(e=e||{}))throw new Error("options is invalid");var r=e.units,i=e.properties||{};if(!t)throw new Error("points is required");if(!(t=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return R(t,function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})}),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter(function(t){return"Point"===t.geometry.type}),t;default:throw new Error("points must be a Point Collection")}}(t)).features.length)throw new Error("points must contain features");if(!n)throw new Error("line is required");if("LineString"!==rt(n))throw new Error("line must be a LineString");var o=1/0,s=null;return L(t,function(t){var e=Bn(t,n,{units:r});e<o&&(o=e,s=t)}),s&&(s.properties=Object.assign({dist:o},s.properties,i)),s},t.planepoint=function(t,e){var n=J(t),r=et(e).coordinates[0];if(r.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=n[0],h=n[1],c=r[0][0],l=r[0][1],p=void 0!==o?o:r[0][2],f=r[1][0],g=r[1][1],d=void 0!==s?s:r[1][2],y=r[2][0],_=r[2][1],m=void 0!==a?a:r[2][2];return(m*(u-c)*(h-g)+p*(u-f)*(h-_)+d*(u-y)*(h-l)-d*(u-c)*(h-_)-m*(u-f)*(h-l)-p*(u-y)*(h-g))/((u-c)*(h-g)+(u-f)*(h-_)+(u-y)*(h-l)-(u-c)*(h-_)-(u-f)*(h-l)-(u-y)*(h-g))},t.tin=$t,t.bearing=Ge,t.destination=Fe,t.kinks=function(t){var e,n,m={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(_){e.forEach(function(t){for(var e,n,r,i,o,s,a,u,h,c,l,p,f,g=0;g<_.length-1;g++)for(var d=g;d<t.length-1;d++){if(_===t){if(1===Math.abs(g-d))continue;if(0===g&&d===_.length-2&&_[g][0]===_[_.length-1][0]&&_[g][1]===_[_.length-1][1])continue}var y=(e=_[g][0],n=_[g][1],r=_[g+1][0],i=_[g+1][1],o=t[d][0],s=t[d][1],a=t[d+1][0],f=void 0,f={x:null,y:null,onLine1:!1,onLine2:!1},0==(h=((u=t[d+1][1])-s)*(r-e)-(a-o)*(i-n))?null!==f.x&&null!==f.y&&f:(p=(r-e)*(c=n-s)-(i-n)*(l=e-o),c=((a-o)*c-(u-s)*l)/h,l=p/h,f.x=e+c*(r-e),f.y=n+c*(i-n),0<=c&&c<=1&&(f.onLine1=!0),0<=l&&l<=1&&(f.onLine2=!0),!(!f.onLine1||!f.onLine2)&&[f.x,f.y]));y&&m.features.push(X([y[0],y[1]]))}})}),m},t.pointOnFeature=zn,t.area=Xn,t.along=function(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r;if("Feature"===t.type)r=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");r=t.coordinates}if(!V(e))throw new Error("distance must be a number");for(var i=0,o=0;o<r.length&&!(i<=e&&o===r.length-1);o++){if(e<=i){var s=e-i;if(s){var a=Ge(r[o],r[o-1])-180;return Fe(r[o],s,a,n)}return X(r[o])}i+=ne(r[o],r[o+1],n)}return X(r[r.length-1])},t.length=Wn,t.lineSlice=function(t,e,n){var r=Z(n);if("LineString"!==rt(n))throw new Error("line must be a LineString");for(var i,o=Ln(n,t),s=Ln(n,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(r[u]);return a.push(i[1].geometry.coordinates),U(a,n.properties)},t.lineSliceAlong=Jn,t.pointGrid=tr,t.truncate=er,t.flatten=function(t){if(!t)throw new Error("geojson is required");var e=[];return A(t,function(t){e.push(t)}),Y(e)},t.lineIntersect=Sn,t.lineChunk=function(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return A(t,function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=Wn(t,{units:n});if(i<=e)return r(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){r(Jn(t,e*s,e*(s+1),{units:n}))}}(t,e,r,function(t){o.push(t)})}),Y(o)},t.unkinkPolygon=function(t){var n=[];return A(t,function(e){"Polygon"===e.geometry.type&&L(function(t){if("Feature"!=t.type)throw new Error("The input must a geojson object of type Feature");if(void 0===t.geometry||null==t.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=t.geometry.type)throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,n=[],r=0;r<e;r++){var i=t.geometry.coordinates[r];sr(i[0],i[i.length-1])||i.push(i[0]),n.push.apply(n,i.slice(0,i.length-1))}if(!function(t){for(var e={},n=1,r=0,i=t.length;r<i;++r){if(e.hasOwnProperty(t[r])){n=0;break}e[t[r]]=1}return n}(n))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=n.length,s=function(t,p,e){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===e&&(e=1);var f=t.geometry.coordinates,g=[],d={};if(e){for(var n=[],r=0;r<f.length;r++)for(var i=0;i<f[r].length-1;i++)n.push(l(r,i));var o=ft();o.load(n)}for(var s=0;s<f.length;s++)for(var a=0;a<f[s].length-1;a++)if(e)o.search(l(s,a)).forEach(function(t){var e=t.ring,n=t.edge;c(s,a,e,n)});else for(var u=0;u<f.length;u++)for(var h=0;h<f[u].length-1;h++)c(s,a,u,h);return p||(g={type:"Feature",geometry:{type:"MultiPoint",coordinates:g}}),g;function c(t,e,n,r){var i,o,s,a=f[t][e],u=f[t][e+1],h=f[n][r],c=f[n][r+1],l=function(t,e,n,r){if(nr(t,n)||nr(t,r)||nr(e,n)||nr(r,n))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=n[0],h=n[1],c=r[0],l=r[1],p=(i-s)*(h-l)-(o-a)*(u-c);return 0==p?null:[((i*a-o*s)*(u-c)-(i-s)*(u*l-h*c))/p,((i*a-o*s)*(h-l)-(o-a)*(u*l-h*c))/p]}(a,u,h,c);null===l||(i=u[0]!==a[0]?(l[0]-a[0])/(u[0]-a[0]):(l[1]-a[1])/(u[1]-a[1]),o=c[0]!==h[0]?(l[0]-h[0])/(c[0]-h[0]):(l[1]-h[1])/(c[1]-h[1]),1<=i||i<=0||1<=o||o<=0)||((s=!d[l])&&(d[l]=!0),p?g.push(p(l,t,e,a,u,i,n,r,h,c,o,s)):g.push(l))}function l(t,e){var n,r,i=f[t][e],o=f[t][e+1],s=i[0]<o[0]?(n=i[0],o[0]):(n=o[0],i[0]),a=i[1]<o[1]?(r=i[1],o[1]):(r=o[1],i[1]);return{minX:n,minY:r,maxX:s,maxY:a,ring:t,edge:e}}}(t,function(t,e,n,r,i,o,s,a,u,h,c,l){return[t,e,n,r,i,o,s,a,u,h,c,l]}),a=s.length;if(0==a){for(var u=[],r=0;r<e;r++)u.push(G([t.geometry.coordinates[r]],{parent:-1,winding:function(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);return or([t[(e-1).modulo(t.length-1)],t[e],t[(e+1).modulo(t.length-1)]],!0)?1:-1}(t.geometry.coordinates[r])}));var h=Y(u);return F(),q(),h}var c=[],l=[];for(r=0;r<e;r++){c.push([]);for(var p=0;p<t.geometry.coordinates[r].length-1;p++)c[r].push([new rr(t.geometry.coordinates[r][(p+1).modulo(t.geometry.coordinates[r].length-1)],1,[r,p],[r,(p+1).modulo(t.geometry.coordinates[r].length-1)],void 0)]),l.push(new ir(t.geometry.coordinates[r][p],[r,(p-1).modulo(t.geometry.coordinates[r].length-1)],[r,p],void 0,void 0,!1,!0))}for(r=0;r<a;r++)c[s[r][1]][s[r][2]].push(new rr(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&l.push(new ir(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var f=l.length;for(r=0;r<c.length;r++)for(p=0;p<c[r].length;p++)c[r][p].sort(function(t,e){return t.param<e.param?-1:1});var g=[];for(r=0;r<f;r++)g.push({minX:l[r].coord[0],minY:l[r].coord[1],maxX:l[r].coord[0],maxY:l[r].coord[1],index:r});var d=ft();for(d.load(g),r=0;r<c.length;r++)for(p=0;p<c[r].length;p++)for(var y=0;y<c[r][p].length;y++){m=y==c[r][p].length-1?c[r][(p+1).modulo(t.geometry.coordinates[r].length-1)][0].coord:c[r][p][y+1].coord;var _=d.search({minX:m[0],minY:m[1],maxX:m[0],maxY:m[1]})[0];c[r][p][y].nxtIsectAlongEdgeIn=_.index}for(r=0;r<c.length;r++)for(p=0;p<c[r].length;p++)for(y=0;y<c[r][p].length;y++){var m=c[r][p][y].coord,v=(_=d.search({minX:m[0],minY:m[1],maxX:m[0],maxY:m[1]})[0]).index;!(v<o)&&sr(l[v].ringAndEdge1,c[r][p][y].ringAndEdgeIn)?l[v].nxtIsectAlongRingAndEdge1=c[r][p][y].nxtIsectAlongEdgeIn:l[v].nxtIsectAlongRingAndEdge2=c[r][p][y].nxtIsectAlongEdgeIn}for(var x=[],p=r=0;p<e;p++){for(var E=r,y=0;y<t.geometry.coordinates[p].length-1;y++)l[r].coord[0]<l[E].coord[0]&&(E=r),r++;var w=l[E].nxtIsectAlongRingAndEdge2;for(y=0;y<l.length;y++)if(l[y].nxtIsectAlongRingAndEdge1==E||l[y].nxtIsectAlongRingAndEdge2==E){var b=y;break}var I=or([l[b].coord,l[E].coord,l[w].coord],!0)?1:-1;x.push({isect:E,parent:-1,winding:I})}for(x.sort(function(t,e){return l[t.isect].coord>l[e.isect].coord?-1:1}),u=[];0<x.length;){for(var N=x.pop(),C=N.isect,S=N.parent,M=N.winding,L=u.length,P=[l[C].coord],O=C,R=l[C].ringAndEdge1Walkable?(A=l[C].ringAndEdge1,l[C].nxtIsectAlongRingAndEdge1):(A=l[C].ringAndEdge2,l[C].nxtIsectAlongRingAndEdge2);!sr(l[C].coord,l[R].coord);){P.push(l[R].coord);var T,A,D=void 0;for(r=0;r<x.length;r++)if(x[r].isect==R){D=r;break}null!=D&&x.splice(D,1),R=sr(A,l[R].ringAndEdge1)?(A=l[R].ringAndEdge2,l[R].ringAndEdge2Walkable=!1,l[R].ringAndEdge1Walkable&&(T={isect:R},or([l[O].coord,l[R].coord,l[l[R].nxtIsectAlongRingAndEdge2].coord],1==M)?(T.parent=S,T.winding=-M):(T.parent=L,T.winding=M),x.push(T)),l[O=R].nxtIsectAlongRingAndEdge2):(A=l[R].ringAndEdge1,l[R].ringAndEdge1Walkable=!1,l[R].ringAndEdge2Walkable&&(T={isect:R},or([l[O].coord,l[R].coord,l[l[R].nxtIsectAlongRingAndEdge1].coord],1==M)?(T.parent=S,T.winding=-M):(T.parent=L,T.winding=M),x.push(T)),l[O=R].nxtIsectAlongRingAndEdge1)}P.push(l[R].coord),u.push(G([P],{index:L,parent:S,winding:M,netWinding:void 0}))}function F(){for(var t=[],e=0;e<h.features.length;e++)-1==h.features[e].properties.parent&&t.push(e);if(1<t.length)for(e=0;e<t.length;e++){for(var n=-1,r=0;r<h.features.length;r++)t[e]!=r&&Zt(h.features[t[e]].geometry.coordinates[0][0],h.features[r],{ignoreBoundary:!0})&&Xn(h.features[r])<1/0&&(n=r);h.features[t[e]].properties.parent=n}}function q(){for(var t,e=0;e<h.features.length;e++){-1==h.features[e].properties.parent&&(t=h.features[e].properties.winding,function t(e,n){for(var r=0;r<h.features.length;r++){var i;h.features[r].properties.parent==e&&(i=n+h.features[r].properties.winding,t(r,h.features[r].properties.netWinding=i))}}(e,h.features[e].properties.netWinding=t))}}return h=Y(u),F(),q(),h}(e),function(t){n.push(G(t.geometry.coordinates,e.properties))})}),Y(n)},t.greatCircle=function(t,e,n){if("object"!=_typeof(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.npoints,o=n.offset;return t=J(t),e=J(e),r=r||{},i=i||100,o=o||10,new pr({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},t.lineSegment=Cn,t.lineSplit=function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=rt(t),r=rt(e);if("LineString"!==n)throw new Error("line must be LineString");if("FeatureCollection"===r)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===r)throw new Error("splitter cannot be a GeometryCollection");var i=er(e,{precision:7});switch(r){case"Point":return gr(t,i);case"MultiPoint":return fr(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return fr(t,Sn(t,i))}},t.lineArc=_r,t.polygonToLine=vr,t.lineToPolygon=Er,t.bboxClip=function(t,e){var n=t.geometry?t.geometry.type:t.type,r=Z(t),i=t.properties;switch(n){case"LineString":case"MultiLineString":var o=[];return"LineString"===n&&(r=[r]),r.forEach(function(t){Ir(t,e,o)}),1===o.length?U(o[0],i):v(o,i);case"Polygon":return G(Mr(r,e),i);case"MultiPolygon":return x(r.map(function(t){return Mr(t,e)}),i);default:throw new Error("geometry "+n+" not supported")}},t.lineOverlap=Ar,t.sector=function(t,e,n,r,i){if(!H(i=i||{}))throw new Error("options is invalid");if(!t)throw new Error("center is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=_typeof(i))throw new Error("options must be an object");if(Fr(n)===Fr(r))return qe(t,e,i);var o=Z(t),s=_r(t,e,n,r,i),a=[[o]];return N(s,function(t){a[0].push(t)}),a[0].push(o),G(a)},t.rhumbBearing=Pn,t.rhumbDistance=Rn,t.rhumbDestination=qr,t.polygonTangents=function(t,e){var n,r=Z(t),i=Z(e);switch(rt(e)){case"Polygon":s=i[0][0],a=i[0][0],n=Br(i[0][0],i[0][i[0].length-1],r);var o=Gr(i[0],r,n,void 0,s,a),s=o[0],a=o[1];break;case"MultiPolygon":s=i[0][0][0],a=i[0][0][0],n=Br(i[0][0][0],i[0][0][i[0][0].length-1],r),i.forEach(function(t){var e=Gr(t[0],r,n,void 0,s,a);s=e[0],a=e[1]})}return Y([X(s),X(a)])},t.rewind=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof n)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof r)throw new Error("<mutate> must be a boolean");!1===r&&(t=re(t));var i=[];switch(t.type){case"GeometryCollection":return R(t,function(t){zr(t,n)}),t;case"FeatureCollection":return L(t,function(t){L(zr(t,n),function(t){i.push(t)})}),Y(i)}return zr(t,n)},t.isobands=function(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(tt(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!H(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;tt(t,"Point","input must contain Points");for(var o,s,a=(o=r,s={},L(t,function(t){var e=Z(t)[1];s[e]||(s[e]=[]),s[e].push(t)}),Object.keys(s).map(function(t){return s[t].sort(function(t,e){return Z(t)[0]-Z(e)[0]})}).sort(function(t,e){return o?Z(t[0])[1]-Z(e[0])[1]:Z(e[0])[1]-Z(t[0])[1]})),u=[],h=0;h<a.length;h++){for(var c=a[h],l=[],p=0;p<c.length;p++){var f=c[p];f.properties[n]?l.push(f.properties[n]):l.push(0),!0===i&&(f.properties.matrixPosition=[h,p])}u.push(l)}return u}(t,{zProperty:r,flip:!0}),a=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=ki(function(t){var n=[],r=[];t.forEach(function(t){var e=Xn(G([t]));r.push(e),n.push({ring:t,area:e})}),r.sort(function(t,e){return e-t});var i=[];return r.forEach(function(t){for(var e=0;e<n.length;e++)if(n[e].area===t){i.push(n[e].ring),n.splice(e,1);break}}),i}(Vr(t,o,s-o))),u={};u.groupedRings=a,u[n]=o+"-"+s,r.push(u)}return r}(s,e,r),u=s,h=W(t),c=h[2]-h[0],l=h[3]-h[1],p=h[0],f=h[1],g=u[0].length-1,d=u.length-1,y=c/g,_=l/d,m=function(t){t[0]=t[0]*y+p,t[1]=t[1]*_+f};return a.forEach(function(t){t.groupedRings.forEach(function(t){t.forEach(function(t){t.forEach(m)})})}),Y(a.map(function(t,e){if(o[e]&&!H(o[e]))throw new Error("Each mappedProperty is required to be an Object");var n=Object.assign({},i,o[e]);return n[r]=t[r],x(t.groupedRings,n)}))},t.transformRotate=zi,t.transformScale=ji,t.transformTranslate=function(t,n,r,e){if(!H(e=e||{}))throw new Error("options is invalid");var i=e.units,o=e.zTranslation,s=e.mutate;if(!t)throw new Error("geojson is required");if(null==n||isNaN(n))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===n&&0===o)return t;if(null==r||isNaN(r))throw new Error("direction is required");return n<0&&(n=-n,r=-r),!1!==s&&void 0!==s||(t=re(t)),N(t,function(t){var e=Z(qr(t,n,r,{units:i}));t[0]=e[0],t[1]=e[1],o&&3===t.length&&(t[2]+=o)}),t},t.lineOffset=function(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=rt(t),o=t.properties;switch(i){case"LineString":return Vi(t,e,r);case"MultiLineString":var s=[];return A(t,function(t){s.push(Vi(t,e,r).geometry.coordinates)}),v(s,o);default:throw new Error("geometry "+i+" is not supported")}},t.polygonize=function(t){var e=$i.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter(function(t){return t.isValid()}).forEach(function(t){t.isHole()?n.push(t):r.push(t)}),n.forEach(function(t){Ki.findEdgeRingContaining(t,r)&&r.push(t)}),Y(r.map(function(t){return t.toPolygon()}))},t.booleanDisjoint=function(t,n){var r;return A(t,function(e){A(n,function(t){return!1!==r&&void(r=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return n=t.coordinates,r=e.coordinates,!(n[0]===r[0]&&n[1]===r[1]);case"LineString":return!to(e,t);case"Polygon":return!Zt(t,e)}break;case"LineString":switch(e.type){case"Point":return!to(t,e);case"LineString":return!(0<Sn(t,e).features.length);case"Polygon":return!eo(e,t)}break;case"Polygon":switch(e.type){case"Point":return!Zt(e,t);case"LineString":return!eo(t,e);case"Polygon":return!function(t,e){for(var n=0;n<t.coordinates[0].length;n++)if(Zt(t.coordinates[0][n],e))return 1;for(var r=0;r<e.coordinates[0].length;r++)if(Zt(e.coordinates[0][r],t))return 1}(e,t)}}var n,r}(e.geometry,t.geometry))})}),r},t.booleanContains=function(t,e){var n=rt(t),r=rt(e),i=et(t),o=et(e),s=Z(t),a=Z(e);switch(n){case"Point":if("Point"!==r)throw new Error("feature2 "+r+" geometry not supported");return ro(s,a);case"MultiPoint":switch(r){case"Point":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++)if(ro(t.coordinates[r],e.coordinates)){n=!0;break}return n}(i,o);case"MultiPoint":return function(t,e){for(var n=0;n<e.coordinates.length;n++){for(var r=!1,i=0;i<t.coordinates.length;i++)if(ro(e.coordinates[n],t.coordinates[i])){r=!0;break}if(!r)return!1}return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"Point":return Zn(o,i,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var n=!1,r=0;r<e.coordinates.length;r++)if(Zn({type:"Point",coordinates:e.coordinates[r]},t,{ignoreEndVertices:!0})&&(n=!0),!Zn({type:"Point",coordinates:e.coordinates[r]},t,{ignoreEndVertices:!1}))return!1;return n}(i,o);case"MultiPoint":return function(t,e){for(var n=!1,r=0;r<e.coordinates.length;r++)if(Zn(e.coordinates[r],t,{ignoreEndVertices:!0})&&(n=!0),!Zn(e.coordinates[r],t))return!1;return!!n}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Point":return Zt(o,i,{ignoreBoundary:!0});case"LineString":return function(t,e){var n,r,i=!1,o=0;if(!no(W(t),W(e)))return!1;for(;o<e.coordinates.length-1;o++){if(Zt({type:"Point",coordinates:(n=e.coordinates[o],r=e.coordinates[o+1],[(n[0]+r[0])/2,(n[1]+r[1])/2])},t,{ignoreBoundary:!0})){i=!0;break}}return i}(i,o);case"Polygon":return function(t,e){if(!no(W(t),W(e)))return!1;for(var n=0;n<e.coordinates[0].length;n++)if(!Zt(e.coordinates[0][n],t))return!1;return!0}(i,o);case"MultiPoint":return function(t,e){for(var n=0;n<e.coordinates.length;n++)if(!Zt(e.coordinates[n],t,{ignoreBoundary:!0}))return!1;return!0}(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}},t.booleanCrosses=function(t,e){var n=rt(t),r=rt(e),i=et(t),o=et(e);switch(n){case"MultiPoint":switch(r){case"LineString":return io(i,o);case"Polygon":return so(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"MultiPoint":return io(o,i);case"LineString":return function(t,e){if(0<Sn(t,e).features.length)for(var n=0;n<t.coordinates.length-1;n++)for(var r=0;r<e.coordinates.length-1;r++){var i=!0;if(0!==r&&r!==e.coordinates.length-2||(i=!1),ao(t.coordinates[n],t.coordinates[n+1],e.coordinates[r],i))return!0}return!1}(i,o);case"Polygon":return oo(i,o);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"MultiPoint":return so(o,i);case"LineString":return oo(o,i);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+n+" geometry not supported")}},t.booleanClockwise=kr,t.booleanOverlap=_o,t.booleanPointOnLine=Zn,t.booleanEqual=function(t,e){if(!t)throw new Error("feature1 is required");if(!e)throw new Error("feature2 is required");return rt(t)===rt(e)&&new yo({precision:6}).compare(Ne(t),Ne(e))},t.booleanWithin=Kn,t.clone=re,t.cleanCoords=Ne,t.clustersDbscan=function(n,t,e){if("object"!=_typeof(e=e||{}))throw new Error("options is invalid");var r=e.minPoints,i=e.units;if(tt(n,"Point","Input must contain Points"),null==t)throw new Error("maxDistance is required");if(!(0<Math.sign(t)))throw new Error("Invalid maxDistance");if(!(null==r||0<Math.sign(r)))throw new Error("Invalid minPoints");n=re(n),r=r||3;var o=new wo.DBSCAN,s=o.run(O(n),_(t,i),r,ne),a=-1;return s.forEach(function(t){a++,t.forEach(function(t){var e=n.features[t];e.properties||(e.properties={}),e.properties.cluster=a,e.properties.dbscan="core"})}),o.noise.forEach(function(t){var e=n.features[t];e.properties||(e.properties={}),e.properties.cluster?e.properties.dbscan="edge":e.properties.dbscan="noise"}),n},t.clustersKmeans=function(t,e){if("object"!=_typeof(e=e||{}))throw new Error("options is invalid");var n=e.numberOfClusters,r=e.mutate;tt(t,"Point","Input must contain Points");var i=t.features.length;i<(n=n||Math.round(Math.sqrt(i/2)))&&(n=i),!1!==r&&void 0!==r||(t=re(t));var o=O(t),s=o.slice(0,n),a=Mo(o,n,s),u={};return a.centroids.forEach(function(t,e){u[e]=t}),L(t,function(t,e){var n=a.idxs[e];t.properties.cluster=n,t.properties.centroid=u[n]}),t},t.pointToLineDistance=Bn,t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Lo(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Lo(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Cn(Ne(t)).features,r=Cn(Ne(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;var s=r[i].geometry.coordinates;if(f(Pn(o[0],o[1]))!==f(Pn(s[0],s[1])))return!1}return!0},t.shortestPath=function(t,e,n){if(!H(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,o=n.obstacles||Y([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!V(r)||r<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=J(t),a=J(e);switch(t=X(s),e=X(a),rt(o)){case"FeatureCollection":if(0===o.features.length)return U([s,a]);break;case"Polygon":o=Y([j(et(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var h=W(ji(Te(W(u)),1.15)),r=r||ne([h[0],h[1]],[h[2],h[1]],n)/100;u.features.pop(),u.features.pop();for(var c=h[0],l=h[1],p=h[2],f=h[3],g=r/ne([c,l],[p,l],n)*(p-c),d=r/ne([c,l],[c,f],n)*(f-l),y=p-c,_=f-l,m=Math.floor(y/g),v=Math.floor(_/d),x=(y-m*g)/2,E=[],w=[],b=[],I=[],N=1/0,C=1/0,S=f-(_-v*d)/2,M=0;l<=S;){for(var L=[],P=[],O=c+x,R=0;O<=p;){var T=X([O,S]),A=function(t,e){for(var n=0;n<e.features.length;n++)if(Zt(t,e.features[n]))return!0;return!1}(T,o);L.push(A?0:1),P.push(O+"|"+S);var D=ne(T,t);!A&&D<N&&(N=D,b={x:R,y:M});var F=ne(T,e);!A&&F<C&&(C=F,I={x:R,y:M}),O+=g,R++}w.push(L),E.push(P),S-=d,M++}var q=new Ro(w,{diagonal:!0}),G=q.grid[b.y][b.x],B=q.grid[I.y][I.x],k=Oo.search(q,G,B),z=[s];return k.forEach(function(t){var e=E[t.x][t.y].split("|");z.push([+e[0],+e[1]])}),z.push(a),Ne(U(z))},t.voronoi=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var i,o,n,r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return tt(t,"Point","points"),Y((i=Fo,o=qo,n=null,s.polygons=function(t){return s(t).polygons()},s.links=function(t){return s(t).links()},s.triangles=function(t){return s(t).triangles()},s.x=function(t){return arguments.length?(i="function"==typeof t?t:Do(+t),s):i},s.y=function(t){return arguments.length?(o="function"==typeof t?t:Do(+t),s):o},s.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],s):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},s.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],s):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},s.x(function(t){return t.geometry.coordinates[0]}).y(function(t){return t.geometry.coordinates[1]}).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(ps)));function s(r){return new ls(r.map(function(t,e){var n=[Math.round(i(t,e,r)/us)*us,Math.round(o(t,e,r)/us)*us];return n.index=e,n.data=t,n}),n)}},t.ellipse=fs,t.centerMean=ds,t.centerMedian=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!V(n))throw new Error("counter must be a number");var r=e.weight,i=ds(t,{weight:e.weight}),o=Y([]);return L(t,function(t){o.features.push(ke(t,{weight:t.properties[r]}))}),o.properties={tolerance:e.tolerance,medianCandidates:[]},function t(o,e,n,r){var i=n.properties.tolerance||.001,s=0,a=0,u=0,h=0;if(L(n,function(t){var e,n,r=t.properties.weight,i=null==r?1:r;if(!V(i=Number(i)))throw new Error("weight value must be a number");0<i&&(h+=1,0===(e=i*ne(t,o))&&(e=1),n=i/e,s+=t.geometry.coordinates[0]*n,a+=t.geometry.coordinates[1]*n,u+=n)}),h<1)throw new Error("no features to measure");var c=s/u,l=a/u;return 1===h||0===r||Math.abs(c-e[0])<i&&Math.abs(l-e[1])<i?X([c,l],{medianCandidates:n.properties.medianCandidates}):(n.properties.medianCandidates.push([c,l]),t([c,l],o,n,r-1))}(i.geometry.coordinates,[0,0],o,n)},t.standardDeviationalEllipse=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!V(n))throw new Error("steps must be a number");if(!H(i))throw new Error("properties must be a number");var o=O(t).length,s=ds(t,{weight:r}),a=0,u=0,h=0;L(t,function(t){var e=t.properties[r]||1,n=ys(Z(t),Z(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,h+=n.x*n.y*e});var c=a-u,l=Math.sqrt(Math.pow(c,2)+4*Math.pow(h,2)),p=2*h,f=Math.atan((c+l)/p),g=180*f/Math.PI,d=0,y=0,_=0;L(t,function(t){var e=t.properties[r]||1,n=ys(Z(t),Z(s));d+=Math.pow(n.x*Math.cos(f)-n.y*Math.sin(f),2)*e,y+=Math.pow(n.x*Math.sin(f)+n.y*Math.cos(f),2)*e,_+=e});var m=Math.sqrt(2*d/_),v=Math.sqrt(2*y/_),x=fs(s,m,v,{units:"degrees",angle:g,steps:n,properties:i}),E=Qt(t,Y([x])),w={meanCenterCoordinates:Z(s),semiMajorAxis:m,semiMinorAxis:v,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*O(E).length/o};return x.properties.standardDeviationalEllipse=w,x},t.difference=function(t,e){var n=et(t),r=et(e),i=t.properties||{},n=vf(n),r=vf(r);if(!n)return null;if(!r)return j(n,i);var o=new Ih,s=o.read(n),a=o.read(r),u=uf.difference(s,a);return u.isEmpty()?null:j((new Nh).write(u),i)},t.buffer=function(t,n,e){var r=(e=e||{}).units,i=e.steps||64;if(!t)throw new Error("geojson is required");if("object"!=_typeof(e))throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===n)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");i=i||64,r=r||"kilometers";var o=[];switch(t.type){case"GeometryCollection":return R(t,function(t){var e=zg(t,n,r,i);e&&o.push(e)}),Y(o);case"FeatureCollection":return L(t,function(t){var e=zg(t,n,r,i);e&&L(e,function(t){t&&o.push(t)})}),Y(o)}return zg(t,n,r,i)},t.union=Xg,t.intersect=Ug,t.dissolve=function(t,e){if(!H(e=e||{}))throw new Error("options is invalid");var o=e.propertyName;tt(t,"Polygon","dissolve");var n=re(t),s=n.features,a=[];s.forEach(function(t,e){t.properties.origIndexPosition=e});var u,h=bn();for(u in h.load(n),s){var c=s[u],l=!1;if(h.search(c).features.forEach(function(t){c=s[u];var e,n,r,i=t.properties.origIndexPosition;0<a.length&&0!==i&&(i>a[a.length-1]?i-=a.length:0!==(e=function(r,t){var i,o;if(!Array.isArray(t))throw new Error("Get closest expects an array as second argument");return t.forEach(function(t,e){var n=t-r;0<=n&&(void 0===o||n<o)&&(o=n,i=e)}),i}(i,a))&&(i-=e)),i===+u||(r=s[i])&&c&&(void 0!==o&&r.properties[o]!==c.properties[o]||_o(c,r)&&(n=r,0<Sn(U(O(c)),U(O(n))).features.length)&&(s[u]=Xg(c,r),a.push(t.properties.origIndexPosition),a.sort(function(t,e){return t-e}),h.remove(t),s.splice(i,1),c.properties.origIndexPosition=u,h.remove(c,function(t,e){return t.properties.origIndexPosition===e.properties.origIndexPosition}),l=!0))}),l){if(!c)continue;c.properties.origIndexPosition=u,h.insert(c),u--}}return s.forEach(function(t){delete t.properties.origIndexPosition,delete t.bbox}),n},t.hexGrid=Yg,t.mask=function(t,e){var i,o,n,r=G(e&&e.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),s=(i=[],o=[],A(t,function(t){var e=t.geometry.coordinates,n=e[0],r=e.slice(1);i.push(G([n])),r.forEach(function(t){o.push(G([t]))})}),[Y(i),Y(o)]),a=s[1],u=Vg(s[0]),h=a=Vg(a);return(n=[]).push(r.geometry.coordinates[0]),A(u,function(t){n.push(t.geometry.coordinates[0])}),A(h,function(t){n.push(t.geometry.coordinates[0])}),G(n)},t.squareGrid=Wg,t.triangleGrid=Jg,t.interpolate=function(e,t,a){if("object"!=_typeof(a=a||{}))throw new Error("options is invalid");var u=a.gridType,h=a.property,c=a.weight;if(!e)throw new Error("points is required");if(tt(e,"Point","input must contain Points"),!t)throw new Error("cellSize is required");if(void 0!==c&&"number"!=typeof c)throw new Error("weight must be a number");h=h||"elevation",u=u||"square",c=c||1;var n,r=W(e);switch(u){case"point":case"points":n=tr(r,t,a);break;case"square":case"squares":n=Wg(r,t,a);break;case"hex":case"hexes":n=Yg(r,t,a);break;case"triangle":case"triangles":n=Jg(r,t,a);break;default:throw new Error("invalid gridType")}var l=[];return L(n,function(i){var o=0,s=0;L(e,function(t){var e=ne("point"===u?i:ke(i),t,a),n=t.properties[h];if(void 0===n&&(n=t.geometry.coordinates[2]),void 0===n)throw new Error("zValue is missing");0===e&&(o=n);var r=1/Math.pow(e,c);s+=r,o+=r*n});var t=re(i);t.properties[h]=o/s,l.push(t)}),Y(l)},t.pointOnSurface=zn,t.polygonToLineString=vr,t.lineStringToPolygon=Er,t.inside=Zt,t.within=Qt,t.bezier=Re,t.nearest=un,t.pointOnLine=Ln,t.lineDistance=Wn,t.radians2degrees=y,t.degrees2radians=m,t.distanceToDegrees=l,t.distanceToRadians=d,t.radiansToDistance=g,t.bearingToAngle=f,t.convertDistance=_,t.toMercator=Tn,t.toWgs84=An,t.randomPosition=_s,t.randomPoint=ms,t.randomPolygon=vs,t.randomLineString=xs,t.getCluster=bs,t.clusterEach=Is,t.clusterReduce=Ns,t.createBins=Cs,t.applyFilter=Ss,t.propertiesContainsFilter=Ms,t.filterProperties=Ls,t.earthRadius=p,t.factors=r,t.unitsFactors=e,t.areaFactors=o,t.feature=j,t.geometry=n,t.point=X,t.points=i,t.polygon=G,t.polygons=s,t.lineString=U,t.lineStrings=a,t.featureCollection=Y,t.multiLineString=v,t.multiPoint=u,t.multiPolygon=x,t.geometryCollection=h,t.round=c,t.radiansToLength=g,t.lengthToRadians=d,t.lengthToDegrees=l,t.bearingToAzimuth=f,t.radiansToDegrees=y,t.degreesToRadians=m,t.convertLength=_,t.convertArea=E,t.isNumber=V,t.isObject=H,t.validateBBox=w,t.validateId=b,t.getCoord=J,t.getCoords=Z,t.containsNumber=K,t.geojsonType=Q,t.featureOf=$,t.collectionOf=tt,t.getGeom=et,t.getGeomType=nt,t.getType=rt,t.coordEach=N,t.coordReduce=C,t.propEach=S,t.propReduce=M,t.featureEach=L,t.featureReduce=P,t.coordAll=O,t.geomEach=R,t.geomReduce=T,t.flattenEach=A,t.flattenReduce=D,t.segmentEach=F,t.segmentReduce=q,t.lineEach=B,t.lineReduce=k,Object.defineProperty(t,"__esModule",{value:!0})});