Measure Length of Line

DISCLAIMER: This example was created before additional GEOMETRY-related calculation functions were added. Please consider using those instead of the turf.js library.

The example below uses the turf.js library to calculate the length of a line collected in Fulcrum. NOTE: You will need to enable Lines and Polygons for an app in order for this data event to work.

!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).turf=t()}(function(){return function r(i,o,s){function a(e,t){if(!o[e]){if(!i[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=o[e]={exports:{}},i[e][0].call(n.exports,function(t){return a(i[e][1][t]||t)},n,n.exports,r,i,o,s)}return o[e].exports}for(var u="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,n){var r,i,e=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return(r=setTimeout)(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}var u,l=[],h=!1,c=-1;function p(){h&&u&&(h=!1,u.length?l=u.concat(l):c=-1,l.length)&&f()}function f(){if(!h){for(var t=a(p),e=(h=!0,l.length);e;){for(u=l,l=[];++c<e;)u&&u[c].run();c=-1,e=l.length}u=null,h=!1,!function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return(i=clearTimeout)(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function d(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new g(t,e)),1!==l.length||h||a(f)},g.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=d,e.addListener=d,e.once=d,e.off=d,e.removeListener=d,e.removeAllListeners=d,e.emit=d,e.prependListener=d,e.prependOnceListener=d,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}],"@turf/turf":[function(t,e,n){!function(fd){!function(){var t;t=this,function(t){"use strict";var q=6371008.8,i={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*q,kilometers:6371.0088,kilometres:6371.0088,meters:q,metres:q,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:q/1852,radians:1,yards:6967335.223679999},n={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/q,yards:1.0936133},o={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function B(t,e,n){var r={type:"Feature"};return 0!==(n=void 0===n?{}:n).id&&!n.id||(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function z(t,e,n){switch(t){case"Point":return R(e).geometry;case"LineString":return V(e).geometry;case"Polygon":return k(e).geometry;case"MultiPoint":return H(e).geometry;case"MultiLineString":return Y(e).geometry;case"MultiPolygon":return W(e).geometry;default:throw new Error(t+" is invalid")}}function R(t,e,n){if(void 0===n&&(n={}),!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(ot(t[0])&&ot(t[1]))return B({type:"Point",coordinates:t},e,n);throw new Error("coordinates must contain numbers")}function j(t,e,n){return void 0===n&&(n={}),G(t.map(function(t){return R(t,e)}),n)}function k(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return B({type:"Polygon",coordinates:t},e,n)}function U(t,e,n){return void 0===n&&(n={}),G(t.map(function(t){return k(t,e)}),n)}function V(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return B({type:"LineString",coordinates:t},e,n)}function X(t,e,n){return void 0===n&&(n={}),G(t.map(function(t){return V(t,e)}),n)}function G(t,e){var n={type:"FeatureCollection"};return(e=void 0===e?{}:e).id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function Y(t,e,n){return B({type:"MultiLineString",coordinates:t},e,n=void 0===n?{}:n)}function H(t,e,n){return B({type:"MultiPoint",coordinates:t},e,n=void 0===n?{}:n)}function W(t,e,n){return B({type:"MultiPolygon",coordinates:t},e,n=void 0===n?{}:n)}function J(t,e,n){return B({type:"GeometryCollection",geometries:t},e,n=void 0===n?{}:n)}function Z(t,e){if(!(e=void 0===e?0:e)||0<=e)return e=Math.pow(10,e||0),Math.round(t*e)/e;throw new Error("precision must be a positive number")}function K(t,e){var n=i[e=void 0===e?"kilometers":e];if(n)return t*n;throw new Error(e+" units is invalid")}function Q(t,e){var n=i[e=void 0===e?"kilometers":e];if(n)return t/n;throw new Error(e+" units is invalid")}function $(t,e){return et(Q(t,e))}function tt(t){t%=360;return t<0&&(t+=360),t}function et(t){return t%(2*Math.PI)*180/Math.PI}function nt(t){return t%360*Math.PI/180}function rt(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),0<=t)return K(Q(t,e),n);throw new Error("length must be a positive number")}function it(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(0<=t))throw new Error("area must be a positive number");e=o[e];if(!e)throw new Error("invalid original units");n=o[n];if(n)return t/e*n;throw new Error("invalid final units")}function ot(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function st(t){return!!t&&t.constructor===Object}function at(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(!ot(t))throw new Error("bbox must only contain numbers")})}function ut(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 lt=Object.freeze({__proto__:null,earthRadius:q,factors:i,unitsFactors:n,areaFactors:o,feature:B,geometry:z,point:R,points:j,polygon:k,polygons:U,lineString:V,lineStrings:X,featureCollection:G,multiLineString:Y,multiPoint:H,multiPolygon:W,geometryCollection:J,round:Z,radiansToLength:K,lengthToRadians:Q,lengthToDegrees:$,bearingToAzimuth:tt,radiansToDegrees:et,degreesToRadians:nt,convertLength:rt,convertArea:it,isNumber:ot,isObject:st,validateBBox:at,validateId:ut});function ht(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l=0,h=t.type,c="FeatureCollection"===h,p="Feature"===h,f=c?t.features.length:1,g=0;g<f;g++)for(var d=(u=!!(a=c?t.features[g].geometry:p?t.geometry:t)&&"GeometryCollection"===a.type)?a.geometries.length:1,y=0;y<d;y++){var _=0,m=0;if(null!==(s=u?a.geometries[y]:a)){var v=s.coordinates,x=s.type,E=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1;switch(x){case null:break;case"Point":if(!1===e(v,l,g,_,m))return!1;l++,_++;break;case"LineString":case"MultiPoint":for(r=0;r<v.length;r++){if(!1===e(v[r],l,g,_,m))return!1;l++,"MultiPoint"===x&&_++}"LineString"===x&&_++;break;case"Polygon":case"MultiLineString":for(r=0;r<v.length;r++){for(i=0;i<v[r].length-E;i++){if(!1===e(v[r][i],l,g,_,m))return!1;l++}"MultiLineString"===x&&_++,"Polygon"===x&&m++}"Polygon"===x&&_++;break;case"MultiPolygon":for(r=0;r<v.length;r++){for(i=m=0;i<v[r].length;i++){for(o=0;o<v[r][i].length-E;o++){if(!1===e(v[r][i][o],l,g,_,m))return!1;l++}m++}_++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===ht(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function ct(t,o,s,e){var a=s;return ht(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)},e),a}function pt(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function ft(t,n,r){var i=r;return pt(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function gt(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function dt(t,n,r){var i=r;return gt(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i}function yt(t){var e=[];return ht(t,function(t){e.push(t)}),e}function _t(t,e){for(var n,r,i,o,s,a,u,l,h,c=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:{},l=p?t.features[d].bbox:f?t.bbox:void 0,h=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":if(!1===e(i,c,u,l,h))return!1;break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===e(i.geometries[n],c,u,l,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,l,h))return!1;c++}}function mt(t,o,s){var a=s;return _t(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)}),a}function vt(t,l){_t(t,function(t,e,n,r,i){var o,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==l(B(t,n,{bbox:r,id:i}),e,0)&&void 0}switch(s){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}for(var a=0;a<t.coordinates.length;a++){var u=t.coordinates[a];if(!1===l(B({type:o,coordinates:u},n),e,a))return!1}})}function xt(t,r,i){var o=i;return vt(t,function(t,e,n){o=0===e&&0===n&&void 0===i?t:r(o,t,e,n)}),o}function Et(t,g){vt(t,function(s,a,u){var l=0;if(s.geometry){var h,c,p,f,t=s.geometry.type;if("Point"!==t&&"MultiPoint"!==t)return f=p=c=0,!1!==ht(s,function(t,e,n,r,i){var o;if(!(void 0===h||c<a||p<r||f<i))return o=V([h,t],s.properties),!1!==g(o,a,u,i,l)&&(l++,void(h=t));h=t,c=a,p=r,f=i,l=0})&&void 0}})}function bt(t,o,s){var a=s,u=!1;return Et(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 wt(t,s){if(!t)throw new Error("geojson is required");vt(t,function(t,e,n){if(null!==t.geometry){var r=t.geometry.type,i=t.geometry.coordinates;switch(r){case"LineString":if(!1===s(t,e,n,0,0))return!1;break;case"Polygon":for(var o=0;o<i.length;o++)if(!1===s(V(i[o],t.properties),e,n,o))return!1}}})}function It(t,i,o){var s=o;return wt(t,function(t,e,n,r){s=0===e&&void 0===o?t:i(s,t,e,n,r)}),s}function Nt(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return V([u[s=s<0?u.length+s-1:s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),V([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),V([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),V([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function St(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return R(u,a,e);case"MultiPoint":return R(u[i=i<0?u.length+i:i],a,e);case"LineString":return R(u[s=s<0?u.length+s:s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),R(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),R(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),R(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var Ct=Object.freeze({__proto__:null,coordAll:yt,coordEach:ht,coordReduce:ct,featureEach:gt,featureReduce:dt,findPoint:St,findSegment:Nt,flattenEach:vt,flattenReduce:xt,geomEach:_t,geomReduce:mt,lineEach:wt,lineReduce:It,propEach:pt,propReduce:ft,segmentEach:Et,segmentReduce:bt});function Pt(t){var e=[1/0,1/0,-1/0,-1/0];return ht(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 Mt(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&2<=t.length&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Lt(t){if(1<t.length&&ot(t[0])&&ot(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Lt(t[0]);throw new Error("coordinates must only contain numbers")}function Ot(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 Rt(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,i=t.features;r<i.length;r++){var o=i[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}function At(t){return"Feature"===t.type?t.geometry:t}function Dt(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":("Feature"===t.type&&null!==t.geometry?t.geometry:t).type}Pt.default=Pt;var Ft=Object.freeze({__proto__:null,getCoord:Mt,getCoords:_,containsNumber:Lt,geojsonType:Ot,featureOf:Rt,collectionOf:Tt,getGeom:At,getType:Dt}),kt=Object.getOwnPropertySymbols,Gt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Bt=function(){try{if(Object.assign){var t=new String("abc");if(t[5]="de","5"!==Object.getOwnPropertyNames(t)[0]){for(var e,n={},r=0;r<10;r++)n["_"+String.fromCharCode(r)]=r;if("0123456789"===Object.getOwnPropertyNames(n).map(function(t){return n[t]}).join(""))return e={},"abcdefghijklmnopqrst".split("").forEach(function(t){e[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},e)).join("")}}}catch(t){}}()?Object.assign:function(t,e){for(var n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),i=1;i<arguments.length;i++){for(var o in n=Object(arguments[i]))Gt.call(n,o)&&(r[o]=n[o]);if(kt)for(var s=kt(n),a=0;a<s.length;a++)qt.call(n,s[a])&&(r[s[a]]=n[s[a]])}return r},zt={successCallback:null,verbose:!1},jt={};function Ut(t,e,n){return(t-e)/(n-e)}function Vt(t){return 0===t.cval||15===t.cval}function Xt(t){Vt(t)||5===t.cval||10===t.cval||(t.cval=15)}function Yt(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}var Ht=Wt;function Wt(t,e,n,r,i){!function t(e,n,r,i,o){for(;r<i;){600<i-r&&(s=i-r+1,a=n-r+1,l=Math.log(s),u=.5*Math.exp(2*l/3),l=.5*Math.sqrt(l*u*(s-u)/s)*(a-s/2<0?-1:1),t(e,n,Math.max(r,Math.floor(n-a*u/s+l)),Math.min(i,Math.floor(n+(s-a)*u/s+l)),o));var s,a,u,l,h=e[n],c=r,p=i;for(Jt(e,r,n),0<o(e[i],h)&&Jt(e,r,i);c<p;){for(Jt(e,c,p),c++,p--;o(e[c],h)<0;)c++;for(;0<o(e[p],h);)p--}0===o(e[r],h)?Jt(e,r,p):Jt(e,++p,i),p<=n&&(r=p+1),n<=p&&(i=p-1)}}(t,e,n||0,r||t.length-1,i||Zt)}function Jt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Zt(t,e){return t<e?-1:e<t?1:0}Ht.default=Wt;var Kt=$t,Qt=$t;function $t(t,e){if(!(this instanceof $t))return new $t(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 te(t,e){ee(t,0,t.children.length,e,t)}function ee(t,e,n,r,i){(i=i||le(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],ne(i,t.leaf?r(o):o);return i}function ne(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 re(t,e){return t.minX-e.minX}function ie(t,e){return t.minY-e.minY}function oe(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function se(t){return t.maxX-t.minX+(t.maxY-t.minY)}function ae(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ue(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function le(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function he(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((n-e)/r/2)*r,Ht(t,o,e,n,i),s.push(e,o,o,n))}function ce(t){var e={exports:{}};return t(e,e.exports),e.exports}$t.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(ue(t,e))for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],ue(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):ae(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(ue(t,e))for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],ue(t,s=e.leaf?n(o):o)){if(e.leaf||ae(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(t&&t.length)if(t.length<this._minEntries)for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);else{var r,i=this._build(t.slice(),0,t.length-1,0);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}return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=le([]),this},remove:function(t,e){if(t)for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],l=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=l.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||!ae(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),l.push(n),s=(r=s).children[n=0])}return this},toBBox:function(t){return t},compareMinX:re,compareMinY:ie,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)te(i=le(t.slice(e,n+1)),this.toBBox);else{r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=le([])).leaf=!1,i.height=r;var a,u,l,h,c=Math.ceil(o/s),p=c*Math.ceil(Math.sqrt(s));for(he(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(he(t,a,l=Math.min(a+p-1,n),c,this.compareMinY),u=a;u<=l;u+=c)h=Math.min(u+c-1,l),i.children.push(this._build(t,u,h,r-1));te(i,this.toBBox)}return i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,l,h,c,p;r.push(e),!e.leaf&&r.length-1!==n;){for(l=h=1/0,i=0,o=e.children.length;i<o;i++)u=oe(s=e.children[i]),c=t,p=s,(p=(Math.max(p.maxX,c.maxX)-Math.min(p.minX,c.minX))*(Math.max(p.maxY,c.maxY)-Math.min(p.minY,c.minY))-u)<h?(h=p,l=u<l?u:l,a=s):p===h&&u<l&&(l=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,n=n?t:r(t),i=[],r=this._chooseSubtree(n,this.data,e,i);for(r.children.push(t),ne(r,n);0<=e&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries,i=(this._chooseSplitAxis(n,i,r),this._chooseSplitIndex(n,i,r)),r=le(n.children.splice(i,n.children.length-i));r.height=n.height,r.leaf=n.leaf,te(n,this.toBBox),te(r,this.toBBox),e?t[e-1].children.push(r):this._splitRoot(n,r)},_splitRoot:function(t,e){this.data=le([t,e]),this.data.height=t.height+1,this.data.leaf=!1,te(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){for(var r,i,o,s,a,u,l,h,c,p=o=1/0,f=e;f<=n-e;f++)c=r=ee(t,0,f,this.toBBox),a=i=ee(t,f,n,this.toBBox),0,u=Math.max(c.minX,a.minX),l=Math.max(c.minY,a.minY),h=Math.min(c.maxX,a.maxX),c=Math.min(c.maxY,a.maxY),a=Math.max(0,h-u)*Math.max(0,c-l),h=oe(r)+oe(i),a<p?(p=a,s=f,o=h<o?h:o):a===p&&h<o&&(o=h,s=f);return s},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:re,i=t.leaf?this.compareMinY:ie;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=ee(t,0,e,o),a=ee(t,n-e,n,o),u=se(s)+se(a),l=e;l<n-e;l++)i=t.children[l],ne(s,t.leaf?o(i):i),u+=se(s);for(l=n-e-1;e<=l;l--)i=t.children[l],ne(a,t.leaf?o(i):i),u+=se(a);return u},_adjustParentBBoxes:function(t,e,n){for(var r=n;0<=r;r--)ne(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():te(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]+"};")}},Kt.default=Qt;function pe(t,e){var n,r,i,o,s=0|t.length,a=0|e.length;if(1==s&&1==a)return n=t[0],r=e[0],(n=n-((i=n+r)-(o=i-n))+(r-o))?[n,i]:[i];var u,l,h=new Array(s+a),c=0,p=0,f=0,g=Math.abs,d=t[p],y=g(d),_=e[f],m=g(_);y<m?(l=d,(p+=1)<s&&(y=g(d=t[p]))):(l=_,(f+=1)<a&&(m=g(_=e[f]))),p<s&&y<m||a<=f?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=e[f])));for(var v,x,E=u+l,b=l-(E-u),w=b,I=E;p<s&&f<a;)y<m?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=e[f]))),(b=(l=w)-((E=u+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v;for(;p<s;)(b=(l=w)-((E=(u=d)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(p+=1)<s&&(d=t[p]);for(;f<a;)(b=(l=w)-((E=(u=_)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(f+=1)<a&&(_=e[f]);return w&&(h[c++]=w),I&&(h[c++]=I),c||(h[c++]=0),h.length=c,h}function fe(t,e){var n,r=t.length;if(1===r)return(n=de(t[0],e))[0]?n:[n[1]];var i=new Array(2*r),o=[.1,.1],s=[.1,.1],a=0;de(t[0],e,o),o[0]&&(i[a++]=o[0]);for(var u=1;u<r;++u){de(t[u],e,s);var l=o[1],l=(_e(l,s[0],o),o[0]&&(i[a++]=o[0]),s[1]),h=o[1],c=l+h,h=h-(c-l);o[1]=c,h&&(i[a++]=h)}return o[1]&&(i[a++]=o[1]),0===a&&(i[a++]=0),i.length=a,i}function ge(t,e){var n,r,i,o,s=0|t.length,a=0|e.length;if(1==s&&1==a)return n=t[0],r=-e[0],(n=n-((i=n+r)-(o=i-n))+(r-o))?[n,i]:[i];var u,l,h=new Array(s+a),c=0,p=0,f=0,g=Math.abs,d=t[p],y=g(d),_=-e[f],m=g(_);y<m?(l=d,(p+=1)<s&&(y=g(d=t[p]))):(l=_,(f+=1)<a&&(m=g(_=-e[f]))),p<s&&y<m||a<=f?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=-e[f])));for(var v,x,E=u+l,b=l-(E-u),w=b,I=E;p<s&&f<a;)y<m?(u=d,(p+=1)<s&&(y=g(d=t[p]))):(u=_,(f+=1)<a&&(m=g(_=-e[f]))),(b=(l=w)-((E=u+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v;for(;p<s;)(b=(l=w)-((E=(u=d)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(p+=1)<s&&(d=t[p]);for(;f<a;)(b=(l=w)-((E=(u=_)+l)-u))&&(h[c++]=b),w=I-((v=I+E)-(x=v-I))+(E-x),I=v,(f+=1)<a&&(_=-e[f]);return w&&(h[c++]=w),I&&(h[c++]=I),c||(h[c++]=0),h.length=c,h}var de=function(t,e,n){var r=t*e,i=ye*t,i=i-(i-t),t=t-i,o=ye*e,o=o-(o-e),e=e-o,t=t*e-(r-i*o-t*o-i*e);return n?(n[0]=t,n[1]=r,n):[t,r]},ye=+(Math.pow(2,27)+1),_e=function(t,e,n){var r=t+e,i=r-t,e=e-i,t=t-(r-i);return n?(n[0]=t+e,n[1]=r,n):[t+e,r]},Qt=ce(function(t){function l(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 h(t){var e;return 1===t.length?t[0]:(2===t.length?["sum(",t[0],",",t[1],")"]:(e=t.length>>1,["sum(",h(t.slice(0,e)),",",h(t.slice(e)),")"])).join("")}function c(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(",h(c(l(t,n))),",",1&n?"-":"",t[0][n],")"].join(""));return e}function e(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,c(l(r,o))):n.push.apply(n,c(l(r,o))),i.push("m"+o);var s=h(e),a=h(n),u="orientation"+t+"Exact",s=["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",s)(pe,de,fe,ge)}var a=e(3),d=e(4),n=[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)}i=33306690738754716e-32*r;return i<=s||s<=-i?s:a(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],l=n[1]-r[1],h=t[2]-r[2],c=e[2]-r[2],p=n[2]-r[2],f=o*l,g=s*u,s=s*a,l=i*l,i=i*u,u=o*a,o=h*(f-g)+c*(s-l)+p*(i-u),a=7771561172376103e-31*((Math.abs(f)+Math.abs(g))*Math.abs(h)+(Math.abs(s)+Math.abs(l))*Math.abs(c)+(Math.abs(i)+Math.abs(u))*Math.abs(p));return a<o||a<-o?o:d(t,e,n,r)}];for(;n.length<=5;)n.push(e(n.length));for(var r=[],i=["slow"],o=0;o<=5;++o)r.push("a"+o),i.push("o"+o);for(var s=["function getOrientation(",r.join(),"){switch(arguments.length){case 0:case 1:return 0;"],o=2;o<=5;++o)s.push("case ",o,":return o",o,"(",r.slice(0,o).join(),");");s.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),i.push(s.join(""));var u=Function.apply(void 0,i);for(t.exports=u.apply(void 0,[function(t){return(n[t.length]||(n[t.length]=e(t.length))).apply(void 0,t)}].concat(n)),o=0;o<=5;++o)t.exports[o]=n[o]}),me=Qt[3],ve=Ee,xe=Ee;function Ee(t,e){if(!(this instanceof Ee))return new Ee(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||be,0<this.length)for(var n=(this.length>>1)-1;0<=n;n--)this._down(n)}function be(t,e){return t<e?-1:e<t?1:0}Ee.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){var t;if(0!==this.length)return t=this.data[0],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}},ve.default=xe;var we=Qt[3],Ie=Ne;function Ne(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],l=e[s][0],h=e[s][1];r<u!=r<h&&n<(l-a)*(r-u)/(h-u)+a&&(i=!i)}return i}(t[o],a)&&u.push(t[o]);var l=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]});var o=[i[0],i[1]],s=[i[0],i[1]];for(r=2;r<t;++r){for(var a=i[r],u=n[a],l=o.length;1<l&&me(n[o[l-2]],n[o[l-1]],u)<=0;)--l,o.pop();for(o.push(a),l=s.length;1<l&&0<=me(n[s[l-2]],n[s[l-1]],u);)--l,s.pop();s.push(a)}for(var e=new Array(s.length+o.length-2),h=0,c=(r=0,o.length);r<c;++r)e[h++]=o[r];for(var p=s.length-2;0<p;--p)e[h++]=s[p];return e}(u),h=[];for(o=0;o<l.length;o++)h.push(u[l[o]]);return h}(t),o=Kt(16,["[0]","[1]","[0]","[1]"]).load(t),s=[],a=0;a<i.length;a++){var u=i[a];o.remove(u),r=Le(u,r),s.push(r)}for(var l=Kt(16),a=0;a<s.length;a++)l.insert(Me(s[a]));for(var h=e*e,c=n*n;s.length;){var p=s.shift(),f=p.p,g=p.next.p,d=Oe(f,g);d<c||(u=function(t,e,n,r,i,o,s){for(var a=new ve(null,Se),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?Re(h,n,r):function(t,e,n){var r,i,o;return Ce(t,n)||Ce(e,n)||0===(r=Te(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY))||0===(i=Te(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY))||0===(o=Te(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY))||0===(t=Te(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY))?0:Math.min(r,i,o,t)}(n,r,h);o<c||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),f=p.node,g=Re(f,e,n),d=Re(f,r,i);if(p.dist<g&&p.dist<d&&Pe(n,f,s)&&Pe(r,f,s))return f}u=(u=a.pop())&&u.node}return null}(o,p.prev.p,f,g,p.next.next.p,d=d/h,l))&&Math.min(Oe(u,f),Oe(u,g))<=d&&(s.push(p),s.push(Le(u,p)),o.remove(u),l.remove(p),l.insert(Me(p)),l.insert(Me(p.next)))}for(var p=r,y=[];y.push(p.p),(p=p.next)!==r;);return y.push(p.p),y}function Se(t,e){return t.dist-e.dist}function Ce(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Pe(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:u,maxX:l,maxY:h}),p=0;p<c.length;p++)if(r=c[p].p,i=c[p].next.p,o=t,r!==(s=e)&&i!==o&&0<we(r,i,o)!=0<we(r,i,s)&&0<we(o,s,r)!=0<we(o,s,i))return;return 1}function Me(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 Le(t,e){t={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(t.next=e.next,(t.prev=e).next.prev=t,e.next=t):(t.prev=t).next=t,t}function Oe(t,e){var n=t[0]-e[0],t=t[1]-e[1];return n*n+t*t}function Re(t,e,n){var r,i=e[0],e=e[1],o=n[0]-i,s=n[1]-e;return 0==o&&0==s||(1<(r=((t[0]-i)*o+(t[1]-e)*s)/(o*o+s*s))?(i=n[0],e=n[1]):0<r&&(i+=o*r,e+=s*r)),(o=t[0]-i)*o+(s=t[1]-e)*s}function Te(t,e,n,r,i,o,s,a){var u,l,h=n-t,c=r-e,p=s-i,f=a-o,g=t-i,d=e-o,y=h*h+c*c,_=h*p+c*f,m=p*p+f*f,h=h*g+c*d,c=p*g+f*d,p=y*m-_*_,g=p,f=p,c=(0==p?(u=0,g=1,l=c,f=m):(l=y*c-_*h,(u=_*c-m*h)<0?(u=0,l=c,f=m):g<u&&(u=g,l=c+_,f=m)),l<0?-h<(l=0)?u=0:y<-h?u=g:(u=-h,g=y):f<l&&(l=f,_-h<0?u=0:y<_-h?u=g:(u=_-h,g=y)),(1-(d=0===l?0:l/f))*i+d*s-((1-(p=0===u?0:u/g))*t+p*n)),m=(1-d)*o+d*a-((1-p)*e+p*r);return c*c+m*m}function Ae(t,e){(e=void 0===e?{}:e).concavity=e.concavity||1/0;var n=[];return ht(t,function(t){n.push([t[0],t[1]])}),n.length&&3<(t=Ie(n,e.concavity)).length?k([t]):null}function De(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=Mt(t),t=At(e),i=t.type,e=e.bbox,o=t.coordinates;if(e&&!1==(e[0]<=r[0]&&e[1]<=r[1]&&e[2]>=r[0]&&e[3]>=r[1]))return!1;"Polygon"===i&&(o=[o]);for(var s=!1,a=0;a<o.length&&!s;a++)if(Fe(r,o[a][0],n.ignoreBoundary)){for(var u=!1,l=1;l<o[a].length&&!u;)Fe(r,o[a][l],!n.ignoreBoundary)&&(u=!0),l++;u||(s=!0)}return s}function Fe(t,e,n){for(var r=!1,i=0,o=(e=e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]?e.slice(0,e.length-1):e).length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+l*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(l-t[1])<=0)return!n;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(r=!r)}return r}function ke(t,e){var o=[];return gt(t,function(n){var r=!1;if("Point"===n.geometry.type)_t(e,function(t){De(n,t)&&(r=!0)}),r&&o.push(n);else{if("MultiPoint"!==n.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];_t(e,function(e){ht(n,function(t){De(t,e)&&(r=!0,i.push(t))})}),r&&o.push(H(i))}}),G(o)}function Ge(t,e,n){void 0===n&&(n={});var t=Mt(t),e=Mt(e),r=nt(e[1]-t[1]),i=nt(e[0]-t[0]),t=nt(t[1]),e=nt(e[1]),r=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(i/2),2)*Math.cos(t)*Math.cos(e);return K(2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r)),n.units)}function qe(t,n){var o=!1;return G(function(t){if(t.length<3)return[];t.sort(ze);for(var e,n,r,i,o,s=t[_=t.length-1].x,a=t[0].x,u=t[_].y,l=u;_--;)t[_].y<u&&(u=t[_].y),t[_].y>l&&(l=t[_].y);for(var h,c=a-s,p=l-u,f=p<c?c:p,a=.5*(a+s),s=.5*(l+u),g=[new Be({__sentinel:!0,x:a-20*f,y:s-f},{__sentinel:!0,x:a,y:s+20*f},{__sentinel:!0,x:a+20*f,y:s-f})],d=[],y=[],_=t.length;_--;){for(y.length=0,h=g.length;h--;)0<(c=t[_].x-g[h].x)&&c*c>g[h].r?(d.push(g[h]),g.splice(h,1)):c*c+(p=t[_].y-g[h].y)*p>g[h].r||(y.push(g[h].a,g[h].b,g[h].b,g[h].c,g[h].c,g[h].a),g.splice(h,1));I=b=E=x=v=m=w=void 0;var m,v,x,E,b,w=y,I=w.length;t:for(;I;)for(v=w[--I],m=w[--I],x=I;x;)if(b=w[--x],m===(E=w[--x])&&v===b||m===b&&v===E){w.splice(I,2),w.splice(x,2),I-=2;continue t}for(h=y.length;h;)n=y[--h],e=y[--h],r=t[_],o=n.x-e.x,i=n.y-e.y,o=2*(o*(r.y-n.y)-i*(r.x-n.x)),1e-12<Math.abs(o)&&g.push(new Be(e,n,r))}for(Array.prototype.push.apply(d,g),_=d.length;_--;)(d[_].a.__sentinel||d[_].b.__sentinel||d[_].c.__sentinel)&&d.splice(_,1);return d}(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},k([[e,n,r,e]],i)}))}Ie.default=Ne;function Be(t,e,n){this.a=t,this.b=e,this.c=n;var r=e.x-t.x,i=e.y-t.y,o=n.x-t.x,s=n.y-t.y,a=r*(t.x+e.x)+i*(t.y+e.y),u=o*(t.x+n.x)+s*(t.y+n.y),n=2*(r*(n.y-e.y)-i*(n.x-e.x));this.x=(s*a-i*u)/n,this.y=(r*u-o*a)/n,e=this.x-t.x,s=this.y-t.y,this.r=e*e+s*s}function ze(t,e){return e.x-t.x}function je(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ue(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(Ue),n;case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ve(t);default:throw new Error("unknown GeoJSON type")}var e,n}function Ue(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:Array.isArray(e)?i[t]=e.map(function(t){return t}):i[t]=n(e):i[t]=e}),i}(e.properties),n.geometry=Ve(e.geometry),n}function Ve(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?e.geometries=t.geometries.map(Ve):e.coordinates=function e(t){return"object"!=typeof t[0]?t.slice():t.map(function(t){return e(t)})}(t.coordinates),e}function Xe(t){return t[0].toString()+","+t[1].toString()}function Ye(t){return t}function He(t,e){var n,o,s,a,u,l,h,f=null==(n=t.transform)?Ye:(a=n.scale[0],u=n.scale[1],l=n.translate[0],h=n.translate[1],function(t,e){e||(o=s=0);var n=2,r=t.length,i=new Array(r);for(i[0]=(o+=t[0])*a+l,i[1]=(s+=t[1])*u+h;n<r;)i[n]=t[n],++n;return i}),g=t.arcs;function i(t){return f(t)}function c(t){for(var e=[],n=0,r=t.length;n<r;++n){i=void 0;o=void 0;s=void 0;a=void 0;u=void 0;h=void 0;l=void 0;c=void 0;p=void 0;var i=t[n];var o=e;o.length&&o.pop();for(var s=g[i<0?~i:i],a=0,u=s.length;a<u;++a)o.push(f(s[a],a));if(i<0)for(var l,h=o,c=h.length,p=c-u;p<--c;)l=h[p],h[p++]=h[c],h[c]=l}return e.length<2&&e.push(e[0]),e}function r(t){for(var e=c(t);e.length<4;)e.push(e[0]);return e}function p(t){return t.map(r)}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=c(e.arcs);break;case"MultiLineString":n=e.arcs.map(c);break;case"Polygon":n=p(e.arcs);break;case"MultiPolygon":n=e.arcs.map(p);break;default:return null}return{type:r,coordinates:n}}(e)}function We(a,r){var i={},u={},l={},o=[],s=-1;function t(t,e){for(var n in t){n=t[n];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[t<0?~t:t]=1}),o.push(n)}}return r.forEach(function(t,e){var n=a.arcs[t<0?~t:t];n.length<3&&!n[1][0]&&!n[1][1]&&(n=r[++s],r[s]=t,r[e]=n)}),r.forEach(function(t){o=t,i=a.arcs[o<0?~o:o],s=i[0],a.transform?(n=[0,0],i.forEach(function(t){n[0]+=t[0],n[1]+=t[1]})):n=i[i.length-1];var e,n,r,i=o<0?[n,s]:[s,n],o=i[0],s=i[1];(i=l[o])?(delete l[i.end],i.push(t),i.end=s,(e=u[s])?(delete u[e.start],r=e===i?i:i.concat(e),u[r.start=i.start]=l[r.end=e.end]=r):u[i.start]=l[i.end]=i):(i=u[s])?(delete u[i.start],i.unshift(t),i.start=o,(e=l[o])?(delete l[e.end],r=e===i?i:e.concat(i),u[r.start=e.start]=l[r.end=i.end]=r):u[i.start]=l[i.end]=i):u[(i=[t]).start=o]=l[i.end=s]=i}),t(l,u),t(u,l),r.forEach(function(t){i[t<0?~t:t]||o.push([t])}),o}function Je(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 l(t){for(var e,n=He(a,{type:"Polygon",arcs:[t]}).coordinates[0],r=-1,i=n.length,o=n[i-1],s=0;++r<i;)e=o,o=n[r],s+=e[0]*o[1]-e[1]*o[0];return Math.abs(s)}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=We(a,n)).length))for(var r,i,o=1,s=l(n[0]);o<e;++o)(r=l(n[o]))>s&&(i=n[0],n[0]=n[o],n[o]=i,s=r);return n}).filter(function(t){return 0<t.length})}}var Ze=Object.prototype.hasOwnProperty;function Ke(o,s,a,t,u,e){3===arguments.length&&(t=e=Array,u=null);for(var l=new t(o=1<<Math.max(4,Math.ceil(Math.log(o)/Math.LN2))),h=new e(o),c=o-1,n=0;n<o;++n)l[n]=u;return{set:function(t,e){for(var n=s(t)&c,r=l[n],i=0;r!=u;){if(a(r,t))return h[n]=e;if(++i>=o)throw new Error("full hashmap");r=l[n=n+1&c]}return l[n]=t,h[n]=e},maybeSet:function(t,e){for(var n=s(t)&c,r=l[n],i=0;r!=u;){if(a(r,t))return h[n];if(++i>=o)throw new Error("full hashmap");r=l[n=n+1&c]}return l[n]=t,h[n]=e},get:function(t,e){for(var n=s(t)&c,r=l[n],i=0;r!=u;){if(a(r,t))return h[n];if(++i>=o)break;r=l[n=n+1&c]}return e},keys:function(){for(var t=[],e=0,n=l.length;e<n;++e){var r=l[e];r!=u&&t.push(r)}return t}}}function Qe(t,e){return t[0]===e[0]&&t[1]===e[1]}var xe=new ArrayBuffer(16),$e=new Float64Array(xe),tn=new Uint32Array(xe);function en(t){$e[0]=t[0],$e[1]=t[1];t=tn[0]^tn[1];return 2147483647&(t<<5^t>>7^tn[2]^tn[3])}function nn(t){for(var i=t.coordinates,e=t.lines,n=t.rings,r=function(){for(var t=Ke(1.4*i.length,E,b,Int32Array,-1,Int32Array),e=new Int32Array(i.length),n=0,r=i.length;n<r;++n)e[n]=t.maybeSet(n,n);return e}(),o=new Int32Array(i.length),s=new Int32Array(i.length),a=new Int32Array(i.length),u=new Int8Array(i.length),l=0,h=0,c=i.length;h<c;++h)o[h]=s[h]=a[h]=-1;for(h=0,c=e.length;h<c;++h){var p=e[h],f=p[0],g=p[1],d=r[f],y=r[++f];for(++l,u[d]=1;++f<=g;)x(h,d,d=y,y=r[f]);++l,u[y]=1}for(h=0,c=i.length;h<c;++h)o[h]=-1;for(h=0,c=n.length;h<c;++h){var _=n[h],m=_[0]+1,v=_[1];for(x(h,r[v-1],d=r[m-1],y=r[m]);++m<=v;)x(h,d,d=y,y=r[m])}function x(t,e,n,r){var i;o[n]!==t&&(o[n]=t,0<=(t=s[n])?(i=a[n],t===e&&i===r||t===r&&i===e||(++l,u[n]=1)):(s[n]=e,a[n]=r))}function E(t){return en(i[t])}function b(t,e){return Qe(i[t],i[e])}var w,o=s=a=null,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))),l=i-1,e=0;e<i;++e)u[e]=a;return{add:function(t){for(var e=o(t)&l,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&l]}return u[e]=t,!0},has:function(t){for(var e=o(t)&l,n=u[e],r=0;n!=a;){if(s(n,t))return!0;if(++r>=i)break;n=u[e=e+1&l]}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*l,en,Qe);for(h=0,c=i.length;h<c;++h)u[w=r[h]]&&I.add(i[w]);return I}function rn(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 on(t){var e={type:"GeometryCollection",geometries:t.features.map(sn)};return null!=t.bbox&&(e.bbox=t.bbox),e}function sn(t){var e,n=an(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 an(t){var e;return null==t?{type:null}:(e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(an)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates},null!=t.bbox&&(e.bbox=t.bbox),e)}function un(t,d){var y=function(t){var n=1/0,r=1/0,i=-1/0,o=-1/0;function e(t){null!=t&&Ze.call(a,t.type)&&a[t.type](t)}var s,a={GeometryCollection:function(t){t.geometries.forEach(e)},Point:function(t){u(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(u)},LineString:function(t){l(t.arcs)},MultiLineString:function(t){t.arcs.forEach(l)},Polygon:function(t){t.arcs.forEach(l)},MultiPolygon:function(t){t.arcs.forEach(h)}};function u(t){var e=t[0],t=t[1];e<n&&(n=e),i<e&&(i=e),t<r&&(r=t),o<t&&(o=t)}function l(t){t.forEach(u)}function h(t){t.forEach(l)}for(s in t)e(t[s]);return n<=i&&r<=o?[n,r,i,o]:void 0}(t=function(t){var e,n,r={};for(e in t)r[e]=null==(n=t[e])?{type:null}:("FeatureCollection"===n.type?on:"Feature"===n.type?sn:an)(n);return r}(t)),e=0<d&&y&&function(t){var h=y[0],c=y[1],e=y[2],n=y[3],p=e-h?(d-1)/(e-h):1,f=n-c?(d-1)/(n-c):1;function r(t){return[Math.round((t[0]-h)*p),Math.round((t[1]-c)*f)]}function i(t,e){for(var n,r,i,o,s=-1,a=0,u=t.length,l=new Array(u);++s<u;)o=t[s],i=Math.round((o[0]-h)*p),o=Math.round((o[1]-c)*f),i===n&&o===r||(l[a++]=[n=i,r=o]);for(l.length=a;a<e;)a=l.push([l[0][0],l[0][1]]);return l}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&&Ze.call(g,t.type)&&g[t.type](t)}var l,g={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(l in t)u(t[l]);return{scale:[1/p,1/f],translate:[h,c]}}(t),n=function(t){var e,n,h=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 l=Ke(2*o*1.4,en,Qe),c=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=l.get(h[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=l.get(e=h[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):l.set(e,[t]),c.push(t)}(n);function u(t){var e,n,r,i,o,s,a,u;if(r=l.get(e=h[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;for(;n<=i;++n,++r)if(!Qe(h[n],h[r]))return;return 1}(i=r[a],t))return t[0]=i[0],t[1]=i[1];if(o=l.get(n=h[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;for(;n<=i;++n,--o)if(!Qe(h[n],h[o]))return;return 1}(s=o[a],t))return t[1]=s[0],t[0]=s[1];r?r.push(t):l.set(e,[t]),o?o.push(t):l.set(n,[t]),c.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(!Qe(h[n+(a+o)%i],h[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),l=0;l<s;++l)if(!Qe(h[n+(l+a)%s],h[o-(l+u)%s]))return;return 1}}function g(t){for(var e=t[0],n=t[1],r=e,i=r,o=h[r];++r<n;){var s=h[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=nn(t),a=t.coordinates,u=t.lines,l=t.rings,h=0,c=u.length;h<c;++h)for(var p=u[h],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(h=0,c=l.length;h<c;++h)for(var d=l[h],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)-_,rn(n=a,r=y,i),rn(n,r,r+o),rn(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&&Ze.call(r,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(l)},MultiPolygon:function(t){t.arcs=t.arcs.map(h)}};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 l(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 h(t){return t.map(l)}for(n in t)e(t[n]);return{type:"Topology",coordinates:a,lines:o,rings:s,objects:t}}(t))),r=n.coordinates,i=Ke(1.4*n.arcs.length,ln,hn);function o(t){t&&Ze.call(a,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;var s,r=null,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(l)}};function u(t){var e=[];do{var n=i.get(t)}while(e.push(t[0]<t[1]?n:~n),t=t.next);return e}function l(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,l=o[0],h=l[0],c=l[1];++s<u;)r=(l=o[s])[0],i=l[1],r===h&&i===c||(o[a++]=[r-h,i-c],h=r,c=i);1===a&&(o[a++]=[0,0]),o.length=a}return t}(n.arcs)),n}function ln(t){var e,n=t[0],t=t[1];return t<n&&(e=n,n=t,t=e),n+31*t}function hn(t,e){var n,r=t[0],t=t[1],i=e[0],e=e[1];return t<r&&(n=r,r=t,t=n),e<i&&(n=i,i=e,e=n),r===i&&t===e}function cn(t,e){if(!st(e=(e=void 0===e?{}:e)||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==Dt(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=je(t));r={},vt(t,function(t){r[t.geometry.type]=!0});var r,i=1===(n=Object.keys(r)).length?n[0]:null;if(!i)throw new Error("geojson must be homogenous");var o=t;switch(i){case"LineString":var s=o,a=e;if(!st(a=(a=void 0===a?{}:a)||{}))throw new Error("options is invalid");if(a=a.mutate,"FeatureCollection"!==Dt(s))throw new Error("geojson must be a FeatureCollection");if(!s.features.length)throw new Error("geojson is empty");!1!==a&&void 0!==a||(s=je(s));var l=[];return(a=It(s,function(a,u){return function(){var t,e=a.geometry.coordinates,n=u.geometry.coordinates,r=Xe(e[0]),i=Xe(e[e.length-1]),o=Xe(n[0]),s=Xe(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 V(t)}()||(l.push(a),u)}))&&l.push(a),l.length?1===l.length?l[0]:Y(l.map(function(t){return t.coordinates})):null;case"Polygon":s=o,a=e;if(void 0===a&&(a={}),"FeatureCollection"!==Dt(s))throw new Error("geojson must be a FeatureCollection");if(!s.features.length)throw new Error("geojson is empty");!1!==a.mutate&&void 0!==a.mutate||(s=je(s));var u=[];return vt(s,function(t){u.push(t.geometry)}),function(t){return He(t,Je.apply(this,arguments))}(a=un({geoms:J(u).geometry}),a.objects.geoms.geometries);default:throw new Error(i+" is not supported")}}function pn(t,e){e="object"==typeof(e=void 0===e?{}:e)?e.mutate:e;if(!t)throw new Error("geojson is required");var n=Dt(t),r=[];switch(n){case"LineString":r=fn(t);break;case"MultiLineString":case"Polygon":_(t).forEach(function(t){r.push(fn(t))});break;case"MultiPolygon":_(t).forEach(function(t){var e=[];t.forEach(function(t){e.push(fn(t))}),r.push(e)});break;case"Point":return t;case"MultiPoint":var i={};_(t).forEach(function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(i,e)||(r.push(t),i[e]=!0)});break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===e?(t.coordinates=r,t):{type:n,coordinates:r}:!0===e?(t.geometry.coordinates=r,t):B({type:n,coordinates:r},t.properties,{bbox:t.bbox,id:t.id})}function fn(t){var e=_(t);if(2===e.length&&!gn(e[0],e[1]))return e;var n=[],r=e.length-1,i=n.length;n.push(e[0]);for(var o=1;o<r;o++){var s=n[n.length-1];e[o][0]===s[0]&&e[o][1]===s[1]||(n.push(e[o]),2<(i=n.length)&&dn(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,gn(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return dn(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function gn(t,e){return t[0]===e[0]&&t[1]===e[1]}function dn(t,e,n){var r=n[0],n=n[1],i=t[0],t=t[1],o=e[0],e=e[1],s=o-i,a=e-t;return 0==(r-i)*a-(n-t)*s&&(Math.abs(s)>=Math.abs(a)?0<s?i<=r&&r<=o:o<=r&&r<=i:0<a?t<=n&&n<=e:e<=n&&n<=t)}function yn(t,e){var n=t.length-1,r=[t[0]];return function t(e,n,r,i,o){for(var s,a,u,l,h,c,p,f=i,g=n+1;g<r;g++){a=e[g],u=e[n],d=e[r],p=c=h=l=void 0,h=u.x,u=u.y,c=d.x-h,p=d.y-u,0==c&&0==p||(1<(l=((a.x-h)*c+(a.y-u)*p)/(c*c+p*p))?(h=d.x,u=d.y):0<l&&(h+=c*l,u+=p*l));var d=(c=a.x-h)*c+(p=a.y-u)*p;f<d&&(s=g,f=d)}i<f&&(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 _n(t,e,n){return t.length<=2?t:(e=void 0!==e?e*e:1,yn(t=n?t:function(t,e){for(var n,r,i,o,s=t[0],a=[s],u=1,l=t.length;u<l;u++)i=s,0,e<(o=(r=n=t[u]).x-i.x)*o+(o=r.y-i.y)*o&&(a.push(n),s=n);return s!==n&&a.push(n),a}(t,e),e))}function mn(t,e,n){return _n(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 vn(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=_n(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=_n(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})}En.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);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))>t&&(e.push(r),n=i)}return e},En.prototype.vector=function(t){var e=this.pos(t+10),t=this.pos(t-10);return{angle:180*Math.atan2(e.y-t.y,e.x-t.x)/3.14,speed:Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)+(t.z-e.z)*(t.z-e.z))}},En.prototype.pos=function(t){var e,n,r,i,o,t=t-this.delay,t=(t=(t=t<0?0:t)>this.duration?this.duration-1:t)/this.duration;return 1<=t?this.points[this.length-1]:(i=Math.floor((this.points.length-1)*t),t=(this.length-1)*t-i,e=this.points[i],n=this.controls[i][1],r=this.controls[i+1][0],i=this.points[i+1],o=[(o=t*t)*t,3*o*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)],{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]})};var xn=En;function En(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++){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 bn(t,e){for(var n=(e=void 0===e?{}:e).resolution||1e4,r=e.sharpness||.85,i=[],t=At(t).coordinates.map(function(t){return{x:t[0],y:t[1]}}),o=new xn({duration:n,points:t,sharpness:r}),s=function(t){var e=o.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},a=0;a<o.duration;a+=10)s(a);return s(o.duration),V(i,e.properties)}function wn(t,e){void 0===e&&(e={});var n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r];return k([[s,[i,r],[i,o],[n,o],s]],e.properties,{bbox:t,id:e.id})}function In(t){return wn(Pt(t))}function Nn(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Ge(t.slice(0,2),[r,n])>=Ge(t.slice(0,2),[e,i])?[e,(t=(n+i)/2)-(r-e)/2,r,t+(r-e)/2]:[(t=(e+r)/2)-(i-n)/2,n,t+(i-n)/2,i]}function Sn(t,e,n,r){void 0===r&&(r={});var t=Mt(t),i=nt(t[0]),t=nt(t[1]),n=nt(n),e=Q(e,r.units),o=Math.asin(Math.sin(t)*Math.cos(e)+Math.cos(t)*Math.sin(e)*Math.cos(n));return R([et(i+Math.atan2(Math.sin(n)*Math.sin(e)*Math.cos(t),Math.cos(e)-Math.sin(t)*Math.sin(o))),et(o)],r.properties)}function Cn(t,e,n){for(var r=(n=void 0===n?{}:n).steps||64,i=n.properties||(!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{}),o=[],s=0;s<r;s++)o.push(Sn(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),k([o],i)}function Pn(t,e,n){var r,i;return!0===(n=void 0===n?{}:n).final?(Pn(e,t)+180)%360:(n=Mt(t),t=Mt(e),e=nt(n[0]),r=nt(t[0]),n=nt(n[1]),t=nt(t[1]),i=Math.sin(r-e)*Math.cos(t),n=Math.cos(n)*Math.sin(t)-Math.sin(n)*Math.cos(t)*Math.cos(r-e),et(Math.atan2(i,n)))}function Mn(t,e){void 0===e&&(e={});t=Pt(t);return R([(t[0]+t[2])/2,(t[1]+t[3])/2],e.properties,e)}function Ln(t,e){void 0===e&&(e={});var n=0,r=0,i=0;return ht(t,function(t){n+=t[0],r+=t[1],i++},!0),R([n/i,r/i],e.properties)}function On(e){var n=[];return"FeatureCollection"===e.type?gt(e,function(e){ht(e,function(t){n.push(R(t,e.properties))})}):ht(e,function(t){n.push(R(t,e.properties))}),G(n)}var Rn=Tn,Qt=Tn;function Tn(t,e,n){n=n||2;var r,i,o,s,a,u=e&&e.length,l=u?e[0]*n:t.length,h=An(t,0,l,n,!0),c=[];if(h){if(u&&(h=function(t,e,n,r){for(var i,o,s,a=[],u=0,l=e.length;u<l;u++)(i=An(t,e[u]*r,u<l-1?e[u+1]*r:t.length,r,!1))===i.next&&(i.steiner=!0),a.push(function(t){var e=t,n=t;for(;e.x<n.x&&(n=e),e=e.next,e!==t;);return n}(i));for(a.sort(kn),u=0;u<a.length;u++)(s=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}}}while((r=r.next)!==e);if(!n)return null;if(i===s)return n.prev;for(var u,l=n,h=n.x,c=n.y,p=1/0,r=n.next;r!==l;)i>=r.x&&r.x>=h&&i!==r.x&&qn(o<c?i:s,o,h,c,o<c?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<p||u===p&&r.x>n.x)&&Un(r,t)&&(n=r,p=u),r=r.next;return n}(o=a[u],s=n))&&Dn(s=Vn(s,o),s.next),n=Dn(n,n.next);return n}(t,e,h,n)),t.length>80*n){for(var p=r=t[0],f=i=t[1],g=n;g<l;g+=n)(o=t[g])<p&&(p=o),(s=t[g+1])<f&&(f=s),r<o&&(r=o),i<s&&(i=s);a=0!==(a=Math.max(r-p,i-f))?1/a:0}Fn(h,c,n,p,f,a)}return c}function An(t,e,n,r,i){var o,s;if(i===0<Wn(t,e,n,r))for(o=e;o<n;o+=r)s=Xn(o,t[o],t[o+1],s);else for(o=n-r;e<=o;o-=r)s=Xn(o,t[o],t[o+1],s);return s&&zn(s,s.next)&&(Yn(s),s=s.next),s}function Dn(t,e){if(!t)return t;e=e||t;var n,r=t;do{if(n=!1,r.steiner||!zn(r,r.next)&&0!==Bn(r.prev,r,r.next))r=r.next;else{if(Yn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Fn(t,e,n,r,i,o,s){if(t){if(!s&&o){var a=t;var u=r;var l=i;var h=o;for(var c=a;null===c.z&&(c.z=Gn(c.x,c.y,u,l,h)),c.prevZ=c.prev,c.nextZ=c.next,(c=c.next)!==a;);c.prevZ.nextZ=null,c.prevZ=null;var p,f,g,d,y,_,m,v,x=c,E=1;do{for(f=x,y=x=null,_=0;f;){for(_++,g=f,p=m=0;p<E&&(m++,g=g.nextZ);p++);for(v=E;0<m||0<v&&g;)0!==m&&(0===v||!g||f.z<=g.z)?(f=(d=f).nextZ,m--):(g=(d=g).nextZ,v--),y?y.nextZ=d:x=d,d.prevZ=y,y=d;f=g}}while(y.nextZ=null,E*=2,1<_)}for(var b,w,I=t;t.prev!==t.next;)if(b=t.prev,w=t.next,o?function(t,e,n,r){var i=t.prev,o=t,s=t.next;if(0<=Bn(i,o,s))return;for(var a=(i.x<o.x?i.x<s.x?i:s:o.x<s.x?o:s).x,u=(i.y<o.y?i.y<s.y?i:s:o.y<s.y?o:s).y,l=(i.x>o.x?i.x>s.x?i:s:o.x>s.x?o:s).x,h=(i.y>o.y?i.y>s.y?i:s:o.y>s.y?o:s).y,c=Gn(a,u,e,n,r),p=Gn(l,h,e,n,r),f=t.prevZ,g=t.nextZ;f&&f.z>=c&&g&&g.z<=p;){if(f!==t.prev&&f!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=Bn(f.prev,f,f.next))return;if(f=f.prevZ,g!==t.prev&&g!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&0<=Bn(g.prev,g,g.next))return;g=g.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,f.x,f.y)&&0<=Bn(f.prev,f,f.next))return;f=f.prevZ}for(;g&&g.z<=p;){if(g!==t.prev&&g!==t.next&&qn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&0<=Bn(g.prev,g,g.next))return;g=g.nextZ}return 1}(t,r,i,o):function(t){var e=t.prev,n=t,r=t.next;if(0<=Bn(e,n,r))return;for(var i=t.next.next;i!==t.prev;){if(qn(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=Bn(i.prev,i,i.next))return;i=i.next}return 1}(t))e.push(b.i/n),e.push(t.i/n),e.push(w.i/n),Yn(t),t=w.next,I=w.next;else if((t=w)===I){s?1===s?Fn(t=function(t,e,n){var r=t;do{var i=r.prev,o=r.next.next}while(!zn(i,o)&&jn(i,r,r.next,o)&&Un(i,o)&&Un(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Yn(r),Yn(r.next),r=t=o),r=r.next,r!==t);return r}(t,e,n),e,n,r,i,o,2):2===s&&function(t,e,n,r,i,o){var s=t;do{for(var a,u=s.next.next;u!==s.prev;){if(s.i!==u.i&&function(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&jn(n,n.next,t,e))return 1}while((n=n.next)!==t)}(t,e)&&Un(t,e)&&Un(e,t)&&function(t,e){for(var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),(n=n.next)!==t;);return r}(t,e)}(s,u))return a=Vn(s,u),s=Dn(s,s.next),a=Dn(a,a.next),Fn(s,e,n,r,i,o),Fn(a,e,n,r,i,o);u=u.next}}while(s=s.next,s!==t)}(t,e,n,r,i,o):Fn(Dn(t),e,n,r,i,o,1);break}}}function kn(t,e){return t.x-e.x}function Gn(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))|(1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qn(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 Bn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function zn(t,e){return t.x===e.x&&t.y===e.y}function jn(t,e,n,r){return zn(t,e)&&zn(n,r)||zn(t,r)&&zn(n,e)||0<Bn(t,e,n)!=0<Bn(t,e,r)&&0<Bn(n,r,t)!=0<Bn(n,r,e)}function Un(t,e){return Bn(t.prev,t,t.next)<0?0<=Bn(t,e,t.next)&&0<=Bn(t,t.prev,e):Bn(t,e,t.prev)<0||Bn(t,t.next,e)<0}function Vn(t,e){var n=new Hn(t.i,t.x,t.y),r=new Hn(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 Xn(t,e,n,r){t=new Hn(t,e,n);return r?(t.next=r.next,(t.prev=r).next.prev=t,r.next=t):(t.prev=t).next=t,t}function Yn(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 Hn(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 Wn(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 Jn(t){var n=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),r=Rn(n.vertices,n.holes,2),e=[],i=[];r.forEach(function(t,e){e=r[e];i.push([n.vertices[2*e],n.vertices[2*e+1]])});for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),e.push(k([s]))}return e}function Zn(n,t){if(!n)throw new Error("targetPoint is required");var r,i;if(t)return r=1/0,i=0,gt(t,function(t,e){t=Ge(n,t);t<r&&(i=e,r=t)}),(t=je(t.features[i])).properties.featureIndex=i,t.properties.distanceToPoint=r,t;throw new Error("points is required")}function Kn(t){var o;if(t)return o=[],vt(t,function(t){var e=t,n=o,r=[],i=e.geometry;if(null!==i){switch(i.type){case"Polygon":r=_(i);break;case"LineString":r=[_(i)]}r.forEach(function(t){var s,a;s=e.properties,a=[],t.reduce(function(t,e){var n,r,i,o=V([t,e],s);return o.bbox=(n=t[0],t=t[1],r=e[0],i=e[1],[n<r?n:r,t<i?t:i,r<n?n:r,i<t?t:i]),a.push(o),e}),a.forEach(function(t){t.id=n.length,n.push(t)})})}}),G(o);throw new Error("geojson is required")}Tn.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Wn(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Wn(t,l,h,n))}for(var c=0,a=0;a<r.length;a+=3){var p=r[a]*n,f=r[a+1]*n,g=r[a+2]*n;c+=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===c?0:Math.abs((c-s)/s)},Tn.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},Rn.default=Qt;var Qn=ce(function(t,r){function a(t,e,n){var r={type:"Feature"};return 0!==(n=void 0===n?{}:n).id&&!n.id||(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function i(t,e,n){if(void 0===n&&(n={}),!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(g(t[0])&&g(t[1]))return a({type:"Point",coordinates:t},e,n);throw new Error("coordinates must contain numbers")}function o(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return a({type:"Polygon",coordinates:t},e,n)}function s(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return a({type:"LineString",coordinates:t},e,n)}function u(t,e){var n={type:"FeatureCollection"};return(e=void 0===e?{}:e).id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function l(t,e,n){return a({type:"MultiLineString",coordinates:t},e,n=void 0===n?{}:n)}function h(t,e,n){return a({type:"MultiPoint",coordinates:t},e,n=void 0===n?{}:n)}function c(t,e,n){return a({type:"MultiPolygon",coordinates:t},e,n=void 0===n?{}:n)}function p(t,e){var n=r.factors[e=void 0===e?"kilometers":e];if(n)return t*n;throw new Error(e+" units is invalid")}function f(t,e){var n=r.factors[e=void 0===e?"kilometers":e];if(n)return t/n;throw new Error(e+" units is invalid")}function n(t){return t%(2*Math.PI)*180/Math.PI}function g(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=6371008.8,r.factors={centimeters:100*r.earthRadius,centimetres:100*r.earthRadius,degrees:r.earthRadius/111325,feet:3.28084*r.earthRadius,inches:39.37*r.earthRadius,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:1e3*r.earthRadius,millimetres:1e3*r.earthRadius,nauticalmiles:r.earthRadius/1852,radians:1,yards:1.0936*r.earthRadius},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1.0936133},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},r.feature=a,r.geometry=function(t,e,n){switch(t){case"Point":return i(e).geometry;case"LineString":return s(e).geometry;case"Polygon":return o(e).geometry;case"MultiPoint":return h(e).geometry;case"MultiLineString":return l(e).geometry;case"MultiPolygon":return c(e).geometry;default:throw new Error(t+" is invalid")}},r.point=i,r.points=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return i(t,e)}),n)},r.polygon=o,r.polygons=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return o(t,e)}),n)},r.lineString=s,r.lineStrings=function(t,e,n){return void 0===n&&(n={}),u(t.map(function(t){return s(t,e)}),n)},r.featureCollection=u,r.multiLineString=l,r.multiPoint=h,r.multiPolygon=c,r.geometryCollection=function(t,e,n){return a({type:"GeometryCollection",geometries:t},e,n=void 0===n?{}:n)},r.round=function(t,e){if(!(e=void 0===e?0:e)||0<=e)return e=Math.pow(10,e||0),Math.round(t*e)/e;throw new Error("precision must be a positive number")},r.radiansToLength=p,r.lengthToRadians=f,r.lengthToDegrees=function(t,e){return n(f(t,e))},r.bearingToAzimuth=function(t){t%=360;return t<0&&(t+=360),t},r.radiansToDegrees=n,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,n){if(void 0===e&&(e="kilometers"),void 0===n&&(n="kilometers"),0<=t)return p(f(t,e),n);throw new Error("length must be a positive number")},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(0<=t))throw new Error("area must be a positive number");e=r.areaFactors[e];if(!e)throw new Error("invalid original units");n=r.areaFactors[n];if(n)return t/e*n;throw new Error("invalid final units")},r.isNumber=g,r.isObject=function(t){return!!t&&t.constructor===Object},r.validateBBox=function(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(!g(t))throw new Error("bbox must only contain numbers")})},r.validateId=function(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")}});function $n(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l=0,h=t.type,c="FeatureCollection"===h,p="Feature"===h,f=c?t.features.length:1,g=0;g<f;g++)for(var d=(u=!!(a=c?t.features[g].geometry:p?t.geometry:t)&&"GeometryCollection"===a.type)?a.geometries.length:1,y=0;y<d;y++){var _=0,m=0;if(null!==(s=u?a.geometries[y]:a)){var v=s.coordinates,x=s.type,E=!n||"Polygon"!==x&&"MultiPolygon"!==x?0:1;switch(x){case null:break;case"Point":if(!1===e(v,l,g,_,m))return!1;l++,_++;break;case"LineString":case"MultiPoint":for(r=0;r<v.length;r++){if(!1===e(v[r],l,g,_,m))return!1;l++,"MultiPoint"===x&&_++}"LineString"===x&&_++;break;case"Polygon":case"MultiLineString":for(r=0;r<v.length;r++){for(i=0;i<v[r].length-E;i++){if(!1===e(v[r][i],l,g,_,m))return!1;l++}"MultiLineString"===x&&_++,"Polygon"===x&&m++}"Polygon"===x&&_++;break;case"MultiPolygon":for(r=0;r<v.length;r++){for(i=m=0;i<v[r].length;i++){for(o=0;o<v[r][i].length-E;o++){if(!1===e(v[r][i][o],l,g,_,m))return!1;l++}m++}_++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===$n(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}function tr(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function er(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function nr(t,e){for(var n,r,i,o,s,a,u,l,h,c=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:{},l=p?t.features[d].bbox:f?t.bbox:void 0,h=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":if(!1===e(i,c,u,l,h))return!1;break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===e(i.geometries[n],c,u,l,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,c,u,l,h))return!1;c++}}function rr(t,l){nr(t,function(t,e,n,r,i){var o,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==l(Qn.feature(t,n,{bbox:r,id:i}),e,0)&&void 0}switch(s){case"MultiPoint":o="Point";break;case"MultiLineString":o="LineString";break;case"MultiPolygon":o="Polygon"}for(var a=0;a<t.coordinates.length;a++){var u={type:o,coordinates:t.coordinates[a]};if(!1===l(Qn.feature(u,n),e,a))return!1}})}function ir(t,g){rr(t,function(s,a,u){var l=0;if(s.geometry){var h,c,p,f,t=s.geometry.type;if("Point"!==t&&"MultiPoint"!==t)return f=p=c=0,!1!==$n(s,function(t,e,n,r,i){var o;if(!(void 0===h||c<a||p<r||f<i))return o=Qn.lineString([h,t],s.properties),!1!==g(o,a,u,i,l)&&(l++,void(h=t));h=t,c=a,p=r,f=i,l=0})&&void 0}})}function or(t,s){if(!t)throw new Error("geojson is required");rr(t,function(t,e,n){if(null!==t.geometry){var r=t.geometry.type,i=t.geometry.coordinates;switch(r){case"LineString":if(!1===s(t,e,n,0,0))return!1;break;case"Polygon":for(var o=0;o<i.length;o++)if(!1===s(Qn.lineString(i[o],t.properties),e,n,o))return!1}}})}var sr=Object.defineProperty({coordAll:function(t){var e=[];return $n(t,function(t){e.push(t)}),e},coordEach:$n,coordReduce:function(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},featureEach:er,featureReduce:function(t,n,r){var i=r;return er(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i},findPoint:function(t,e){if(!Qn.isObject(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return Qn.point(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Qn.point(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Qn.point(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Qn.point(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Qn.point(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Qn.point(u[i][o][s],a,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(!Qn.isObject(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Qn.lineString([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),Qn.lineString([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),Qn.lineString([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),Qn.lineString([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},flattenEach:rr,flattenReduce:function(t,r,i){var o=i;return rr(t,function(t,e,n){o=0===e&&0===n&&void 0===i?t:r(o,t,e,n)}),o},geomEach:nr,geomReduce:function(t,o,s){var a=s;return nr(t,function(t,e,n,r,i){a=0===e&&void 0===s?t:o(a,t,e,n,r,i)}),a},lineEach:or,lineReduce:function(t,i,o){var s=o;return or(t,function(t,e,n,r){s=0===e&&void 0===o?t:i(s,t,e,n,r)}),s},propEach:tr,propReduce:function(t,n,r){var i=r;return tr(t,function(t,e){i=0===e&&void 0===r?t:n(i,t,e)}),i},segmentEach:ir,segmentReduce:function(t,o,s){var a=s,u=!1;return ir(t,function(t,e,n,r,i){a=!1===u&&void 0===s?t:o(a,t,e,n,r,i),u=!0}),a}},"__esModule",{value:!0});function ar(t){var e=[1/0,1/0,-1/0,-1/0];return sr.coordEach(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}ar.default=ar;var ur=Object.defineProperty({default:ar},"__esModule",{value:!0}).default,lr=sr.featureEach,hr=(sr.coordEach,Qn.polygon,Qn.featureCollection);function cr(t){t=Kt(t);return t.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox||ur(t),Kt.prototype.insert.call(this,t)},t.load=function(t){var e=[];return Array.isArray(t)?t.forEach(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox||ur(t),e.push(t)}):lr(t,function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox||ur(t),e.push(t)}),Kt.prototype.load.call(this,e)},t.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox||ur(t),Kt.prototype.remove.call(this,t,e)},t.clear=function(){return Kt.prototype.clear.call(this)},t.search=function(t){t=Kt.prototype.search.call(this,this.toBBox(t));return hr(t)},t.collides=function(t){return Kt.prototype.collides.call(this,this.toBBox(t))},t.all=function(){var t=Kt.prototype.all.call(this);return hr(t)},t.toJSON=function(){return Kt.prototype.toJSON.call(this)},t.fromJSON=function(t){return Kt.prototype.fromJSON.call(this,t)},t.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else{if("Feature"!==t.type&&"FeatureCollection"!==t.type)throw new Error("invalid geojson");e=ur(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},t}var pr=cr;function fr(t,e){var n,r,i={},o=[];return("LineString"===t.type&&(t=B(t)),"LineString"===e.type&&(e=B(e)),"Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length)?(n=gr(t,e))&&o.push(n):((r=pr()).load(Kn(e)),gt(Kn(t),function(n){gt(r.search(n),function(t){var e,t=gr(n,t);t&&(e=_(t).join(","),i[e]||(i[e]=!0,o.push(t)))})})),G(o)}function gr(t,e){t=_(t),e=_(e);if(2!==t.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==e.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var n,r=t[0][0],i=t[0][1],o=t[1][0],t=t[1][1],s=e[0][0],a=e[0][1],u=e[1][0],e=e[1][1],l=(e-a)*(o-r)-(u-s)*(t-i);return 0!=l&&(n=((o-r)*(i-a)-(t-i)*(r-s))/l,0<=(u=((u-s)*(i-a)-(e-a)*(r-s))/l))&&u<=1&&0<=n&&n<=1?R([r+u*(o-r),i+u*(t-i)]):null}function dr(t,l,h){void 0===h&&(h={});var c=R([1/0,1/0],{dist:1/0}),p=0;return vt(t,function(t){for(var e=_(t),n=0;n<e.length-1;n++){var r=R(e[n]),i=(r.properties.dist=Ge(l,r,h),R(e[n+1])),o=(i.properties.dist=Ge(l,i,h),Ge(r,i,h)),s=Math.max(r.properties.dist,i.properties.dist),a=Pn(r,i),u=Sn(l,s,a+90,h),s=Sn(l,s,a-90,h),a=fr(V([u.geometry.coordinates,s.geometry.coordinates]),V([r.geometry.coordinates,i.geometry.coordinates])),u=null;0<a.features.length&&((u=a.features[0]).properties.dist=Ge(l,u,h),u.properties.location=p+Ge(r,u,h)),r.properties.dist<c.properties.dist&&((c=r).properties.index=n,c.properties.location=p),i.properties.dist<c.properties.dist&&((c=i).properties.index=n+1,c.properties.location=p+o),u&&u.properties.dist<c.properties.dist&&((c=u).properties.index=n),p+=o}}),c}function yr(t,e,n){void 0===n&&(n={});var r,i,o,s,t=Mt(t),e=Mt(e);return e[0]+=180<e[0]-t[0]?-360:180<t[0]-e[0]?360:0,rt((r=q,i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,(e=Math.abs(e[0]-t[0])*Math.PI/180)>Math.PI&&(e-=2*Math.PI),o=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),o=1e-11<Math.abs(o)?s/o:Math.cos(i),Math.sqrt(s*s+o*o*e*e)*r),"meters",n.units)}function _r(t,e,s){if((s=void 0===s?{}:s).method||(s.method="geodesic"),s.units||(s.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=R(t):"Point"===t.type?t=B(t):Rt(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=V(e):"LineString"===e.type?e=B(e):Rt(e,"LineString","line");var a=1/0,u=t.geometry.coordinates;return Et(e,function(t){var e,n,r,i=t.geometry.coordinates[0],t=t.geometry.coordinates[1],o=(e=u,i=i,n=s,r=[(t=t)[0]-i[0],t[1]-i[1]],o=mr([e[0]-i[0],e[1]-i[1]],r),vr(e,o<=0?i:(e=mr(r,r))<=o?t:[i[0]+(t=o/e)*r[0],i[1]+t*r[1]],{method:n.method,units:"degrees"}));o<a&&(a=o)}),rt(a,"degrees",s.units)}function mr(t,e){return t[0]*e[0]+t[1]*e[1]}function vr(t,e,n){return("planar"===n.method?yr:Ge)(t,e,n)}function xr(t){for(var e="FeatureCollection"!==(t=t).type?"Feature"!==t.type?G([B(t)]):G([t]):t,n=Mn(e),r=!1,i=0;!r&&i<e.features.length;){var o=e.features[i].geometry,s=!1;if("Point"===o.type)n.geometry.coordinates[0]===o.coordinates[0]&&n.geometry.coordinates[1]===o.coordinates[1]&&(r=!0);else if("MultiPoint"===o.type)for(var a=!1,u=0;!a&&u<o.coordinates.length;)n.geometry.coordinates[0]===o.coordinates[u][0]&&n.geometry.coordinates[1]===o.coordinates[u][1]&&(a=r=!0),u++;else if("LineString"===o.type)for(u=0;!s&&u<o.coordinates.length-1;)Er(n.geometry.coordinates[0],n.geometry.coordinates[1],o.coordinates[u][0],o.coordinates[u][1],o.coordinates[u+1][0],o.coordinates[u+1][1])&&(r=s=!0),u++;else if("MultiLineString"===o.type)for(var l=0;l<o.coordinates.length;){s=!1,u=0;for(var h=o.coordinates[l];!s&&u<h.length-1;)Er(n.geometry.coordinates[0],n.geometry.coordinates[1],h[u][0],h[u][1],h[u+1][0],h[u+1][1])&&(r=s=!0),u++;l++}else"Polygon"!==o.type&&"MultiPolygon"!==o.type||De(n,o)&&(r=!0);i++}if(r)return n;for(var c=G([]),i=0;i<e.features.length;i++)c.features=c.features.concat(On(e.features[i]).features);return R(Zn(n,c).geometry.coordinates)}function Er(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))}pr.default=cr;var br=6378137;function wr(t){return mt(t,function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return Ir(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=Ir(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)},0)}function Ir(t){var e=0;if(t&&0<t.length){e+=Math.abs(Nr(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Nr(t[n]))}return e}function Nr(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+=(Sr(t[o][0])-Sr(e[0]))*Math.sin(Sr(n[1]));a=a*br*br/2}return a}function Sr(t){return t*Math.PI/180}function Cr(t,n){return void 0===n&&(n={}),bt(t,function(t,e){e=e.geometry.coordinates;return t+Ge(e[0],e[1],n)},0)}function Pr(t,e,n,r){if(!st(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,t=i.length,l=0,h=0;h<i.length&&!(l<=e&&h===i.length-1);h++){if(e<l&&0===o.length){if(!(s=e-l))return o.push(i[h]),V(o);a=Pn(i[h],i[h-1])-180,u=Sn(i[h],s,a,r),o.push(u.geometry.coordinates)}if(n<=l)return(s=n-l)?(a=Pn(i[h],i[h-1])-180,u=Sn(i[h],s,a,r),o.push(u.geometry.coordinates)):o.push(i[h]),V(o);if(e<=l&&o.push(i[h]),h===i.length-1)return V(o);l+=Ge(i[h],i[h+1],r)}if(l<e&&i.length===t)throw new Error("Start position is beyond line");t=i[i.length-1];return V([t,t])}function Mr(t,e,n){void 0===n&&(n={});for(var r=Mt(t),i=_(e),o=0;o<i.length-1;o++){var s=!1;if(n.ignoreEndVertices&&(0===o&&(s="start"),o===i.length-2&&(s="end"),0===o)&&o+1===i.length-1&&(s="both"),function(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],t=t[1],u=e[0],e=e[1],l=u-a,h=e-t,n=(n[0]-a)*h-(n[1]-t)*l;if(null!==i){if(Math.abs(n)>i)return}else if(0!=n)return;return r?"start"===r?Math.abs(l)>=Math.abs(h)?0<l?a<o&&o<=u:u<=o&&o<a:0<h?t<s&&s<=e:e<=s&&s<t:"end"===r?Math.abs(l)>=Math.abs(h)?0<l?a<=o&&o<u:u<o&&o<=a:0<h?t<=s&&s<e:e<s&&s<=t:"both"===r&&(Math.abs(l)>=Math.abs(h)?0<l?a<o&&o<u:u<o&&o<a:0<h?t<s&&s<e:e<s&&s<t):Math.abs(l)>=Math.abs(h)?0<l?a<=o&&o<=u:u<=o&&o<=a:0<h?t<=s&&s<=e:e<=s&&s<=t}(i[o],i[o+1],r,s,void 0===n.epsilon?null:n.epsilon))return!0}return!1}function Lr(t,e){var n=At(t),r=At(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":for(var s=n,a=r,u=!1,l=0;l<a.coordinates.length;l++)if(Rr(a.coordinates[l],s.coordinates)){u=!0;break}return u;case"LineString":return Mr(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return De(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":for(var h=n,c=r,p=0;p<h.coordinates.length;p++){for(var f=!1,g=0;g<c.coordinates.length;g++)Rr(h.coordinates[p],c.coordinates[g])&&(f=!0);if(!f)return!1}return!0;case"LineString":for(var d=n,y=r,_=!1,m=0;m<d.coordinates.length;m++){if(!Mr(d.coordinates[m],y))return!1;_=_||Mr(d.coordinates[m],y,{ignoreEndVertices:!0})}return _;case"Polygon":case"MultiPolygon":for(var v=n,x=r,E=!0,b=!1,w=0;w<v.coordinates.length;w++){if(!(b=De(v.coordinates[1],x))){E=!1;break}b=De(v.coordinates[1],x,{ignoreBoundary:!0})}return E&&b;default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":for(var I=n,N=r,S=0;S<I.coordinates.length;S++)if(!Mr(I.coordinates[S],N))return!1;return!0;case"Polygon":case"MultiPolygon":var C=n,P=r;if(!Or(Pt(P),Pt(C)))return!1;for(var M,L,O=!1,R=0;R<C.coordinates.length-1;R++){if(!De(C.coordinates[R],P))return!1;O=(O=O||De(C.coordinates[R],P,{ignoreBoundary:!0}))||De((M=C.coordinates[R],L=C.coordinates[R+1],[(M[0]+L[0])/2,(M[1]+L[1])/2]),P,{ignoreBoundary:!0})}return O;default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":var T=n,A=r,F=Pt(T);if(!Or(Pt(A),F))return!1;for(var D=0;D<T.coordinates[0].length;D++)if(!De(T.coordinates[0][D],A))return!1;return!0;default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function Or(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Rr(t,e){return t[0]===e[0]&&t[1]===e[1]}function Tr(t,e,n){(n=void 0===n?{}:n).mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/Ge([i,o],[s,o],n)*(s-i),l=e/Ge([i,o],[i,a],n)*(a-o),t=s-i,e=a-o,h=Math.floor(t/u),c=(e-Math.floor(e/l)*l)/2,p=i+(t-h*u)/2;p<=s;){for(var f=o+c;f<=a;){var g=R([p,f],n.properties);n.mask&&!Lr(g,n.mask)||r.push(g),f+=l}p+=u}return G(r)}function Ar(t,e){var n=(e=void 0===e?{}:e).precision,i=e.coordinates,e=e.mutate,n=null==n||isNaN(n)?6:n,i=null==i||isNaN(i)?3:i;if(!t)throw new Error("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof i)throw new Error("<coordinates> must be a number");!1!==e&&void 0!==e||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return ht(t,function(t){var e=t,n=o;e.length>i&&e.splice(i,e.length);for(var r=0;r<e.length;r++)e[r]=Math.round(e[r]*n)/n}),t}function Dr(t){var e;if(t)return e=[],vt(t,function(t){e.push(t)}),G(e);throw new Error("geojson is required")}function Fr(t,_,e){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");var m=t.geometry.coordinates,v=[],x={};if(e=void 0===e?1:e){for(var n=[],r=0;r<m.length;r++)for(var i=0;i<m[r].length-1;i++)n.push(c(r,i));var o=Kt();o.load(n)}for(var s=0;s<m.length;s++)for(var a=0;a<m[s].length-1;a++)if(e)o.search(c(s,a)).forEach(function(t){var e=t.ring,t=t.edge;h(s,a,e,t)});else for(var u=0;u<m.length;u++)for(var l=0;l<m[u].length-1;l++)h(s,a,u,l);return v=_?v:{type:"Feature",geometry:{type:"MultiPoint",coordinates:v}};function h(t,e,n,r){var i,o,s,a,u,l,h,c,p=m[t][e],f=m[t][e+1],g=m[n][r],d=m[n][r+1],y=(c=f,s=d,kr(i=p,o=g)||kr(i,s)||kr(c,o)||kr(s,o)||(y=i[0],i=i[1],a=c[0],c=c[1],u=o[0],o=o[1],l=s[0],0==(h=(y-a)*(o-(s=s[1]))-(i-c)*(u-l)))?null:[((y*c-i*a)*(u-l)-(y-a)*(u*s-o*l))/h,((y*c-i*a)*(o-s)-(i-c)*(u*s-o*l))/h]);null===y||(a=f[0]!==p[0]?(y[0]-p[0])/(f[0]-p[0]):(y[1]-p[1])/(f[1]-p[1]),i=d[0]!==g[0]?(y[0]-g[0])/(d[0]-g[0]):(y[1]-g[1])/(d[1]-g[1]),1<=a)||a<=0||1<=i||i<=0||((c=!x[y])&&(x[y]=!0),_?v.push(_(y,t,e,p,f,a,n,r,g,d,i,c)):v.push(y))}function c(t,e){var n,r,i=m[t][e],o=m[t][e+1],s=(i[0]<o[0]?(n=i[0],o):(n=o[0],i))[0],o=(i[1]<o[1]?(r=i[1],o):(r=o[1],i))[1];return{minX:n,minY:r,maxX:s,maxY:o,ring:t,edge:e}}}function kr(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(!kr(t[n],e[n]))return}else if(t[n]!==e[n])return;return 1}}function Gr(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];jr(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(Object.prototype.hasOwnProperty.call(e,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=Fr(t,function(t,e,n,r,i,o,s,a,u,l,h,c){return[t,e,n,r,i,o,s,a,u,l,h,c]}),a=s.length;if(0==a){for(var u=[],r=0;r<e;r++)u.push(k([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);{var r;r=zr([t[Ur(e-1,t.length-1)],t[e],t[Ur(e+1,t.length-1)]],!0)?1:-1}return r}(t.geometry.coordinates[r])}));var l=G(u)}else{var h=[],c=[];for(r=0;r<e;r++){h.push([]);for(var p=0;p<t.geometry.coordinates[r].length-1;p++)h[r].push([new qr(t.geometry.coordinates[r][Ur(p+1,t.geometry.coordinates[r].length-1)],1,[r,p],[r,Ur(p+1,t.geometry.coordinates[r].length-1)],void 0)]),c.push(new Br(t.geometry.coordinates[r][p],[r,Ur(p-1,t.geometry.coordinates[r].length-1)],[r,p],void 0,void 0,!1,!0))}for(r=0;r<a;r++)h[s[r][1]][s[r][2]].push(new qr(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&c.push(new Br(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var f=c.length;for(r=0;r<h.length;r++)for(p=0;p<h[r].length;p++)h[r][p].sort(function(t,e){return t.param<e.param?-1:1});var g=[];for(r=0;r<f;r++)g.push({minX:c[r].coord[0],minY:c[r].coord[1],maxX:c[r].coord[0],maxY:c[r].coord[1],index:r});var d=Kt();for(d.load(g),r=0;r<h.length;r++)for(p=0;p<h[r].length;p++)for(var y=0;y<h[r][p].length;y++){var _=(y==h[r][p].length-1?h[r][Ur(p+1,t.geometry.coordinates[r].length-1)][0]:h[r][p][y+1]).coord,m=d.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0];h[r][p][y].nxtIsectAlongEdgeIn=m.index}for(r=0;r<h.length;r++)for(p=0;p<h[r].length;p++)for(y=0;y<h[r][p].length;y++){var _=h[r][p][y].coord,v=(m=d.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0]).index;!(v<o)&&jr(c[v].ringAndEdge1,h[r][p][y].ringAndEdgeIn)?c[v].nxtIsectAlongRingAndEdge1=h[r][p][y].nxtIsectAlongEdgeIn:c[v].nxtIsectAlongRingAndEdge2=h[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++)c[r].coord[0]<c[E].coord[0]&&(E=r),r++;var b=c[E].nxtIsectAlongRingAndEdge2;for(y=0;y<c.length;y++)if(c[y].nxtIsectAlongRingAndEdge1==E||c[y].nxtIsectAlongRingAndEdge2==E){var w=y;break}b=zr([c[w].coord,c[E].coord,c[b].coord],!0)?1:-1;x.push({isect:E,parent:-1,winding:b})}for(x.sort(function(t,e){return c[t.isect].coord>c[e.isect].coord?-1:1}),u=[];0<x.length;){for(var I=x.pop(),N=I.isect,S=I.parent,C=I.winding,P=u.length,M=[c[N].coord],L=N,O=c[N].ringAndEdge1Walkable?(T=c[N].ringAndEdge1,c[N].nxtIsectAlongRingAndEdge1):(T=c[N].ringAndEdge2,c[N].nxtIsectAlongRingAndEdge2);!jr(c[N].coord,c[O].coord);){M.push(c[O].coord);var R,T,A=void 0;for(r=0;r<x.length;r++)if(x[r].isect==O){A=r;break}null!=A&&x.splice(A,1),O=jr(T,c[O].ringAndEdge1)?(T=c[O].ringAndEdge2,c[O].ringAndEdge2Walkable=!1,c[O].ringAndEdge1Walkable&&(R={isect:O},zr([c[L].coord,c[O].coord,c[c[O].nxtIsectAlongRingAndEdge2].coord],1==C)?(R.parent=S,R.winding=-C):(R.parent=P,R.winding=C),x.push(R)),c[L=O].nxtIsectAlongRingAndEdge2):(T=c[O].ringAndEdge1,c[O].ringAndEdge1Walkable=!1,c[O].ringAndEdge2Walkable&&(R={isect:O},zr([c[L].coord,c[O].coord,c[c[O].nxtIsectAlongRingAndEdge1].coord],1==C)?(R.parent=S,R.winding=-C):(R.parent=P,R.winding=C),x.push(R)),c[L=O].nxtIsectAlongRingAndEdge1)}M.push(c[O].coord),u.push(k([M],{index:P,parent:S,winding:C,netWinding:void 0}))}l=G(u)}return D(),F(),l;function D(){for(var t=[],e=0;e<l.features.length;e++)-1==l.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<l.features.length;r++)t[e]!=r&&De(l.features[t[e]].geometry.coordinates[0][0],l.features[r],{ignoreBoundary:!0})&&wr(l.features[r])<1/0&&(n=r);l.features[t[e]].properties.parent=n}}function F(){for(var t,e=0;e<l.features.length;e++)-1==l.features[e].properties.parent&&(t=l.features[e].properties.winding,function t(e,n){for(var r=0;r<l.features.length;r++){var i;l.features[r].properties.parent==e&&(i=n+l.features[r].properties.winding,l.features[r].properties.netWinding=i,t(r,i))}}(e,l.features[e].properties.netWinding=t))}}function qr(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i}function Br(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 zr(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 jr(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(!jr(t[n],e[n]))return}else if(t[n]!=e[n])return;return 1}}function Ur(t,e){return(t%e+e)%e}function Vr(t,e){this.lon=t,this.lat=e,this.x=Wr*t,this.y=Wr*e}function Xr(){this.coords=[],this.length=0}function Yr(t){this.properties=t||{},this.geometries=[]}function Hr(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 Vr(t.x,t.y),this.end=new Vr(e.x,e.y),this.properties=n||{};var n=this.start.x-this.end.x,r=this.start.y-this.end.y,r=Math.pow(Math.sin(r/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(n/2),2);if(this.g=2*Math.asin(Math.sqrt(r)),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)}var Wr=Math.PI/180,Jr=180/Math.PI;Vr.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Vr.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new Vr(e,t)},Xr.prototype.move_to=function(t){this.length++,this.coords.push(t)},Yr.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}},Yr.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 Zr(r,t){var i=[],o=pr();return vt(t,function(t){var e,n;i.forEach(function(t,e){t.id=e}),i.length?(e=o.search(t)).features.length&&(n=Qr(t,e),i=i.filter(function(t){return t.id!==n.id}),o.remove(n),gt(Kr(n,t),function(t){i.push(t),o.insert(t)})):((i=Kr(r,t).features).forEach(function(t){t.bbox||(t.bbox=Nn(Pt(t)))}),o.load(G(i)))}),G(i)}function Kr(t,i){var e,o,s=[],n=_(t)[0],r=_(t)[t.geometry.coordinates.length-1];return!$r(n,Mt(i))&&!$r(r,Mt(i))&&(r=pr(),e=Kn(t),r.load(e),(r=r.search(i)).features.length)?(o=Qr(i,r),1<(r=dt(e,function(t,e,n){var e=_(e)[1],r=Mt(i);return n===o.id?(t.push(r),s.push(V(t)),$r(r,e)?[r]:[r,e]):(t.push(e),t)},[n])).length&&s.push(V(r)),G(s)):G([t])}function Qr(n,t){var r,i;if(t.features.length)return 1===t.features.length?t.features[0]:(i=1/0,gt(t,function(t){var e=dr(t,n).properties.dist;e<i&&(r=t,i=e)}),r);throw new Error("lines must contain features")}function $r(t,e){return t[0]===e[0]&&t[1]===e[1]}function ti(t,e,n,r,i){var o=(i=void 0===i?{}:i).steps||64,n=ei(n),r=ei(r),s=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(n===r)return V(Cn(t,e,i).geometry.coordinates[0],s);for(var a=n,u=n<r?r:r+360,l=a,h=[],c=0;l<u;)h.push(Sn(t,e,l,i).geometry.coordinates),l=a+360*++c/o;return u<l&&h.push(Sn(t,e,u,i).geometry.coordinates),V(h,s)}function ei(t){t%=360;return t<0&&(t+=360),t}function ni(t,e){var n,r,i,o,s=At(t);switch((e=void 0===e?{}:e).properties||"Feature"!==t.type||(e.properties=t.properties),s.type){case"Polygon":return ri(s,e);case"MultiPolygon":return n=e,r=At(s).coordinates,i=(n=void 0===n?{}:n).properties||("Feature"===s.type?s.properties:{}),o=[],r.forEach(function(t){o.push(ii(t,i))}),G(o);default:throw new Error("invalid poly")}}function ri(t,e){return ii(At(t).coordinates,(e=void 0===e?{}:e).properties||("Feature"===t.type?t.properties:{}))}function ii(t,e){return 1<t.length?Y(t,e):V(t[0],e)}function oi(t,e){var n,r,i=(e=void 0===e?{}:e).properties,o=null==(n=e.autoComplete)||n,s=null==(n=e.orderCoords)||n;return"FeatureCollection"!==(t=null!=(n=e.mutate)&&n?t:je(t)).type?si(t,i,o,s):(r=[],t.features.forEach(function(t){r.push(_(si(t,{},o,s)))}),W(r,i))}function si(t,e,o,s){e=e||("Feature"===t.type?t.properties:{});var t=At(t),n=t.coordinates,r=t.type;if(!n.length)throw new Error("line must contain coordinates");switch(r){case"LineString":return k([n=o?ai(n):n],e);case"MultiLineString":var a=[],u=0;return n.forEach(function(t){var e,n,r,i;o&&(t=ai(t)),s&&(e=Pt(V(t)),n=e[0],r=e[1],i=e[2],e=e[3],n=Math.abs(n-i)*Math.abs(r-e),u<n)?(a.unshift(t),u=n):a.push(t)}),k(a,e);default:throw new Error("geometry type "+r+" is not supported")}}function ai(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],i=i[1];return n===o&&r===i||t.push(e),t}function ui(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 li(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 hi(t,e){for(var n=[],r=0,i=t;r<i.length;r++){var o=function(t,e){for(var n,r,i,o,s,a,u=1;u<=8;u*=2){for(n=[],i=!(li(r=t[t.length-1],e)&u),o=0;o<t.length;o++)(a=!(li(s=t[o],e)&u))!==i&&n.push(ui(r,s,u,e)),a&&n.push(s),r=s,i=a;if(!(t=n).length)break}return n}(i[r],e);0<o.length&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),4<=o.length)&&n.push(o)}return n}Hr.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),t=Math.sin(t*this.g)/Math.sin(this.g),n=e*Math.cos(this.start.y)*Math.cos(this.start.x)+t*Math.cos(this.end.y)*Math.cos(this.end.x),r=e*Math.cos(this.start.y)*Math.sin(this.start.x)+t*Math.cos(this.end.y)*Math.sin(this.end.x),e=e*Math.sin(this.start.y)+t*Math.sin(this.end.y),t=Jr*Math.atan2(e,Math.sqrt(Math.pow(n,2)+Math.pow(r,2)));return[Jr*Math.atan2(r,n),t]},Hr.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=this.interpolate(r*i);n.push(o)}for(var s=!1,a=0,e=e&&e.offset?e.offset:10,u=180-e,l=-180+e,h=360-e,c=1;c<n.length;++c){var p=n[c-1][0],f=n[c][0],g=Math.abs(f-p);h<g&&(u<f&&p<l||u<p&&f<l)?s=!0:a<g&&(a=g)}var d=[];if(s&&a<e){var y=[];d.push(y);for(var _=0;_<n.length;++_){var m,v,x,E,b,w=parseFloat(n[_][0]);0<_&&Math.abs(w-n[_-1][0])>h?(m=parseFloat(n[_-1][0]),v=parseFloat(n[_-1][1]),b=parseFloat(n[_][0]),x=parseFloat(n[_][1]),-180<m&&m<l&&180===b&&_+1<n.length&&-180<n[_-1][0]&&n[_-1][0]<l?(y.push([-180,n[_][1]]),_++,y.push([n[_][0],n[_][1]])):u<m&&m<180&&-180===b&&_+1<n.length&&n[_-1][0]>u&&n[_-1][0]<180?(y.push([180,n[_][1]]),_++,y.push([n[_][0],n[_][1]])):(m<l&&u<b&&(E=m,m=b,b=E,E=v,v=x,x=E),u<m&&b<l&&(b+=360),m<=180&&180<=b&&m<b?(y.push([n[_-1][0]>u?180:-180,b=(E=(180-m)/(b-m))*x+(1-E)*v]),(y=[]).push([n[_-1][0]>u?-180:180,b]),d.push(y)):d.push(y=[]),y.push([w,n[_][1]]))):y.push([n[_][0],n[_][1]])}}else{var I=[];d.push(I);for(var N=0;N<n.length;++N)I.push([n[N][0],n[N][1]])}for(var S=new Yr(this.properties),C=0;C<d.length;++C){var P=new Xr;S.geometries.push(P);for(var M=d[C],L=0;L<M.length;++L)P.move_to(M[L])}return S};var ci=ce(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}),pi=ce(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}),fi=ce(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(l(t)||l(e))return!1;if(t.prototype!==e.prototype)return!1;if(pi(t))return!!pi(e)&&(t=a.call(t),e=a.call(e),u(t,e,n));if(h(t)){if(!h(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=ci(t),s=ci(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 l(t){return null==t}function h(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 gi(t,e,n){var o,s,a,u;if(st(n=(n=void 0===n?{}:n)||{}))return s=n.tolerance||0,a=[],u=pr(),n=Kn(t),u.load(n),Et(e,function(r){var i=!1;r&&(gt(u.search(r),function(t){var e,n;!1===i&&(e=_(r).sort(),n=_(t).sort(),fi(e,n)||(0===s?Mr(e[0],t)&&Mr(e[1],t):dr(t,e[0]).properties.dist<=s&&dr(t,e[1]).properties.dist<=s)?(i=!0,o=o?di(o,r):r):(0===s?Mr(n[0],r)&&Mr(n[1],r):dr(r,n[0]).properties.dist<=s&&dr(r,n[1]).properties.dist<=s)&&(o=o?di(o,t):t))}),!1===i)&&o&&(a.push(o),o=void 0)}),o&&a.push(o),G(a);throw new Error("options is invalid")}function di(t,e){var e=_(e),n=_(t),r=n[0],n=n[n.length-1],i=t.geometry.coordinates;return fi(e[0],r)?i.unshift(e[1]):fi(e[0],n)?i.push(e[1]):fi(e[1],r)?i.unshift(e[0]):fi(e[1],n)&&i.push(e[0]),t}function yi(t){t%=360;return t<0&&(t+=360),t}function _i(t,e,n){return 180<(n=(n=void 0===n?{}:n).final?mi(Mt(e),Mt(t)):mi(Mt(t),Mt(e)))?-(360-n):n}function mi(t,e){var n=nt(t[1]),r=nt(e[1]),e=nt(e[0]-t[0]),t=(e>Math.PI&&(e-=2*Math.PI),e<-Math.PI&&(e+=2*Math.PI),Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)));return(et(Math.atan2(e,t))+360)%360}function vi(t,e,n,r){void 0===r&&(r={});var i,o,s,a=e<0,e=rt(Math.abs(e),r.units,"meters"),a=(a&&(e=-Math.abs(e)),Mt(t)),u=(t=e/q,e=a[0]*Math.PI/180,i=nt(a[1]),n=nt(n),o=t*Math.cos(n),s=i+o,Math.abs(s)>Math.PI/2&&(s=0<s?Math.PI-s:-Math.PI-s),u=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),o=1e-11<Math.abs(u)?o/u:Math.cos(i),[(180*(e+t*Math.sin(n)/o)/Math.PI+540)%360-180,180*s/Math.PI]);return u[0]+=180<u[0]-a[0]?-360:180<a[0]-u[0]?360:0,R(u,r.properties)}function xi(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=Ei(a,u,e),n<=0&&0<r?Ei(e,a,i)<0||(i=a):0<n&&r<=0&&(0<Ei(e,a,o)||(o=a)),n=r}return[i,o]}function Ei(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function bi(t){for(var e,n,r=_(t),i=0,o=1;o<r.length;)e=n||r[0],i+=((n=r[o])[0]-e[0])*(n[1]+e[1]),o++;return 0<i}function wi(t,e){switch(("Feature"===t.type?t.geometry:t).type){case"GeometryCollection":return _t(t,function(t){wi(t,e)}),t;case"LineString":return Ii(_(t),e),t;case"Polygon":return Ni(_(t),e),t;case"MultiLineString":return _(t).forEach(function(t){Ii(t,e)}),t;case"MultiPolygon":return _(t).forEach(function(t){Ni(t,e)}),t;case"Point":case"MultiPoint":return t}}function Ii(t,e){bi(t)===e&&t.reverse()}function Ni(t,e){bi(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)bi(t[n])===e&&t[n].reverse()}var Si={successCallback:null,verbose:!1,polygons:!1},Ci={};function Pi(t,e,I,n){n=n||{};for(var r=Object.keys(Si),i=0;i<r.length;i++){var o=r[i],s=n[o];Ci[o]=null!=s?s:Si[o]}Ci.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+I)+"]");var a,u,t=function(t,e){for(var n=t.length-1,r=t[0].length-1,i={rows:n,cols:r,cells:[]},o=e+Math.abs(I),s=0;s<n;++s){i.cells[s]=[];for(var a=0;a<r;++a){var u,l,h,c,p,f,g,d,y,_,m,v=0,x=t[s+1][a],E=t[s+1][a+1],b=t[s][a+1],w=t[s][a];isNaN(x)||isNaN(E)||isNaN(b)||isNaN(w)||(u=v=(v=v|(x<e?0:o<x?128:64)|(E<e?0:o<E?32:16))|(b<e?0:o<b?8:4)|(w<e?0:o<w?2:1),l=0,17!==v&&18!==v&&33!==v&&34!==v&&38!==v&&68!==v&&72!==v&&98!==v&&102!==v&&132!==v&&136!==v&&137!==v&&152!==v&&153!==v||(l=o<(y=(x+E+b+w)/4)?2:y<e?0:1,34===v?1===l?v=35:0===l&&(v=136):136===v?1===l?(v=35,l=4):0===l&&(v=34):17===v?1===l?(v=155,l=4):0===l&&(v=153):68===v?1===l?(v=103,l=4):0===l&&(v=102):153===v?1===l&&(v=155):102===v?1===l&&(v=103):152===v?l<2&&(v=156,l=1):137===v?l<2&&(v=139,l=1):98===v?l<2&&(v=99,l=1):38===v?l<2&&(v=39,l=1):18===v?0<l?(v=156,l=4):v=152:33===v?0<l?(v=139,l=4):v=137:72===v?0<l?(v=99,l=4):v=98:132===v&&(0<l?(v=39,l=4):v=38)),0!=v&&170!=v&&(_=h=c=p=f=g=d=y=.5,m=[],1===v?(c=1-O(e,b,w),y=1-O(e,x,w),m.push(P[v])):169===v?(c=O(o,w,b),y=O(o,w,x),m.push(P[v])):4===v?(g=1-O(e,E,b),p=O(e,w,b),m.push(S[v])):166===v?(g=O(o,b,E),p=1-O(o,b,w),m.push(S[v])):16===v?(f=O(e,b,E),h=O(e,x,E),m.push(N[v])):154===v?(f=1-O(o,E,b),h=1-O(o,E,x),m.push(N[v])):64===v?(d=O(e,w,x),_=1-O(e,E,x),m.push(L[v])):106===v?(d=1-O(o,x,w),_=O(o,x,E),m.push(L[v])):168===v?(p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),m.push(C[v]),m.push(P[v])):2===v?(p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),m.push(C[v]),m.push(P[v])):162===v?(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),m.push(C[v]),m.push(P[v])):8===v?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),m.push(N[v]),m.push(S[v])):138===v?(f=1-O(e,E,b),g=1-O(o,E,b),_=1-O(o,E,x),h=1-O(e,E,x),m.push(N[v]),m.push(S[v])):32===v?(f=O(o,b,E),g=O(e,b,E),_=O(e,x,E),h=O(o,x,E),m.push(N[v]),m.push(S[v])):42===v?(y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),h=O(o,x,E),m.push(M[v]),m.push(L[v])):128===v&&(y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),h=1-O(e,E,x),m.push(M[v]),m.push(L[v])),5===v?(g=1-O(e,E,b),y=1-O(e,x,w),m.push(S[v])):165===v?(g=O(o,b,E),y=O(o,w,x),m.push(S[v])):20===v?(p=O(e,w,b),h=O(e,x,E),m.push(C[v])):150===v?(p=1-O(o,b,w),h=1-O(o,E,x),m.push(C[v])):80===v?(f=O(e,b,E),d=O(e,w,x),m.push(N[v])):90===v?(f=1-O(o,E,b),d=1-O(o,x,w),m.push(N[v])):65===v?(c=1-O(e,b,w),_=1-O(e,E,x),m.push(P[v])):105===v?(c=O(o,w,b),_=O(o,x,E),m.push(P[v])):160===v?(f=O(o,b,E),g=O(e,b,E),y=O(e,w,x),d=O(o,w,x),m.push(N[v]),m.push(S[v])):10===v?(f=1-O(e,E,b),g=1-O(o,E,b),y=1-O(o,x,w),d=1-O(e,x,w),m.push(N[v]),m.push(S[v])):130===v?(p=1-O(e,b,w),c=1-O(o,b,w),_=1-O(o,E,x),h=1-O(e,E,x),m.push(C[v]),m.push(P[v])):40===v?(p=O(o,w,b),c=O(e,w,b),_=O(e,x,E),h=O(o,x,E),m.push(C[v]),m.push(P[v])):101===v?(g=O(o,b,E),_=O(o,x,E),m.push(S[v])):69===v?(g=1-O(e,E,b),_=1-O(e,E,x),m.push(S[v])):149===v?(y=O(o,w,x),h=1-O(o,E,x),m.push(M[v])):21===v?(y=1-O(e,x,w),h=O(e,x,E),m.push(M[v])):86===v?(p=1-O(o,b,w),d=1-O(o,x,w),m.push(C[v])):84===v?(p=O(e,w,b),d=O(e,w,x),m.push(C[v])):89===v?(f=1-O(o,E,b),c=O(o,w,b),m.push(P[v])):81===v?(f=O(e,b,E),c=1-O(e,b,w),m.push(P[v])):96===v?(f=O(o,b,E),g=O(e,b,E),d=O(e,w,x),_=O(o,x,E),m.push(N[v]),m.push(S[v])):74===v?(f=1-O(e,E,b),g=1-O(o,E,b),d=1-O(o,x,w),_=1-O(e,E,x),m.push(N[v]),m.push(S[v])):24===v?(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),h=O(e,x,E),m.push(N[v]),m.push(P[v])):146===v?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),h=1-O(o,E,x),m.push(N[v]),m.push(P[v])):6===v?(g=1-O(e,E,b),p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),m.push(S[v]),m.push(C[v])):164===v?(g=O(o,b,E),p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),m.push(S[v]),m.push(C[v])):129===v?(c=1-O(e,b,w),y=O(o,w,x),_=1-O(o,E,x),h=1-O(e,E,x),m.push(P[v]),m.push(M[v])):41===v?(c=O(o,w,b),y=1-O(e,x,w),_=O(e,x,E),h=O(o,x,E),m.push(P[v]),m.push(M[v])):66===v?(p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),_=1-O(e,E,x),m.push(C[v]),m.push(P[v])):104===v?(p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),_=O(o,x,E),m.push(P[v]),m.push(so[v])):144===v?(f=O(e,b,E),y=O(e,w,x),d=O(o,w,x),h=1-O(o,E,x),m.push(N[v]),m.push(L[v])):26===v?(f=1-O(o,E,b),y=1-O(o,x,w),d=1-O(e,x,w),h=O(e,x,E),m.push(N[v]),m.push(L[v])):36===v?(g=O(o,b,E),p=O(e,w,b),_=O(e,x,E),h=O(o,x,E),m.push(S[v]),m.push(C[v])):134===v?(g=1-O(e,E,b),p=1-O(o,b,w),_=1-O(o,E,x),h=1-O(e,E,x),m.push(S[v]),m.push(C[v])):9===v?(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),y=1-O(e,x,w),m.push(N[v]),m.push(S[v])):161===v?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),y=O(o,w,x),m.push(N[v]),m.push(S[v])):37===v?(g=O(o,b,E),y=1-O(e,x,w),_=O(e,x,E),h=O(o,x,E),m.push(S[v]),m.push(M[v])):133===v?(g=1-O(e,E,b),y=O(o,w,x),_=1-O(o,E,x),h=1-O(e,E,x),m.push(S[v]),m.push(M[v])):148===v?(p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),h=1-O(o,E,x),m.push(C[v]),m.push(L[v])):22===v?(p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),h=O(e,x,E),m.push(C[v]),m.push(L[v])):82===v?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),m.push(N[v]),m.push(P[v])):88===v?(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),m.push(N[v]),m.push(P[v])):73===v?(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),_=1-O(e,E,x),m.push(N[v]),m.push(S[v])):97===v?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),_=O(o,x,E),m.push(N[v]),m.push(S[v])):145===v?(f=O(e,b,E),c=1-O(e,b,w),y=O(o,w,x),h=1-O(o,E,x),m.push(N[v]),m.push(M[v])):25===v?(f=1-O(o,E,b),c=O(o,w,b),y=1-O(e,x,w),h=O(e,x,E),m.push(N[v]),m.push(M[v])):70===v?(g=1-O(e,E,b),p=1-O(o,b,w),d=1-O(o,x,w),_=1-O(e,E,x),m.push(S[v]),m.push(C[v])):100===v?(g=O(o,b,E),p=O(e,w,b),d=O(e,w,x),_=O(o,x,E),m.push(S[v]),m.push(C[v])):34===v?(h=0===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(M[v]),m.push(L[v])):35===v?(h=4===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(P[v]),m.push(L[v])):136===v?(h=0===l?(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)):(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)),m.push(N[v]),m.push(S[v]),m.push(M[v]),m.push(L[v])):153===v?(h=0===l?(f=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(P[v])):102===v?(_=0===l?(g=1-O(e,E,b),p=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(S[v]),m.push(L[v])):155===v?(h=4===l?(f=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(M[v])):103===v?(_=4===l?(g=1-O(e,E,b),p=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(S[v]),m.push(C[v])):152===v?(h=0===l?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(C[v]),m.push(P[v])):156===v?(h=4===l?(f=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),O(e,x,E)):(f=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),y=O(e,w,x),d=O(o,w,x),1-O(o,E,x)),m.push(N[v]),m.push(P[v]),m.push(L[v])):137===v?(h=0===l?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),_=O(e,x,E),O(o,x,E)):(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)),m.push(N[v]),m.push(S[v]),m.push(P[v])):139===v?(h=4===l?(f=O(o,b,E),g=O(e,b,E),c=1-O(e,b,w),y=1-O(e,x,w),_=O(e,x,E),O(o,x,E)):(f=1-O(e,E,b),g=1-O(o,E,b),c=O(o,w,b),y=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)),m.push(N[v]),m.push(S[v]),m.push(M[v])):98===v?(_=0===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(L[v])):99===v?(_=4===l?(f=1-O(e,E,b),g=1-O(o,E,b),p=O(o,w,b),c=O(e,w,b),d=O(e,w,x),1-O(e,E,x)):(f=O(o,b,E),g=O(e,b,E),p=1-O(e,b,w),c=1-O(o,b,w),d=1-O(o,x,w),O(o,x,E)),m.push(N[v]),m.push(S[v]),m.push(P[v])):38===v?(h=0===l?(g=1-O(e,E,b),p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(S[v]),m.push(M[v]),m.push(L[v])):39===v?(h=4===l?(g=1-O(e,E,b),p=O(e,w,b),y=O(e,w,x),d=O(o,w,x),_=1-O(o,E,x),1-O(e,E,x)):(g=O(o,b,E),p=1-O(o,b,w),y=1-O(o,x,w),d=1-O(e,x,w),_=O(e,x,E),O(o,x,E)),m.push(S[v]),m.push(C[v]),m.push(L[v])):85===v&&(_=y=c=g=0,h=d=p=f=1),(_<0||1<_||h<0||1<h||f<0||1<f||p<0||1<p||y<0||1<y||d<0||1<d)&&console.log("MarchingSquaresJS-isoBands: "+v+" "+u+" "+x+","+E+","+b+","+w+" "+l+" "+_+" "+h+" "+f+" "+g+" "+p+" "+c+" "+y+" "+d),i.cells[s][a]={cval:v,cval_real:u,flipped:l,topleft:_,topright:h,righttop:f,rightbottom:g,bottomright:p,bottomleft:c,leftbottom:y,lefttop:d,edges:m}))}}return i}(t,e),e=Ci.polygons?(Ci.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),a=[],u=0,t.cells.forEach(function(t,n){t.forEach(function(t,e){void 0!==t&&("object"==typeof(t=l[t.cval](t))&&uo(t)?"object"==typeof t[0]&&uo(t[0])?"object"==typeof t[0][0]&&uo(t[0][0])?t.forEach(function(t){t.forEach(function(t){t[0]+=e,t[1]+=n}),a[u++]=t}):(t.forEach(function(t){t[0]+=e,t[1]+=n}),a[u++]=t):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates"))})}),a):(Ci.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=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&Gi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return 4&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return 1&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Gi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return 4&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return 1&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return 1&n?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&ki?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return 1&n?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&ki?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&ki?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&ki?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&ki?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Gi?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&ki?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Gi?{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]),u=s,l=o;null!==a&&i.push([a.p[0]+u,a.p[1]+l]);do{if(null===(h=function(t,e,n,r){var i,o,s,a,u,l=t.cval;switch(e){case-1:u=(0===r?(i=S[l],s=Xi[l],a=Yi[l],Hi):(i=N[l],s=ji[l],a=Ui[l],Vi))[l];break;case 1:u=(0===r?(i=M[l],s=ro[l],a=io[l],oo):(i=L[l],s=to[l],a=eo[l],no))[l];break;default:switch(n){case-1:u=(0===r?(i=so[l],s=c[l],a=p[l],f):(i=ao[l],s=qi[l],a=Bi[l],zi))[l];break;case 1:u=(0===r?(i=P[l],s=Wi[l],a=Ji[l],Zi):(i=C[l],s=Ki[l],a=Qi[l],$i))[l]}}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),l=t.cval_real,i){case 0:n=l&Gi?(e=t.topleft,1):(e=1,t.righttop);break;case 1:n=4&l?(e=1,t.rightbottom):(e=t.topleft,1);break;case 2:n=4&l?(e=t.topleft,1):(e=t.bottomright,0);break;case 3:n=1&l?(e=t.bottomleft,0):(e=t.topleft,1);break;case 4:n=l&Gi?(e=t.topright,1):(e=1,t.righttop);break;case 5:n=4&l?(e=1,t.rightbottom):(e=t.topright,1);break;case 6:n=4&l?(e=t.topright,1):(e=t.bottomright,0);break;case 7:n=1&l?(e=t.bottomleft,0):(e=t.topright,1);break;case 8:n=4&l?(e=1,t.righttop):(e=t.bottomright,0);break;case 9:n=1&l?(e=t.bottomleft,0):(e=1,t.righttop);break;case 10:n=1&l?(e=1,t.righttop):(e=0,t.leftbottom);break;case 11:n=l&ki?(e=0,t.lefttop):(e=1,t.righttop);break;case 12:n=4&l?(e=1,t.rightbottom):(e=t.bottomright,0);break;case 13:n=1&l?(e=t.bottomleft,0):(e=1,t.rightbottom);break;case 14:n=1&l?(e=1,t.rightbottom):(e=0,t.leftbottom);break;case 15:n=l&ki?(e=0,t.lefttop):(e=1,t.rightbottom);break;case 16:n=4&l?(e=0,t.leftbottom):(e=t.bottomright,0);break;case 17:n=l&ki?(e=0,t.lefttop):(e=t.bottomright,0);break;case 18:n=1&l?(e=t.bottomleft,0):(e=0,t.leftbottom);break;case 19:n=l&ki?(e=0,t.lefttop):(e=t.bottomleft,0);break;case 20:n=l&ki?(e=0,t.leftbottom):(e=t.topleft,1);break;case 21:n=l&Gi?(e=t.topright,1):(e=0,t.leftbottom);break;case 22:n=l&ki?(e=0,t.lefttop):(e=t.topleft,1);break;case 23:n=l&Gi?(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[l][u],a.x,a.y,a.o)))break;if(i.push([h.p[0]+u,h.p[1]+l]),u+=h.x,(l+=(a=h).y)<0||n<=l||u<0||r<=u||void 0===t.cells[l][u]){var h=function(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,h=[],c=!1;!c;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=r,a=(s=t.cells[l][u]).cval_real,-1===i)if(0===o)if(1&a)h.push([u,l]),r=-1,o=i=0;else{if(!(4&a)){h.push([u+s.bottomright,l]),o=i=1,c=!(r=0);break}h.push([u+1,l]),r=1,o=i=0}else{if(!(1&a)){if(4&a){h.push([u+s.bottomright,l]),o=i=1,c=!(r=0);break}h.push([u+s.bottomleft,l]),i=1,c=!(o=r=0);break}h.push([u,l]),r=-1,o=i=0}else if(1===i)if(0===o){if(!(a&Gi)){if(a&ki){h.push([u+s.topleft,l+1]),i=-1,c=!(o=r=0);break}h.push([u+s.topright,l+1]),i=-1,o=1,c=!(r=0);break}h.push([u+1,l+1]),i=0,o=r=1}else h.push([u+1,l+1]),i=0,o=r=1;else if(-1===r){if(0===o){if(!(a&ki)){if(1&a){h.push([u,l+s.leftbottom]),r=1,c=!(o=i=0);break}h.push([u,l+s.lefttop]),o=r=1,c=!(i=0);break}}else if(!(a&ki)){console.log("MarchingSquaresJS-isoBands: wtf");break}h.push([u,l+1]),i=1,o=r=0}else{if(1!==r){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(4&a)){h.push([u+1,l+s.rightbottom]),r=-1,c=!(o=i=0);break}}else if(!(4&a)){if(a&Gi){h.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}h.push([u+1,l+s.rightbottom]),r=-1,c=!(o=i=0);break}h.push([u+1,l]),r=0,i=-1,o=1}else if(a=(s=t.cells[l][u]).cval_real,-1===r)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])r=0,i=-1,o=1;else{if(!(1&a)){h.push([u+s.bottomright,l]),o=i=1,c=!(r=0);break}h.push([u,l])}else{if(!(a&ki)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);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[l+1]&&void 0!==t.cells[l+1][u])i=1,o=r=0;else{if(!(a&Gi)){h.push([u+s.topleft,l+1]),i=-1,c=!(o=r=0);break}h.push([u+1,l+1]),i=0,o=r=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u+1])r=1,i=0;else{if(!(4&a)){h.push([u+1,l+s.righttop]),r=-1,o=1,c=!(i=0);break}h.push([u+1,l]),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[l][u-1])r=-1,o=i=0;else{if(!(a&ki)){h.push([u,l+s.leftbottom]),r=1,c=!(o=i=0);break}h.push([u,l+1]),i=1,o=r=0}}if(l+=i,(u+=r)===e&&l===n)break}return{path:h,i:u,j:l,x:r,y:i,o:o}}(t,u-=h.x,l-=h.y,h.x,h.y,h.o);if(null===h)break;h.path.forEach(function(t){i.push(t)}),u=h.i,l=h.j,a=h}}while(void 0!==t.cells[l][u]&&0<t.cells[l][u].edges.length);e.push(i),i=[],0<t.cells[o][s].edges.length&&s--}return e}(t));return"function"==typeof Ci.successCallback&&Ci.successCallback(e),e}function Mi(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]}function Li(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]}function Oi(t){return[[t.topright,1],[1,1],[1,t.righttop]]}function Ri(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]}function Ti(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]}function Ai(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]}function Di(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]}function Fi(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]}var ki=64,Gi=16,c=[],p=[],f=[],qi=[],Bi=[],zi=[],ji=[],Ui=[],Vi=[],Xi=[],Yi=[],Hi=[],Wi=[],Ji=[],Zi=[],Ki=[],Qi=[],$i=[],to=[],eo=[],no=[],ro=[],io=[],oo=[],N=(ji[85]=Xi[85]=-1,Ui[85]=Yi[85]=0,Vi[85]=Hi[85]=1,to[85]=ro[85]=1,eo[85]=io[85]=0,no[85]=oo[85]=1,c[85]=qi[85]=0,p[85]=Bi[85]=-1,f[85]=Zi[85]=0,Ki[85]=Wi[85]=0,Qi[85]=Ji[85]=1,zi[85]=$i[85]=1,ro[1]=ro[169]=0,io[1]=io[169]=-1,oo[1]=oo[169]=0,Wi[1]=Wi[169]=-1,Ji[1]=Ji[169]=0,Zi[1]=Zi[169]=0,Xi[4]=Xi[166]=0,Yi[4]=Yi[166]=-1,Hi[4]=Hi[166]=1,Ki[4]=Ki[166]=1,Qi[4]=Qi[166]=0,$i[4]=$i[166]=0,ji[16]=ji[154]=0,Ui[16]=Ui[154]=1,Vi[16]=Vi[154]=1,qi[16]=qi[154]=1,Bi[16]=Bi[154]=0,zi[16]=zi[154]=1,to[64]=to[106]=0,eo[64]=eo[106]=1,no[64]=no[106]=0,c[64]=c[106]=-1,p[64]=p[106]=0,f[64]=f[106]=1,to[2]=to[168]=0,eo[2]=eo[168]=-1,no[2]=no[168]=1,ro[2]=ro[168]=0,io[2]=io[168]=-1,oo[2]=oo[168]=0,Wi[2]=Wi[168]=-1,Ji[2]=Ji[168]=0,Zi[2]=Zi[168]=0,Ki[2]=Ki[168]=-1,Qi[2]=Qi[168]=0,$i[2]=$i[168]=1,ji[8]=ji[162]=0,Ui[8]=Ui[162]=-1,Vi[8]=Vi[162]=0,Xi[8]=Xi[162]=0,Yi[8]=Yi[162]=-1,Hi[8]=Hi[162]=1,Wi[8]=Wi[162]=1,Ji[8]=Ji[162]=0,Zi[8]=Zi[162]=1,Ki[8]=Ki[162]=1,Qi[8]=Qi[162]=0,$i[8]=$i[162]=0,ji[32]=ji[138]=0,Ui[32]=Ui[138]=1,Vi[32]=Vi[138]=1,Xi[32]=Xi[138]=0,Yi[32]=Yi[138]=1,Hi[32]=Hi[138]=0,c[32]=c[138]=1,p[32]=p[138]=0,f[32]=f[138]=0,qi[32]=qi[138]=1,Bi[32]=Bi[138]=0,zi[32]=zi[138]=1,ro[128]=ro[42]=0,io[128]=io[42]=1,oo[128]=oo[42]=1,to[128]=to[42]=0,eo[128]=eo[42]=1,no[128]=no[42]=0,c[128]=c[42]=-1,p[128]=p[42]=0,f[128]=f[42]=1,qi[128]=qi[42]=-1,Bi[128]=Bi[42]=0,zi[128]=zi[42]=0,Xi[5]=Xi[165]=-1,Yi[5]=Yi[165]=0,Hi[5]=Hi[165]=0,ro[5]=ro[165]=1,io[5]=io[165]=0,oo[5]=oo[165]=0,Ki[20]=Ki[150]=0,Qi[20]=Qi[150]=1,$i[20]=$i[150]=1,qi[20]=qi[150]=0,Bi[20]=Bi[150]=-1,zi[20]=zi[150]=1,ji[80]=ji[90]=-1,Ui[80]=Ui[90]=0,Vi[80]=Vi[90]=1,to[80]=to[90]=1,eo[80]=eo[90]=0,no[80]=no[90]=1,Wi[65]=Wi[105]=0,Ji[65]=Ji[105]=1,Zi[65]=Zi[105]=0,c[65]=c[105]=0,p[65]=p[105]=-1,f[65]=f[105]=0,ji[160]=ji[10]=-1,Ui[160]=Ui[10]=0,Vi[160]=Vi[10]=1,Xi[160]=Xi[10]=-1,Yi[160]=Yi[10]=0,Hi[160]=Hi[10]=0,ro[160]=ro[10]=1,io[160]=io[10]=0,oo[160]=oo[10]=0,to[160]=to[10]=1,eo[160]=eo[10]=0,no[160]=no[10]=1,Ki[130]=Ki[40]=0,Qi[130]=Qi[40]=1,$i[130]=$i[40]=1,Wi[130]=Wi[40]=0,Ji[130]=Ji[40]=1,Zi[130]=Zi[40]=0,c[130]=c[40]=0,p[130]=p[40]=-1,f[130]=f[40]=0,qi[130]=qi[40]=0,Bi[130]=Bi[40]=-1,zi[130]=zi[40]=1,Xi[37]=Xi[133]=0,Yi[37]=Yi[133]=1,Hi[37]=Hi[133]=1,ro[37]=ro[133]=0,io[37]=io[133]=1,oo[37]=oo[133]=0,c[37]=c[133]=-1,p[37]=p[133]=0,f[37]=f[133]=0,qi[37]=qi[133]=1,Bi[37]=Bi[133]=0,zi[37]=zi[133]=0,Ki[148]=Ki[22]=-1,Qi[148]=Qi[22]=0,$i[148]=$i[22]=0,ro[148]=ro[22]=0,io[148]=io[22]=-1,oo[148]=oo[22]=1,to[148]=to[22]=0,eo[148]=eo[22]=1,no[148]=no[22]=1,qi[148]=qi[22]=-1,Bi[148]=Bi[22]=0,zi[148]=zi[22]=1,ji[82]=ji[88]=0,Ui[82]=Ui[88]=-1,Vi[82]=Vi[88]=1,Ki[82]=Ki[88]=1,Qi[82]=Qi[88]=0,$i[82]=$i[88]=1,Wi[82]=Wi[88]=-1,Ji[82]=Ji[88]=0,Zi[82]=Zi[88]=1,to[82]=to[88]=0,eo[82]=eo[88]=-1,no[82]=no[88]=0,ji[73]=ji[97]=0,Ui[73]=Ui[97]=1,Vi[73]=Vi[97]=0,Xi[73]=Xi[97]=0,Yi[73]=Yi[97]=-1,Hi[73]=Hi[97]=0,Wi[73]=Wi[97]=1,Ji[73]=Ji[97]=0,Zi[73]=Zi[97]=0,c[73]=c[97]=1,p[73]=p[97]=0,f[73]=f[97]=1,ji[145]=ji[25]=0,Ui[145]=Ui[25]=-1,Vi[145]=Vi[25]=0,Wi[145]=Wi[25]=1,Ji[145]=Ji[25]=0,Zi[145]=Zi[25]=1,ro[145]=ro[25]=0,io[145]=io[25]=1,oo[145]=oo[25]=1,qi[145]=qi[25]=-1,Bi[145]=Bi[25]=0,zi[145]=zi[25]=0,Xi[70]=Xi[100]=0,Yi[70]=Yi[100]=1,Hi[70]=Hi[100]=0,Ki[70]=Ki[100]=-1,Qi[70]=Qi[100]=0,$i[70]=$i[100]=1,to[70]=to[100]=0,eo[70]=eo[100]=-1,no[70]=no[100]=1,c[70]=c[100]=1,p[70]=p[100]=0,f[70]=f[100]=0,Xi[101]=Xi[69]=0,Yi[101]=Yi[69]=1,Hi[101]=Hi[69]=0,c[101]=c[69]=1,p[101]=p[69]=0,f[101]=f[69]=0,ro[149]=ro[21]=0,io[149]=io[21]=1,oo[149]=oo[21]=1,qi[149]=qi[21]=-1,Bi[149]=Bi[21]=0,zi[149]=zi[21]=0,Ki[86]=Ki[84]=-1,Qi[86]=Qi[84]=0,$i[86]=$i[84]=1,to[86]=to[84]=0,eo[86]=eo[84]=-1,no[86]=no[84]=1,ji[89]=ji[81]=0,Ui[89]=Ui[81]=-1,Vi[89]=Vi[81]=0,Wi[89]=Wi[81]=1,Ji[89]=Ji[81]=0,Zi[89]=Zi[81]=1,ji[96]=ji[74]=0,Ui[96]=Ui[74]=1,Vi[96]=Vi[74]=0,Xi[96]=Xi[74]=-1,Yi[96]=Yi[74]=0,Hi[96]=Hi[74]=1,to[96]=to[74]=1,eo[96]=eo[74]=0,no[96]=no[74]=0,c[96]=c[74]=1,p[96]=p[74]=0,f[96]=f[74]=1,ji[24]=ji[146]=0,Ui[24]=Ui[146]=-1,Vi[24]=Vi[146]=1,Ki[24]=Ki[146]=1,Qi[24]=Qi[146]=0,$i[24]=$i[146]=1,Wi[24]=Wi[146]=0,Ji[24]=Ji[146]=1,Zi[24]=Zi[146]=1,qi[24]=qi[146]=0,Bi[24]=Bi[146]=-1,zi[24]=zi[146]=0,Xi[6]=Xi[164]=-1,Yi[6]=Yi[164]=0,Hi[6]=Hi[164]=1,Ki[6]=Ki[164]=-1,Qi[6]=Qi[164]=0,$i[6]=$i[164]=0,ro[6]=ro[164]=0,io[6]=io[164]=-1,oo[6]=oo[164]=1,to[6]=to[164]=1,eo[6]=eo[164]=0,no[6]=no[164]=0,Wi[129]=Wi[41]=0,Ji[129]=Ji[41]=1,Zi[129]=Zi[41]=1,ro[129]=ro[41]=0,io[129]=io[41]=1,oo[129]=oo[41]=0,c[129]=c[41]=-1,p[129]=p[41]=0,f[129]=f[41]=0,qi[129]=qi[41]=0,Bi[129]=Bi[41]=-1,zi[129]=zi[41]=0,Ki[66]=Ki[104]=0,Qi[66]=Qi[104]=1,$i[66]=$i[104]=0,Wi[66]=Wi[104]=-1,Ji[66]=Ji[104]=0,Zi[66]=Zi[104]=1,to[66]=to[104]=0,eo[66]=eo[104]=-1,no[66]=no[104]=0,c[66]=c[104]=0,p[66]=p[104]=-1,f[66]=f[104]=1,ji[144]=ji[26]=-1,Ui[144]=Ui[26]=0,Vi[144]=Vi[26]=0,ro[144]=ro[26]=1,io[144]=io[26]=0,oo[144]=oo[26]=1,to[144]=to[26]=0,eo[144]=eo[26]=1,no[144]=no[26]=1,qi[144]=qi[26]=-1,Bi[144]=Bi[26]=0,zi[144]=zi[26]=1,Xi[36]=Xi[134]=0,Yi[36]=Yi[134]=1,Hi[36]=Hi[134]=1,Ki[36]=Ki[134]=0,Qi[36]=Qi[134]=1,$i[36]=$i[134]=0,c[36]=c[134]=0,p[36]=p[134]=-1,f[36]=f[134]=1,qi[36]=qi[134]=1,Bi[36]=Bi[134]=0,zi[36]=zi[134]=0,ji[9]=ji[161]=-1,Ui[9]=Ui[161]=0,Vi[9]=Vi[161]=0,Xi[9]=Xi[161]=0,Yi[9]=Yi[161]=-1,Hi[9]=Hi[161]=0,Wi[9]=Wi[161]=1,Ji[9]=Ji[161]=0,Zi[9]=Zi[161]=0,ro[9]=ro[161]=1,io[9]=io[161]=0,oo[9]=oo[161]=1,ji[136]=0,Ui[136]=1,Vi[136]=1,Xi[136]=0,Yi[136]=1,Hi[136]=0,Ki[136]=-1,Qi[136]=0,$i[136]=1,Wi[136]=-1,Ji[136]=0,Zi[136]=0,ro[136]=0,io[136]=-1,oo[136]=0,to[136]=0,eo[136]=-1,no[136]=1,c[136]=1,p[136]=0,f[136]=0,qi[136]=1,Bi[136]=0,zi[136]=1,ji[34]=0,Ui[34]=-1,Vi[34]=0,Xi[34]=0,Yi[34]=-1,Hi[34]=1,Ki[34]=1,Qi[34]=0,$i[34]=0,Wi[34]=1,Ji[34]=0,Zi[34]=1,ro[34]=0,io[34]=1,oo[34]=1,to[34]=0,eo[34]=1,no[34]=0,c[34]=-1,p[34]=0,f[34]=1,qi[34]=-1,Bi[34]=0,zi[34]=0,ji[35]=0,Ui[35]=1,Vi[35]=1,Xi[35]=0,Yi[35]=-1,Hi[35]=1,Ki[35]=1,Qi[35]=0,$i[35]=0,Wi[35]=-1,Ji[35]=0,Zi[35]=0,ro[35]=0,io[35]=-1,oo[35]=0,to[35]=0,eo[35]=1,no[35]=0,c[35]=-1,p[35]=0,f[35]=1,qi[35]=1,Bi[35]=0,zi[35]=1,ji[153]=0,Ui[153]=1,Vi[153]=1,Wi[153]=-1,Ji[153]=0,Zi[153]=0,ro[153]=0,io[153]=-1,oo[153]=0,qi[153]=1,Bi[153]=0,zi[153]=1,Xi[102]=0,Yi[102]=-1,Hi[102]=1,Ki[102]=1,Qi[102]=0,$i[102]=0,to[102]=0,eo[102]=1,no[102]=0,c[102]=-1,p[102]=0,f[102]=1,ji[155]=0,Ui[155]=-1,Vi[155]=0,Wi[155]=1,Ji[155]=0,Zi[155]=1,ro[155]=0,io[155]=1,oo[155]=1,qi[155]=-1,Bi[155]=0,zi[155]=0,Xi[103]=0,Yi[103]=1,Hi[103]=0,Ki[103]=-1,Qi[103]=0,$i[103]=1,to[103]=0,eo[103]=-1,no[103]=1,c[103]=1,p[103]=0,f[103]=0,ji[152]=0,Ui[152]=1,Vi[152]=1,Ki[152]=-1,Qi[152]=0,$i[152]=1,Wi[152]=-1,Ji[152]=0,Zi[152]=0,ro[152]=0,io[152]=-1,oo[152]=0,to[152]=0,eo[152]=-1,no[152]=1,qi[152]=1,Bi[152]=0,zi[152]=1,ji[156]=0,Ui[156]=-1,Vi[156]=1,Ki[156]=1,Qi[156]=0,$i[156]=1,Wi[156]=-1,Ji[156]=0,Zi[156]=0,ro[156]=0,io[156]=-1,oo[156]=0,to[156]=0,eo[156]=1,no[156]=1,qi[156]=-1,Bi[156]=0,zi[156]=1,ji[137]=0,Ui[137]=1,Vi[137]=1,Xi[137]=0,Yi[137]=1,Hi[137]=0,Wi[137]=-1,Ji[137]=0,Zi[137]=0,ro[137]=0,io[137]=-1,oo[137]=0,c[137]=1,p[137]=0,f[137]=0,qi[137]=1,Bi[137]=0,zi[137]=1,ji[139]=0,Ui[139]=1,Vi[139]=1,Xi[139]=0,Yi[139]=-1,Hi[139]=0,Wi[139]=1,Ji[139]=0,Zi[139]=0,ro[139]=0,io[139]=1,oo[139]=0,c[139]=-1,p[139]=0,f[139]=0,qi[139]=1,Bi[139]=0,zi[139]=1,ji[98]=0,Ui[98]=-1,Vi[98]=0,Xi[98]=0,Yi[98]=-1,Hi[98]=1,Ki[98]=1,Qi[98]=0,$i[98]=0,Wi[98]=1,Ji[98]=0,Zi[98]=1,to[98]=0,eo[98]=1,no[98]=0,c[98]=-1,p[98]=0,f[98]=1,ji[99]=0,Ui[99]=1,Vi[99]=0,Xi[99]=0,Yi[99]=-1,Hi[99]=1,Ki[99]=1,Qi[99]=0,$i[99]=0,Wi[99]=-1,Ji[99]=0,Zi[99]=1,to[99]=0,eo[99]=-1,no[99]=0,c[99]=1,p[99]=0,f[99]=1,Xi[38]=0,Yi[38]=-1,Hi[38]=1,Ki[38]=1,Qi[38]=0,$i[38]=0,ro[38]=0,io[38]=1,oo[38]=1,to[38]=0,eo[38]=1,no[38]=0,c[38]=-1,p[38]=0,f[38]=1,qi[38]=-1,Bi[38]=0,zi[38]=0,Xi[39]=0,Yi[39]=1,Hi[39]=1,Ki[39]=-1,Qi[39]=0,$i[39]=0,ro[39]=0,io[39]=-1,oo[39]=1,to[39]=0,eo[39]=1,no[39]=0,c[39]=-1,p[39]=0,f[39]=1,qi[39]=1,Bi[39]=0,zi[39]=0,[]),S=[],C=[],P=[],M=[],L=[],so=[],ao=[],l=(P[1]=M[1]=18,P[169]=M[169]=18,C[4]=S[4]=12,C[166]=S[166]=12,N[16]=ao[16]=4,N[154]=ao[154]=4,L[64]=so[64]=22,L[106]=so[106]=22,C[2]=L[2]=17,P[2]=M[2]=18,C[168]=L[168]=17,P[168]=M[168]=18,N[8]=P[8]=9,S[8]=C[8]=12,N[162]=P[162]=9,S[162]=C[162]=12,N[32]=ao[32]=4,S[32]=so[32]=1,N[138]=ao[138]=4,S[138]=so[138]=1,M[128]=ao[128]=21,L[128]=so[128]=22,M[42]=ao[42]=21,L[42]=so[42]=22,S[5]=M[5]=14,S[165]=M[165]=14,C[20]=ao[20]=6,C[150]=ao[150]=6,N[80]=L[80]=11,N[90]=L[90]=11,P[65]=so[65]=3,P[105]=so[105]=3,N[160]=L[160]=11,S[160]=M[160]=14,N[10]=L[10]=11,S[10]=M[10]=14,C[130]=ao[130]=6,P[130]=so[130]=3,C[40]=ao[40]=6,P[40]=so[40]=3,S[101]=so[101]=1,S[69]=so[69]=1,M[149]=ao[149]=21,M[21]=ao[21]=21,C[86]=L[86]=17,C[84]=L[84]=17,N[89]=P[89]=9,N[81]=P[81]=9,N[96]=so[96]=0,S[96]=L[96]=15,N[74]=so[74]=0,S[74]=L[74]=15,N[24]=C[24]=8,P[24]=ao[24]=7,N[146]=C[146]=8,P[146]=ao[146]=7,S[6]=L[6]=15,C[6]=M[6]=16,S[164]=L[164]=15,C[164]=M[164]=16,P[129]=ao[129]=7,M[129]=so[129]=20,P[41]=ao[41]=7,M[41]=so[41]=20,C[66]=so[66]=2,P[66]=L[66]=19,C[104]=so[104]=2,P[104]=L[104]=19,N[144]=M[144]=10,L[144]=ao[144]=23,N[26]=M[26]=10,L[26]=ao[26]=23,S[36]=ao[36]=5,C[36]=so[36]=2,S[134]=ao[134]=5,C[134]=so[134]=2,N[9]=M[9]=10,S[9]=P[9]=13,N[161]=M[161]=10,S[161]=P[161]=13,S[37]=ao[37]=5,M[37]=so[37]=20,S[133]=ao[133]=5,M[133]=so[133]=20,C[148]=M[148]=16,L[148]=ao[148]=23,C[22]=M[22]=16,L[22]=ao[22]=23,N[82]=C[82]=8,P[82]=L[82]=19,N[88]=C[88]=8,P[88]=L[88]=19,N[73]=so[73]=0,S[73]=P[73]=13,N[97]=so[97]=0,S[97]=P[97]=13,N[145]=P[145]=9,M[145]=ao[145]=21,N[25]=P[25]=9,M[25]=ao[25]=21,S[70]=so[70]=1,C[70]=L[70]=17,S[100]=so[100]=1,C[100]=L[100]=17,N[34]=P[34]=9,S[34]=C[34]=12,M[34]=ao[34]=21,L[34]=so[34]=22,N[136]=ao[136]=4,S[136]=so[136]=1,C[136]=L[136]=17,P[136]=M[136]=18,N[35]=ao[35]=4,S[35]=C[35]=12,P[35]=M[35]=18,L[35]=so[35]=22,N[153]=ao[153]=4,P[153]=M[153]=18,S[102]=C[102]=12,L[102]=so[102]=22,N[155]=P[155]=9,M[155]=ao[155]=23,S[103]=so[103]=1,C[103]=L[103]=17,N[152]=ao[152]=4,C[152]=L[152]=17,P[152]=M[152]=18,N[156]=C[156]=8,P[156]=M[156]=18,L[156]=ao[156]=23,N[137]=ao[137]=4,S[137]=so[137]=1,P[137]=M[137]=18,N[139]=ao[139]=4,S[139]=P[139]=13,M[139]=so[139]=20,N[98]=P[98]=9,S[98]=C[98]=12,L[98]=so[98]=22,N[99]=so[99]=0,S[99]=C[99]=12,P[99]=L[99]=19,S[38]=C[38]=12,M[38]=ao[38]=21,L[38]=so[38]=22,S[39]=ao[39]=5,C[39]=M[39]=16,L[39]=so[39]=22,[]);function O(t,e,n){return(t-e)/(n-e)}function uo(t){return-1<t.constructor.toString().indexOf("Array")}function lo(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;return 1}(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=k([e[r].lrCoordinates]),s=r+1;s<e.length;s++)!e[s].grouped&&function(t,e){for(var n=On(t),r=0;r<n.features.length;r++)if(!De(n.features[r],e))return;return 1}(k([e[s].lrCoordinates]),o)&&(i.push(e[s].lrCoordinates),e[s].grouped=!0);n.push(i)}return n}function ho(t,r,e){if(!st(e=e||{}))throw new Error("options is invalid");var i=e.pivot,e=e.mutate;if(!t)throw new Error("geojson is required");if(null==r||isNaN(r))throw new Error("angle is required");return 0!==r&&(i=i||Ln(t),ht(t=!1!==e&&void 0!==e?t:je(t),function(t){var e=_i(i,t)+r,n=yr(i,t),n=_(vi(i,n,e));t[0]=n[0],t[1]=n[1]})),t}function co(n,r,t){if(!st(t=t||{}))throw new Error("options is invalid");var i=t.origin,t=t.mutate;if(!n)throw new Error("geojson required");if("number"!=typeof r||0===r)throw new Error("invalid factor");var e=Array.isArray(i)||"object"==typeof i;return"FeatureCollection"!==(n=!0!==t?je(n):n).type||e?po(n,r,i):(gt(n,function(t,e){n.features[e]=po(t,r,i)}),n)}function po(t,r,i){var e="Point"===Dt(t);return i=function(t,e){if(null==e&&(e="centroid"),Array.isArray(e)||"object"==typeof e)return Mt(e);var n=t.bbox||Pt(t),r=n[0],i=n[1],o=n[2],s=n[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return R([r,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return R([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return R([r,s]);case"ne":case"northeast":case"eastnorth":case"topright":return R([o,s]);case"center":return Mn(t);case void 0:case null:case"centroid":return Ln(t);default:throw new Error("invalid origin")}}(t,i),1===r||e||ht(t,function(t){var e=yr(i,t),n=_i(i,t),e=_(vi(i,e*r,n));t[0]=e[0],t[1]=e[1],3===t.length&&(t[2]*=r)}),t}function fo(t){var e=t[0],t=t[1];return[t[0]-e[0],t[1]-e[1]]}function go(t,e){return t[0]*e[1]-e[0]*t[1]}function yo(t,e,n){var u=[],l=$(e,n),h=_(t),c=[];return h.forEach(function(t,e){var n,r,i,o,s,a;e!==h.length-1&&(t=t,r=h[e+1],i=l,o=Math.sqrt((t[0]-r[0])*(t[0]-r[0])+(t[1]-r[1])*(t[1]-r[1])),s=t[0]+i*(r[1]-t[1])/o,a=r[0]+i*(r[1]-t[1])/o,s=[[s,t[1]+i*(t[0]-r[0])/o],[a,r[1]+i*(t[0]-r[0])/o]],u.push(s),0<e&&(i=a=u[e-1],!1!==(n=!(0===go(fo(t=s),fo(i)))&&(r=t[0],t=fo(t),o=i[0],i=fo(i),n=go(t,i),o=go([o[0]-r[0],o[1]-r[1]],i)/n,i=[o*t[0],o*t[1]],[r[0]+i[0],r[1]+i[1]]))&&(a[1]=n,s[0]=n),c.push(a[0]),e===h.length-2)&&(c.push(s[0]),c.push(s[1])),2===h.length)&&(c.push(s[0]),c.push(s[1]))}),V(c,t.properties)}function _o(t,e,n){var r=e[0]-t[0],t=e[1]-t[1],i=n[0]-e[0];return(0<(r=r*(n[1]-e[1])-i*t))-(r<0)||r}function mo(e,t){return t.geometry.coordinates[0].every(function(t){return De(R(t),e)})}l[1]=l[169]=Mi,l[4]=l[166]=Li,l[16]=l[154]=Oi,l[64]=l[106]=Ri,l[168]=l[2]=Ti,l[162]=l[8]=Ai,l[138]=l[32]=Di,l[42]=l[128]=Fi,l[5]=l[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},l[20]=l[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},l[80]=l[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},l[65]=l[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},l[160]=l[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},l[130]=l[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},l[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},l[101]=l[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},l[149]=l[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},l[86]=l[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},l[89]=l[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},l[96]=l[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},l[24]=l[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},l[6]=l[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},l[129]=l[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},l[66]=l[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[144]=l[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},l[36]=l[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},l[9]=l[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},l[37]=l[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},l[148]=l[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},l[82]=l[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},l[73]=l[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},l[145]=l[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},l[70]=l[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[34]=function(t){return[Fi(t),Ai(t)]},l[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]]},l[136]=function(t){return[Di(t),Ti(t)]},l[153]=function(t){return[Oi(t),Mi(t)]},l[102]=function(t){return[Li(t),Ri(t)]},l[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},l[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[152]=function(t){return[Oi(t),Ti(t)]},l[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},l[137]=function(t){return[Di(t),Mi(t)]},l[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},l[98]=function(t){return[Ai(t),Ri(t)]},l[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},l[38]=function(t){return[Li(t),Fi(t)]},l[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};Io.buildId=function(t){return t.join(",")},Io.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(t){return t.from.id!==e.from.id})},Io.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(t){return t.to.id!==e.to.id})},Io.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},Io.prototype.sortOuterEdges=function(){var r=this;this.outerEdgesSorted||(this.outerEdges.sort(function(t,e){var n,t=t.to,e=e.to;return 0<=t.coordinates[0]-r.coordinates[0]&&e.coordinates[0]-r.coordinates[0]<0?1:t.coordinates[0]-r.coordinates[0]<0&&0<=e.coordinates[0]-r.coordinates[0]?-1:t.coordinates[0]-r.coordinates[0]==0&&e.coordinates[0]-r.coordinates[0]==0?0<=t.coordinates[1]-r.coordinates[1]||0<=e.coordinates[1]-r.coordinates[1]?t.coordinates[1]-e.coordinates[1]:e.coordinates[1]-t.coordinates[1]:(n=_o(r.coordinates,t.coordinates,e.coordinates))<0?1:0<n?-1:Math.pow(t.coordinates[0]-r.coordinates[0],2)+Math.pow(t.coordinates[1]-r.coordinates[1],2)-(Math.pow(e.coordinates[0]-r.coordinates[0],2)+Math.pow(e.coordinates[1]-r.coordinates[1],2))}),this.outerEdgesSorted=!0)},Io.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},Io.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},Io.prototype.addInnerEdge=function(t){this.innerEdges.push(t)};var vo=Io,xo=(wo.prototype.getSymetric=function(){return this.symetric||(this.symetric=new wo(this.to,this.from),this.symetric.symetric=this),this.symetric},wo.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},wo.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},wo.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},wo.prototype.toLineString=function(){return V([this.from.coordinates,this.to.coordinates])},wo.prototype.compareTo=function(t){return _o(t.from.coordinates,t.to.coordinates,this.to.coordinates)},wo),Eo=(bo.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},bo.prototype.get=function(t){return this.edges[t]},Object.defineProperty(bo.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),bo.prototype.forEach=function(t){this.edges.forEach(t)},bo.prototype.map=function(t){return this.edges.map(t)},bo.prototype.some=function(t){return this.edges.some(t)},bo.prototype.isValid=function(){return!0},bo.prototype.isHole=function(){var r=this,t=this.edges.reduce(function(t,e,n){return t=e.from.coordinates[1]>r.edges[t].from.coordinates[1]?n:t},0),e=(0===t?this.length:t)-1,n=(t+1)%this.length,t=_o(this.edges[e].from.coordinates,this.edges[t].from.coordinates,this.edges[n].from.coordinates);return 0===t?this.edges[e].from.coordinates[0]>this.edges[n].from.coordinates[0]:0<t},bo.prototype.toMultiPoint=function(){return H(this.edges.map(function(t){return t.from.coordinates}))},bo.prototype.toPolygon=function(){var t;return this.polygon||((t=this.edges.map(function(t){return t.from.coordinates})).push(this.edges[0].from.coordinates),this.polygon=k([t]))},bo.prototype.getEnvelope=function(){return this.envelope||(this.envelope=In(this.toPolygon()))},bo.findEdgeRingContaining=function(l,t){var h,c,p=l.getEnvelope();return t.forEach(function(t){var e,n,r,i=t.getEnvelope();if(c&&(h=c.getEnvelope()),r=p,o=(e=i).geometry.coordinates[0].map(function(t){return t[0]}),e=e.geometry.coordinates[0].map(function(t){return t[1]}),n=r.geometry.coordinates[0].map(function(t){return t[0]}),r=r.geometry.coordinates[0].map(function(t){return t[1]}),(Math.max.apply(null,o)!==Math.max.apply(null,n)||Math.max.apply(null,e)!==Math.max.apply(null,r)||Math.min.apply(null,o)!==Math.min.apply(null,n)||Math.min.apply(null,e)!==Math.min.apply(null,r))&&mo(i,p)){for(var o=l.map(function(t){return t.from.coordinates}),s=void 0,a=0,u=o;a<u.length;a++)!function(e){t.some(function(t){return t=t.from.coordinates,e[0]===t[0]&&e[1]===t[1]})||(s=e)}(u[a]);s&&t.inside(R(s))&&(c&&!mo(h,i)||(c=t))}}),c},bo.prototype.inside=function(t){return De(t,this.toPolygon())},bo);function bo(){this.edges=[],this.polygon=void 0,this.envelope=void 0}function wo(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)}function Io(t){this.id=Io.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}So.fromGeoJson=function(t){var e=t;if(!e)throw new Error("No geojson passed");if("FeatureCollection"!==e.type&&"GeometryCollection"!==e.type&&"MultiLineString"!==e.type&&"LineString"!==e.type&&"Feature"!==e.type)throw new Error("Invalid input type '"+e.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature");var r=new So;return vt(t,function(t){Rt(t,"LineString","Graph::fromGeoJson"),ct(t,function(t,e){var n;return t&&(t=r.getNode(t),n=r.getNode(e),r.addEdge(t,n)),e})}),r},So.prototype.getNode=function(t){var e=vo.buildId(t);return this.nodes[e]||(this.nodes[e]=new vo(t))},So.prototype.addEdge=function(t,e){t=new xo(t,e),e=t.getSymetric();this.edges.push(t),this.edges.push(e)},So.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(t){return e.nodes[t]}).forEach(function(t){return e._removeIfDangle(t)})},So.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)}))},So.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))})},So.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})},So.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,l=void 0;s.label===e&&(u=s),a.label===e&&(l=a),u&&l&&(l&&(r=l),u)&&(r&&(r.next=u,r=void 0),n=n||u)}r&&(r.next=n)},So.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},So.prototype.getEdgeRings=function(){var n=this,e=(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)})}),[]);return this.edges.forEach(function(t){t.ring||e.push(n._findEdgeRing(t))}),e},So.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},So.prototype._findEdgeRing=function(t){for(var e=t,n=new Eo;n.push(e),e.ring=n,e=e.next,!t.isEqual(e););return n},So.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]},So.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(t){return!t.isEqual(e)}),e.deleteEdge()};var No=So;function So(){this.edges=[],this.nodes={}}function Co(t,n){var r=!0;return vt(t,function(e){vt(n,function(t){if(!1===r)return!1;r=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return u=t.coordinates,l=e.coordinates,!(u[0]===l[0]&&u[1]===l[1]);case"LineString":return!Po(e,t);case"Polygon":return!De(t,e)}break;case"LineString":switch(e.type){case"Point":return!Po(t,e);case"LineString":return!(0<fr(t,e).features.length);case"Polygon":return!Mo(e,t)}break;case"Polygon":switch(e.type){case"Point":return!De(e,t);case"LineString":return!Mo(t,e);case"Polygon":for(var n=e,r=t,i=0,o=n.coordinates[0];i<o.length;i++)if(De(o[i],r))return!1;for(var s=0,a=r.coordinates[0];s<a.length;s++)if(De(a[s],n))return!1;return!(0<fr(ni(n),ni(r)).features.length)}}var u,l;return!1}(e.geometry,t.geometry)})}),r}function Po(t,e){for(var n,r,i,o,s,a,u,l=0;l<t.coordinates.length-1;l++)if(n=t.coordinates[l],r=t.coordinates[l+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 Mo(t,e){for(var n=0,r=e.coordinates;n<r.length;n++)if(De(r[n],t))return 1;return 0<fr(e,ni(t)).features.length}function Lo(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Oo(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ro(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),Do(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function To(t,e){return 0<fr(t,ri(e)).features.length}function Ao(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&(!n||!r);o++)De(R(t.coordinates[o]),e)?n=!0:r=!0;return r&&n}function Do(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])}function Fo(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:qo}function ko(e){return e.coordinates.map(function(t){return{type:e.type.replace("Multi",""),coordinates:t}})}function Go(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function qo(t,e){return fi(t,e,{strict:!0})}Fo.prototype.compare=function(t,e){if(t.type===e.type&&Go(t,e))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:var n,r,i;if(0===t.type.indexOf("Multi"))return n=this,r=ko(t),i=ko(e),r.every(function(e){return this.some(function(t){return n.compare(e,t)})},i)}return!1},Fo.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},Fo.prototype.compareLine=function(t,e,n,r){return!!Go(t,e)&&(t=this.pseudoNode?t:this.removePseudo(t),e=this.pseudoNode?e:this.removePseudo(e),!r||this.compareCoord(t[0],e[0])||(e=this.fixStartIndex(e,t))?(r=this.compareCoord(t[n],e[n]),this.direction||r?this.comparePath(t,e):!!this.compareCoord(t[n],e[e.length-(1+n)])&&this.comparePath(t.slice().reverse(),e)):void 0)},Fo.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 n=0<=r?[].concat(t.slice(r,t.length),t.slice(1,r+1)):n},Fo.prototype.comparePath=function(t,e){var n=this;return t.every(function(t,e){return n.compareCoord(t,this[e])},e)},Fo.prototype.comparePolygon=function(t,e){var n;return!!this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)&&(t=t.coordinates.slice(1,t.coordinates.length),e=e.coordinates.slice(1,e.coordinates.length),n=this,t.every(function(e){return this.some(function(t){return n.compareLine(e,t,1,!0)})},e))},Fo.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)},Fo.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Fo.prototype.removePseudo=function(t){return t};var Bo=Fo;function zo(t,n){var r=!1;return vt(t,function(e){vt(n,function(t){if(!0===r)return!0;r=!Co(e.geometry,t.geometry)})}),r}function jo(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}var Uo=ce(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=ce(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;)for(var i=this.assign(),o=0;o<this.k;o++){for(var s=new Array(h),a=0,u=0;u<h;u++)s[u]=0;for(var l=0;l<n;l++){var h=this.dataset[l].length;if(o===this.assignments[l]){for(u=0;u<h;u++)s[u]+=this.dataset[l][u];a++}}if(0<a){for(u=0;u<h;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=ce(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)}),Yo=ce(function(t){var l;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&&(l=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 l(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(n,t,r){var i=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(t){var e;void 0===i._processed[t]&&(e=i.distance(i.dataset[n],i.dataset[t]),e=Math.max(i._coreDistance,e),void 0===i._reachability[t]?(i._reachability[t]=e,r.insert(t,e)):e<i._reachability[t]&&(i._reachability[t]=e,r.remove(t),r.insert(t,e)))})},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)}),Ho=ce(function(t){t.exports&&(t.exports={DBSCAN:Uo,KMEANS:Vo,OPTICS:Yo,PriorityQueue:Xo})}),Wo=jo,Jo=function(t,e,n){t=Math.abs(t-e);return n?t:t*t},Zo=jo;function Ko(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}function Qo(t,e,n,r){var i,o=[],s=[],a=[],u=!1,l=r||1e4,h=t.length,c=t[0].length,p=0<c,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?Wo:Jo,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,l=0,h=[],c=0;c<i;c++){for(var p=1/0,f=0;f<u;f++){var g=n(t[c],r[f]);g<=p&&(p=g)}a[c]=p}for(var d=0;d<i;d++)l+=a[d];for(var y=0;y<i;y++)h[y]={i:y,v:t[y],pr:a[y]/l,cs:0};h.sort(function(t,e){return t.pr-e.pr}),h[0].cs=h[0].pr;for(var _=1;_<i;_++)h[_].cs=h[_-1].cs+h[_].pr;for(var m=Math.random(),v=0;v<i-1&&h[v++].cs<m;);r.push(h[v-1].v)}return r}(t,e):n;else for(var g={};o.length<e;){var d=Math.floor(Math.random()*h);g[d]||(g[d]=!0,o.push(t[d]))}do{Ko(e,0,f);for(var y=0;y<h;y++){for(var _=1/0,m=0,v=0;v<e;v++)(i=p?Zo(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?Ko(c,0,x[E]):0,s[E]=o[E];if(p){for(var b=0;b<e;b++)o[b]=[];for(var w=0;w<h;w++)for(var I=x[a[w]],N=t[w],S=0;S<c;S++)I[S]+=N[S];for(var u=!0,C=0;C<e;C++){for(var P=o[C],M=x[C],L=s[C],F=f[C],O=0;O<c;O++)P[O]=M[O]/F||0;if(u)for(var R=0;R<c;R++)if(L[R]!=P[R]){u=!1;break}}}else{for(var T=0;T<h;T++)x[a[T]]+=t[T];for(var A=0;A<e;A++)o[A]=x[A]/f[A]||0;u=!0;for(var D=0;D<e;D++)if(s[D]!=o[D]){u=!1;break}}}while(!(u=u||--l<=0));return{it:1e4-l,k:e,idxs:a,centroids:o}}function $o(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 ts(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}var es={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||es.heuristics.manhattan,o=r.closest||!1,s=new is(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 ts(u);u.closed=!0;for(var l=t.neighbors(u),h=0,c=l.length;h<c;++h){var p,f,g=l[h];!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?ts(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),e=Math.abs(e.y-t.y);return+(r+e)+(n-2)*Math.min(r,e)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function ns(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 rs(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function rs(t,e,n){this.x=t,this.y=e,this.weight=n}function is(t){this.content=[],this.scoreFunction=t}function os(t){return function(){return t}}function ss(t){return t[0]}function as(t){return t[1]}function us(){this._=null}function ls(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function hs(t,e){var n=e,e=e.R,r=n.U;r?r.L===n?r.L=e:r.R=e:t._=e,e.U=r,n.U=e,n.R=e.L,n.R&&(n.R.U=n),e.L=n}function cs(t,e){var n=e,e=e.L,r=n.U;r?r.L===n?r.L=e:r.R=e:t._=e,e.U=r,n.U=e,n.L=e.R,n.L&&(n.L.U=n),e.R=n}function ps(t){for(;t.L;)t=t.L;return t}function fs(t,e,n,r){var i=[null,null],o=Os.push(i)-1;return i.left=t,i.right=e,n&&ds(i,t,e,n),r&&ds(i,e,t,r),Ms[t.index].halfedges.push(o),Ms[e.index].halfedges.push(o),i}function gs(t,e,n){e=[e,n];return e.left=t,e}function ds(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 ys(t,e){return e[+(e.left!==t.site)]}ns.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)es.cleanNode(this.nodes[t])},ns.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)es.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},ns.prototype.markDirty=function(t){this.dirtyNodes.push(t)},ns.prototype.neighbors=function(t){var e=[],n=t.x,t=t.y,r=this.grid;return r[n-1]&&r[n-1][t]&&e.push(r[n-1][t]),r[n+1]&&r[n+1][t]&&e.push(r[n+1][t]),r[n]&&r[n][t-1]&&e.push(r[n][t-1]),r[n]&&r[n][t+1]&&e.push(r[n][t+1]),this.diagonal&&(r[n-1]&&r[n-1][t-1]&&e.push(r[n-1][t-1]),r[n+1]&&r[n+1][t-1]&&e.push(r[n+1][t-1]),r[n-1]&&r[n-1][t+1]&&e.push(r[n-1][t+1]),r[n+1])&&r[n+1][t+1]&&e.push(r[n+1][t+1]),e},ns.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")},rs.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},rs.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},rs.prototype.isWall=function(){return 0===this.weight},is.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=t+1<<1,s=o-1,a=null;if(s<e&&(i=this.content[s],(i=this.scoreFunction(i))<r)&&(a=s),null===(a=o<e&&(s=this.content[o],this.scoreFunction(s)<(null===a?r:i))?o:a))break;this.content[t]=this.content[a],this.content[a]=n,t=a}}},us.prototype={constructor:us,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=ps(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&&(hs(this,n),n=(t=n).U),n.C=!1,r.C=!0,cs(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(cs(this,n),n=(t=n).U),n.C=!1,r.C=!0,hs(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?ps(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,hs(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,cs(this,e),e=r.R),e.C=r.C,r.C=e.R.C=!1,hs(this,r),t=this._;break}}else if((e=r.L).C&&(e.C=!1,r.C=!0,cs(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,hs(this,e),e=r.L),e.C=r.C,r.C=e.L.C=!1,cs(this,r),t=this._;break}}while(e.C=!0,r=(t=r).U,!t.C);t&&(t.C=!1)}}};var _s,ms=[];function vs(){ls(this),this.x=this.y=this.arc=this.site=this.cy=null}function xs(t){var e=t.P,n=t.N;if(e&&n){var e=e.site,r=t.site,n=n.site;if(e!==n){var i=r[0],o=r[1],s=e[0]-i,e=e[1]-o,a=n[0]-i,n=n[1]-o,u=2*(s*n-e*a);if(!(-Ts<=u)){var l=s*s+e*e,h=a*a+n*n,n=(n*l-e*h)/u,e=(s*h-a*l)/u,c=ms.pop()||new vs;c.arc=t,c.site=r,c.x=n+i,c.y=(c.cy=e+o)+Math.sqrt(n*n+e*e),t.circle=c;for(var p=null,f=Ls._;f;)if(c.y<f.y||c.y===f.y&&c.x<=f.x){if(!f.L){p=f.P;break}f=f.L}else{if(!f.R){p=f;break}f=f.R}Ls.insert(p,c),p||(_s=c)}}}}function Es(t){var e=t.circle;e&&(e.P||(_s=e.N),Ls.remove(e),ms.push(e),ls(e),t.circle=null)}var bs=[];function ws(){ls(this),this.edge=this.site=this.circle=null}function Is(t){var e=bs.pop()||new ws;return e.site=t,e}function Ns(t){Es(t),Ps.remove(t),bs.push(t),ls(t)}function Ss(t){for(var e,n,r,i,o,s,a=t[0],u=t[1],l=Ps._;l;)if((r=Cs(l,u)-a)>Rs)l=l.L;else{if(!((i=a-(o=u,s=void 0,(s=(i=l).N)?Cs(s,o):(s=i.site)[1]===o?s[0]:1/0))>Rs)){-Rs<r?(e=l.P,n=l):-Rs<i?n=(e=l).N:e=n=l;break}if(!l.R){e=l;break}l=l.R}Ms[t.index]={site:t,halfedges:[]};var h,c,p,f,g,d,y,_,m,v,x=Is(t);if(Ps.insert(e,x),e||n){if(e===n)return Es(e),n=Is(e.site),Ps.insert(x,n),x.edge=n.edge=fs(e.site,x.site),xs(e),xs(n);n?(Es(e),Es(n),c=(h=e.site)[0],p=h[1],f=t[0]-c,v=t[1]-p,d=(g=n.site)[0]-c,y=g[1]-p,ds(n.edge,h,g,v=[(y*(_=f*f+v*v)-v*(m=d*d+y*y))/(y=2*(f*y-v*d))+c,(f*m-d*_)/y+p]),x.edge=fs(h,t,null,v),n.edge=fs(t,g,null,v),xs(e),xs(n)):x.edge=fs(e.site,x.site)}}function Cs(t,e){var n,r,i,o=t.site,s=o[0],a=o[1],u=a-e;return u?(t=t.P)?(t=(o=t.site)[0],(e=(o=o[1])-e)?(i=(n=t-s)/e,(r=1/u-1/e)?(-i+Math.sqrt(i*i-2*r*(n*n/(-2*e)-o+e/2+a-u/2)))/r+s:(s+t)/2):t):-1/0:s}var Ps,Ms,Ls,Os,Rs=1e-6,Ts=1e-12;function As(t,e){return e[1]-t[1]||e[0]-t[0]}function Ds(F,t){var k,G,e,n=F.sort(As).pop();for(Os=[],Ms=new Array(F.length),Ps=new us,Ls=new us;;)if(e=_s,n&&(!e||n[1]<e.y||n[1]===e.y&&n[0]<e.x))n[0]===k&&n[1]===G||(Ss(n),k=n[0],G=n[1]),n=F.pop();else{if(!e)break;V=u=a=s=o=U=j=z=B=i=q=r=void 0;var r=e.arc,q=r.circle,i=q.x,B=q.cy,z=[i,B],j=r.P,U=r.N,o=[r];Ns(r);for(var s=j;s.circle&&Math.abs(i-s.circle.x)<Rs&&Math.abs(B-s.circle.cy)<Rs;)j=s.P,o.unshift(s),Ns(s),s=j;o.unshift(s),Es(s);for(var a=U;a.circle&&Math.abs(i-a.circle.x)<Rs&&Math.abs(B-a.circle.cy)<Rs;)U=a.N,o.push(a),Ns(a),a=U;o.push(a),Es(a);for(var V=o.length,u=1;u<V;++u)ds((a=o[u]).edge,(s=o[u-1]).site,a.site,z);(a=o[V-1]).edge=fs((s=o[0]).site,a.site,null,z),xs(s),xs(a)}for(var X,Y,l,h,c,p,f,H=0,W=Ms.length;H<W;++H)if((X=Ms[H])&&(l=(Y=X.halfedges).length)){for(var J=new Array(l),g=new Array(l),d=0;d<l;++d)J[d]=d,g[d]=(h=X,c=Os[Y[d]],f=p=void 0,h=h.site,p=c.left,f=c.right,h===f&&(f=p,p=h),f?Math.atan2(f[1]-p[1],f[0]-p[0]):(f=h===p?(p=c[1],c[0]):(p=c[0],c[1]),Math.atan2(p[0]-f[0],f[1]-p[1])));for(J.sort(function(t,e){return g[e]-g[t]}),d=0;d<l;++d)g[d]=Y[J[d]];for(d=0;d<l;++d)Y[d]=g[d]}if(t){for(var y,_=+t[0][0],m=+t[0][1],Z=+t[1][0],t=+t[1][1],K=_,Q=m,$=Z,tt=t,et=Os.length;et--;)(function(t,e,n,r,i){var o=t[1];if(!o){var s,a=t[0],u=t.left,l=t.right,h=u[0],u=u[1],c=l[0],l=l[1],p=(h+c)/2;if(l===u){if(p<e||r<=p)return;if(c<h){if(a){if(a[1]>=i)return}else a=[p,n];o=[p,i]}else{if(a){if(a[1]<n)return}else a=[p,i];o=[p,n]}}else if(p=(u+l)/2-(s=(h-c)/(l-u))*p,s<-1||1<s)if(c<h){if(a){if(a[1]>=i)return}else a=[(n-p)/s,n];o=[(i-p)/s,i]}else{if(a){if(a[1]<n)return}else a=[(i-p)/s,i];o=[(n-p)/s,n]}else if(u<l){if(a){if(a[0]>=r)return}else a=[e,s*e+p];o=[r,s*r+p]}else{if(a){if(a[0]<e)return}else a=[r,s*r+p];o=[e,s*e+p]}t[0]=a,t[1]=o}return 1})(y=Os[et],K,Q,$,tt)&&function(t,e,n,r,i){var o=t[0],s=t[1],a=o[0],o=o[1],u=0,l=1,h=s[0]-a,s=s[1]-o,e=e-a;if(h||!(0<e)){if(e/=h,h<0){if(e<u)return;e<l&&(l=e)}else if(0<h){if(l<e)return;u<e&&(u=e)}if(e=r-a,h||!(e<0)){if(e/=h,h<0){if(l<e)return;u<e&&(u=e)}else if(0<h){if(e<u)return;e<l&&(l=e)}if(e=n-o,s||!(0<e)){if(e/=s,s<0){if(e<u)return;e<l&&(l=e)}else if(0<s){if(l<e)return;u<e&&(u=e)}if(e=i-o,s||!(e<0)){if(e/=s,s<0){if(l<e)return;u<e&&(u=e)}else if(0<s){if(e<u)return;e<l&&(l=e)}return(0<u||l<1)&&(0<u&&(t[0]=[a+u*h,o+u*s]),l<1)&&(t[1]=[a+l*h,o+l*s]),1}}}}}(y,K,Q,$,tt)&&(Math.abs(y[0][0]-y[1][0])>Rs||Math.abs(y[0][1]-y[1][1])>Rs)||delete Os[et];var v,x,E,b,w,I,N,S,C,P,M=_,L=m,O=Z,R=t,nt=Ms.length,T=!0;for(D=0;D<nt;++D)if(v=Ms[D]){for(x=v.site,E=(b=v.halfedges).length;E--;)Os[b[E]]||b.splice(E,1);for(E=0,w=b.length;E<w;)C=v,C=(P=(P=Os[b[E]])[+(P.left===C.site)])[0],S=P[1],I=(N=ys(v,Os[b[++E%w]]))[0],N=N[1],(Math.abs(C-I)>Rs||Math.abs(S-N)>Rs)&&(b.splice(E,0,Os.push(gs(x,P,Math.abs(C-M)<Rs&&Rs<R-S?[M,Math.abs(I-M)<Rs?N:R]:Math.abs(S-R)<Rs&&Rs<O-C?[Math.abs(N-R)<Rs?I:O,R]:Math.abs(C-O)<Rs&&Rs<S-L?[O,Math.abs(I-O)<Rs?N:L]:Math.abs(S-L)<Rs&&Rs<C-M?[Math.abs(N-L)<Rs?I:M,L]:null))-1),++w);w&&(T=!1)}if(T){for(var A,rt=1/0,D=0,T=null;D<nt;++D)(v=Ms[D])&&(A=(A=(x=v.site)[0]-M)*A+(A=x[1]-L)*A)<rt&&(rt=A,T=v);T&&(_=[O,R],m=[O,L],T.halfedges.push(Os.push(gs(x=T.site,Z=[M,L],t=[M,R]))-1,Os.push(gs(x,t,_))-1,Os.push(gs(x,_,m))-1,Os.push(gs(x,m,Z))-1))}for(D=0;D<nt;++D)!(v=Ms[D])||v.halfedges.length||delete Ms[D]}this.edges=Os,this.cells=Ms,Ps=Ls=Os=Ms=null}function Fs(t){return(t=t.slice()).push(t[0]),k([t])}function ks(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(!st(r))throw new Error("options must be an object");if(!ot(i))throw new Error("steps must be a number");if(!ot(s))throw new Error("angle must be a number");var l,h=Mt(t);"degrees"===o?l=nt(s):(e=vi(t,e,90,{units:o}),n=vi(t,n,0,{units:o}),e=Mt(e)[0]-h[0],n=Mt(n)[1]-h[1]);for(var c=[],p=0;p<i;p+=1){var f,g=-360*p/i,d=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e,2)*Math.pow(Gs(g),2)),y=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(Gs(g),2));g<-90&&-270<=g&&(d=-d),g<-180&&-360<=g&&(y=-y),"degrees"===o&&(g=d*Math.cos(l)+y*Math.sin(l),f=y*Math.cos(l)-d*Math.sin(l),d=g,y=f),c.push([d+h[0],y+h[1]])}return c.push(c[0]),"degrees"===o?k([c],u):ho(k([c],u),s,{pivot:a})}function Gs(t){t=t*Math.PI/180;return Math.tan(t)}function qs(t,i){void 0===i&&(i={});var o=0,s=0,a=0;return _t(t,function(t,e,n){var r=!i.weight||null==n?void 0:n[i.weight];if(!ot(r=null==r?1:r))throw new Error("weight value must be a number for feature index "+e);0<(r=Number(r))&&ht(t,function(t){o+=t[0]*r,s+=t[1]*r,a+=r})}),R([o/a,s/a],i.properties,i)}function Bs(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function zs(t,e){var n=(e=e||{}).threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,e=e.standardization||!1,s=[];gt(t,function(t){s.push(Ln(t))});for(var a,u,l,h,c=[],p=0;p<s.length;p++)c[p]=[];for(p=0;p<s.length;p++)for(var f=p;f<s.length;f++){p===f&&(c[p][f]=0);u=s[f],(h=void 0)===(l=r)&&(l=2),a=Mt(a=s[p]),u=Mt(u),h=a[0]-u[0],a=a[1]-u[1];var g=1===l?Math.abs(h)+Math.abs(a):Math.pow(Math.pow(h,l)+Math.pow(a,l),1/l);c[p][f]=g,c[f][p]=g}for(p=0;p<s.length;p++)for(f=0;f<s.length;f++)0!==(g=c[p][f])&&(c[p][f]=i?g<=n?1:0:g<=n?Math.pow(g,o):0);if(e)for(p=0;p<s.length;p++)for(var d=c[p].reduce(function(t,e){return t+e},0),f=0;f<s.length;f++)c[p][f]=c[p][f]/d;return c}function js(t){for(var e=0,n=0,r=t;n<r.length;n++)e+=r[n];return e/t.length}function Us(t,e){return Xs(t,"mercator",e=void 0===e?{}:e)}function Vs(t,e){return Xs(t,"wgs84",e=void 0===e?{}:e)}function Xs(t,n,e){e=(e=(e=void 0===e?{}:e)||{}).mutate;if(t)return Array.isArray(t)&&ot(t[0])?t=("mercator"===n?Ys:Hs)(t):ht(t=!0!==e?je(t):t,function(t){var e=("mercator"===n?Ys:Hs)(t);t[0]=e[0],t[1]=e[1]}),t;throw new Error("geojson is required")}function Ys(t){var e=Math.PI/180,n=20037508.342789244,r=[6378137*(Math.abs(t[0])<=180?t[0]:t[0]-360*((r=t[0])<0?-1:0<r?1:0))*e,6378137*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return n<r[0]&&(r[0]=n),r[0]<-n&&(r[0]=-n),n<r[1]&&(r[1]=n),r[1]<-n&&(r[1]=-n),r}function Hs(t){var e=180/Math.PI;return[t[0]*e/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/6378137)))*e]}Ds.prototype={constructor:Ds,polygons:function(){var n=this.edges;return this.cells.map(function(e){var t=e.halfedges.map(function(t){return ys(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,s=t.site,a=-1,u=c[n[r-1]],l=u.left===s?u.right:u.left;++a<r;)i=l,l=(u=c[n[a]]).left===s?u.right:u.left,i&&l&&e<i.index&&e<l.index&&(o=l,(s[0]-o[0])*(i[1]-s[1])-(s[0]-i[0])*(o[1]-s[1])<0)&&h.push([s.data,i.data,l.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(n,r,t){for(var e,i,o=this,s=o._found||0,a=o.cells.length;!(i=o.cells[s]);)if(++s>=a)return null;for(var u=n-i.site[0],l=r-i.site[1],h=u*u+l*l;i=o.cells[e=s],s=null,i.halfedges.forEach(function(t){var t=o.edges[t],e=t.left;(e!==i.site&&e||(e=t.right))&&(t=(t=n-e[0])*t+(t=r-e[1])*t)<h&&(h=t,s=e.index)}),null!==s;);return o._found=e,null==t||h<=t*t?i.site:null}};xe=Object.freeze({__proto__:null,toMercator:Us,toWgs84:Vs});function Ws(t){return Array.isArray(t)?$s(t):t&&t.bbox?$s(t.bbox):[360*Qs(),180*Qs()]}function Js(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var n=[],r=0;r<t;r++)n.push(R(Ws(e.bbox)));return G(n)}function Zs(t,i){null==t&&(t=1),ot((i=void 0===i?{}:i).num_vertices)&&void 0!==i.num_vertices||(i.num_vertices=10),ot(i.max_radial_length)&&void 0!==i.max_radial_length||(i.max_radial_length=10);for(var o=[],e=function(t){var e,n=[],r=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(Array(i.num_vertices+1)).map(Math.random);r.forEach(function(t,e,n){n[e]=0<e?t+n[e-1]:t}),r.forEach(function(t){t=2*t*Math.PI/r[r.length-1];var e=Math.random();n.push([e*(i.max_radial_length||10)*Math.sin(t),e*(i.max_radial_length||10)*Math.cos(t)])}),n[n.length-1]=n[0],n=n.map((e=Ws(i.bbox),function(t){return[t[0]+e[0],t[1]+e[1]]})),o.push(k([n]))},n=0;n<t;n++)e();return G(o)}function Ks(t,e){if(!st(e=(e=void 0===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),(!ot(r)||void 0===r||r<2)&&(r=10),ot(i)&&void 0!==i||(i=1e-4),ot(o)&&void 0!==o||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[Ws(n)],l=0;l<r-1;l++){var h=(0===l?2*Math.random()*Math.PI:Math.tan((u[l][1]-u[l-1][1])/(u[l][0]-u[l-1][0])))+(Math.random()-.5)*o*2,c=Math.random()*i;u.push([u[l][0]+c*Math.cos(h),u[l][1]+c*Math.sin(h)])}s.push(V(u))}return G(s)}function Qs(){return Math.random()-.5}function $s(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}Qt=Object.freeze({__proto__:null,randomPosition:Ws,randomPoint:Js,randomPolygon:Zs,randomLineString:Ks});function ta(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 gt(t,function(t){ia(t.properties,e)&&n.push(t)}),G(n)}function ea(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=ra(t,e),i=Object.keys(r),o=0;o<i.length;o++){for(var s=i[o],a=r[s],u=[],l=0;l<a.length;l++)u.push(t.features[a[l]]);n(G(u),s,o)}}function na(t,e,r,i){var o=i;return ea(t,e,function(t,e,n){o=0===n&&void 0===i?t:r(o,t,e,n)}),o}function ra(t,n){var r={};return gt(t,function(t,e){var t=t.properties||{};Object.prototype.hasOwnProperty.call(t,String(n))&&(t=t[n],Object.prototype.hasOwnProperty.call(r,t)?r[t].push(e):r[t]=[e])}),r}function ia(t,e){if(void 0===t)return!1;var n=typeof e;if("number"==n||"string"==n)return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(!ia(t,e[r]))return!1;return!0}return oa(t,e)}function oa(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 sa(t,e){if(!e)return{};if(!e.length)return{};for(var n={},r=0;r<e.length;r++){var i=e[r];Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n}var aa=Object.freeze({__proto__:null,getCluster:ta,clusterEach:ea,clusterReduce:na,createBins:ra,applyFilter:ia,propertiesContainsFilter:oa,filterProperties:sa}),ua=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function la(t,e){return e<t?1:t<e?-1:0}function ha(t,e,n){for(var r=new ua(null,null),i=r,o=r;;){var s=n(t,e.key);if(s<0){if(null===e.left)break;if(n(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,e=(o=e).left}else{if(!(0<s))break;if(null===e.right)break;if(0<n(t,e.right.key)&&(a=e.right,e.right=a.left,a.left=e,null===(e=a).right))break;i.right=e,e=(i=e).right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function ca(t,e,n,r){e=new ua(t,e);return null===n?e.left=e.right=null:(t=r(t,(n=ha(t,n,r)).key))<0?(e.left=n.left,(e.right=n).left=null):0<=t&&(e.right=n.right,(e.left=n).right=null),e}function pa(t,e,n){var r=null,i=null;return e&&(0===(n=n((e=ha(t,e,n)).key,t))?(r=e.left,i=e.right):n<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)),{left:r,right:i}}ga.prototype.insert=function(t,e){return this._size++,this._root=ca(t,e,this._root,this._comparator)},ga.prototype.add=function(t,e){var e=new ua(t,e),n=(null===this._root&&(e.left=e.right=null,this._size++,this._root=e),this._comparator),r=ha(t,this._root,n),n=n(t,r.key);return 0===n?this._root=r:(n<0?(e.left=r.left,(e.right=r).left=null):0<n&&(e.right=r.right,(e.left=r).right=null),this._size++,this._root=e),this._root},ga.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},ga.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=ha(t,e,n)).key)?(null===e.left?r=e.right:(r=ha(t,e.left,n)).right=e.right,this._size--,r):e},ga.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=ha(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},ga.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},ga.prototype.find=function(t){return this._root&&(this._root=ha(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},ga.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},ga.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},ga.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(0<o((s=i.pop()).key,e))break;if(0<=o(s.key,t)&&n.call(r,s))return this;s=s.right}return this},ga.prototype.keys=function(){var e=[];return this.forEach(function(t){t=t.key;return e.push(t)}),e},ga.prototype.values=function(){var e=[];return this.forEach(function(t){t=t.data;return e.push(t)}),e},ga.prototype.min=function(){return this._root?this.minNode(this._root).key:null},ga.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},ga.prototype.minNode=function(t){if(t=void 0===t?this._root:t)for(;t.left;)t=t.left;return t},ga.prototype.maxNode=function(t){if(t=void 0===t?this._root:t)for(;t.right;)t=t.right;return t},ga.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(0<i.length){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},ga.prototype.next=function(t){var e=this._root,n=null;if(t.right)for(n=t.right;n.left;)n=n.left;else for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;e=i<0?(n=e).left:e.right}return n},ga.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left)for(n=t.left;n.right;)n=n.right;else for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;e=i<0?e.left:(n=e).right}return n},ga.prototype.clear=function(){return this._root=null,this._size=0,this},ga.prototype.toList=function(){for(var t=this._root,e=t,n=[],r=!1,i=t=new ua(null,null);!r;)e?(n.push(e),e=e.left):0<n.length?e=(e=i=i.next=n.pop()).right:r=!0;return i.next=null,t.next},ga.prototype.load=function(t,e,n){void 0===e&&(e=[]);var r=t.length,i=this._comparator;return(n=void 0===n?!1:n)&&function t(e,n,r,i,o){if(!(i<=r)){for(var s=e[r+i>>1],a=r-1,u=i+1;;){for(;o(e[++a],s)<0;);for(;0<o(e[--u],s););if(u<=a)break;var l=e[a];e[a]=e[u],e[u]=l,l=n[a],n[a]=n[u],n[u]=l}t(e,n,r,u,o),t(e,n,u+1,i,o)}}(t,e,0,r-1,i),null===this._root?(this._root=function t(e,n,r,i){var o=i-r;{var s,a;if(0<o)return o=r+Math.floor(o/2),a=e[o],s=n[o],(a=new ua(a,s)).left=t(e,n,r,o),a.right=t(e,n,o+1,i),a}return null}(t,e,0,r),this._size=r):(n=function(t,e,n){for(var r=new ua(null,null),i=r,o=t,s=e;null!==o&&null!==s;)n(o.key,s.key)<0?o=(i.next=o).next:s=(i.next=s).next,i=i.next;return null!==o?i.next=o:null!==s&&(i.next=s),r.next}(this.toList(),function(t,e){for(var n=new ua(null,null),r=n,i=0;i<t.length;i++)r=r.next=new ua(t[i],e[i]);return r.next=null,n.next}(t,e),i),r=this._size+r,this._root=function t(e,n,r){var i=r-n;{var o;if(0<i)return i=n+Math.floor(i/2),n=t(e,n,i),(o=e.head).left=n,e.head=e.head.next,o.right=t(e,i+1,r),o}return null}({head:n},0,r)),this},ga.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(ga.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(ga.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),ga.prototype.toString=function(t){var e=[];return function t(e,n,r,i,o){e&&(i(n+(r?"└── ":"├── ")+o(e)+"\n"),n+=r?"    ":"│   ",e.left&&t(e.left,n,!1,i,o),e.right)&&t(e.right,n,!0,i,o)}(this._root,"",!0,function(t){return e.push(t)},t=void 0===t?function(t){return String(t.key)}:t),e.join("")},ga.prototype.update=function(t,e,n){var r=this._comparator,i=pa(t,this._root,r),o=i.left,i=i.right;r(t,e)<0?i=ca(e,n,i,r):o=ca(e,n,o,r),this._root=(t=o,null===(e=i)?t:(null!==t&&((e=ha(t.key,e,r)).left=t),e))},ga.prototype.split=function(t){return pa(t,this._root,this._comparator)};var fa=ga;function ga(t){void 0===t&&(t=la),this._root=null,this._size=0,this._comparator=t}function da(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ya(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _a(t,e,n){e&&ya(t.prototype,e),n&&ya(t,n)}function ma(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y}function va(t,e){var n,r;return e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y?null:(n=(t.ll.x<e.ll.x?e:t).ll.x,r=(t.ur.x<e.ur.x?t:e).ur.x,{ll:{x:n,y:(t.ll.y<e.ll.y?e:t).ll.y},ur:{x:r,y:(t.ur.y<e.ur.y?t:e).ur.y}})}function xa(t,e){var n;return-Na<t&&t<Na&&-Na<e&&e<Na||(n=t-e)*n<Sa*t*e?0:t<e?-1:1}function Ea(t,e){return t.x*e.y-t.y*e.x}function ba(t,e,n){return e={x:e.x-t.x,y:e.y-t.y},n={x:n.x-t.x,y:n.y-t.y},t=Ea(e,n),xa(t,0)}function wa(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}}function Ia(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}}var Na=Number.EPSILON,Sa=(Na=void 0===Na?Math.pow(2,-52):Na)*Na,e=(_a(nu,[{key:"reset",value:function(){this.xRounder=new Ca,this.yRounder=new Ca}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),nu),Ca=(_a(eu,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);return null!==n&&0===xa(e.key,n.key)||null!==(n=this.tree.next(e))&&0===xa(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),eu),Pa=new e,Ma=function(t,e){return t.x*e.x+t.y*e.y},La=function(t){return Math.sqrt(Ma(t,t))},Oa=(_a(tu,null,[{key:"compare",value:function(t,e){var n=tu.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:Ta.compare(t.segment,e.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),_a(tu,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(i){function o(t){var e,n,r=t.otherSE;a.set(t,{sine:(t=s.point,e=i.point,n=r.point,e={x:e.x-t.x,y:e.y-t.y},n={x:n.x-t.x,y:n.y-t.y},Ea(n,e)/La(n)/La(e)),cosine:function(t,e,n){e={x:e.x-t.x,y:e.y-t.y},n={x:n.x-t.x,y:n.y-t.y};return Ma(n,e)/La(n)/La(e)}(s.point,i.point,r.point)})}var s=this,a=new Map;return function(t,e){a.has(t)||o(t),a.has(e)||o(e);var t=a.get(t),n=t.sine,t=t.cosine,e=a.get(e),r=e.sine,e=e.cosine;return 0<=n&&0<=r?t<e?1:e<t?-1:0:n<0&&r<0?t<e?-1:e<t?1:0:r<n?-1:n<r?1:0}}}]),tu),Ra=0,Ta=(_a($a,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(n<r)return a<s&&a<u?1:s<a&&u<a?-1:(h=t.comparePoint(e.leftSE.point))<0?1:!(0<h)&&0!==(h=e.comparePoint(t.rightSE.point))?h:-1;if(r<n)return s<a&&s<l?-1:a<s&&l<s?1:0!==(h=e.comparePoint(t.leftSE.point))?h:!((h=t.comparePoint(e.rightSE.point))<0)&&0<h?-1:1;if(s<a)return-1;if(a<s)return 1;if(i<o){var h=e.comparePoint(t.rightSE.point);if(0!==h)return h}if(o<i){h=t.comparePoint(e.rightSE.point);if(h<0)return 1;if(0<h)return-1}if(i!==o){h=u-s,s=i-n,n=l-a,a=o-r;if(s<h&&n<a)return 1;if(h<s&&a<n)return-1}return o<i?1:i<o||u<l?-1:l<u?1:t.id<e.id?-1:t.id>e.id?1:0}}]),_a($a,[{key:"replaceRightSE",value:function(t){this.rightSE=t,(this.rightSE.segment=this).rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:e<t?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){var e,n,r;return this.isAnEndpoint(t)?0:(r=this.leftSE.point,n=this.rightSE.point,e=this.vector(),r.x===n.x?t.x===r.x?0:t.x<r.x?1:-1:(n=(t.y-r.y)/e.y,n=r.x+n*e.x,t.x===n||(n=(t.x-r.x)/e.x,r=r.y+n*e.y,t.y===r)?0:t.y<r?-1:1))}},{key:"getIntersection",value:function(t){var e,n,r,i,o,s,a=this.bbox(),u=t.bbox(),l=va(a,u);return null===l?null:(o=this.leftSE.point,i=this.rightSE.point,e=t.leftSE.point,s=t.rightSE.point,r=ma(a,e)&&0===this.comparePoint(e),n=ma(u,o)&&0===t.comparePoint(o),a=ma(a,s)&&0===this.comparePoint(s),u=ma(u,i)&&0===t.comparePoint(i),n&&r?u&&!a?i:!u&&a?s:null:n?a&&o.x===s.x&&o.y===s.y?null:o:r?u&&i.x===e.x&&i.y===e.y?null:e:u&&a?null:u?i:a?s:(n=o,r=this.vector(),u=e,i=t.vector(),null!==(e=0===r.x?Ia(u,i,n.x):0===i.x?Ia(n,r,u.x):0===r.y?wa(u,i,n.y):0===i.y?wa(n,r,u.y):0==(a=Ea(r,i))?null:(s={x:u.x-n.x,y:u.y-n.y},o=Ea(s,r)/a,s=Ea(s,i)/a,{x:(n.x+s*r.x+(u.x+o*i.x))/2,y:(n.y+s*r.y+(u.y+o*i.y))/2}))&&ma(l,e)?Pa.round(e.x,e.y):null))}},{key:"split",value:function(t){var e=[],n=void 0!==t.events,r=new Oa(t,!0),t=new Oa(t,!1),i=this.rightSE,i=(this.replaceRightSE(t),e.push(t),e.push(r),new $a(r,i,this.rings.slice(),this.windings.slice()));return 0<Oa.comparePoints(i.leftSE.point,i.rightSE.point)&&i.swapEvents(),0<Oa.comparePoints(this.leftSE.point,this.rightSE.point)&&this.swapEvents(),n&&(r.checkForConsuming(),t.checkForConsuming()),e}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){for(var e=this,n=t;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var t=$a.compare(e,n);if(0!==t){0<t&&(t=e,e=n,n=t),e.prev===n&&(t=e,e=n,n=t);for(var r=0,i=n.rings.length;r<i;r++){var o=n.rings[r],s=n.windings[r],a=e.rings.indexOf(o);-1===a?(e.rings.push(o),e.windings.push(s)):e.windings[a]+=s}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}},{key:"prevInResult",value:function(){return void 0===this._prevInResult&&(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){var t;return void 0===this._beforeState&&(this.prev?(t=this.prev.consumedBy||this.prev,this._beforeState=t.afterState()):this._beforeState={rings:[],windings:[],multiPolys:[]}),this._beforeState}},{key:"afterState",value:function(){if(void 0===this._afterState){var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(a)):n[u]+=a}for(var l,h,c=[],p=[],f=0,g=e.length;f<g;f++)0!==n[f]&&(h=(l=e[f]).poly,-1===p.indexOf(h))&&(l.isExterior?c.push(h):(-1===p.indexOf(h)&&p.push(h),-1!==(h=c.indexOf(l.poly))&&c.splice(h,1)));for(var d=0,y=c.length;d<y;d++){var _=c[d].multiPoly;-1===r.indexOf(_)&&r.push(_)}}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0===this._isInResult){var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Ua.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!=r;break;case"intersection":n=(t.length<e.length?(i=t.length,e):(i=e.length,t)).length;this._isInResult=n===Ua.numMultiPolys&&i<n;break;case"xor":r=Math.abs(t.length-e.length);this._isInResult=r%2==1;break;case"difference":var i=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=i(t)!==i(e);break;default:throw new Error("Unrecognized operation type found ".concat(Ua.type))}}return this._isInResult}}],[{key:"fromRing",value:function(t,e,n){var r,i,o,s=Oa.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(0<s))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));r=e,i=t,o=-1}return new $a(new Oa(r,!0),new Oa(i,!1),[n],[o])}}]),$a),Aa=(_a(Qa,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),Qa),Da=(_a(Ka,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),Ka),Fa=(_a(Za,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),Za),ka=(_a(Ja,null,[{key:"factory",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(i.isInResult()&&!i.ringOut){for(var o,s=i.leftSE,a=i.rightSE,u=[s],l=s.point,h=[];o=s,s=a,u.push(s),s.point!==l;)for(;;){var c=s.getAvailableLinkedEvents();if(0===c.length)throw d=u[0].point,y=u[u.length-1].point,new Error("Unable to complete output ring starting at [".concat(d.x,",")+" ".concat(d.y,"]. Last matching segment found ends at")+" [".concat(y.x,", ").concat(y.y,"]."));if(1===c.length){a=c[0].otherSE;break}for(var p=null,f=0,g=h.length;f<g;f++)if(h[f].point===s.point){p=f;break}if(null===p){h.push({index:u.length,point:s.point});var d=s.getLeftmostComparator(o),a=c.sort(d)[0].otherSE;break}var y=h.splice(p)[0],c=u.splice(y.index);c.unshift(c[0].otherSE),e.push(new Ja(c.reverse()))}e.push(new Ja(u))}}return e}}]),_a(Ja,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==ba(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;0===ba(e[0],t,e[1])&&e.shift(),e.push(e[0]);for(var s=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:e.length-1,u=this.isExteriorRing()?e.length:-1,l=[],h=a;h!=u;h+=s)l.push([e[h].x,e[h].y]);return l}},{key:"isExteriorRing",value:function(){var t;return void 0===this._isExteriorRing&&(t=this.enclosingRing(),this._isExteriorRing=!t||!t.isExteriorRing()),this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];0<Oa.compare(t,r)&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();o=(i=o.prevInResult())?i.prevInResult():null}}}]),Ja),Ga=(_a(Wa,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),Wa),qa=(_a(Ha,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i,o=t[n];o.poly||(o.isExteriorRing()?e.push(new Ga(o)):((i=o.enclosingRing()).poly||e.push(new Ga(i)),i.poly.addInterior(o)))}return e}}]),Ha),Ba=(_a(Ya,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e);else{var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){r=null;if(s){var u=s.getIntersection(e);if(null!==u&&(e.isAnEndpoint(u)||(r=u),!s.isAnEndpoint(u)))for(var l=this._splitSafely(s,u),h=0,c=l.length;h<c;h++)n.push(l[h])}u=null;if(a){var p=a.getIntersection(e);if(null!==p&&(e.isAnEndpoint(p)||(u=p),!a.isAnEndpoint(p)))for(var f=this._splitSafely(a,p),g=0,d=f.length;g<d;g++)n.push(f[g])}if(null!==r||null!==u){p=null,p=null!==r&&(null===u||Oa.comparePoints(r,u)<=0)?r:u;this.queue.remove(e.rightSE),n.push(e.rightSE);for(var y=e.split(p),_=0,m=y.length;_<m;_++)n.push(y[_])}0<n.length?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){r=s.getIntersection(a);if(null!==r){if(!s.isAnEndpoint(r))for(var v=this._splitSafely(s,r),x=0,E=v.length;x<E;x++)n.push(v[x]);if(!a.isAnEndpoint(r))for(var b=this._splitSafely(a,r),w=0,I=b.length;w<I;w++)n.push(b[w])}}this.tree.remove(e)}}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE,e=(this.queue.remove(n),t.split(e));return e.push(n),void 0===t.consumedBy&&this.tree.insert(t),e}}]),Ya),za=void 0!==fd&&fd.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ja=void 0!==fd&&fd.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Ua=(_a(Xa,[{key:"run",value:function(t,e,n){Ua.type=t,Pa.reset();for(var r=[new Fa(e,!0)],i=0,o=n.length;i<o;i++)r.push(new Fa(n[i],!1));if(Ua.numMultiPolys=r.length,"difference"===Ua.type)for(var s=r[0],a=1;a<r.length;)null!==va(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===Ua.type)for(var u=0,l=r.length;u<l;u++)for(var h=r[u],c=u+1,p=r.length;c<p;c++)if(null===va(h.bbox,r[c].bbox))return[];for(var f=new fa(Oa.compare),g=0,d=r.length;g<d;g++)for(var y=r[g].getSweepEvents(),_=0,m=y.length;_<m;_++)if(f.insert(y[_]),f.size>za)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new Ba(f),x=f.size,E=f.pop();E;){var b,w=E.key;if(f.size===x)throw b=w.segment,new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(b.id," ")+"[".concat(b.leftSE.point.x,", ").concat(b.leftSE.point.y,"] -> ")+"[".concat(b.rightSE.point.x,", ").concat(b.rightSE.point.y,"] from queue. ")+"Please file a bug report.");if(f.size>za)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>ja)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=v.process(w),N=0,S=I.length;N<S;N++){var C=I[N];void 0===C.consumedBy&&f.insert(C)}x=f.size,E=f.pop()}Pa.reset();t=ka.factory(v.segments);return new qa(t).getGeom()}}]),new Xa),Va={union:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Ua.run("difference",t,n)}};function Xa(){da(this,Xa)}function Ya(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Ta.compare;da(this,Ya),this.queue=t,this.tree=new fa(e),this.segments=[]}function Ha(t){da(this,Ha),this.rings=t,this.polys=this._composePolys(t)}function Wa(t){da(this,Wa),((this.exteriorRing=t).poly=this).interiorRings=[]}function Ja(t){da(this,Ja);for(var e=0,n=(this.events=t).length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}function Za(t,e){if(da(this,Za),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,r=t.length;n<r;n++){var i=new Da(t[n],this);i.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=e}function Ka(t,e){if(da(this,Ka),!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Aa(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,r=t.length;n<r;n++){var i=new Aa(t[n],this,!1);i.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=e}function Qa(t,e,n){if(da(this,Qa),!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");e=Pa.round(t[0][0],t[0][1]);this.bbox={ll:{x:e.x,y:e.y},ur:{x:e.x,y:e.y}};for(var r=e,i=1,o=t.length;i<o;i++){if("number"!=typeof t[i][0]||"number"!=typeof t[i][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var s=Pa.round(t[i][0],t[i][1]);s.x===r.x&&s.y===r.y||(this.segments.push(Ta.fromRing(r,s,this)),s.x<this.bbox.ll.x&&(this.bbox.ll.x=s.x),s.y<this.bbox.ll.y&&(this.bbox.ll.y=s.y),s.x>this.bbox.ur.x&&(this.bbox.ur.x=s.x),s.y>this.bbox.ur.y&&(this.bbox.ur.y=s.y),r=s)}e.x===r.x&&e.y===r.y||this.segments.push(Ta.fromRing(r,e,this))}function $a(t,e,n,r){da(this,$a),this.id=++Ra,(this.leftSE=t).segment=this,t.otherSE=e,(this.rightSE=e).segment=this,e.otherSE=t,this.rings=n,this.windings=r}function tu(t,e){da(this,tu),void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}function eu(){da(this,eu),this.tree=new fa,this.round(0)}function nu(){da(this,nu),this.reset()}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");for(var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=((r=1 in arguments&&parseInt(Number(arguments[1]),10)||0)<0?Math.max(n+r,0):Math.min(r,n)),i=((i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n)<0?Math.max(n+arguments[2],0):Math.min(i,n));r<i;)e[r]=t,++r;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function ru(){}function h(){}ru.prototype.interfaces_=function(){return[]},ru.prototype.getClass=function(){return ru},ru.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n},(iu=Error)&&(su.__proto__=iu);var iu,ou=(su.prototype=Object.create(iu&&iu.prototype)).constructor=su,e={MAX_VALUE:{configurable:!0}};function su(t){iu.call(this,t),this.name="IllegalArgumentException",this.message=t,this.stack=(new iu).stack}h.isNaN=function(t){return Number.isNaN(t)},h.doubleToLongBits=function(t){return t},h.longBitsToDouble=function(t){return t},h.isInfinite=function(t){return!Number.isFinite(t)},e.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(h,e);function au(){}function uu(){}function lu(){}function hu(){}function m(){var t;this.x=null,this.y=null,this.z=null,0===arguments.length?(this.x=0,this.y=0,this.z=m.NULL_ORDINATE):1===arguments.length?(this.x=(t=arguments[0]).x,this.y=t.y,this.z=t.z):2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=m.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])}function cu(){}function g(){}function v(t,e){return t.interfaces_&&-1<t.interfaces_().indexOf(e)}function pu(){}function fu(t){this.str=t}function gu(t){this.value=t}function du(){}function d(){this._hi=0,(this._lo=0)===arguments.length?this.init(0):1===arguments.length?"number"==typeof arguments[0]||arguments[0]instanceof d?this.init(arguments[0]):"string"==typeof arguments[0]&&d.call(this,d.parse(arguments[0])):2===arguments.length&&this.init(arguments[0],arguments[1])}function yu(){}function y(){}function _u(){}function mu(){}var vu,e={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}},xu=(m.prototype.setOrdinate=function(t,e){switch(t){case m.X:this.x=e;break;case m.Y:this.y=e;break;case m.Z:this.z=e;break;default:throw new ou("Invalid ordinate index: "+t)}},m.prototype.equals2D=function(){var t,e;return 1===arguments.length?this.x===(t=arguments[0]).x&&this.y===t.y:2===arguments.length?!!ru.equalsWithTolerance(this.x,(t=arguments[0]).x,e=arguments[1])&&!!ru.equalsWithTolerance(this.y,t.y,e):void 0},m.prototype.getOrdinate=function(t){switch(t){case m.X:return this.x;case m.Y:return this.y;case m.Z:return this.z}throw new ou("Invalid ordinate index: "+t)},m.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||h.isNaN(this.z))&&h.isNaN(t.z)},m.prototype.equals=function(t){return t instanceof m&&this.equals2D(t)},m.prototype.equalInZ=function(t,e){return ru.equalsWithTolerance(this.z,t.z,e)},m.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},m.prototype.clone=function(){},m.prototype.copy=function(){return new m(this)},m.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},m.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,t=this.z-t.z;return Math.sqrt(e*e+n*n+t*t)},m.prototype.distance=function(t){var e=this.x-t.x,t=this.y-t.y;return Math.sqrt(e*e+t*t)},m.prototype.hashCode=function(){return 37*(629+m.hashCode(this.x))+m.hashCode(this.y)},m.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},m.prototype.interfaces_=function(){return[au,uu,hu]},m.prototype.getClass=function(){return m},m.hashCode=function(){var t;if(1===arguments.length)return t=h.doubleToLongBits(arguments[0]),Math.trunc((t^t)>>>32)},e.DimensionalComparator.get=function(){return xu},e.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},e.NULL_ORDINATE.get=function(){return h.NaN},e.X.get=function(){return 0},e.Y.get=function(){return 1},e.Z.get=function(){return 2},Object.defineProperties(m,e),function(t){if(this._dimensionsToTest=2,0!==arguments.length&&1===arguments.length){if(2!==t&&3!==t)throw new ou("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}),e=(xu.prototype.compare=function(t,e){var n=xu.compare(t.x,e.x);return 0!==n||0!==(n=xu.compare(t.y,e.y))?n:this._dimensionsToTest<=2?0:xu.compare(t.z,e.z)},xu.prototype.interfaces_=function(){return[lu]},xu.prototype.getClass=function(){return xu},xu.compare=function(t,e){return t<e?-1:e<t?1:h.isNaN(t)?h.isNaN(e)?0:-1:h.isNaN(e)?1:0},cu.prototype.create=function(){},cu.prototype.interfaces_=function(){return[]},cu.prototype.getClass=function(){return cu},{INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}}),e=(g.prototype.interfaces_=function(){return[]},g.prototype.getClass=function(){return g},g.toLocationSymbol=function(t){switch(t){case g.EXTERIOR:return"e";case g.BOUNDARY:return"b";case g.INTERIOR:return"i";case g.NONE:return"-"}throw new ou("Unknown location value: "+t)},e.INTERIOR.get=function(){return 0},e.BOUNDARY.get=function(){return 1},e.EXTERIOR.get=function(){return 2},e.NONE.get=function(){return-1},Object.defineProperties(g,e),{LOG_10:{configurable:!0}}),e=(pu.prototype.interfaces_=function(){return[]},pu.prototype.getClass=function(){return pu},pu.log10=function(t){t=Math.log(t);return h.isInfinite(t)||h.isNaN(t)?t:t/pu.LOG_10},pu.min=function(t,e,n,r){return t=r<(t=n<(t=e<t?e:t)?n:t)?r:t},pu.clamp=function(){var t,e,n;return"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]?(n=arguments[0],t=arguments[1],e=arguments[2],n<t?t:e<n?e:n):Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])?(t=arguments[0],e=arguments[1],n=arguments[2],t<e?e:n<t?n:t):void 0},pu.wrap=function(t,e){return t<0?e- -t%e:t%e},pu.max=function(){var t,e,n;return 3===arguments.length?(t=(t=n=arguments[0])<(e=arguments[1])?e:n)<(e=arguments[2])?e:t:4===arguments.length?(n=(n=(n=arguments[0])<(e=arguments[1])?e:n)<(t=arguments[2])?t:n)<(e=arguments[3])?e:n:void 0},pu.average=function(t,e){return(t+e)/2},e.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(pu,e),fu.prototype.append=function(t){this.str+=t},fu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},fu.prototype.toString=function(t){return this.str},gu.prototype.intValue=function(){return this.value},gu.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},gu.isNaN=function(t){return Number.isNaN(t)},du.isWhitespace=function(t){return t<=32&&0<=t||127===t},du.toUpperCase=function(t){return t.toUpperCase()},{PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}}),e=(d.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},d.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=d.magnitude(n._hi),i=d.TEN.pow(r);(n=n.divide(i)).gt(d.TEN)?(n=n.divide(d.TEN),r+=1):n.lt(d.ONE)&&(n=n.multiply(d.TEN),--r);for(var o=r+1,s=new fu,a=d.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var h=!1,c=0,c=9<l?(h=!0,"9"):"0"+l,c=(s.append(c),n=n.subtract(d.valueOf(l)).multiply(d.TEN),h&&n.selfAdd(d.TEN),!0),l=d.magnitude(n._hi);if(!(c=l<0&&Math.abs(l)>=a-u?!1:c))break}return e[0]=r,s.toString()},d.prototype.sqr=function(){return this.multiply(this)},d.prototype.doubleValue=function(){return this._hi+this._lo},d.prototype.subtract=function(){return arguments[0]instanceof d?this.add(arguments[0].negate()):"number"==typeof arguments[0]?this.add(-arguments[0]):void 0},d.prototype.equals=function(){var t;if(1===arguments.length)return this._hi===(t=arguments[0])._hi&&this._lo===t._lo},d.prototype.isZero=function(){return 0===this._hi&&0===this._lo},d.prototype.selfSubtract=function(){var t;return arguments[0]instanceof d?(t=arguments[0],this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)):"number"==typeof arguments[0]?(t=arguments[0],this.isNaN()?this:this.selfAdd(-t,0)):void 0},d.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},d.prototype.min=function(t){return this.le(t)?this:t},d.prototype.selfDivide=function(){var t,e,n,r,i,o,s,a,u;return 1===arguments.length?arguments[0]instanceof d?this.selfDivide((e=arguments[0])._hi,e._lo):"number"==typeof arguments[0]?this.selfDivide(arguments[0],0):void 0:2===arguments.length?(u=s=o=a=i=r=n=e=null,a=this._hi/(t=arguments[0]),u=(e=(o=d.SPLIT*a)-(o-a))*(r=(u=d.SPLIT*t)-(u-t))-(s=a*t)+e*(i=t-r)+(n=a-e)*r+n*i,u=a+(o=(this._hi-s-u+this._lo-a*arguments[1])/t),this._hi=u,this._lo=a-u+o,this):void 0},d.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},d.prototype.divide=function(){var t,e,n,r,i,o,s,a,u;return arguments[0]instanceof d?(a=o=i=r=n=e=s=u=null,s=(r=this._hi/(t=arguments[0])._hi)-(u=(i=d.SPLIT*r)-(i-r)),a=u*(e=(a=d.SPLIT*t._hi)-(a-t._hi))-(o=r*t._hi)+u*(n=t._hi-e)+s*e+s*n,a=r+(i=(this._hi-o-a+this._lo-r*t._lo)/t._hi),new d(a,r-a+i)):"number"==typeof arguments[0]?h.isNaN(u=arguments[0])?d.createNaN():d.copy(this).selfDivide(u,0):void 0},d.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},d.prototype.pow=function(t){if(0===t)return d.valueOf(1);var e=new d(this),n=d.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},d.prototype.ceil=function(){var t,e;return this.isNaN()?d.NaN:(e=0,(t=Math.ceil(this._hi))===this._hi&&(e=Math.ceil(this._lo)),new d(t,e))},d.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},d.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},d.prototype.setValue=function(){return arguments[0]instanceof d||"number"==typeof arguments[0]?(this.init(arguments[0]),this):void 0},d.prototype.max=function(t){return this.ge(t)?this:t},d.prototype.sqrt=function(){var t,e;return this.isZero()?d.valueOf(0):this.isNegative()?d.NaN:(e=1/Math.sqrt(this._hi),t=this._hi*e,t=d.valueOf(t),e=this.subtract(t.sqr())._hi*(.5*e),t.add(e))},d.prototype.selfAdd=function(){var t,e,n,r,i,o,s,a,u;return 1===arguments.length?arguments[0]instanceof d?this.selfAdd((r=arguments[0])._hi,r._lo):"number"==typeof arguments[0]?(u=o=s=i=n=r=null,s=(i=this._hi+(e=arguments[0]))-(o=i-this._hi),n=(u=(s=e-o+(this._hi-s))+this._lo)+(i-(r=i+u)),this._hi=r+n,this._lo=n+(r-this._hi),this):void 0:2===arguments.length?(r=n=u=i=s=o=e=null,i=this._hi+(a=arguments[0]),o=this._lo+(t=arguments[1]),u=i-(n=i-this._hi),s=o-(r=o-this._lo),a=(e=i+(n=(u=a-n+(this._hi-u))+o))+(n=(s=t-r+(this._lo-s))+(n+(i-e))),u=n+(e-a),this._hi=a,this._lo=u,this):void 0},d.prototype.selfMultiply=function(){var t,e,n,r,i,o,s;return 1===arguments.length?arguments[0]instanceof d?this.selfMultiply((r=arguments[0])._hi,r._lo):"number"==typeof arguments[0]?this.selfMultiply(arguments[0],0):void 0:2===arguments.length?(i=n=e=o=s=r=null,r=(n=d.SPLIT*this._hi)-this._hi,s=this._hi-(r=n-r),o=(n=this._hi*(t=arguments[0]))+(i=r*(o=(i=d.SPLIT*t)-(o=i-t))-n+r*(e=t-o)+s*o+s*e+(this._hi*arguments[1]+this._lo*t)),s=i+(r=n-o),this._hi=o,this._lo=s,this):void 0},d.prototype.selfSqr=function(){return this.selfMultiply(this)},d.prototype.floor=function(){var t,e;return this.isNaN()?d.NaN:(e=0,(t=Math.floor(this._hi))===this._hi&&(e=Math.floor(this._lo)),new d(t,e))},d.prototype.negate=function(){return this.isNaN()?this:new d(-this._hi,-this._lo)},d.prototype.clone=function(){},d.prototype.multiply=function(){var t;return arguments[0]instanceof d?(t=arguments[0]).isNaN()?d.createNaN():d.copy(this).selfMultiply(t):"number"==typeof arguments[0]?h.isNaN(t=arguments[0])?d.createNaN():d.copy(this).selfMultiply(t,0):void 0},d.prototype.isNaN=function(){return h.isNaN(this._hi)},d.prototype.intValue=function(){return Math.trunc(this._hi)},d.prototype.toString=function(){var t=d.magnitude(this._hi);return-3<=t&&t<=20?this.toStandardNotation():this.toSciNotation()},d.prototype.toStandardNotation=function(){var t,e,n=this.getSpecialNumberString();return null!==n?n:(n=new Array(1).fill(null),t=this.extractSignificantDigits(!0,n),n=n[0]+1,"."===(e=t).charAt(0)?e="0"+t:n<0?e="0."+d.stringOfChar("0",-n)+t:-1===t.indexOf(".")&&(n=n-t.length,e=t+d.stringOfChar("0",n)+".0"),this.isNegative()?"-"+e:e)},d.prototype.reciprocal=function(){var t,e,n,r=null,i=(t=1/this._hi)-(r=(e=d.SPLIT*t)-(e-t)),o=(n=d.SPLIT*this._hi)-this._hi,s=t+(e=(1-(s=t*this._hi)-(r*(o=n-o)-s+r*(n=this._hi-o)+i*o+i*n)-t*this._lo)/this._hi);return new d(s,t-s+e)},d.prototype.toSciNotation=function(){if(this.isZero())return d.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var t=new Array(1).fill(null),e=this.extractSignificantDigits(!1,t),t=d.SCI_NOT_EXPONENT_CHAR+t[0];if("0"===e.charAt(0))throw new Error("Found leading zero: "+e);var n="",e=(1<e.length&&(n=e.substring(1)),e.charAt(0)+"."+n);return this.isNegative()?"-"+e+t:e+t},d.prototype.abs=function(){return this.isNaN()?d.NaN:this.isNegative()?this.negate():new d(this)},d.prototype.isPositive=function(){return(0<this._hi||0===this._hi)&&0<this._lo},d.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},d.prototype.add=function(){var t;return arguments[0]instanceof d||"number"==typeof arguments[0]?(t=arguments[0],d.copy(this).selfAdd(t)):void 0},d.prototype.init=function(){var t,e;1===arguments.length?"number"==typeof arguments[0]?(this._hi=arguments[0],this._lo=0):arguments[0]instanceof d&&(this._hi=(t=arguments[0])._hi,this._lo=t._lo):2===arguments.length&&(t=arguments[0],e=arguments[1],this._hi=t,this._lo=e)},d.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},d.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},d.prototype.trunc=function(){return this.isNaN()?d.NaN:this.isPositive()?this.floor():this.ceil()},d.prototype.signum=function(){return 0<this._hi?1:this._hi<0?-1:0<this._lo?1:this._lo<0?-1:0},d.prototype.interfaces_=function(){return[hu,au,uu]},d.prototype.getClass=function(){return d},d.sqr=function(t){return d.valueOf(t).selfMultiply(t)},d.valueOf=function(){return"string"==typeof arguments[0]?d.parse(arguments[0]):"number"==typeof arguments[0]?new d(arguments[0]):void 0},d.sqrt=function(t){return d.valueOf(t).sqrt()},d.parse=function(t){for(var e=0,n=t.length;du.isWhitespace(t.charAt(e));)e++;var r=!1;e<n&&("-"!==(c=t.charAt(e))&&"+"!==c||(e++,"-"===c&&(r=!0)));for(var i=new d,o=0,s=0,a=0;!(n<=e);){var u=t.charAt(e);if(e++,du.isDigit(u)){var l=u-"0";i.selfMultiply(d.TEN),i.selfAdd(l),o++}else{if("."!==u){if("e"!==u&&"E"!==u)throw new Error("Unexpected character '"+u+"' at position "+e+" in string "+t);l=t.substring(e);try{a=gu.parseInt(l)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+l+" in string "+t):e}break}s=o}}var h,c=i,p=o-s-a;return 0==p?c=i:0<p?(h=d.TEN.pow(p),c=i.divide(h)):p<0&&(h=d.TEN.pow(-p),c=i.multiply(h)),r?c.negate():c},d.createNaN=function(){return new d(h.NaN,h.NaN)},d.copy=function(t){return new d(t)},d.magnitude=function(t){var t=Math.abs(t),e=Math.log(t)/Math.log(10),e=Math.trunc(Math.floor(e));return 10*Math.pow(10,e)<=t&&(e+=1),e},d.stringOfChar=function(t,e){for(var n=new fu,r=0;r<e;r++)n.append(t);return n.toString()},e.PI.get=function(){return new d(3.141592653589793,12246467991473532e-32)},e.TWO_PI.get=function(){return new d(6.283185307179586,24492935982947064e-32)},e.PI_2.get=function(){return new d(1.5707963267948966,6123233995736766e-32)},e.E.get=function(){return new d(2.718281828459045,14456468917292502e-32)},e.NaN.get=function(){return new d(h.NaN,h.NaN)},e.EPS.get=function(){return 123259516440783e-46},e.SPLIT.get=function(){return 134217729},e.MAX_PRINT_DIGITS.get=function(){return 32},e.TEN.get=function(){return d.valueOf(10)},e.ONE.get=function(){return d.valueOf(1)},e.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},e.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(d,e),{DP_SAFE_EPSILON:{configurable:!0}}),e=(yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu},yu.orientationIndex=function(t,e,n){var r,i=yu.orientationIndexFilter(t,e,n);return i<=1?i:(i=d.valueOf(e.x).selfAdd(-t.x),t=d.valueOf(e.y).selfAdd(-t.y),r=d.valueOf(n.x).selfAdd(-e.x),n=d.valueOf(n.y).selfAdd(-e.y),i.selfMultiply(n).selfSubtract(t.selfMultiply(r)).signum())},yu.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},yu.intersection=function(t,e,n,r){var i=d.valueOf(r.y).selfSubtract(n.y).selfMultiply(d.valueOf(e.x).selfSubtract(t.x)),o=d.valueOf(r.x).selfSubtract(n.x).selfMultiply(d.valueOf(e.y).selfSubtract(t.y)),i=i.subtract(o),o=d.valueOf(r.x).selfSubtract(n.x).selfMultiply(d.valueOf(t.y).selfSubtract(n.y)),s=d.valueOf(r.y).selfSubtract(n.y).selfMultiply(d.valueOf(t.x).selfSubtract(n.x)),o=o.subtract(s).selfDivide(i).doubleValue(),s=d.valueOf(t.x).selfAdd(d.valueOf(e.x).selfSubtract(t.x).selfMultiply(o)).doubleValue(),o=d.valueOf(e.x).selfSubtract(t.x).selfMultiply(d.valueOf(t.y).selfSubtract(n.y)),e=d.valueOf(e.y).selfSubtract(t.y).selfMultiply(d.valueOf(t.x).selfSubtract(n.x)),t=o.subtract(e).selfDivide(i).doubleValue(),o=d.valueOf(n.y).selfAdd(d.valueOf(r.y).selfSubtract(n.y).selfMultiply(t)).doubleValue();return new m(s,o)},yu.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),t=(t.y-n.y)*(e.x-n.x),e=i-t;if(0<i){if(t<=0)return yu.signum(e);r=i+t}else{if(!(i<0))return yu.signum(e);if(0<=t)return yu.signum(e);r=-i-t}n=yu.DP_SAFE_EPSILON*r;return n<=e||n<=-e?yu.signum(e):2},yu.signum=function(t){return 0<t?1:t<0?-1:0},e.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(yu,e),{X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}}),Eu=(e.X.get=function(){return 0},e.Y.get=function(){return 1},e.Z.get=function(){return 2},e.M.get=function(){return 3},y.prototype.setOrdinate=function(t,e,n){},y.prototype.size=function(){},y.prototype.getOrdinate=function(t,e){},y.prototype.getCoordinate=function(){},y.prototype.getCoordinateCopy=function(t){},y.prototype.getDimension=function(){},y.prototype.getX=function(t){},y.prototype.clone=function(){},y.prototype.expandEnvelope=function(t){},y.prototype.copy=function(){},y.prototype.getY=function(t){},y.prototype.toCoordinateArray=function(){},y.prototype.interfaces_=function(){return[uu]},y.prototype.getClass=function(){return y},Object.defineProperties(y,e),(vu=_u)&&(bu.__proto__=vu),((bu.prototype=Object.create(vu&&vu.prototype)).constructor=bu).prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu},bu);function bu(){vu.call(this,"Projective point not representable on the Cartesian plane.")}mu.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},mu.getProperty=function(t){return{"line.separator":"\n"}[t]};function wu(){var t,e,n,r,i,o,s;this.x=null,this.y=null,this.w=null,0===arguments.length?(this.x=0,this.y=0,this.w=1):1===arguments.length?(this.x=(t=arguments[0]).x,this.y=t.y,this.w=1):2===arguments.length?"number"==typeof arguments[0]&&"number"==typeof arguments[1]?(t=arguments[0],r=arguments[1],this.x=t,this.y=r,this.w=1):arguments[0]instanceof wu&&arguments[1]instanceof wu?(this.x=(t=arguments[0]).y*(r=arguments[1]).w-r.y*t.w,this.y=r.x*t.w-t.x*r.w,this.w=t.x*r.y-r.x*t.y):arguments[0]instanceof m&&arguments[1]instanceof m&&(this.x=(r=arguments[0]).y-(t=arguments[1]).y,this.y=t.x-r.x,this.w=r.x*t.y-t.x*r.y):3===arguments.length?(t=arguments[0],r=arguments[1],e=arguments[2],this.x=t,this.y=r,this.w=e):4===arguments.length&&(e=(t=arguments[0]).y-(r=arguments[1]).y,n=r.x-t.x,r=t.x*r.y-r.x*t.y,i=(t=arguments[2]).y-(s=arguments[3]).y,o=s.x-t.x,s=t.x*s.y-s.x*t.y,this.x=n*s-o*r,this.y=i*r-e*s,this.w=e*o-i*n)}function u(){var t,e;this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length?this.init():1===arguments.length?arguments[0]instanceof m?this.init((t=arguments[0]).x,t.x,t.y,t.y):arguments[0]instanceof u&&this.init(arguments[0]):2===arguments.length?this.init((t=arguments[0]).x,(e=arguments[1]).x,t.y,e.y):4===arguments.length&&this.init(arguments[0],arguments[1],arguments[2],arguments[3])}wu.prototype.getY=function(){var t=this.y/this.w;if(h.isNaN(t)||h.isInfinite(t))throw new Eu;return t},wu.prototype.getX=function(){var t=this.x/this.w;if(h.isNaN(t)||h.isInfinite(t))throw new Eu;return t},wu.prototype.getCoordinate=function(){var t=new m;return t.x=this.getX(),t.y=this.getY(),t},wu.prototype.interfaces_=function(){return[]},wu.prototype.getClass=function(){return wu},wu.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,e=t.x*e.y-e.x*t.y,t=n.y-r.y,s=r.x-n.x,r=n.x*r.y-r.x*n.y,n=i*s-t*o,o=(o*r-s*e)/n,s=(t*e-i*r)/n;if(h.isNaN(o)||h.isInfinite(o)||h.isNaN(s)||h.isInfinite(s))throw new Eu;return new m(o,s)};function Iu(t){this.geometryFactory=t||new A}function Nu(t){this.parser=new Iu(t)}function x(){}var Su,Cu,e={serialVersionUID:{configurable:!0}},Pu=(u.prototype.getArea=function(){return this.getWidth()*this.getHeight()},u.prototype.equals=function(t){return t instanceof u&&(t=t,this.isNull()?t.isNull():this._maxx===t.getMaxX()&&this._maxy===t.getMaxY()&&this._minx===t.getMinX()&&this._miny===t.getMinY())},u.prototype.intersection=function(t){var e,n,r;return this.isNull()||t.isNull()||!this.intersects(t)?new u:(e=(this._minx>t._minx?this:t)._minx,n=(this._miny>t._miny?this:t)._miny,r=(this._maxx<t._maxx?this:t)._maxx,t=(this._maxy<t._maxy?this:t)._maxy,new u(e,r,n,t))},u.prototype.isNull=function(){return this._maxx<this._minx},u.prototype.getMaxX=function(){return this._maxx},u.prototype.covers=function(){var t,e;return 1===arguments.length?arguments[0]instanceof m?this.covers((t=arguments[0]).x,t.y):arguments[0]instanceof u?(t=arguments[0],!this.isNull()&&!t.isNull()&&t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy):void 0:2===arguments.length?(t=arguments[0],e=arguments[1],!this.isNull()&&t>=this._minx&&t<=this._maxx&&e>=this._miny&&e<=this._maxy):void 0},u.prototype.intersects=function(){var t,e;return 1===arguments.length?arguments[0]instanceof u?(t=arguments[0],!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)):arguments[0]instanceof m?this.intersects((t=arguments[0]).x,t.y):void 0:2===arguments.length?(t=arguments[0],e=arguments[1],!this.isNull()&&!(t>this._maxx||t<this._minx||e>this._maxy||e<this._miny)):void 0},u.prototype.getMinY=function(){return this._miny},u.prototype.getMinX=function(){return this._minx},u.prototype.expandToInclude=function(){var t;if(1===arguments.length){if(arguments[0]instanceof m){var e=arguments[0];this.expandToInclude(e.x,e.y)}else if(arguments[0]instanceof u){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else 2===arguments.length&&(e=arguments[0],t=arguments[1],this.isNull()?(this._minx=e,this._maxx=e,this._miny=t,this._maxy=t):(e<this._minx&&(this._minx=e),e>this._maxx&&(this._maxx=e),t<this._miny&&(this._miny=t),t>this._maxy&&(this._maxy=t)))},u.prototype.minExtent=function(){var t,e;return this.isNull()?0:(t=this.getWidth())<(e=this.getHeight())?t:e},u.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},u.prototype.compareTo=function(t){return this.isNull()?t.isNull()?0:-1:t.isNull()?1:this._minx<t._minx?-1:this._minx>t._minx?1:this._miny<t._miny?-1:this._miny>t._miny?1:this._maxx<t._maxx?-1:this._maxx>t._maxx?1:this._maxy<t._maxy?-1:this._maxy>t._maxy?1:0},u.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},u.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},u.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},u.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},u.prototype.maxExtent=function(){var t,e;return this.isNull()?0:(t=this.getWidth(),(e=this.getHeight())<t?t:e)},u.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var t=arguments[0],e=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=e,this._maxy+=e,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},u.prototype.contains=function(){return 1===arguments.length?arguments[0]instanceof u||arguments[0]instanceof m?this.covers(arguments[0]):void 0:2===arguments.length?this.covers(arguments[0],arguments[1]):void 0},u.prototype.centre=function(){return this.isNull()?null:new m((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},u.prototype.init=function(){var t,e,n,r;0===arguments.length?this.setToNull():1===arguments.length?arguments[0]instanceof m?this.init((t=arguments[0]).x,t.x,t.y,t.y):arguments[0]instanceof u&&(this._minx=(t=arguments[0])._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy):2===arguments.length?this.init((t=arguments[0]).x,(e=arguments[1]).x,t.y,e.y):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],t<e?(this._minx=t,this._maxx=e):(this._minx=e,this._maxx=t),n<r?(this._miny=n,this._maxy=r):(this._miny=r,this._maxy=n))},u.prototype.getMaxY=function(){return this._maxy},u.prototype.distance=function(t){var e,n;return this.intersects(t)?0:(e=0,this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx),n=0,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))},u.prototype.hashCode=function(){return 37*(37*(37*(629+m.hashCode(this._minx))+m.hashCode(this._maxx))+m.hashCode(this._miny))+m.hashCode(this._maxy)},u.prototype.interfaces_=function(){return[au,hu]},u.prototype.getClass=function(){return u},u.intersects=function(){var t,e,n,r,i,o,s,a;return 3===arguments.length?(e=arguments[0],n=arguments[1],(t=arguments[2]).x>=(e.x<n.x?e:n).x&&t.x<=(e.x>n.x?e:n).x&&t.y>=(e.y<n.y?e:n).y&&t.y<=(e.y>n.y?e:n).y):4===arguments.length?(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],i=Math.min(n.x,r.x),o=Math.max(n.x,r.x),s=Math.min(t.x,e.x),a=Math.max(t.x,e.x),!(o<s||a<i||(i=Math.min(n.y,r.y),o=Math.max(n.y,r.y),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),o<s)||a<i)):void 0},e.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(u,e),{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*$/}),Mu=(Iu.prototype.read=function(t){t=t.replace(/[\n\r]/g," ");var e,n,r=Pu.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((r=Pu.emptyTypeStr.exec(t))[2]=void 0),void 0===(e=r&&(n=r[1].toLowerCase(),r=r[2],Lu[n])?Lu[n].apply(this,[r]):e))throw new Error("Could not parse WKT "+t);return e},Iu.prototype.write=function(t){return this.extractGeometry(t)},Iu.prototype.extractGeometry=function(t){var e,n=t.getGeometryType().toLowerCase();return Mu[n]?(e=n.toUpperCase(),t.isEmpty()?e+" EMPTY":e+"("+Mu[n].apply(this,[t])+")"):null},{coordinate:function(t){return t.x+" "+t.y},point:function(t){return Mu.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+Mu.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(Mu.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(Mu.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("("+Mu.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+Mu.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+Mu.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("("+Mu.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(",")}}),Lu={point:function(t){return void 0===t?this.geometryFactory.createPoint():(t=t.trim().split(Pu.spaces),this.geometryFactory.createPoint(new m(Number.parseFloat(t[0]),Number.parseFloat(t[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(Pu.trimParens,"$1"),r.push(Lu.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(Pu.spaces),r.push(new m(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(Pu.spaces),r.push(new m(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(Pu.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Pu.trimParens,"$1"),r.push(Lu.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e;if(void 0===t)return this.geometryFactory.createPolygon();for(var n,r=t.trim().split(Pu.parenComma),i=[],o=0,s=r.length;o<s;++o)e=r[o].replace(Pu.trimParens,"$1"),e=Lu.linestring.apply(this,[e]),e=this.geometryFactory.createLinearRing(e._points),0===o?n=e:i.push(e);return this.geometryFactory.createPolygon(n,i)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(Pu.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(Pu.trimParens,"$1"),r.push(Lu.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)}},Ou=(Nu.prototype.write=function(t){return this.parser.write(t)},Nu.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"},(Cu=Error)&&(Au.__proto__=Cu),(Au.prototype=Object.create(Cu&&Cu.prototype)).constructor=Au),Ru=((Su=Ou)&&(Tu.__proto__=Su),((Tu.prototype=Object.create(Su&&Su.prototype)).constructor=Tu).prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu},Tu);function Tu(){Su.call(this),0===arguments.length?Su.call(this):1===arguments.length&&Su.call(this,arguments[0])}function Au(t){Cu.call(this,t),this.name="RuntimeException",this.message=t,this.stack=(new Cu).stack}x.prototype.interfaces_=function(){return[]},x.prototype.getClass=function(){return x},x.shouldNeverReachHere=function(){var t;if(0===arguments.length)x.shouldNeverReachHere(null);else if(1===arguments.length)throw new Ru("Should never reach here"+(null!==(t=arguments[0])?": "+t:""))},x.isTrue=function(){var t;if(1===arguments.length)x.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new Ru:new Ru(t)},x.equals=function(){var t,e,n;if(2===arguments.length)x.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 Ru("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};function Du(){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 m,this._intPt[1]=new m,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}function Fu(){}var ku,e={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}},Gu=(Du.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},Du.prototype.getTopologySummary=function(){var t=new fu;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},Du.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)},Du.prototype.getIntersectionNum=function(){return this._result},Du.prototype.computeIntLineIndex=function(){var t,e;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&&(e=this.getEdgeDistance(t=arguments[0],0),this.getEdgeDistance(t,1)<e?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0))},Du.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Du.prototype.setPrecisionModel=function(t){this._precisionModel=t},Du.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}},Du.prototype.getIntersection=function(t){return this._intPt[t]},Du.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Du.prototype.hasIntersection=function(){return this._result!==Du.NO_INTERSECTION},Du.prototype.getEdgeDistance=function(t,e){return Du.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},Du.prototype.isCollinear=function(){return this._result===Du.COLLINEAR_INTERSECTION},Du.prototype.toString=function(){return Nu.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Nu.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Du.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},Du.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},Du.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},Du.prototype.interfaces_=function(){return[]},Du.prototype.getClass=function(){return Du},Du.computeEdgeDistance=function(t,e,n){var r,i=Math.abs(n.x-e.x),o=Math.abs(n.y-e.y),s=-1;return t.equals(e)?s=0:t.equals(n)?s=o<i?i:o:(n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),0!==(s=o<i?n:r)||t.equals(e)||(s=Math.max(n,r))),x.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s},Du.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,r=Math.sqrt(r*r+i*i);return x.isTrue(!(0===r&&!t.equals(e)),"Invalid distance calculation"),r},e.DONT_INTERSECT.get=function(){return 0},e.DO_INTERSECT.get=function(){return 1},e.COLLINEAR.get=function(){return 2},e.NO_INTERSECTION.get=function(){return 0},e.POINT_INTERSECTION.get=function(){return 1},e.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Du,e),(ku=Du)&&(qu.__proto__=ku),((qu.prototype=Object.create(ku&&ku.prototype)).constructor=qu).prototype.isInSegmentEnvelopes=function(t){var e=new u(this._inputLines[0][0],this._inputLines[0][1]),n=new u(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},qu.prototype.computeIntersection=function(){var t,e,n;return 3!==arguments.length?ku.prototype.computeIntersection.apply(this,arguments):(t=arguments[0],e=arguments[1],n=arguments[2],this._isProper=!1,u.intersects(e,n,t)&&0===b.orientationIndex(e,n,t)&&0===b.orientationIndex(n,e,t)?(this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=ku.POINT_INTERSECTION,null):void(this._result=ku.NO_INTERSECTION))},qu.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},qu.prototype.safeHCoordinateIntersection=function(e,n,r,i){var o=null;try{o=wu.intersection(e,n,r,i)}catch(t){if(!(t instanceof Eu))throw t;o=qu.nearestEndpoint(e,n,r,i)}return o},qu.prototype.intersection=function(t,e,n,r){var i=this.intersectionWithNormalization(t,e,n,r);return this.isInSegmentEnvelopes(i)||(i=new m(qu.nearestEndpoint(t,e,n,r))),null!==this._precisionModel&&this._precisionModel.makePrecise(i),i},qu.prototype.smallestInAbsValue=function(t,e,n,r){var i=Math.abs(t);return Math.abs(e)<i&&(t=e,i=Math.abs(e)),Math.abs(n)<i&&(t=n,i=Math.abs(n)),t=Math.abs(r)<i?r:t},qu.prototype.checkDD=function(t,e,n,r,i){t=yu.intersection(t,e,n,r),e=this.isInSegmentEnvelopes(t);mu.out.println("DD in env = "+e+"  --------------------- "+t),1e-4<i.distance(t)&&mu.out.println("Distance = "+i.distance(t))},qu.prototype.intersectionWithNormalization=function(t,e,n,r){var t=new m(t),e=new m(e),n=new m(n),r=new m(r),i=new m,t=(this.normalizeToEnvCentre(t,e,n,r,i),this.safeHCoordinateIntersection(t,e,n,r));return t.x+=i.x,t.y+=i.y,t},qu.prototype.computeCollinearIntersection=function(t,e,n,r){var i=u.intersects(t,e,n),o=u.intersects(t,e,r),s=u.intersects(n,r,t),a=u.intersects(n,r,e);return i&&o?(this._intPt[0]=n,this._intPt[1]=r,ku.COLLINEAR_INTERSECTION):s&&a?(this._intPt[0]=t,this._intPt[1]=e,ku.COLLINEAR_INTERSECTION):i&&s?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||o||a?ku.COLLINEAR_INTERSECTION:ku.POINT_INTERSECTION):i&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||o||s?ku.COLLINEAR_INTERSECTION:ku.POINT_INTERSECTION):o&&s?(this._intPt[0]=r,this._intPt[1]=t,!r.equals(t)||i||a?ku.COLLINEAR_INTERSECTION:ku.POINT_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||i||s?ku.COLLINEAR_INTERSECTION:ku.POINT_INTERSECTION):ku.NO_INTERSECTION},qu.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=(t.x<e.x?t:e).x,s=(t.y<e.y?t:e).y,a=(t.x>e.x?t:e).x,u=(t.y>e.y?t:e).y,l=(n.x<r.x?n:r).x,h=(n.y<r.y?n:r).y,c=(n.x>r.x?n:r).x,p=(n.y>r.y?n:r).y,s=((h<s?s:h)+(u<p?u:p))/2;i.x=((l<o?o:l)+(a<c?a:c))/2,i.y=s,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},qu.prototype.computeIntersect=function(t,e,n,r){var i,o,s,a;return this._isProper=!1,!u.intersects(t,e,n,r)||(i=b.orientationIndex(t,e,n),o=b.orientationIndex(t,e,r),0<i&&0<o)||i<0&&o<0||(s=b.orientationIndex(n,r,t),a=b.orientationIndex(n,r,e),0<s&&0<a)||s<0&&a<0?ku.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 m(n):0===o?this._intPt[0]=new m(r):0===s?this._intPt[0]=new m(t):0===a&&(this._intPt[0]=new m(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,r)),ku.POINT_INTERSECTION)},qu.prototype.interfaces_=function(){return[]},qu.prototype.getClass=function(){return qu},qu.nearestEndpoint=function(t,e,n,r){var i=t,o=b.distancePointLine(t,n,r),s=b.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=b.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=b.distancePointLine(r,t,e))<o&&(o=s,i=r),i},qu);function qu(){ku.apply(this,arguments)}Fu.prototype.interfaces_=function(){return[]},Fu.prototype.getClass=function(){return Fu},Fu.orientationIndex=function(t,e,n){var r=e.x-t.x,t=e.y-t.y,i=n.x-e.x,n=n.y-e.y;return Fu.signOfDet2x2(r,t,i,n)},Fu.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(t>(n-=i*t)+n){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(n>(t-=i*n)+t){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 Bu(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1,this._p=arguments[0]}function zu(){}function E(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()}function ju(){}function Uu(){}function Vu(){}Bu.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)return n=t.x,(r=e.x)<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 n=t.x-this._p.x,r=t.y-this._p.y,t=e.x-this._p.x,e=e.y-this._p.y,n=Fu.signOfDet2x2(n,r,t,e);if(0===n)return this._isPointOnSegment=!0,null;0<(n=e<r?-n:n)&&this._crossingCount++}},Bu.prototype.isPointInPolygon=function(){return this.getLocation()!==g.EXTERIOR},Bu.prototype.getLocation=function(){return this._isPointOnSegment?g.BOUNDARY:this._crossingCount%2==1?g.INTERIOR:g.EXTERIOR},Bu.prototype.isOnSegment=function(){return this._isPointOnSegment},Bu.prototype.interfaces_=function(){return[]},Bu.prototype.getClass=function(){return Bu},Bu.locatePointInRing=function(){if(arguments[0]instanceof m&&v(arguments[1],y)){for(var t=arguments[0],e=arguments[1],n=new Bu(t),r=new m,i=new m,o=1;o<e.size();o++)if(e.getCoordinate(o,r),e.getCoordinate(o-1,i),n.countSegment(r,i),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof m&&arguments[1]instanceof Array){for(var t=arguments[0],s=arguments[1],a=new Bu(t),u=1;u<s.length;u++){var l=s[u],h=s[u-1];if(a.countSegment(l,h),a.isOnSegment())return a.getLocation()}return a.getLocation()}};var b=function(){},e={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}},e=(b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.orientationIndex=function(t,e,n){return yu.orientationIndex(t,e,n)},b.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(v(arguments[0],y)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new m,l=new m,h=new m,c=(s.getCoordinate(0,l),s.getCoordinate(1,h),l.x);h.x-=c;for(var p=0,f=1;f<a-1;f++)u.y=l.y,l.x=h.x,l.y=h.y,s.getCoordinate(f+1,h),h.x-=c,p+=l.x*(u.y-h.y);return p/2}},b.distanceLineLine=function(t,e,n,r){var i,o,s,a;return t.equals(e)?b.distancePointLine(t,n,r):n.equals(r)?b.distancePointLine(r,t,e):(i=!1,(i=!u.intersects(t,e,n,r)||0==(o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x))||(a=(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))/o,(a=a/o)<0)||1<a||s<0||1<s?!0:i)?pu.min(b.distancePointLine(t,n,r),b.distancePointLine(e,n,r),b.distancePointLine(n,t,e),b.distancePointLine(r,t,e)):0)},b.isPointInRing=function(t,e){return b.locatePointInRing(t,e)!==g.EXTERIOR},b.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new m;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,l=a-i,h=u-o;n+=Math.sqrt(l*l+h*h),i=a,o=u}return n},b.isCCW=function(t){var e=t.length-1;if(e<3)throw new ou("Ring has fewer than 4 points, so orientation cannot be determined");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;t[s=--s<0?e:s].equals2D(n)&&s!==r;);for(var a=r;t[a=(a+1)%e].equals2D(n)&&a!==r;);var u,l=t[s],h=t[a];return!(l.equals2D(n)||h.equals2D(n)||l.equals2D(h))&&(0===(u=b.computeOrientation(l,n,h))?l.x>h.x:0<u)},b.locatePointInRing=function(t,e){return Bu.locatePointInRing(t,e)},b.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),t=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(t)*Math.sqrt(r)},b.computeOrientation=function(t,e,n){return b.orientationIndex(t,e,n)},b.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new ou("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=b.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}var o,s,a,u,l;if(3===arguments.length)return o=arguments[0],(s=arguments[1]).x===(a=arguments[2]).x&&s.y===a.y||(u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),(l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u)<=0)?o.distance(s):1<=l?o.distance(a):(l=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u,Math.abs(l)*Math.sqrt(u))},b.isOnLine=function(t,e){for(var n=new Gu,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},e.CLOCKWISE.get=function(){return-1},e.RIGHT.get=function(){return b.CLOCKWISE},e.COUNTERCLOCKWISE.get=function(){return 1},e.LEFT.get=function(){return b.COUNTERCLOCKWISE},e.COLLINEAR.get=function(){return 0},e.STRAIGHT.get=function(){return b.COLLINEAR},Object.defineProperties(b,e),zu.prototype.filter=function(t){},zu.prototype.interfaces_=function(){return[]},zu.prototype.getClass=function(){return zu},{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}}),Xu=(E.prototype.isGeometryCollection=function(){return this.getSortIndex()===E.SORTINDEX_GEOMETRYCOLLECTION},E.prototype.getFactory=function(){return this._factory},E.prototype.getGeometryN=function(t){return this},E.prototype.getArea=function(){return 0},E.prototype.isRectangle=function(){return!1},E.prototype.equals=function(){var t;return arguments[0]instanceof E?null!==(t=arguments[0])&&this.equalsTopo(t):arguments[0]instanceof Object?(t=arguments[0])instanceof E&&this.equalsExact(t):void 0},E.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},E.prototype.geometryChanged=function(){this.apply(E.geometryChangedFilter)},E.prototype.geometryChangedAction=function(){this._envelope=null},E.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},E.prototype.getLength=function(){return 0},E.prototype.getNumGeometries=function(){return 1},E.prototype.compareTo=function(){var t,e;return 1===arguments.length?(t=e=arguments[0],this.getSortIndex()!==t.getSortIndex()?this.getSortIndex()-t.getSortIndex():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e)):2===arguments.length?(t=arguments[0],e=arguments[1],this.getSortIndex()!==t.getSortIndex()?this.getSortIndex()-t.getSortIndex():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(t,e)):void 0},E.prototype.getUserData=function(){return this._userData},E.prototype.getSRID=function(){return this._SRID},E.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},E.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===E.SORTINDEX_GEOMETRYCOLLECTION)throw new ou("This method does not support GeometryCollection arguments")},E.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},E.prototype.norm=function(){var t=this.copy();return t.normalize(),t},E.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},E.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new u(this._envelope)},E.prototype.setSRID=function(t){this._SRID=t},E.prototype.setUserData=function(t){this._userData=t},E.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),i=i.compareTo(o);if(0!==i)return i}return n.hasNext()?1:r.hasNext()?-1:0},E.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},E.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===E.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===E.SORTINDEX_MULTIPOINT||this.getSortIndex()===E.SORTINDEX_MULTILINESTRING||this.getSortIndex()===E.SORTINDEX_MULTIPOLYGON},E.prototype.interfaces_=function(){return[uu,au,hu]},E.prototype.getClass=function(){return E},E.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},E.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},e.serialVersionUID.get=function(){return 0x799ea46522854c00},e.SORTINDEX_POINT.get=function(){return 0},e.SORTINDEX_MULTIPOINT.get=function(){return 1},e.SORTINDEX_LINESTRING.get=function(){return 2},e.SORTINDEX_LINEARRING.get=function(){return 3},e.SORTINDEX_MULTILINESTRING.get=function(){return 4},e.SORTINDEX_POLYGON.get=function(){return 5},e.SORTINDEX_MULTIPOLYGON.get=function(){return 6},e.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},e.geometryChangedFilter.get=function(){return Xu},Object.defineProperties(E,e),function(){}),e=(Xu.interfaces_=function(){return[zu]},Xu.filter=function(t){t.geometryChangedAction()},ju.prototype.filter=function(t){},ju.prototype.interfaces_=function(){return[]},ju.prototype.getClass=function(){return ju},{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}}),Yu=(Uu.prototype.isInBoundary=function(t){},Uu.prototype.interfaces_=function(){return[]},Uu.prototype.getClass=function(){return Uu},e.Mod2BoundaryNodeRule.get=function(){return Yu},e.EndPointBoundaryNodeRule.get=function(){return Hu},e.MultiValentEndPointBoundaryNodeRule.get=function(){return Wu},e.MonoValentEndPointBoundaryNodeRule.get=function(){return Ju},e.MOD2_BOUNDARY_RULE.get=function(){return new Yu},e.ENDPOINT_BOUNDARY_RULE.get=function(){return new Hu},e.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Wu},e.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ju},e.OGC_SFS_BOUNDARY_RULE.get=function(){return Uu.MOD2_BOUNDARY_RULE},Object.defineProperties(Uu,e),function(){}),Hu=(Yu.prototype.isInBoundary=function(t){return t%2==1},Yu.prototype.interfaces_=function(){return[Uu]},Yu.prototype.getClass=function(){return Yu},function(){}),Wu=(Hu.prototype.isInBoundary=function(t){return 0<t},Hu.prototype.interfaces_=function(){return[Uu]},Hu.prototype.getClass=function(){return Hu},function(){}),Ju=(Wu.prototype.isInBoundary=function(t){return 1<t},Wu.prototype.interfaces_=function(){return[Uu]},Wu.prototype.getClass=function(){return Wu},function(){});Ju.prototype.isInBoundary=function(t){return 1===t},Ju.prototype.interfaces_=function(){return[Uu]},Ju.prototype.getClass=function(){return Ju};function Zu(t){this.message=t||""}Vu.prototype.add=function(){},Vu.prototype.addAll=function(){},Vu.prototype.isEmpty=function(){},Vu.prototype.iterator=function(){},Vu.prototype.size=function(){},Vu.prototype.toArray=function(){},Vu.prototype.remove=function(){},(Zu.prototype=new Error).name="IndexOutOfBoundsException";function Ku(){}Ku.prototype.hasNext=function(){},Ku.prototype.next=function(){},Ku.prototype.remove=function(){},(Qu=Vu)&&(tl.__proto__=Qu),((tl.prototype=Object.create(Qu&&Qu.prototype)).constructor=tl).prototype.get=function(){},tl.prototype.set=function(){},tl.prototype.isEmpty=function(){};var Qu,$u=tl;function tl(){Qu.apply(this,arguments)}function el(t){this.message=t||""}(el.prototype=new Error).name="NoSuchElementException";function w(){}(il=$u)&&(ll.__proto__=il),((ll.prototype=Object.create(il&&il.prototype)).constructor=ll).prototype.ensureCapacity=function(){},ll.prototype.interfaces_=function(){return[il,Vu]},ll.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(t,arguments[1]),!0},ll.prototype.clear=function(){this.array_=[]},ll.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},ll.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},ll.prototype.iterator=function(){return new ol(this)},ll.prototype.get=function(t){if(t<0||t>=this.size())throw new Zu;return this.array_[t]},ll.prototype.isEmpty=function(){return 0===this.array_.length},ll.prototype.size=function(){return this.array_.length},ll.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},ll.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};var nl,rl,il,I=ll,ol=((rl=Ku)&&(ul.__proto__=rl),((ul.prototype=Object.create(rl&&rl.prototype)).constructor=ul).prototype.next=function(){if(this.position_===this.arrayList_.size())throw new el;return this.arrayList_.get(this.position_++)},ul.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},ul.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},ul.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},ul),sl=((nl=I)&&(al.__proto__=nl),(al.prototype=Object.create(nl&&nl.prototype)).constructor=al,(e={coordArrayType:{configurable:!0}}).coordArrayType.get=function(){return new Array(0).fill(null)},al.prototype.getCoordinate=function(t){return this.get(t)},al.prototype.addAll=function(){if(2!==arguments.length)return nl.prototype.addAll.apply(this,arguments);for(var t=arguments[0],e=arguments[1],n=!1,r=t.iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n},al.prototype.clone=function(){for(var t=nl.prototype.clone.call(this),e=0;e<this.size();e++)t.add(e,this.get(e).copy());return t},al.prototype.toCoordinateArray=function(){return this.toArray(al.coordArrayType)},al.prototype.add=function(){if(1===arguments.length)nl.prototype.add.call(this,arguments[0]);else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1])return this.add(arguments[0],arguments[1],!0),!0;if(arguments[0]instanceof m&&"boolean"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(!e&&1<=this.size())if(this.get(this.size()-1).equals2D(t))return null;nl.prototype.add.call(this,t)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1])return this.add(arguments[0],arguments[1]),!0}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],r=arguments[1];if(arguments[2])for(var i=0;i<n.length;i++)this.add(n[i],r);else for(var o=n.length-1;0<=o;o--)this.add(n[o],r);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof m){e=arguments[0],t=arguments[1];if(!arguments[2]){var s=this.size();if(0<s){if(0<e)if(this.get(e-1).equals2D(t))return null;if(e<s)if(this.get(e).equals2D(t))return null}}nl.prototype.add.call(this,e,t)}}else if(4===arguments.length){var a=arguments[0],u=arguments[1],s=arguments[2],l=arguments[3],h=1;l<s&&(h=-1);for(var c=s;c!==l;c+=h)this.add(a[c],u);return!0}},al.prototype.closeRing=function(){0<this.size()&&this.add(new m(this.get(0)),!1)},al.prototype.interfaces_=function(){return[]},al.prototype.getClass=function(){return al},Object.defineProperties(al,e),al),e={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};function al(){var t,e;nl.call(this),0!==arguments.length&&(1===arguments.length?(this.ensureCapacity((t=arguments[0]).length),this.add(t,!0)):2===arguments.length&&(t=arguments[0],e=arguments[1],this.ensureCapacity(t.length),this.add(t,e)))}function ul(t){rl.call(this),this.arrayList_=t,this.position_=0}function ll(){il.call(this),this.array_=[],arguments[0]instanceof Vu&&this.addAll(arguments[0])}e.ForwardComparator.get=function(){return pl},e.BidirectionalComparator.get=function(){return fl},e.coordArrayType.get=function(){return new Array(0).fill(null)},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},w.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},w.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(w.indexOf(r,e)<0)return r}return null},w.scroll=function(t,e){e=w.indexOf(e,t);if(e<0)return null;var n=new Array(t.length).fill(null);mu.arraycopy(t,e,n,0,t.length-e),mu.arraycopy(t,0,n,t.length-e,e),mu.arraycopy(n,0,t,0,t.length)},w.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t!==e){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){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}},w.intersection=function(t,e){for(var n=new sl,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},w.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},w.removeRepeatedPoints=function(t){return w.hasRepeatedPoints(t)?new sl(t,!1).toCoordinateArray():t},w.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}},w.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)for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},w.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 m(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 m(r[i+u])},w.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},w.envelope=function(t){for(var e=new u,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},w.toCoordinateArray=function(t){return t.toArray(w.coordArrayType)},w.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},w.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},w.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,n=t[e].compareTo(t[n]);if(0!==n)return n}return 1},w.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},w.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},w.extract=function(t,e,n){e=pu.clamp(e,0,t.length);var r=(n=pu.clamp(n,-1,t.length))-e+1,i=(n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0),new Array(r).fill(null));if(0!==r)for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(w,e);function hl(){}var cl,pl=function(){},fl=(pl.prototype.compare=function(t,e){return w.compare(t,e)},pl.prototype.interfaces_=function(){return[lu]},pl.prototype.getClass=function(){return pl},function(){}),e=(fl.prototype.compare=function(t,e){var n;return t.length<e.length?-1:t.length>e.length?1:0===t.length||(n=w.compare(t,e),w.isEqualReversed(t,e))?0:n},fl.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)for(var i=w.increasingDirection(n),o=w.increasingDirection(r),s=0<i?0:n.length-1,a=0<o?0:n.length-1,u=0;u<n.length;u++){var l=n[s].compareTo(r[a]);if(0!==l)return l;s+=i,a+=o}return 0},fl.prototype.interfaces_=function(){return[lu]},fl.prototype.getClass=function(){return fl},hl.prototype.get=function(){},hl.prototype.put=function(){},hl.prototype.size=function(){},hl.prototype.values=function(){},hl.prototype.entrySet=function(){},(cl=hl)&&(gl.__proto__=cl),(gl.prototype=Object.create(cl&&cl.prototype)).constructor=gl);function gl(){cl.apply(this,arguments)}function dl(t){this.message=t||""}function yl(){}(dl.prototype=new Error).name="OperationNotSupported",(yl.prototype=new Vu).contains=function(){};(ml=yl)&&(bl.__proto__=ml),((bl.prototype=Object.create(ml&&ml.prototype)).constructor=bl).prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e]===t)return!0;return!1},bl.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},bl.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},bl.prototype.remove=function(t){throw new Error},bl.prototype.size=function(){return this.array_.length},bl.prototype.isEmpty=function(){return 0===this.array_.length},bl.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},bl.prototype.iterator=function(){return new xl(this)};var _l,ml,vl=bl,xl=((_l=Ku)&&(El.__proto__=_l),((El.prototype=Object.create(_l&&_l.prototype)).constructor=El).prototype.next=function(){if(this.position_===this.hashSet_.size())throw new el;return this.hashSet_.array_[this.position_++]},El.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},El.prototype.remove=function(){throw new dl},El);function El(t){_l.call(this),this.hashSet_=t,this.position_=0}function bl(){ml.call(this),this.array_=[],arguments[0]instanceof Vu&&this.addAll(arguments[0])}function wl(t){return null===t?0:t.color}function Il(t){return null===t?null:t.parent}function Nl(t,e){null!==t&&(t.color=e)}function Sl(t){return null===t?null:t.left}function Cl(t){return null===t?null:t.right}function Pl(){this.root_=null,this.size_=0}(Pl.prototype=new e).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},Pl.prototype.put=function(t,e){if(null===this.root_)this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1;else{var n,r,i,o=this.root_;do{if(n=o,(r=t.compareTo(o.key))<0)o=o.left;else{if(!(0<r))return i=o.value,o.value=e,i;o=o.right}}while(null!==o);var s={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++}return null},Pl.prototype.fixAfterInsertion=function(t){var e;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)Il(t)===Sl(Il(Il(t)))?1===wl(e=Cl(Il(Il(t))))?(Nl(Il(t),0),Nl(e,0),Nl(Il(Il(t)),1),t=Il(Il(t))):(t===Cl(Il(t))&&(t=Il(t),this.rotateLeft(t)),Nl(Il(t),0),Nl(Il(Il(t)),1),this.rotateRight(Il(Il(t)))):1===wl(e=Sl(Il(Il(t))))?(Nl(Il(t),0),Nl(e,0),Nl(Il(Il(t)),1),t=Il(Il(t))):(t===Sl(Il(t))&&(t=Il(t),this.rotateRight(t)),Nl(Il(t),0),Nl(Il(Il(t)),1),this.rotateLeft(Il(Il(t))));this.root_.color=0},Pl.prototype.values=function(){var t=new I,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=Pl.successor(e));)t.add(e.value);return t},Pl.prototype.entrySet=function(){var t=new vl,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=Pl.successor(e));)t.add(e);return t},Pl.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)},Pl.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)},Pl.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},Pl.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},Pl.prototype.size=function(){return this.size_};function Ml(){}function Ll(){}function Ol(){this.array_=[],arguments[0]instanceof Vu&&this.addAll(arguments[0])}Ml.prototype.interfaces_=function(){return[]},Ml.prototype.getClass=function(){return Ml},Ll.prototype=new yl,(Ol.prototype=new Ll).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},Ol.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},Ol.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},Ol.prototype.remove=function(t){throw new dl},Ol.prototype.size=function(){return this.array_.length},Ol.prototype.isEmpty=function(){return 0===this.array_.length},Ol.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},Ol.prototype.iterator=function(){return new Gl(this)};function Rl(){}function Tl(){}function Al(){}function Dl(){}var Fl,kl,Gl=function(t){this.treeSet_=t,this.position_=0},e=(Gl.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new el;return this.treeSet_.array_[this.position_++]},Gl.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Gl.prototype.remove=function(){throw new dl},Rl.sort=function(){var t,e,n,r=arguments[0];if(1===arguments.length)r.sort(function(t,e){return t.compareTo(e)});else if(2===arguments.length)n=arguments[1],r.sort(function(t,e){return n.compare(t,e)});else if(3===arguments.length){(e=r.slice(arguments[1],arguments[2])).sort();var i=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length));for(r.splice(0,r.length),t=0;t<i.length;t++)r.push(i[t])}else if(4===arguments.length)for(e=r.slice(arguments[1],arguments[2]),n=arguments[3],e.sort(function(t,e){return n.compare(t,e)}),i=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length)),r.splice(0,r.length),t=0;t<i.length;t++)r.push(i[t])},Rl.asList=function(t){for(var e=new I,n=0,r=t.length;n<r;n++)e.add(t[n]);return e},{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}}),ql=(e.P.get=function(){return 0},e.L.get=function(){return 1},e.A.get=function(){return 2},e.FALSE.get=function(){return-1},e.TRUE.get=function(){return-2},e.DONTCARE.get=function(){return-3},e.SYM_FALSE.get=function(){return"F"},e.SYM_TRUE.get=function(){return"T"},e.SYM_DONTCARE.get=function(){return"*"},e.SYM_P.get=function(){return"0"},e.SYM_L.get=function(){return"1"},e.SYM_A.get=function(){return"2"},Tl.prototype.interfaces_=function(){return[]},Tl.prototype.getClass=function(){return Tl},Tl.toDimensionSymbol=function(t){switch(t){case Tl.FALSE:return Tl.SYM_FALSE;case Tl.TRUE:return Tl.SYM_TRUE;case Tl.DONTCARE:return Tl.SYM_DONTCARE;case Tl.P:return Tl.SYM_P;case Tl.L:return Tl.SYM_L;case Tl.A:return Tl.SYM_A}throw new ou("Unknown dimension value: "+t)},Tl.toDimensionValue=function(t){switch(du.toUpperCase(t)){case Tl.SYM_FALSE:return Tl.FALSE;case Tl.SYM_TRUE:return Tl.TRUE;case Tl.SYM_DONTCARE:return Tl.DONTCARE;case Tl.SYM_P:return Tl.P;case Tl.SYM_L:return Tl.L;case Tl.SYM_A:return Tl.A}throw new ou("Unknown dimension symbol: "+t)},Object.defineProperties(Tl,e),Al.prototype.filter=function(t){},Al.prototype.interfaces_=function(){return[]},Al.prototype.getClass=function(){return Al},Dl.prototype.filter=function(t,e){},Dl.prototype.isDone=function(){},Dl.prototype.isGeometryChanged=function(){},Dl.prototype.interfaces_=function(){return[]},Dl.prototype.getClass=function(){return Dl},(kl=E)&&(Ul.__proto__=kl),e={serialVersionUID:{configurable:!0}},((Ul.prototype=Object.create(kl&&kl.prototype)).constructor=Ul).prototype.computeEnvelopeInternal=function(){for(var t=new u,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},Ul.prototype.getGeometryN=function(t){return this._geometries[t]},Ul.prototype.getSortIndex=function(){return kl.SORTINDEX_GEOMETRYCOLLECTION},Ul.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},Ul.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},Ul.prototype.equalsExact=function(){if(2!==arguments.length)return kl.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},Ul.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();Rl.sort(this._geometries)},Ul.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},Ul.prototype.getBoundaryDimension=function(){for(var t=Tl.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},Ul.prototype.getDimension=function(){for(var t=Tl.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},Ul.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},Ul.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},Ul.prototype.getNumGeometries=function(){return this._geometries.length},Ul.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)},Ul.prototype.compareToSameClass=function(){var t;if(1===arguments.length)return t=arguments[0],e=new Ol(Rl.asList(this._geometries)),t=new Ol(Rl.asList(t._geometries)),this.compare(e,t);if(2===arguments.length){for(var e=arguments[0],n=arguments[1],r=e,i=this.getNumGeometries(),o=r.getNumGeometries(),s=0;s<i&&s<o;){var a=this.getGeometryN(s),u=r.getGeometryN(s),a=a.compareToSameClass(u,n);if(0!==a)return a;s++}return s<i?1:s<o?-1:0}},Ul.prototype.apply=function(){if(v(arguments[0],ju))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(v(arguments[0],Dl)){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(v(arguments[0],Al)){var i=arguments[0];i.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(i)}else if(v(arguments[0],zu)){var s=arguments[0];s.filter(this);for(var a=0;a<this._geometries.length;a++)this._geometries[a].apply(s)}},Ul.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),x.shouldNeverReachHere(),null},Ul.prototype.clone=function(){var t=kl.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},Ul.prototype.getGeometryType=function(){return"GeometryCollection"},Ul.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 Ul(t,this._factory)},Ul.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},Ul.prototype.interfaces_=function(){return[]},Ul.prototype.getClass=function(){return Ul},e.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(Ul,e),Ul),Bl=((Fl=ql)&&(jl.__proto__=Fl),e={serialVersionUID:{configurable:!0}},((jl.prototype=Object.create(Fl&&Fl.prototype)).constructor=jl).prototype.getSortIndex=function(){return E.SORTINDEX_MULTILINESTRING},jl.prototype.equalsExact=function(){var t,e;return 2===arguments.length?(t=arguments[0],e=arguments[1],!!this.isEquivalentClass(t)&&Fl.prototype.equalsExact.call(this,t,e)):Fl.prototype.equalsExact.apply(this,arguments)},jl.prototype.getBoundaryDimension=function(){return this.isClosed()?Tl.FALSE:0},jl.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},jl.prototype.getDimension=function(){return 1},jl.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)},jl.prototype.getBoundary=function(){return new zl(this).getBoundary()},jl.prototype.getGeometryType=function(){return"MultiLineString"},jl.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 jl(t,this._factory)},jl.prototype.interfaces_=function(){return[Ml]},jl.prototype.getClass=function(){return jl},e.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(jl,e),jl),zl=function(){var t,e;this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length?(e=Uu.MOD2_BOUNDARY_RULE,this._geom=t=arguments[0],this._geomFact=t.getFactory(),this._bnRule=e):2===arguments.length&&(t=arguments[0],e=arguments[1],this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e)};function jl(){Fl.apply(this,arguments)}function Ul(t,e){if(kl.call(this,e),this._geometries=t||[],kl.hasNullElements(this._geometries))throw new ou("geometries must not contain null elements")}zl.prototype.boundaryMultiLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():1===(t=this.computeBoundaryCoordinates(t)).length?this._geomFact.createPoint(t[0]):this._geomFact.createMultiPointFromCoords(t)},zl.prototype.getBoundary=function(){return this._geom instanceof $l?this.boundaryLineString(this._geom):this._geom instanceof Bl?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},zl.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()])},zl.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},zl.prototype.computeBoundaryCoordinates=function(t){var e=new I;this._endpointMap=new Pl;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 w.toCoordinateArray(e)},zl.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Vl,this._endpointMap.put(t,e)),e.count++},zl.prototype.interfaces_=function(){return[]},zl.prototype.getClass=function(){return zl},zl.getBoundary=function(){return 1===arguments.length?new zl(arguments[0]).getBoundary():2===arguments.length?new zl(arguments[0],arguments[1]).getBoundary():void 0};var Vl=function(){this.count=null};function Xl(){}Vl.prototype.interfaces_=function(){return[]},Vl.prototype.getClass=function(){return Vl};function Yl(){}function Hl(){}function Wl(){}function Jl(){}function Zl(){}function Kl(){}var Ql,e={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}},$l=(Jl.prototype.interfaces_=function(){return[]},Jl.prototype.getClass=function(){return Jl},Jl.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Jl.getStackTrace=function(){var t;if(1===arguments.length)return t=new Hl,e=new Xl,arguments[0].printStackTrace(e),t.toString();if(2===arguments.length){for(var e=arguments[0],n=arguments[1],r="",i=(Jl.getStackTrace(e),new Wl),o=0;o<n;o++)try{r+=i.readLine()+Jl.NEWLINE}catch(t){if(!!1)throw t;x.shouldNeverReachHere()}return r}},Jl.split=function(t,e){for(var n=e.length,r=new I,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},Jl.toString=function(){if(1===arguments.length)return Jl.SIMPLE_ORDINATE_FORMAT.format(arguments[0])},Jl.spaces=function(t){return Jl.chars(" ",t)},e.NEWLINE.get=function(){return mu.getProperty("line.separator")},e.SIMPLE_ORDINATE_FORMAT.get=function(){return new Yl},Object.defineProperties(Jl,e),Zl.prototype.interfaces_=function(){return[]},Zl.prototype.getClass=function(){return Zl},Zl.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))},Zl.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,y.X)===t.getOrdinate(e-1,y.X)&&t.getOrdinate(0,y.Y)===t.getOrdinate(e-1,y.Y)},Zl.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)||h.isNaN(s)&&h.isNaN(a)))return!1}return!0},Zl.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(Zl.copy(e,0,r,0,i),0<i)for(var o=i;o<n;o++)Zl.copy(e,i-1,r,o,1);return r},Zl.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)Zl.swap(t,r,e-r)},Zl.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)}},Zl.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)Zl.copyCoord(t,e+o,n,r+o)},Zl.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new fu;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(Jl.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},Zl.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Zl.createClosedRing(t,e,4):e.getOrdinate(0,y.X)===e.getOrdinate(n-1,y.X)&&e.getOrdinate(0,y.Y)===e.getOrdinate(n-1,y.Y)?e:Zl.createClosedRing(t,e,n+1)},Zl.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),t=e.size();Zl.copy(e,0,r,0,t);for(var i=t;i<n;i++)Zl.copy(e,0,r,i,1);return r},(Ql=E)&&(th.__proto__=Ql),e={serialVersionUID:{configurable:!0}},((th.prototype=Object.create(Ql&&Ql.prototype)).constructor=th).prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new u:this._points.expandEnvelope(new u)},th.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},th.prototype.getSortIndex=function(){return Ql.SORTINDEX_LINESTRING},th.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},th.prototype.equalsExact=function(){if(2!==arguments.length)return Ql.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},th.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))&&Zl.reverse(this._points),null}},th.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},th.prototype.getBoundaryDimension=function(){return this.isClosed()?Tl.FALSE:0},th.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},th.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},th.prototype.getDimension=function(){return 1},th.prototype.getLength=function(){return b.computeLength(this._points)},th.prototype.getNumPoints=function(){return this._points.size()},th.prototype.reverse=function(){var t=this._points.copy();return Zl.reverse(t),this.getFactory().createLineString(t)},th.prototype.compareToSameClass=function(){var t;if(1===arguments.length){for(var e=arguments[0],n=0,r=0;n<this._points.size()&&r<e._points.size();){var i=this._points.getCoordinate(n).compareTo(e._points.getCoordinate(r));if(0!==i)return i;n++,r++}return n<this._points.size()?1:r<e._points.size()?-1:0}if(2===arguments.length)return t=arguments[0],arguments[1].compare(this._points,t._points)},th.prototype.apply=function(){if(v(arguments[0],ju))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(v(arguments[0],Dl)){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(v(arguments[0],Al)||v(arguments[0],zu))&&arguments[0].filter(this)},th.prototype.getBoundary=function(){return new zl(this).getBoundary()},th.prototype.isEquivalentClass=function(t){return t instanceof th},th.prototype.clone=function(){var t=Ql.prototype.clone.call(this);return t._points=this._points.clone(),t},th.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},th.prototype.getGeometryType=function(){return"LineString"},th.prototype.copy=function(){return new th(this._points.copy(),this._factory)},th.prototype.getCoordinateSequence=function(){return this._points},th.prototype.isEmpty=function(){return 0===this._points.size()},th.prototype.init=function(t){if(1===(t=null===t?this.getFactory().getCoordinateSequenceFactory().create([]):t).size())throw new ou("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},th.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},th.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},th.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},th.prototype.interfaces_=function(){return[Ml]},th.prototype.getClass=function(){return th},e.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(th,e),th);function th(t,e){Ql.call(this,e),this._points=null,this.init(t)}Kl.prototype.interfaces_=function(){return[]},Kl.prototype.getClass=function(){return Kl};function eh(){}(nh=E)&&(ih.__proto__=nh),e={serialVersionUID:{configurable:!0}},((ih.prototype=Object.create(nh&&nh.prototype)).constructor=ih).prototype.computeEnvelopeInternal=function(){var t;return this.isEmpty()?new u:((t=new u).expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t)},ih.prototype.getSortIndex=function(){return nh.SORTINDEX_POINT},ih.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},ih.prototype.equalsExact=function(){var t,e;return 2===arguments.length?(t=arguments[0],e=arguments[1],!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))):nh.prototype.equalsExact.apply(this,arguments)},ih.prototype.normalize=function(){},ih.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},ih.prototype.getBoundaryDimension=function(){return Tl.FALSE},ih.prototype.getDimension=function(){return 0},ih.prototype.getNumPoints=function(){return this.isEmpty()?0:1},ih.prototype.reverse=function(){return this.copy()},ih.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},ih.prototype.compareToSameClass=function(){var t;return 1===arguments.length?(t=arguments[0],this.getCoordinate().compareTo(t.getCoordinate())):2===arguments.length?(t=arguments[0],arguments[1].compare(this._coordinates,t._coordinates)):void 0},ih.prototype.apply=function(){if(v(arguments[0],ju)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(v(arguments[0],Dl)){t=arguments[0];if(this.isEmpty())return null;t.filter(this._coordinates,0),t.isGeometryChanged()&&this.geometryChanged()}else(v(arguments[0],Al)||v(arguments[0],zu))&&arguments[0].filter(this)},ih.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},ih.prototype.clone=function(){var t=nh.prototype.clone.call(this);return t._coordinates=this._coordinates.clone(),t},ih.prototype.getGeometryType=function(){return"Point"},ih.prototype.copy=function(){return new ih(this._coordinates.copy(),this._factory)},ih.prototype.getCoordinateSequence=function(){return this._coordinates},ih.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},ih.prototype.isEmpty=function(){return 0===this._coordinates.size()},ih.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),x.isTrue(t.size()<=1),this._coordinates=t},ih.prototype.isSimple=function(){return!0},ih.prototype.interfaces_=function(){return[Kl]},ih.prototype.getClass=function(){return ih},e.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(ih,e);var nh,rh=ih;function ih(t,e){nh.call(this,e),this._coordinates=t||null,this.init(this._coordinates)}eh.prototype.interfaces_=function(){return[]},eh.prototype.getClass=function(){return eh};function oh(t){this._factory=t||null,this._isUserDataCopied=!1}(lh=E)&&(_h.__proto__=lh),e={serialVersionUID:{configurable:!0}},((_h.prototype=Object.create(lh&&lh.prototype)).constructor=_h).prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},_h.prototype.getSortIndex=function(){return lh.SORTINDEX_POLYGON},_h.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},_h.prototype.getArea=function(){var t=0;t+=Math.abs(b.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(b.signedArea(this._holes[e].getCoordinateSequence()));return t},_h.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;r=t.getY(n);if(r!==e.getMinY()&&r!==e.getMaxY())return!1}for(var i=t.getX(0),o=t.getY(0),s=1;s<=4;s++){var a=t.getX(s),u=t.getY(s);if(a!==i==(u!==o))return!1;i=a,o=u}return!0},_h.prototype.equalsExact=function(){if(2!==arguments.length)return lh.prototype.equalsExact.apply(this,arguments);var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t,t=this._shell,r=n._shell;if(!t.equalsExact(r,e))return!1;if(this._holes.length!==n._holes.length)return!1;for(var i=0;i<this._holes.length;i++)if(!this._holes[i].equalsExact(n._holes[i],e))return!1;return!0},_h.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);Rl.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),i=(mu.arraycopy(e.getCoordinates(),0,r,0,r.length),w.minCoordinate(e.getCoordinates()));w.scroll(r,i),mu.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],b.isCCW(e.getCoordinates())===n&&w.reverse(e.getCoordinates())}},_h.prototype.getCoordinate=function(){return this._shell.getCoordinate()},_h.prototype.getNumInteriorRing=function(){return this._holes.length},_h.prototype.getBoundaryDimension=function(){return 1},_h.prototype.getDimension=function(){return 2},_h.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},_h.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},_h.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},_h.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},_h.prototype.compareToSameClass=function(){if(1===arguments.length)return t=this._shell,r=arguments[0]._shell,t.compareToSameClass(r);if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t,r=this._shell,t=n._shell,r=r.compareToSameClass(t,e);if(0!==r)return r;for(var i=this.getNumInteriorRing(),o=n.getNumInteriorRing(),s=0;s<i&&s<o;){var a=this.getInteriorRingN(s),u=n.getInteriorRingN(s),a=a.compareToSameClass(u,e);if(0!==a)return a;s++}return s<i?1:s<o?-1:0}},_h.prototype.apply=function(t){if(v(t,ju)){this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(v(t,Dl)){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(v(t,Al))t.filter(this);else if(v(t,zu)){t.filter(this),this._shell.apply(t);for(var r=0;r<this._holes.length;r++)this._holes[r].apply(t)}},_h.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)},_h.prototype.clone=function(){var t=lh.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},_h.prototype.getGeometryType=function(){return"Polygon"},_h.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 _h(t,e,this._factory)},_h.prototype.getExteriorRing=function(){return this._shell},_h.prototype.isEmpty=function(){return this._shell.isEmpty()},_h.prototype.getInteriorRingN=function(t){return this._holes[t]},_h.prototype.interfaces_=function(){return[eh]},_h.prototype.getClass=function(){return _h},e.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(_h,e);var sh,ah,uh,lh,hh=_h,ch=((uh=ql)&&(yh.__proto__=uh),e={serialVersionUID:{configurable:!0}},((yh.prototype=Object.create(uh&&uh.prototype)).constructor=yh).prototype.getSortIndex=function(){return E.SORTINDEX_MULTIPOINT},yh.prototype.isValid=function(){return!0},yh.prototype.equalsExact=function(){var t,e;return 2===arguments.length?(t=arguments[0],e=arguments[1],!!this.isEquivalentClass(t)&&uh.prototype.equalsExact.call(this,t,e)):uh.prototype.equalsExact.apply(this,arguments)},yh.prototype.getCoordinate=function(){return 1===arguments.length?this._geometries[arguments[0]].getCoordinate():uh.prototype.getCoordinate.apply(this,arguments)},yh.prototype.getBoundaryDimension=function(){return Tl.FALSE},yh.prototype.getDimension=function(){return 0},yh.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},yh.prototype.getGeometryType=function(){return"MultiPoint"},yh.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 yh(t,this._factory)},yh.prototype.interfaces_=function(){return[Kl]},yh.prototype.getClass=function(){return yh},e.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(yh,e),yh),ph=((ah=$l)&&(dh.__proto__=ah),e={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}},((dh.prototype=Object.create(ah&&ah.prototype)).constructor=dh).prototype.getSortIndex=function(){return E.SORTINDEX_LINEARRING},dh.prototype.getBoundaryDimension=function(){return Tl.FALSE},dh.prototype.isClosed=function(){return!!this.isEmpty()||ah.prototype.isClosed.call(this)},dh.prototype.reverse=function(){var t=this._points.copy();return Zl.reverse(t),this.getFactory().createLinearRing(t)},dh.prototype.validateConstruction=function(){if(!this.isEmpty()&&!ah.prototype.isClosed.call(this))throw new ou("Points of LinearRing do not form a closed linestring");if(1<=this.getCoordinateSequence().size()&&this.getCoordinateSequence().size()<dh.MINIMUM_VALID_SIZE)throw new ou("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},dh.prototype.getGeometryType=function(){return"LinearRing"},dh.prototype.copy=function(){return new dh(this._points.copy(),this._factory)},dh.prototype.interfaces_=function(){return[]},dh.prototype.getClass=function(){return dh},e.MINIMUM_VALID_SIZE.get=function(){return 4},e.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(dh,e),dh),fh=((sh=ql)&&(gh.__proto__=sh),e={serialVersionUID:{configurable:!0}},((gh.prototype=Object.create(sh&&sh.prototype)).constructor=gh).prototype.getSortIndex=function(){return E.SORTINDEX_MULTIPOLYGON},gh.prototype.equalsExact=function(){var t,e;return 2===arguments.length?(t=arguments[0],e=arguments[1],!!this.isEquivalentClass(t)&&sh.prototype.equalsExact.call(this,t,e)):sh.prototype.equalsExact.apply(this,arguments)},gh.prototype.getBoundaryDimension=function(){return 1},gh.prototype.getDimension=function(){return 2},gh.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)},gh.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new I,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))},gh.prototype.getGeometryType=function(){return"MultiPolygon"},gh.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 gh(t,this._factory)},gh.prototype.interfaces_=function(){return[eh]},gh.prototype.getClass=function(){return gh},e.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(gh,e),gh),e={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};function gh(){sh.apply(this,arguments)}function dh(t,e){t instanceof m&&e instanceof A&&(t=e.getCoordinateSequenceFactory().create(t)),ah.call(this,t,e),this.validateConstruction()}function yh(){uh.apply(this,arguments)}function _h(t,e,n){if(lh.call(this,n),this._shell=null,(this._holes=null)===t&&(t=this.getFactory().createLinearRing()),lh.hasNullElements(e=null===e?[]:e))throw new ou("holes must not contain null elements");if(t.isEmpty()&&lh.hasNonEmptyElements(e))throw new ou("shell is empty but holes are not");this._shell=t,this._holes=e}oh.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},oh.prototype.edit=function(t,e){return null===t?null:(e=this.editInternal(t,e),this._isUserDataCopied&&e.setUserData(t.getUserData()),e)},oh.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof ql?this.editGeometryCollection(t,e):t instanceof hh?this.editPolygon(t,e):t instanceof rh||t instanceof $l?e.edit(t,this._factory):(x.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},oh.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new I,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===ch?this._factory.createMultiPoint(r.toArray([])):n.getClass()===Bl?this._factory.createMultiLineString(r.toArray([])):n.getClass()===fh?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},oh.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if((n=null===n?this._factory.createPolygon(null):n).isEmpty())return n;t=this.edit(n.getExteriorRing(),e);if(null===t||t.isEmpty())return this._factory.createPolygon();for(var r=new I,i=0;i<n.getNumInteriorRing();i++){var o=this.edit(n.getInteriorRingN(i),e);null===o||o.isEmpty()||r.add(o)}return this._factory.createPolygon(t,r.toArray([]))},oh.prototype.interfaces_=function(){return[]},oh.prototype.getClass=function(){return oh},oh.GeometryEditorOperation=function(){},e.NoOpGeometryOperation.get=function(){return Eh},e.CoordinateOperation.get=function(){return bh},e.CoordinateSequenceOperation.get=function(){return wh},Object.defineProperties(oh,e);function mh(){if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var e=0;e<t;e++)this._coordinates[e]=new m}else if(v(arguments[0],y)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var r=0;r<this._coordinates.length;r++)this._coordinates[r]=n.getCoordinateCopy(r)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var i=arguments[0],o=arguments[1];this._coordinates=i,this._dimension=o,null===i&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],o=arguments[1];this._coordinates=new Array(s).fill(null),this._dimension=o;for(var a=0;a<s;a++)this._coordinates[a]=new m}}function vh(){}function r(){var t;this._modelType=null,this._scale=null,0===arguments.length?this._modelType=r.FLOATING:1===arguments.length&&(arguments[0]instanceof Mh?(this._modelType=arguments[0])===r.FIXED&&this.setScale(1):"number"==typeof arguments[0]?(t=arguments[0],this._modelType=r.FIXED,this.setScale(t)):arguments[0]instanceof r&&(this._modelType=(t=arguments[0])._modelType,this._scale=t._scale))}var xh,Eh=function(){},bh=(Eh.prototype.edit=function(t,e){return t},Eh.prototype.interfaces_=function(){return[oh.GeometryEditorOperation]},Eh.prototype.getClass=function(){return Eh},function(){}),wh=(bh.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof ph?e.createLinearRing(n):t instanceof $l?e.createLineString(n):t instanceof rh?0<n.length?e.createPoint(n[0]):e.createPoint():t},bh.prototype.interfaces_=function(){return[oh.GeometryEditorOperation]},bh.prototype.getClass=function(){return bh},function(){}),e=(wh.prototype.edit=function(t,e){return t instanceof ph?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof $l?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof rh?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},wh.prototype.interfaces_=function(){return[oh.GeometryEditorOperation]},wh.prototype.getClass=function(){return wh},{serialVersionUID:{configurable:!0}}),e=(mh.prototype.setOrdinate=function(t,e,n){switch(e){case y.X:this._coordinates[t].x=n;break;case y.Y:this._coordinates[t].y=n;break;case y.Z:this._coordinates[t].z=n;break;default:throw new ou("invalid ordinateIndex")}},mh.prototype.size=function(){return this._coordinates.length},mh.prototype.getOrdinate=function(t,e){switch(e){case y.X:return this._coordinates[t].x;case y.Y:return this._coordinates[t].y;case y.Z:return this._coordinates[t].z}return h.NaN},mh.prototype.getCoordinate=function(){var t,e;if(1===arguments.length)return this._coordinates[arguments[0]];2===arguments.length&&(t=arguments[0],(e=arguments[1]).x=this._coordinates[t].x,e.y=this._coordinates[t].y,e.z=this._coordinates[t].z)},mh.prototype.getCoordinateCopy=function(t){return new m(this._coordinates[t])},mh.prototype.getDimension=function(){return this._dimension},mh.prototype.getX=function(t){return this._coordinates[t].x},mh.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 mh(t,this._dimension)},mh.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},mh.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 mh(t,this._dimension)},mh.prototype.toString=function(){if(0<this._coordinates.length){var t=new fu(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"()"},mh.prototype.getY=function(t){return this._coordinates[t].y},mh.prototype.toCoordinateArray=function(){return this._coordinates},mh.prototype.interfaces_=function(){return[y,hu]},mh.prototype.getClass=function(){return mh},e.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(mh,e),{serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}}),Ih=(vh.prototype.readResolve=function(){return vh.instance()},vh.prototype.create=function(){var t,e;return 1===arguments.length?arguments[0]instanceof Array||v(arguments[0],y)?new mh(arguments[0]):void 0:2===arguments.length?(t=arguments[0],(e=3<(e=arguments[1])?3:e)<2?new mh(t):new mh(t,e)):void 0},vh.prototype.interfaces_=function(){return[cu,hu]},vh.prototype.getClass=function(){return vh},vh.instance=function(){return vh.instanceObject},e.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},e.instanceObject.get=function(){return new vh},Object.defineProperties(vh,e),(xh=hl)&&(Nh.__proto__=xh),((Nh.prototype=Object.create(xh&&xh.prototype)).constructor=Nh).prototype.get=function(t){return this.map_.get(t)||null},Nh.prototype.put=function(t,e){return this.map_.set(t,e),e},Nh.prototype.values=function(){for(var t=new I,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},Nh.prototype.entrySet=function(){var e=new vl;return this.map_.entries().forEach(function(t){return e.add(t)}),e},Nh.prototype.size=function(){return this.map_.size()},Nh),e={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};function Nh(){xh.call(this),this.map_=new Map}r.prototype.equals=function(t){return t instanceof r&&this._modelType===t._modelType&&this._scale===t._scale},r.prototype.compareTo=function(t){var e=this.getMaximumSignificantDigits(),t=t.getMaximumSignificantDigits();return new gu(e).compareTo(new gu(t))},r.prototype.getScale=function(){return this._scale},r.prototype.isFloating=function(){return this._modelType===r.FLOATING||this._modelType===r.FLOATING_SINGLE},r.prototype.getType=function(){return this._modelType},r.prototype.toString=function(){var t="UNKNOWN";return this._modelType===r.FLOATING?t="Floating":this._modelType===r.FLOATING_SINGLE?t="Floating-Single":this._modelType===r.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},r.prototype.makePrecise=function(){if("number"==typeof arguments[0])return!h.isNaN(t=arguments[0])&&this._modelType!==r.FLOATING_SINGLE&&this._modelType===r.FIXED?Math.round(t*this._scale)/this._scale:t;if(arguments[0]instanceof m){var t=arguments[0];if(this._modelType===r.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}},r.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===r.FLOATING?t=16:this._modelType===r.FLOATING_SINGLE?t=6:this._modelType===r.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},r.prototype.setScale=function(t){this._scale=Math.abs(t)},r.prototype.interfaces_=function(){return[hu,au]},r.prototype.getClass=function(){return r},r.mostPrecise=function(t,e){return 0<=t.compareTo(e)?t:e},e.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},e.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(r,e);function Sh(t){this.geometryFactory=t||new A}function Ch(t){this.geometryFactory=t||new A,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Sh(this.geometryFactory)}function Ph(){this.parser=new Sh(this.geometryFactory)}function T(){}var Mh=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},e={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}},A=(Mh.prototype.readResolve=function(){return Mh.nameToTypeMap.get(this._name)},Mh.prototype.toString=function(){return this._name},Mh.prototype.interfaces_=function(){return[hu]},Mh.prototype.getClass=function(){return Mh},e.serialVersionUID.get=function(){return-552860263173159e4},e.nameToTypeMap.get=function(){return new Ih},Object.defineProperties(Mh,e),r.Type=Mh,r.FIXED=new Mh("FIXED"),r.FLOATING=new Mh("FLOATING"),r.FLOATING_SINGLE=new Mh("FLOATING SINGLE"),function t(){this._precisionModel=new r,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0!==arguments.length&&(1===arguments.length?v(arguments[0],cu)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof r&&(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]))}),e={serialVersionUID:{configurable:!0}},Lh=(A.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new m(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new m(t.getMinX(),t.getMinY()),new m(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new m(t.getMinX(),t.getMinY()),new m(t.getMinX(),t.getMaxY()),new m(t.getMaxX(),t.getMaxY()),new m(t.getMaxX(),t.getMinY()),new m(t.getMinX(),t.getMinY())]),null)},A.prototype.createLineString=function(t){return t?t instanceof Array?new $l(this.getCoordinateSequenceFactory().create(t),this):v(t,y)?new $l(t,this):void 0:new $l(this.getCoordinateSequenceFactory().create([]),this)},A.prototype.createMultiLineString=function(){return 0===arguments.length?new Bl(null,this):1===arguments.length?new Bl(arguments[0],this):void 0},A.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();s!==(e=null===e?s:e)&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(A.toGeometryArray(t));var a=t.iterator().next();if(1<t.size()){if(a instanceof hh)return this.createMultiPolygon(A.toPolygonArray(t));if(a instanceof $l)return this.createMultiLineString(A.toLineStringArray(t));if(a instanceof rh)return this.createMultiPoint(A.toPointArray(t));x.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},A.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},A.prototype.createPoint=function(){var t;return 0===arguments.length?this.createPoint(this.getCoordinateSequenceFactory().create([])):1===arguments.length?arguments[0]instanceof m?this.createPoint(null!==(t=arguments[0])?this.getCoordinateSequenceFactory().create([t]):null):v(arguments[0],y)?new rh(arguments[0],this):void 0:void 0},A.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},A.prototype.createPolygon=function(){return 0===arguments.length?new hh(null,null,this):1===arguments.length?v(arguments[0],y)||arguments[0]instanceof Array?this.createPolygon(this.createLinearRing(arguments[0])):arguments[0]instanceof ph?this.createPolygon(arguments[0],null):void 0:2===arguments.length?new hh(arguments[0],arguments[1],this):void 0},A.prototype.getSRID=function(){return this._SRID},A.prototype.createGeometryCollection=function(){return 0===arguments.length?new ql(null,this):1===arguments.length?new ql(arguments[0],this):void 0},A.prototype.createGeometry=function(t){return new oh(this).edit(t,{edit:function(){if(2===arguments.length)return this._coordinateSequenceFactory.create(arguments[0])}})},A.prototype.getPrecisionModel=function(){return this._precisionModel},A.prototype.createLinearRing=function(){var t;return 0===arguments.length?this.createLinearRing(this.getCoordinateSequenceFactory().create([])):1===arguments.length?arguments[0]instanceof Array?this.createLinearRing(null!==(t=arguments[0])?this.getCoordinateSequenceFactory().create(t):null):v(arguments[0],y)?new ph(arguments[0],this):void 0:void 0},A.prototype.createMultiPolygon=function(){return 0===arguments.length?new fh(null,this):1===arguments.length?new fh(arguments[0],this):void 0},A.prototype.createMultiPoint=function(){var t;if(0===arguments.length)return new ch(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new ch(arguments[0],this);if(arguments[0]instanceof Array)return this.createMultiPoint(null!==(t=arguments[0])?this.getCoordinateSequenceFactory().create(t):null);if(v(arguments[0],y)){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());Zl.copy(e,r,i,0,1),n[r]=this.createPoint(i)}return this.createMultiPoint(n)}}},A.prototype.interfaces_=function(){return[hu]},A.prototype.getClass=function(){return A},A.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.toGeometryArray=function(t){var e;return null===t?null:(e=new Array(t.size()).fill(null),t.toArray(e))},A.getDefaultCoordinateSequenceFactory=function(){return vh.instance()},A.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},A.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},e.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(A,e),["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"]),Oh=(Sh.prototype.read=function(t){var e=(t="string"==typeof t?JSON.parse(t):t).type;if(Oh[e])return-1!==Lh.indexOf(e)?Oh[e].apply(this,[t.coordinates]):"GeometryCollection"===e?Oh[e].apply(this,[t.geometries]):Oh[e].apply(this,[t]);throw new Error("Unknown GeoJSON type: "+t.type)},Sh.prototype.write=function(t){var e=t.getGeometryType();if(Rh[e])return Rh[e].apply(this,[t]);throw new Error("Geometry is not supported")},{Feature:function(t){var e,n={};for(e in t)n[e]=t[e];if(t.geometry){var r=t.geometry.type;if(!Oh[r])throw new Error("Unknown GeoJSON type: "+t.type);n.geometry=this.read(t.geometry)}return t.bbox&&(n.bbox=Oh.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 m(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new m(t[0],t[1]),new m(t[2],t[1]),new m(t[2],t[3]),new m(t[0],t[3]),new m(t[0],t[1])])},Point:function(t){t=new m(t[0],t[1]);return this.geometryFactory.createPoint(t)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Oh.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){t=Oh.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(t)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(Oh.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Oh.coordinates.apply(this,[t[0]]),e=this.geometryFactory.createLinearRing(e),n=[],r=1;r<t.length;++r){var i=t[r],i=Oh.coordinates.apply(this,[i]),i=this.geometryFactory.createLinearRing(i);n.push(i)}return this.geometryFactory.createPolygon(e,n)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(Oh.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)}}),Rh={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Rh.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],r=Rh.Point.apply(this,[r]);e.push(r.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(Rh.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],r=Rh.LineString.apply(this,[r]);e.push(r.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=Rh.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],i=Rh.LineString.apply(this,[i]);e.push(i.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],r=Rh.Polygon.apply(this,[r]);e.push(r.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(Rh[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},e=(Ch.prototype.read=function(t){t=this.parser.read(t);return this.precisionModel.getType()===r.FIXED&&this.reducePrecision(t),t},Ch.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])},Ph.prototype.write=function(t){return this.parser.write(t)},{ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}});function Th(t){this.message=t||""}function Ah(){this.array_=[]}T.prototype.interfaces_=function(){return[]},T.prototype.getClass=function(){return T},T.opposite=function(t){return t===T.LEFT?T.RIGHT:t===T.RIGHT?T.LEFT:t},e.ON.get=function(){return 0},e.LEFT.get=function(){return 1},e.RIGHT.get=function(){return 2},Object.defineProperties(T,e),(Th.prototype=new Error).name="EmptyStackException",(Ah.prototype=new $u).add=function(t){return this.array_.push(t),!0},Ah.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},Ah.prototype.push=function(t){return this.array_.push(t),t},Ah.prototype.pop=function(t){if(0===this.array_.length)throw new Th;return this.array_.pop()},Ah.prototype.peek=function(){if(0===this.array_.length)throw new Th;return this.array_[this.array_.length-1]},Ah.prototype.empty=function(){return 0===this.array_.length},Ah.prototype.isEmpty=function(){return this.empty()},Ah.prototype.search=function(t){return this.array_.indexOf(t)},Ah.prototype.size=function(){return this.array_.length},Ah.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};function Dh(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}function Fh(){this.array_=[]}Dh.prototype.getCoordinate=function(){return this._minCoord},Dh.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return(n=n<0?this.getRightmostSideOfSegment(t,e-1):n)<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},Dh.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates(),e=(x.isTrue(0<this._minIndex&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge"),t[this._minIndex-1]),t=t[this._minIndex+1],n=b.computeOrientation(this._minCoord,t,e),r=!1;(r=e.y<this._minCoord.y&&t.y<this._minCoord.y&&n===b.COUNTERCLOCKWISE||e.y>this._minCoord.y&&t.y>this._minCoord.y&&n===b.CLOCKWISE?!0:r)&&(this._minIndex=this._minIndex-1)},Dh.prototype.getRightmostSideOfSegment=function(t,e){var n,t=t.getEdge().getCoordinates();return e<0||e+1>=t.length||t[e].y===t[e+1].y?-1:(n=T.LEFT,t[e].y<t[e+1].y?T.RIGHT:n)},Dh.prototype.getEdge=function(){return this._orientedDe},Dh.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])},Dh.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)},Dh.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}x.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===T.LEFT&&(this._orientedDe=this._minDe.getSym())},Dh.prototype.interfaces_=function(){return[]},Dh.prototype.getClass=function(){return Dh},(kh=Ou)&&(qh.__proto__=kh),((qh.prototype=Object.create(kh&&kh.prototype)).constructor=qh).prototype.getCoordinate=function(){return this.pt},qh.prototype.interfaces_=function(){return[]},qh.prototype.getClass=function(){return qh},qh.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"};var kh,Gh=qh;function qh(t,e){kh.call(this,qh.msgWithCoord(t,e)),this.pt=e?new m(e):null,this.name="TopologyException"}Fh.prototype.addLast=function(t){this.array_.push(t)},Fh.prototype.removeFirst=function(){return this.array_.shift()},Fh.prototype.isEmpty=function(){return 0===this.array_.length};function Bh(){this._finder=null,this._dirEdgeList=new I,this._nodes=new I,this._rightMostCoord=null,this._env=null,this._finder=new Dh}function zh(){var t,e;if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array)this.init(arguments[0].length);else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[T.ON]=n}else if(arguments[0]instanceof zh){var r=arguments[0];if(this.init(r.location.length),null!==r)for(var i=0;i<this.location.length;i++)this.location[i]=r.location[i]}}else 3===arguments.length&&(n=arguments[0],t=arguments[1],e=arguments[2],this.init(3),this.location[T.ON]=n,this.location[T.LEFT]=t,this.location[T.RIGHT]=e)}function jh(){var t,e,n,r;this.elt=new Array(2).fill(null),1===arguments.length?Number.isInteger(arguments[0])?(this.elt[0]=new zh(t=arguments[0]),this.elt[1]=new zh(t)):arguments[0]instanceof jh&&(this.elt[0]=new zh((t=arguments[0]).elt[0]),this.elt[1]=new zh(t.elt[1])):2===arguments.length?(t=arguments[0],e=arguments[1],this.elt[0]=new zh(g.NONE),this.elt[1]=new zh(g.NONE),this.elt[t].setLocation(e)):3===arguments.length?(this.elt[0]=new zh(t=arguments[0],e=arguments[1],n=arguments[2]),this.elt[1]=new zh(t,e,n)):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],this.elt[0]=new zh(g.NONE,g.NONE,g.NONE),this.elt[1]=new zh(g.NONE,g.NONE,g.NONE),this.elt[t].setLocations(e,n,r))}function Uh(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new I,this._pts=new I,this._label=new jh(g.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new I,this._geometryFactory=null;var t=arguments[0];this._geometryFactory=arguments[1],this.computePoints(t),this.computeRing()}Bh.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Bh.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Bh.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 Gh("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)}},Bh.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(T.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},Bh.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Bh.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();1<=e.getDepth(T.RIGHT)&&e.getDepth(T.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},Bh.prototype.computeDepths=function(t){var e=new vl,n=new Fh,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=o.next().getSym();s.isVisited()||(s=s.getNode(),e.contains(s))||(n.addLast(s),e.add(s))}}},Bh.prototype.compareTo=function(t){return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0},Bh.prototype.getEnvelope=function(){if(null===this._env){for(var t=new u,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},Bh.prototype.addReachable=function(t){var e=new Ah;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},Bh.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(T.LEFT,t.getDepth(T.RIGHT)),e.setDepth(T.RIGHT,t.getDepth(T.LEFT))},Bh.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next(),r=(this._dirEdgeList.add(r),r.getSym().getNode());r.isVisited()||e.push(r)}},Bh.prototype.getNodes=function(){return this._nodes},Bh.prototype.getDirectedEdges=function(){return this._dirEdgeList},Bh.prototype.interfaces_=function(){return[au]},Bh.prototype.getClass=function(){return Bh},zh.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},zh.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==g.NONE)return!1;return!0},zh.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===g.NONE&&(this.location[e]=t)},zh.prototype.isLine=function(){return 1===this.location.length},zh.prototype.merge=function(t){var e;t.location.length>this.location.length&&((e=new Array(3).fill(null))[T.ON]=this.location[T.ON],e[T.LEFT]=g.NONE,e[T.RIGHT]=g.NONE,this.location=e);for(var n=0;n<this.location.length;n++)this.location[n]===g.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},zh.prototype.getLocations=function(){return this.location},zh.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[T.LEFT];this.location[T.LEFT]=this.location[T.RIGHT],this.location[T.RIGHT]=t},zh.prototype.toString=function(){var t=new fu;return 1<this.location.length&&t.append(g.toLocationSymbol(this.location[T.LEFT])),t.append(g.toLocationSymbol(this.location[T.ON])),1<this.location.length&&t.append(g.toLocationSymbol(this.location[T.RIGHT])),t.toString()},zh.prototype.setLocations=function(t,e,n){this.location[T.ON]=t,this.location[T.LEFT]=e,this.location[T.RIGHT]=n},zh.prototype.get=function(t){return t<this.location.length?this.location[t]:g.NONE},zh.prototype.isArea=function(){return 1<this.location.length},zh.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===g.NONE)return!0;return!1},zh.prototype.setLocation=function(){1===arguments.length?this.setLocation(T.ON,arguments[0]):2===arguments.length&&(this.location[arguments[0]]=arguments[1])},zh.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(g.NONE)},zh.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},zh.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},zh.prototype.interfaces_=function(){return[]},zh.prototype.getClass=function(){return zh},jh.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},jh.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},jh.prototype.isNull=function(t){return this.elt[t].isNull()},jh.prototype.setAllLocationsIfNull=function(){var t;1===arguments.length?(this.setAllLocationsIfNull(0,t=arguments[0]),this.setAllLocationsIfNull(1,t)):2===arguments.length&&this.elt[arguments[0]].setAllLocationsIfNull(arguments[1])},jh.prototype.isLine=function(t){return this.elt[t].isLine()},jh.prototype.merge=function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new zh(t.elt[e]):this.elt[e].merge(t.elt[e])},jh.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},jh.prototype.getLocation=function(){return 1===arguments.length?this.elt[arguments[0]].get(T.ON):2===arguments.length?this.elt[arguments[0]].get(arguments[1]):void 0},jh.prototype.toString=function(){var t=new fu;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()},jh.prototype.isArea=function(){return 0===arguments.length?this.elt[0].isArea()||this.elt[1].isArea():1===arguments.length?this.elt[arguments[0]].isArea():void 0},jh.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},jh.prototype.setLocation=function(){2===arguments.length?this.elt[arguments[0]].setLocation(T.ON,arguments[1]):3===arguments.length&&this.elt[arguments[0]].setLocation(arguments[1],arguments[2])},jh.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},jh.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},jh.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new zh(this.elt[t].location[0]))},jh.prototype.interfaces_=function(){return[]},jh.prototype.getClass=function(){return jh},jh.toLineLabel=function(t){for(var e=new jh(g.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};function Vh(){this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0!==arguments.length&&1===arguments.length&&(this._label=arguments[0])}Uh.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=b.isCCW(this._ring.getCoordinates())},Uh.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},Uh.prototype.computePoints=function(t){var e=this._startDe=t,n=!0;do{if(null===e)throw new Gh("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new Gh("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var r=e.getLabel()}while(x.isTrue(r.isArea()),this.mergeLabel(r),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),(e=this.getNext(e))!==this._startDe)},Uh.prototype.getLinearRing=function(){return this._ring},Uh.prototype.getCoordinate=function(t){return this._pts.get(t)},Uh.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this)}while(e>this._maxNodeDegree&&(this._maxNodeDegree=e),(t=this.getNext(t))!==this._startDe);this._maxNodeDegree*=2},Uh.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e)for(var t=1,i=t=n?0:t;i<r.length;i++)this._pts.add(r[i]);else for(var e=r.length-2,o=e=n?r.length-1:e;0<=o;o--)this._pts.add(r[o])},Uh.prototype.isHole=function(){return this._isHole},Uh.prototype.setInResult=function(){for(var t=this._startDe;t.getEdge().setInResult(!0),(t=t.getNext())!==this._startDe;);},Uh.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!b.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},Uh.prototype.addHole=function(t){this._holes.add(t)},Uh.prototype.isShell=function(){return null===this._shell},Uh.prototype.getLabel=function(){return this._label},Uh.prototype.getEdges=function(){return this._edges},Uh.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Uh.prototype.getShell=function(){return this._shell},Uh.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else{var e;if(2===arguments.length)return(e=arguments[0].getLocation(t=arguments[1],T.RIGHT))===g.NONE?null:this._label.getLocation(t)===g.NONE?(this._label.setLocation(t,e),null):void 0}},Uh.prototype.setShell=function(t){null!==(this._shell=t)&&t.addHole(this)},Uh.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)},Uh.prototype.interfaces_=function(){return[]},Uh.prototype.getClass=function(){return Uh},(Yh=Uh)&&(Zh.__proto__=Yh),((Zh.prototype=Object.create(Yh&&Yh.prototype)).constructor=Zh).prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},Zh.prototype.getNext=function(t){return t.getNextMin()},Zh.prototype.interfaces_=function(){return[]},Zh.prototype.getClass=function(){return Zh};var Xh,Yh,Hh=Zh,Wh=((Xh=Uh)&&(Jh.__proto__=Xh),((Jh.prototype=Object.create(Xh&&Xh.prototype)).constructor=Jh).prototype.buildMinimalRings=function(){var t,e=new I,n=this._startDe;do{}while(null===n.getMinEdgeRing()&&(t=new Hh(n,this._geometryFactory),e.add(t)),(n=n.getNext())!==this._startDe);return e},Jh.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},Jh.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){for(var t=this._startDe;t.getNode().getEdges().linkMinimalDirectedEdges(this),(t=t.getNext())!==this._startDe;);},Jh.prototype.getNext=function(t){return t.getNext()},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh},Jh);function Jh(){Xh.call(this,arguments[0],arguments[1])}function Zh(){Yh.call(this,arguments[0],arguments[1])}Vh.prototype.setVisited=function(t){this._isVisited=t},Vh.prototype.setInResult=function(t){this._isInResult=t},Vh.prototype.isCovered=function(){return this._isCovered},Vh.prototype.isCoveredSet=function(){return this._isCoveredSet},Vh.prototype.setLabel=function(t){this._label=t},Vh.prototype.getLabel=function(){return this._label},Vh.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Vh.prototype.updateIM=function(t){x.isTrue(2<=this._label.getGeometryCount(),"found partial label"),this.computeIM(t)},Vh.prototype.isInResult=function(){return this._isInResult},Vh.prototype.isVisited=function(){return this._isVisited},Vh.prototype.interfaces_=function(){return[]},Vh.prototype.getClass=function(){return Vh};function Kh(){this.nodeMap=new Pl,this.nodeFact=null,this.nodeFact=arguments[0]}(Qh=Vh)&&(tc.__proto__=Qh),((tc.prototype=Object.create(Qh&&Qh.prototype)).constructor=tc).prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},tc.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},tc.prototype.getCoordinate=function(){return this._coord},tc.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},tc.prototype.computeIM=function(t){},tc.prototype.computeMergedLocation=function(t,e){var n=g.NONE,n=this._label.getLocation(e);return t.isNull(e)||(t=t.getLocation(e),n!==g.BOUNDARY&&(n=t)),n},tc.prototype.setLabel=function(){if(2!==arguments.length)return Qh.prototype.setLabel.apply(this,arguments);var t=arguments[0],e=arguments[1];null===this._label?this._label=new jh(t,e):this._label.setLocation(t,e)},tc.prototype.getEdges=function(){return this._edges},tc.prototype.mergeLabel=function(){if(arguments[0]instanceof tc)this.mergeLabel(arguments[0]._label);else if(arguments[0]instanceof jh)for(var t=arguments[0],e=0;e<2;e++){var n=this.computeMergedLocation(t,e);this._label.getLocation(e)===g.NONE&&this._label.setLocation(e,n)}},tc.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},tc.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=g.NONE,n=null,n=(e=null!==this._label?this._label.getLocation(t):e)===g.BOUNDARY?g.INTERIOR:g.BOUNDARY;this._label.setLocation(t,n)},tc.prototype.interfaces_=function(){return[]},tc.prototype.getClass=function(){return tc};var Qh,$h=tc;function tc(){Qh.call(this),this._coord=null,this._edges=null;var t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new jh(0,g.NONE)}Kh.prototype.find=function(t){return this.nodeMap.get(t)},Kh.prototype.addNode=function(){var t,e;return arguments[0]instanceof m?(null===(e=this.nodeMap.get(t=arguments[0]))&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e):arguments[0]instanceof $h?null===(e=this.nodeMap.get((t=arguments[0]).getCoordinate()))?(this.nodeMap.put(t.getCoordinate(),t),t):(e.mergeLabel(t),e):void 0},Kh.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},Kh.prototype.iterator=function(){return this.nodeMap.values().iterator()},Kh.prototype.values=function(){return this.nodeMap.values()},Kh.prototype.getBoundaryNodes=function(t){for(var e=new I,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===g.BOUNDARY&&e.add(r)}return e},Kh.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},Kh.prototype.interfaces_=function(){return[]},Kh.prototype.getClass=function(){return Kh};function ec(){}function nc(){var t,e,n,r;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=arguments[0]:3===arguments.length?(t=arguments[0],e=arguments[1],n=arguments[2],this._edge=t,this.init(e,n),this._label=null):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],this._edge=t,this.init(e,n),this._label=r)}function rc(){}var ic,e={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}},oc=(ec.prototype.interfaces_=function(){return[]},ec.prototype.getClass=function(){return ec},ec.isNorthern=function(t){return t===ec.NE||t===ec.NW},ec.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},ec.commonHalfPlane=function(t,e){var n;return t===e?t:2==(t-e+4)%4?-1:0===(n=t<e?t:e)&&3===(e<t?t:e)?3:n},ec.isInHalfPlane=function(t,e){return e===ec.SE?t===ec.SE||t===ec.SW:t===e||t===e+1},ec.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 ou("Cannot compute the quadrant for point ( "+t+", "+e+" )");return 0<=t?0<=e?ec.NE:ec.SE:0<=e?ec.NW:ec.SW}if(arguments[0]instanceof m&&arguments[1]instanceof m){t=arguments[0],e=arguments[1];if(e.x===t.x&&e.y===t.y)throw new ou("Cannot compute the quadrant for two identical points "+t);return e.x>=t.x?e.y>=t.y?ec.NE:ec.SE:e.y>=t.y?ec.NW:ec.SW}},e.NE.get=function(){return 0},e.NW.get=function(){return 1},e.SW.get=function(){return 2},e.SE.get=function(){return 3},Object.defineProperties(ec,e),nc.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:b.computeOrientation(t._p0,t._p1,this._p1)},nc.prototype.getDy=function(){return this._dy},nc.prototype.getCoordinate=function(){return this._p0},nc.prototype.setNode=function(t){this._node=t},nc.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),n=n.substring(r+1);t.print("  "+n+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+"   "+this._label)},nc.prototype.compareTo=function(t){return this.compareDirection(t)},nc.prototype.getDirectedCoordinate=function(){return this._p1},nc.prototype.getDx=function(){return this._dx},nc.prototype.getLabel=function(){return this._label},nc.prototype.getEdge=function(){return this._edge},nc.prototype.getQuadrant=function(){return this._quadrant},nc.prototype.getNode=function(){return this._node},nc.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},nc.prototype.computeLabel=function(t){},nc.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=ec.quadrant(this._dx,this._dy),x.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},nc.prototype.interfaces_=function(){return[au]},nc.prototype.getClass=function(){return nc},(ic=nc)&&(sc.__proto__=ic),((sc.prototype=Object.create(ic&&ic.prototype)).constructor=sc).prototype.getNextMin=function(){return this._nextMin},sc.prototype.getDepth=function(t){return this._depth[t]},sc.prototype.setVisited=function(t){this._isVisited=t},sc.prototype.computeDirectedLabel=function(){this._label=new jh(this._edge.getLabel()),this._isForward||this._label.flip()},sc.prototype.getNext=function(){return this._next},sc.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new Gh("assigned depths do not match",this.getCoordinate());this._depth[t]=e},sc.prototype.isInteriorAreaEdge=function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,T.LEFT)===g.INTERIOR&&this._label.getLocation(e,T.RIGHT)===g.INTERIOR||(t=!1);return t},sc.prototype.setNextMin=function(t){this._nextMin=t},sc.prototype.print=function(t){ic.prototype.print.call(this,t),t.print(" "+this._depth[T.LEFT]+"/"+this._depth[T.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")},sc.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},sc.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,g.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,g.EXTERIOR);return t&&e&&n},sc.prototype.setEdgeRing=function(t){this._edgeRing=t},sc.prototype.getMinEdgeRing=function(){return this._minEdgeRing},sc.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return t=this._isForward?t:-t},sc.prototype.setInResult=function(t){this._isInResult=t},sc.prototype.getSym=function(){return this._sym},sc.prototype.isForward=function(){return this._isForward},sc.prototype.getEdge=function(){return this._edge},sc.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},sc.prototype.setSym=function(t){this._sym=t},sc.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},sc.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta(),r=(this._isForward||(n=-n),1),i=(t===T.LEFT&&(r=-1),T.opposite(t)),n=e+n*r;this.setDepth(t,e),this.setDepth(i,n)},sc.prototype.getEdgeRing=function(){return this._edgeRing},sc.prototype.isInResult=function(){return this._isInResult},sc.prototype.setNext=function(t){this._next=t},sc.prototype.isVisited=function(){return this._isVisited},sc.prototype.interfaces_=function(){return[]},sc.prototype.getClass=function(){return sc},sc.depthFactor=function(t,e){return t===g.EXTERIOR&&e===g.INTERIOR?1:t===g.INTERIOR&&e===g.EXTERIOR?-1:0},sc);function sc(){var t=arguments[0],e=arguments[1];ic.call(this,t),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=e)?this.init(t.getCoordinate(0),t.getCoordinate(1)):(e=t.getNumPoints()-1,this.init(t.getCoordinate(e),t.getCoordinate(e-1))),this.computeDirectedLabel()}rc.prototype.createNode=function(t){return new $h(t,null)},rc.prototype.interfaces_=function(){return[]},rc.prototype.getClass=function(){return rc};function ac(){this._edges=new I,this._nodes=null,this._edgeEndList=new I,0===arguments.length?this._nodes=new Kh(new rc):1===arguments.length&&(this._nodes=new Kh(arguments[0]))}function uc(){this._geometryFactory=null,this._shellList=new I,this._geometryFactory=arguments[0]}function lc(){}function hc(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}function cc(){this._size=null,this._items=null,this._size=0,this._items=new I,this._items.add(null)}function pc(){}function fc(){}function gc(){this._childBoundables=new I,this._bounds=null,this._level=null,0!==arguments.length&&1===arguments.length&&(this._level=arguments[0])}ac.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)}},ac.prototype.find=function(t){return this._nodes.find(t)},ac.prototype.addNode=function(){return arguments[0]instanceof $h||arguments[0]instanceof m?this._nodes.addNode(arguments[0]):void 0},ac.prototype.getNodeIterator=function(){return this._nodes.iterator()},ac.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},ac.prototype.debugPrintln=function(t){mu.out.println(t)},ac.prototype.isBoundaryNode=function(t,e){var e=this._nodes.find(e);return null!==e&&null!==(e=e.getLabel())&&e.getLocation(t)===g.BOUNDARY},ac.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},ac.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&b.computeOrientation(t,e,r)===b.COLLINEAR&&ec.quadrant(t,e)===ec.quadrant(n,r)},ac.prototype.getEdgeEnds=function(){return this._edgeEndList},ac.prototype.debugPrint=function(t){mu.out.print(t)},ac.prototype.getEdgeIterator=function(){return this._edges.iterator()},ac.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},ac.prototype.insertEdge=function(t){this._edges.add(t)},ac.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},ac.prototype.addEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=(this._edges.add(n),new oc(n,!0)),n=new oc(n,!1);r.setSym(n),n.setSym(r),this.add(r),this.add(n)}},ac.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},ac.prototype.getNodes=function(){return this._nodes.values()},ac.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},ac.prototype.interfaces_=function(){return[]},ac.prototype.getClass=function(){return ac},ac.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()},uc.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();(i.isHole()?n:e).add(i)}},uc.prototype.computePolygons=function(t){for(var e=new I,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},uc.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 Gh("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},uc.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new I,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},uc.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},uc.prototype.buildMaximalEdgeRings=function(t){for(var e=new I,n=t.iterator();n.hasNext();){var r=n.next();r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()&&(r=new Wh(r,this._geometryFactory),e.add(r),r.setInResult())}return e},uc.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},uc.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},uc.prototype.findEdgeRingContaining=function(t,e){for(var t=t.getLinearRing(),n=t.getEnvelopeInternal(),r=t.getCoordinateN(0),i=null,o=null,s=e.iterator();s.hasNext();){var a=s.next(),u=a.getLinearRing(),l=u.getEnvelopeInternal(),h=(null!==i&&(o=i.getLinearRing().getEnvelopeInternal()),!1);(h=l.contains(n)&&b.isPointInRing(r,u.getCoordinates())?!0:h)&&(null===i||o.contains(l))&&(i=a)}return i},uc.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 x.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},uc.prototype.add=function(){var t,e;1===arguments.length?this.add((e=arguments[0]).getEdgeEnds(),e.getNodes()):2===arguments.length&&(e=arguments[0],ac.linkResultDirectedEdges(arguments[1]),e=this.buildMaximalEdgeRings(e),t=new I,e=this.buildMinimalEdgeRings(e,this._shellList,t),this.sortShellsAndHoles(e,this._shellList,t),this.placeFreeHoles(this._shellList,t))},uc.prototype.interfaces_=function(){return[]},uc.prototype.getClass=function(){return uc},lc.prototype.getBounds=function(){},lc.prototype.interfaces_=function(){return[]},lc.prototype.getClass=function(){return lc},hc.prototype.getItem=function(){return this._item},hc.prototype.getBounds=function(){return this._bounds},hc.prototype.interfaces_=function(){return[lc,hu]},hc.prototype.getClass=function(){return hc},cc.prototype.poll=function(){var t;return this.isEmpty()?null:(t=this._items.get(1),this._items.set(1,this._items.get(this._size)),--this._size,this.reorder(1),t)},cc.prototype.size=function(){return this._size},cc.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)},cc.prototype.clear=function(){this._size=0,this._items.clear()},cc.prototype.isEmpty=function(){return 0===this._size},cc.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)},cc.prototype.interfaces_=function(){return[]},cc.prototype.getClass=function(){return cc},pc.prototype.visitItem=function(t){},pc.prototype.interfaces_=function(){return[]},pc.prototype.getClass=function(){return pc},fc.prototype.insert=function(t,e){},fc.prototype.remove=function(t,e){},fc.prototype.query=function(){},fc.prototype.interfaces_=function(){return[]},fc.prototype.getClass=function(){return fc};function dc(){}function yc(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()}function _c(){var t;this._root=null,this._built=!1,this._itemBoundables=new I,this._nodeCapacity=null,0===arguments.length?this._nodeCapacity=_c.DEFAULT_NODE_CAPACITY:1===arguments.length&&(x.isTrue(1<(t=arguments[0]),"Node capacity must be greater than 1"),this._nodeCapacity=t)}function mc(){}function vc(){}var xc,Ec,e={serialVersionUID:{configurable:!0}},e=(gc.prototype.getLevel=function(){return this._level},gc.prototype.size=function(){return this._childBoundables.size()},gc.prototype.getChildBoundables=function(){return this._childBoundables},gc.prototype.addChildBoundable=function(t){x.isTrue(null===this._bounds),this._childBoundables.add(t)},gc.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},gc.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},gc.prototype.interfaces_=function(){return[lc,hu]},gc.prototype.getClass=function(){return gc},e.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(gc,e),dc.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},dc.min=function(t){return dc.sort(t),t.get(0)},dc.sort=function(t,e){var n=t.toArray();e?Rl.sort(n,e):Rl.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},dc.singletonList=function(t){var e=new I;return e.add(t),e},yc.prototype.expandToQueue=function(t,e){var n=yc.isComposite(this._boundable1),r=yc.isComposite(this._boundable2);if(n&&r)return yc.area(this._boundable1)>yc.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 ou("neither boundable is composite")},yc.prototype.isLeaves=function(){return!(yc.isComposite(this._boundable1)||yc.isComposite(this._boundable2))},yc.prototype.compareTo=function(t){return this._distance<t._distance?-1:this._distance>t._distance?1:0},yc.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),o=new yc(o,e,this._itemDistance);o.getDistance()<r&&n.add(o)}},yc.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},yc.prototype.getDistance=function(){return this._distance},yc.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},yc.prototype.interfaces_=function(){return[au]},yc.prototype.getClass=function(){return yc},yc.area=function(t){return t.getBounds().getArea()},yc.isComposite=function(t){return t instanceof gc},{IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}}),bc=(_c.prototype.getNodeCapacity=function(){return this._nodeCapacity},_c.prototype.lastNode=function(t){return t.get(t.size()-1)},_c.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 gc?t+=this.size(n):n instanceof hc&&(t+=1)}return t}},_c.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof hc&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},_c.prototype.itemsTree=function(){if(0===arguments.length)return this.build(),null===(t=this.itemsTree(this._root))?new I:t;if(1===arguments.length){for(var t=arguments[0],e=new I,n=t.getChildBoundables().iterator();n.hasNext();){var r,i=n.next();i instanceof gc?null!==(r=this.itemsTree(i))&&e.add(r):i instanceof hc?e.add(i.getItem()):x.shouldNeverReachHere()}return e.size()<=0?null:e}},_c.prototype.insert=function(t,e){x.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new hc(t,e))},_c.prototype.boundablesAtLevel=function(){var t;if(1===arguments.length)return n=arguments[0],t=new I,this.boundablesAtLevel(n,this._root,t),t;if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];if(x.isTrue(-2<e),n.getLevel()===e)r.add(n);else for(var i=n.getChildBoundables().iterator();i.hasNext();){var o=i.next();o instanceof gc?this.boundablesAtLevel(e,o,r):(x.isTrue(o instanceof hc),-1===e&&r.add(o))}return null}},_c.prototype.query=function(){if(1===arguments.length)return t=arguments[0],this.build(),e=new I,this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e),e;if(2===arguments.length){var t=arguments[0],e=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,e)}else if(3===arguments.length)if(v(arguments[2],pc)&&arguments[0]instanceof Object&&arguments[1]instanceof gc)for(var n=arguments[0],t=arguments[1],r=arguments[2],i=t.getChildBoundables(),o=0;o<i.size();o++){var s=i.get(o);this.getIntersectsOp().intersects(s.getBounds(),n)&&(s instanceof gc?this.query(n,s,r):s instanceof hc?r.visitItem(s.getItem()):x.shouldNeverReachHere())}else if(v(arguments[2],$u)&&arguments[0]instanceof Object&&arguments[1]instanceof gc)for(var a=arguments[0],e=arguments[1],u=arguments[2],l=e.getChildBoundables(),h=0;h<l.size();h++){var c=l.get(h);this.getIntersectsOp().intersects(c.getBounds(),a)&&(c instanceof gc?this.query(a,c,u):c instanceof hc?u.add(c.getItem()):x.shouldNeverReachHere())}},_c.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},_c.prototype.getRoot=function(){return this.build(),this._root},_c.prototype.remove=function(){var t;if(2===arguments.length)return n=arguments[0],t=arguments[1],this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,t);if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=this.removeItem(n,r);if(i)return!0;for(var o=null,s=n.getChildBoundables().iterator();s.hasNext();){var a=s.next();if(this.getIntersectsOp().intersects(a.getBounds(),e)&&a instanceof gc&&(i=this.remove(e,a,r))){o=a;break}}return null!==o&&o.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(o),i}},_c.prototype.createHigherLevels=function(t,e){x.isTrue(!t.isEmpty());t=this.createParentBoundables(t,e+1);return 1===t.size()?t.get(0):this.createHigherLevels(t,e+1)},_c.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof gc&&t<(n=this.depth(n))&&(t=n)}return t+1}},_c.prototype.createParentBoundables=function(t,e){x.isTrue(!t.isEmpty());var n=new I,t=(n.add(this.createNode(e)),new I(t));dc.sort(t,this.getComparator());for(var r=t.iterator();r.hasNext();){var i=r.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(i)}return n},_c.prototype.isEmpty=function(){return(this._built?this._root:this._itemBoundables).isEmpty()},_c.prototype.interfaces_=function(){return[hu]},_c.prototype.getClass=function(){return _c},_c.compareDoubles=function(t,e){return e<t?1:t<e?-1:0},e.IntersectsOp.get=function(){return bc},e.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},e.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(_c,e),function(){}),wc=(mc.prototype.distance=function(t,e){},mc.prototype.interfaces_=function(){return[]},mc.prototype.getClass=function(){return mc},(Ec=_c)&&(Sc.__proto__=Ec),e={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}},((Sc.prototype=Object.create(Ec&&Ec.prototype)).constructor=Sc).prototype.createParentBoundablesFromVerticalSlices=function(t,e){x.isTrue(0<t.length);for(var n=new I,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},Sc.prototype.createNode=function(t){return new Ic(t)},Sc.prototype.size=function(){return 0===arguments.length?Ec.prototype.size.call(this):Ec.prototype.size.apply(this,arguments)},Sc.prototype.insert=function(){var t,e;return 2!==arguments.length?Ec.prototype.insert.apply(this,arguments):(t=arguments[0],e=arguments[1],t.isNull()?null:void Ec.prototype.insert.call(this,t,e))},Sc.prototype.getIntersectsOp=function(){return Sc.intersectsOp},Sc.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 I;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},Sc.prototype.query=function(){if(1===arguments.length)return Ec.prototype.query.call(this,arguments[0]);2===arguments.length?Ec.prototype.query.call(this,arguments[0],arguments[1]):3===arguments.length&&(v(arguments[2],pc)&&arguments[0]instanceof Object&&arguments[1]instanceof gc||v(arguments[2],$u)&&arguments[0]instanceof Object&&arguments[1]instanceof gc)&&Ec.prototype.query.call(this,arguments[0],arguments[1],arguments[2])},Sc.prototype.getComparator=function(){return Sc.yComparator},Sc.prototype.createParentBoundablesFromVerticalSlice=function(t,e){return Ec.prototype.createParentBoundables.call(this,t,e)},Sc.prototype.remove=function(){return 2===arguments.length?Ec.prototype.remove.call(this,arguments[0],arguments[1]):Ec.prototype.remove.apply(this,arguments)},Sc.prototype.depth=function(){return 0===arguments.length?Ec.prototype.depth.call(this):Ec.prototype.depth.apply(this,arguments)},Sc.prototype.createParentBoundables=function(t,e){x.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),t=new I(t),t=(dc.sort(t,Sc.xComparator),this.verticalSlices(t,Math.trunc(Math.ceil(Math.sqrt(n)))));return this.createParentBoundablesFromVerticalSlices(t,e)},Sc.prototype.nearestNeighbour=function(){var t,e;if(1===arguments.length)return v(arguments[0],mc)?(e=arguments[0],e=new yc(this.getRoot(),this.getRoot(),e),this.nearestNeighbour(e)):arguments[0]instanceof yc?this.nearestNeighbour(arguments[0],h.POSITIVE_INFINITY):void 0;if(2===arguments.length){if(arguments[0]instanceof Sc&&v(arguments[1],mc))return e=arguments[0],n=arguments[1],e=new yc(this.getRoot(),e.getRoot(),n),this.nearestNeighbour(e);if(arguments[0]instanceof yc&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1],i=null,o=new cc;for(o.add(n);!o.isEmpty()&&0<r;){var s=o.poll(),a=s.getDistance();if(r<=a)break;s.isLeaves()?(r=a,i=s):s.expandToQueue(o,r)}return[i.getBoundable(0).getItem(),i.getBoundable(1).getItem()]}}else if(3===arguments.length)return e=arguments[0],n=arguments[1],t=arguments[2],e=new hc(e,n),n=new yc(this.getRoot(),e,t),this.nearestNeighbour(n)[0]},Sc.prototype.interfaces_=function(){return[fc,hu]},Sc.prototype.getClass=function(){return Sc},Sc.centreX=function(t){return Sc.avg(t.getMinX(),t.getMaxX())},Sc.avg=function(t,e){return(t+e)/2},Sc.centreY=function(t){return Sc.avg(t.getMinY(),t.getMaxY())},e.STRtreeNode.get=function(){return Ic},e.serialVersionUID.get=function(){return 0x39920f7d5f261e0},e.xComparator.get=function(){return{interfaces_:function(){return[lu]},compare:function(t,e){return Ec.compareDoubles(Sc.centreX(t.getBounds()),Sc.centreX(e.getBounds()))}}},e.yComparator.get=function(){return{interfaces_:function(){return[lu]},compare:function(t,e){return Ec.compareDoubles(Sc.centreY(t.getBounds()),Sc.centreY(e.getBounds()))}}},e.intersectsOp.get=function(){return{interfaces_:function(){return[Ec.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},e.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Sc,e),Sc),Ic=((xc=gc)&&(Nc.__proto__=xc),((Nc.prototype=Object.create(xc&&xc.prototype)).constructor=Nc).prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new u(n.getBounds()):t.expandToInclude(n.getBounds())}return t},Nc.prototype.interfaces_=function(){return[]},Nc.prototype.getClass=function(){return Nc},Nc);function Nc(){xc.call(this,arguments[0])}function Sc(t){Ec.call(this,t=t||Sc.DEFAULT_NODE_CAPACITY)}vc.prototype.interfaces_=function(){return[]},vc.prototype.getClass=function(){return vc},vc.relativeSign=function(t,e){return t<e?-1:e<t?1:0},vc.compare=function(t,e,n){if(!e.equals2D(n)){var r=vc.relativeSign(e.x,n.x),i=vc.relativeSign(e.y,n.y);switch(t){case 0:return vc.compareValue(r,i);case 1:return vc.compareValue(i,r);case 2:return vc.compareValue(i,-r);case 3:return vc.compareValue(-r,i);case 4:return vc.compareValue(-r,-i);case 5:return vc.compareValue(-i,-r);case 6:return vc.compareValue(-i,r);case 7:return vc.compareValue(r,-i)}x.shouldNeverReachHere("invalid octant value")}return 0},vc.compareValue=function(t,e){return t<0?-1:0<t?1:e<0?-1:0<e?1:0};function Cc(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new m(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))}function Pc(){this._nodeMap=new Pl,this._edge=null,this._edge=arguments[0]}function Mc(){}function Lc(){}function Oc(){}Cc.prototype.getCoordinate=function(){return this.coord},Cc.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Cc.prototype.compareTo=function(t){return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:vc.compare(this._segmentOctant,this.coord,t.coord)},Cc.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},Cc.prototype.isInterior=function(){return this._isInterior},Cc.prototype.interfaces_=function(){return[au]},Cc.prototype.getClass=function(){return Cc},Pc.prototype.getSplitCoordinates=function(){var t=new sl;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()},Pc.prototype.addCollapsedNodes=function(){var t=new I;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)}},Pc.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Pc.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 gu(e+1))}},Pc.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(r);n.add(new m(t.coord),!1);for(var i=t.segmentIndex+1;i<=e.segmentIndex;i++)n.add(this._edge.getCoordinate(i));r&&n.add(new m(e.coord))},Pc.prototype.iterator=function(){return this._nodeMap.values().iterator()},Pc.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}},Pc.prototype.findCollapseIndex=function(t,e,n){var r;return!!t.coord.equals2D(e.coord)&&(r=e.segmentIndex-t.segmentIndex,e.isInterior()||r--,1===r)&&(n[0]=t.segmentIndex+1,!0)},Pc.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 gu(e[0])),r=i}},Pc.prototype.getEdge=function(){return this._edge},Pc.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Pc.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(r),i=(r||n--,new Array(n).fill(null)),o=0;i[o++]=new m(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)i[o++]=this._edge.getCoordinate(s);return r&&(i[o]=new m(e.coord)),new qc(i,this._edge.getData())},Pc.prototype.add=function(t,e){var e=new Cc(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(e);return null!==n?(x.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(e,e),e)},Pc.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new Ou("bad split edge start point at "+n);n=t.get(t.size()-1).getCoordinates(),t=n[n.length-1];if(!t.equals2D(e[e.length-1]))throw new Ou("bad split edge end point at "+t)},Pc.prototype.interfaces_=function(){return[]},Pc.prototype.getClass=function(){return Pc},Mc.prototype.interfaces_=function(){return[]},Mc.prototype.getClass=function(){return Mc},Mc.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 ou("Cannot compute the octant for point ( "+t+", "+e+" )");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 m&&arguments[1]instanceof m){t=arguments[0],e=arguments[1],r=e.x-t.x,n=e.y-t.y;if(0==r&&0==n)throw new ou("Cannot compute the octant for two identical points "+t);return Mc.octant(r,n)}},Lc.prototype.getCoordinates=function(){},Lc.prototype.size=function(){},Lc.prototype.getCoordinate=function(t){},Lc.prototype.isClosed=function(){},Lc.prototype.setData=function(t){},Lc.prototype.getData=function(){},Lc.prototype.interfaces_=function(){return[]},Lc.prototype.getClass=function(){return Lc};function D(){var t,e,n,r;this.p0=null,this.p1=null,0===arguments.length?(this.p0=new m,this.p1=new m):1===arguments.length?(this.p0=new m((t=arguments[0]).p0),this.p1=new m(t.p1)):2===arguments.length?(this.p0=arguments[0],this.p1=arguments[1]):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],this.p0=new m(t,e),this.p1=new m(n,r))}function Rc(){this.tempEnv1=new u,this.tempEnv2=new u,this._overlapSeg1=new D,this._overlapSeg2=new D}function Tc(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r}function Ac(){}function Dc(){}function Fc(){this._segInt=null,0!==arguments.length&&1===arguments.length&&this.setSegmentIntersector(arguments[0])}function F(){var t,e,n,r;this._quadrantSegments=F.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=F.CAP_ROUND,this._joinStyle=F.JOIN_ROUND,this._mitreLimit=F.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=F.DEFAULT_SIMPLIFY_FACTOR,0!==arguments.length&&(1===arguments.length?this.setQuadrantSegments(arguments[0]):2===arguments.length?(t=arguments[0],e=arguments[1],this.setQuadrantSegments(t),this.setEndCapStyle(e)):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],this.setQuadrantSegments(t),this.setEndCapStyle(e),this.setJoinStyle(n),this.setMitreLimit(r)))}Oc.prototype.addIntersection=function(t,e){},Oc.prototype.interfaces_=function(){return[Lc]},Oc.prototype.getClass=function(){return Oc};var kc,Gc,qc=function(){this._nodeList=new Pc(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e},e=(qc.prototype.getCoordinates=function(){return this._pts},qc.prototype.size=function(){return this._pts.length},qc.prototype.getCoordinate=function(t){return this._pts[t]},qc.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},qc.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},qc.prototype.setData=function(t){this._data=t},qc.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Mc.octant(t,e)},qc.prototype.getData=function(){return this._data},qc.prototype.addIntersection=function(){var t,e;2===arguments.length?this.addIntersectionNode(arguments[0],arguments[1]):4===arguments.length&&(e=arguments[0],t=arguments[1],e=new m(e.getIntersection(arguments[3])),this.addIntersection(e,t))},qc.prototype.toString=function(){return Nu.toLineString(new mh(this._pts))},qc.prototype.getNodeList=function(){return this._nodeList},qc.prototype.addIntersectionNode=function(t,e){var n,r=e+1;return r<this._pts.length&&(n=this._pts[r],t.equals2D(n))&&(e=r),this._nodeList.add(t,e)},qc.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},qc.prototype.interfaces_=function(){return[Oc]},qc.prototype.getClass=function(){return qc},qc.getNodedSubstrings=function(){var t;if(1===arguments.length)return e=arguments[0],t=new I,qc.getNodedSubstrings(e,t),t;if(2===arguments.length)for(var e=arguments[0],n=arguments[1],r=e.iterator();r.hasNext();)r.next().getNodeList().addSplitEdges(n)},{serialVersionUID:{configurable:!0}}),Bc=(D.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},D.prototype.orientationIndex=function(){var t,e;return arguments[0]instanceof D?(t=b.orientationIndex(this.p0,this.p1,(e=arguments[0]).p0),e=b.orientationIndex(this.p0,this.p1,e.p1),0<=t&&0<=e||t<=0&&e<=0?Math.max(t,e):0):arguments[0]instanceof m?b.orientationIndex(this.p0,this.p1,arguments[0]):void 0},D.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},D.prototype.isVertical=function(){return this.p0.x===this.p1.x},D.prototype.equals=function(t){return t instanceof D&&this.p0.equals((t=t).p0)&&this.p1.equals(t.p1)},D.prototype.intersection=function(t){var e=new Gu;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},D.prototype.project=function(){var t,e,n,r;return arguments[0]instanceof m?(t=arguments[0]).equals(this.p0)||t.equals(this.p1)?new m(t):(t=this.projectionFactor(t),(r=new m).x=this.p0.x+t*(this.p1.x-this.p0.x),r.y=this.p0.y+t*(this.p1.y-this.p0.y),r):arguments[0]instanceof D?(r=this.projectionFactor((t=arguments[0]).p0),e=this.projectionFactor(t.p1),1<=r&&1<=e||r<=0&&e<=0?null:(n=this.project(t.p0),r<0&&(n=this.p0),1<r&&(n=this.p1),r=this.project(t.p1),e<0&&(r=this.p0),1<e&&(r=this.p1),new D(n,r))):void 0},D.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},D.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},D.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},D.prototype.distancePerpendicular=function(t){return b.distancePointLinePerpendicular(t,this.p0,this.p1)},D.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},D.prototype.midPoint=function(){return D.midPoint(this.p0,this.p1)},D.prototype.projectionFactor=function(t){var e,n,r;return t.equals(this.p0)?0:t.equals(this.p1)?1:(r=(e=this.p1.x-this.p0.x)*e+(n=this.p1.y-this.p0.y)*n)<=0?h.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},D.prototype.closestPoints=function(t){var e,n,r,i=this.intersection(t);return null!==i?[i,i]:(i=new Array(2).fill(null),n=h.MAX_VALUE,e=null,n=(r=this.closestPoint(t.p0)).distance(t.p0),i[0]=r,i[1]=t.p0,(e=(r=this.closestPoint(t.p1)).distance(t.p1))<n&&(n=e,i[0]=r,i[1]=t.p1),(e=(r=t.closestPoint(this.p0)).distance(this.p0))<n&&(n=e,i[0]=this.p0,i[1]=r),(e=(r=t.closestPoint(this.p1)).distance(this.p1))<n&&(n=e,i[0]=this.p1,i[1]=r),i)},D.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},D.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},D.prototype.getLength=function(){return this.p0.distance(this.p1)},D.prototype.compareTo=function(t){var e=this.p0.compareTo(t.p0);return 0!==e?e:this.p1.compareTo(t.p1)},D.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},D.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)},D.prototype.lineIntersection=function(t){try{return wu.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof Eu))throw t}return null},D.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},D.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),t=this.p0.y+t*(this.p1.y-this.p0.y),r=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,o=Math.sqrt(r*r+i*i),s=0,a=0;if(0!==e){if(o<=0)throw new Error("Cannot compute offset from zero-length line segment");s=e*r/o,a=e*i/o}return new m(n-a,t+s)},D.prototype.setCoordinates=function(){var t,e;1===arguments.length?this.setCoordinates((t=arguments[0]).p0,t.p1):2===arguments.length&&(t=arguments[0],e=arguments[1],this.p0.x=t.x,this.p0.y=t.y,this.p1.x=e.x,this.p1.y=e.y)},D.prototype.segmentFraction=function(t){t=this.projectionFactor(t);return t<0?t=0:(1<t||h.isNaN(t))&&(t=1),t},D.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},D.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},D.prototype.distance=function(){var t;return arguments[0]instanceof D?b.distanceLineLine(this.p0,this.p1,(t=arguments[0]).p0,t.p1):arguments[0]instanceof m?b.distancePointLine(arguments[0],this.p0,this.p1):void 0},D.prototype.pointAlong=function(t){var e=new m;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},D.prototype.hashCode=function(){var t=h.doubleToLongBits(this.p0.x),t=(t^=31*h.doubleToLongBits(this.p0.y),Math.trunc(t)^Math.trunc(t>>32)),e=h.doubleToLongBits(this.p1.x);return e^=31*h.doubleToLongBits(this.p1.y),t^(Math.trunc(e)^Math.trunc(e>>32))},D.prototype.interfaces_=function(){return[au,hu]},D.prototype.getClass=function(){return D},D.midPoint=function(t,e){return new m((t.x+e.x)/2,(t.y+e.y)/2)},e.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(D,e),Rc.prototype.overlap=function(){var t,e,n,r;2!==arguments.length&&4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2))},Rc.prototype.interfaces_=function(){return[]},Rc.prototype.getClass=function(){return Rc},Tc.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Tc.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];return r.tempEnv1.init(i,o),n-e==1?(r.select(this,e),null):t.intersects(r.tempEnv1)?(e<(i=Math.trunc((e+n)/2))&&this.computeSelect(t,e,i,r),void(i<n&&this.computeSelect(t,i,n,r))):null},Tc.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},Tc.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Tc.prototype.setId=function(t){this._id=t},Tc.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Tc.prototype.getEnvelope=function(){var t,e;return null===this._env&&(t=this._pts[this._start],e=this._pts[this._end],this._env=new u(t,e)),this._env},Tc.prototype.getEndIndex=function(){return this._end},Tc.prototype.getStartIndex=function(){return this._start},Tc.prototype.getContext=function(){return this._context},Tc.prototype.getId=function(){return this._id},Tc.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],l=n._pts[i];return e-t==1&&i-r==1?(o.overlap(this,t,n,r),null):(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),o.tempEnv1.intersects(o.tempEnv2)?(s=Math.trunc((t+e)/2),a=Math.trunc((r+i)/2),t<s&&(r<a&&this.computeOverlapsInternal(t,s,n,r,a,o),a<i)&&this.computeOverlapsInternal(t,s,n,a,i,o),void(s<e&&(r<a&&this.computeOverlapsInternal(s,e,n,r,a,o),a<i)&&this.computeOverlapsInternal(s,e,n,a,i,o))):null)},Tc.prototype.interfaces_=function(){return[]},Tc.prototype.getClass=function(){return Tc},Ac.prototype.interfaces_=function(){return[]},Ac.prototype.getClass=function(){return Ac},Ac.getChainStartIndices=function(t){var e=0,n=new I;n.add(new gu(e));do{var r=Ac.findChainEnd(t,e)}while(n.add(new gu(r)),(e=r)<t.length-1);return Ac.toIntArray(n)},Ac.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=ec.quadrant(t[n],t[n+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||ec.quadrant(t[i-1],t[i])===r);)i++;return i-1},Ac.getChains=function(){if(1===arguments.length)return Ac.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=new I,r=Ac.getChainStartIndices(t),i=0;i<r.length-1;i++){var o=new Tc(t,r[i],r[i+1],e);n.add(o)}return n}},Ac.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},Dc.prototype.computeNodes=function(t){},Dc.prototype.getNodedSubstrings=function(){},Dc.prototype.interfaces_=function(){return[]},Dc.prototype.getClass=function(){return Dc},Fc.prototype.setSegmentIntersector=function(t){this._segInt=t},Fc.prototype.interfaces_=function(){return[Dc]},Fc.prototype.getClass=function(){return Fc},(Gc=Fc)&&(Uc.__proto__=Gc),e={SegmentOverlapAction:{configurable:!0}},((Uc.prototype=Object.create(Gc&&Gc.prototype)).constructor=Uc).prototype.getMonotoneChains=function(){return this._monoChains},Uc.prototype.getNodedSubstrings=function(){return qc.getNodedSubstrings(this._nodedSegStrings)},Uc.prototype.getIndex=function(){return this._index},Uc.prototype.add=function(t){for(var e=Ac.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)}},Uc.prototype.computeNodes=function(t){for(var e=(this._nodedSegStrings=t).iterator();e.hasNext();)this.add(e.next());this.intersectChains()},Uc.prototype.intersectChains=function(){for(var t=new zc(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}},Uc.prototype.interfaces_=function(){return[]},Uc.prototype.getClass=function(){return Uc},e.SegmentOverlapAction.get=function(){return zc},Object.defineProperties(Uc,e),Uc),zc=((kc=Rc)&&(jc.__proto__=kc),((jc.prototype=Object.create(kc&&kc.prototype)).constructor=jc).prototype.overlap=function(){if(4!==arguments.length)return kc.prototype.overlap.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],t=t.getContext(),n=n.getContext();this._si.processIntersections(t,e,n,r)},jc.prototype.interfaces_=function(){return[]},jc.prototype.getClass=function(){return jc},jc),e={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 jc(){kc.call(this),this._si=null,this._si=arguments[0]}function Uc(t){t?Gc.call(this,t):Gc.call(this),this._monoChains=new I,this._index=new wc,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}F.prototype.getEndCapStyle=function(){return this._endCapStyle},F.prototype.isSingleSided=function(){return this._isSingleSided},F.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=F.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=F.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==F.JOIN_ROUND&&(this._quadrantSegments=F.DEFAULT_QUADRANT_SEGMENTS)},F.prototype.getJoinStyle=function(){return this._joinStyle},F.prototype.setJoinStyle=function(t){this._joinStyle=t},F.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},F.prototype.getSimplifyFactor=function(){return this._simplifyFactor},F.prototype.getQuadrantSegments=function(){return this._quadrantSegments},F.prototype.setEndCapStyle=function(t){this._endCapStyle=t},F.prototype.getMitreLimit=function(){return this._mitreLimit},F.prototype.setMitreLimit=function(t){this._mitreLimit=t},F.prototype.setSingleSided=function(t){this._isSingleSided=t},F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.bufferDistanceError=function(t){t=Math.PI/2/t;return 1-Math.cos(t/2)},e.CAP_ROUND.get=function(){return 1},e.CAP_FLAT.get=function(){return 2},e.CAP_SQUARE.get=function(){return 3},e.JOIN_ROUND.get=function(){return 1},e.JOIN_MITRE.get=function(){return 2},e.JOIN_BEVEL.get=function(){return 3},e.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},e.DEFAULT_MITRE_LIMIT.get=function(){return 5},e.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(F,e);function Vc(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=b.COUNTERCLOCKWISE,this._inputLine=t||null}function Xc(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new I}function a(){}function Yc(){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 D,this._seg1=new D,this._offset0=new D,this._offset1=new D,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 Gu,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),8<=e.getQuadrantSegments()&&e.getJoinStyle()===F.JOIN_ROUND&&(this._closingSegLengthFactor=Yc.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}function Hc(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}function Wc(){this._subgraphs=null,this._seg=new D,this._cga=new b,this._subgraphs=arguments[0]}function Jc(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null}function Zc(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new I;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n}function Kc(){}function Qc(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}function $c(){this._geom=null,this._geom=arguments[0]}function tp(){this._edgeMap=new Pl,this._edgeList=null,this._ptInAreaLocation=[g.NONE,g.NONE]}function ep(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=ep.orientation(t)}var np,rp,e={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}},e=(Vc.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],e=this._inputLine[e],o=this._inputLine[n];return!!this.isConcave(i,e,o)&&!!this.isShallow(i,e,o,r)&&this.isShallowSampled(i,e,t,n,r)},Vc.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]=Vc.DELETE,r=i=!0),e=this.findNextNonDeletedIndex(t=i?n:e),n=this.findNextNonDeletedIndex(e)}return r},Vc.prototype.isShallowConcavity=function(t,e,n,r){return b.computeOrientation(t,e,n)===this._angleOrientation&&b.distancePointLine(e,t,n)<r},Vc.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/Vc.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},Vc.prototype.isConcave=function(t,e,n){return b.computeOrientation(t,e,n)===this._angleOrientation},Vc.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=b.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);for(;this.deleteShallowConcavities(););return this.collapseLine()},Vc.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Vc.DELETE;)e++;return e},Vc.prototype.isShallow=function(t,e,n,r){return b.distancePointLine(e,t,n)<r},Vc.prototype.collapseLine=function(){for(var t=new sl,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Vc.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},Vc.prototype.interfaces_=function(){return[]},Vc.prototype.getClass=function(){return Vc},Vc.simplify=function(t,e){return new Vc(t).simplify(e)},e.INIT.get=function(){return 0},e.DELETE.get=function(){return 1},e.KEEP.get=function(){return 1},e.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Vc,e),{COORDINATE_ARRAY_TYPE:{configurable:!0}}),e=(Xc.prototype.getCoordinates=function(){return this._ptList.toArray(Xc.COORDINATE_ARRAY_TYPE)},Xc.prototype.setPrecisionModel=function(t){this._precisionModel=t},Xc.prototype.addPt=function(t){t=new m(t);if(this._precisionModel.makePrecise(t),this.isRedundant(t))return null;this._ptList.add(t)},Xc.prototype.revere=function(){},Xc.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])},Xc.prototype.isRedundant=function(t){var e;return!(this._ptList.size()<1)&&(e=this._ptList.get(this._ptList.size()-1),t.distance(e)<this._minimimVertexDistance)},Xc.prototype.toString=function(){return(new A).createLineString(this.getCoordinates()).toString()},Xc.prototype.closeRing=function(){var t,e;return this._ptList.size()<1||(t=new m(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1),t.equals(e))?null:void this._ptList.add(t)},Xc.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Xc.prototype.interfaces_=function(){return[]},Xc.prototype.getClass=function(){return Xc},e.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Xc,e),{PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}}),e=(a.prototype.interfaces_=function(){return[]},a.prototype.getClass=function(){return a},a.toDegrees=function(t){return 180*t/Math.PI},a.normalize=function(t){for(;t>Math.PI;)t-=a.PI_TIMES_2;for(;t<=-Math.PI;)t+=a.PI_TIMES_2;return t},a.angle=function(){var t,e,n;return 1===arguments.length?(t=arguments[0],Math.atan2(t.y,t.x)):2===arguments.length?(t=arguments[0],e=(n=arguments[1]).x-t.x,n=n.y-t.y,Math.atan2(n,e)):void 0},a.isAcute=function(t,e,n){var r=t.x-e.x,t=t.y-e.y;return 0<r*(n.x-e.x)+t*(n.y-e.y)},a.isObtuse=function(t,e,n){var r=t.x-e.x,t=t.y-e.y;return r*(n.x-e.x)+t*(n.y-e.y)<0},a.interiorAngle=function(t,e,n){t=a.angle(e,t),e=a.angle(e,n);return Math.abs(e-t)},a.normalizePositive=function(t){if(t<0){for(;t<0;)t+=a.PI_TIMES_2;a.PI_TIMES_2<=t&&(t=0)}else{for(;a.PI_TIMES_2<=t;)t-=a.PI_TIMES_2;t<0&&(t=0)}return t},a.angleBetween=function(t,e,n){t=a.angle(e,t),e=a.angle(e,n);return a.diff(t,e)},a.diff=function(t,e){var n=null;return n=(n=t<e?e-t:t-e)>Math.PI?2*Math.PI-n:n},a.toRadians=function(t){return t*Math.PI/180},a.getTurn=function(t,e){e=Math.sin(e-t);return 0<e?a.COUNTERCLOCKWISE:e<0?a.CLOCKWISE:a.NONE},a.angleBetweenOriented=function(t,e,n){t=a.angle(e,t),e=a.angle(e,n)-t;return e<=-Math.PI?e+a.PI_TIMES_2:e>Math.PI?e-a.PI_TIMES_2:e},e.PI_TIMES_2.get=function(){return 2*Math.PI},e.PI_OVER_2.get=function(){return Math.PI/2},e.PI_OVER_4.get=function(){return Math.PI/4},e.COUNTERCLOCKWISE.get=function(){return b.COUNTERCLOCKWISE},e.CLOCKWISE.get=function(){return b.CLOCKWISE},e.NONE.get=function(){return b.COLLINEAR},Object.defineProperties(a,e),{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}}),e=(Yc.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 t=b.computeOrientation(this._s0,this._s1,this._s2),n=t===b.CLOCKWISE&&this._side===T.LEFT||t===b.COUNTERCLOCKWISE&&this._side===T.RIGHT;0===t?this.addCollinear(e):n?this.addOutsideTurn(t,e):this.addInsideTurn(t,e)},Yc.prototype.addLineEndCap=function(t,e){var n=new D(t,e),r=new D,i=(this.computeOffsetSegment(n,T.LEFT,this._distance,r),new D),n=(this.computeOffsetSegment(n,T.RIGHT,this._distance,i),e.x-t.x),t=e.y-t.y,o=Math.atan2(t,n);switch(this._bufParams.getEndCapStyle()){case F.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,o+Math.PI/2,o-Math.PI/2,b.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case F.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case F.CAP_SQUARE:var s=new m,a=(s.x=Math.abs(this._distance)*Math.cos(o),s.y=Math.abs(this._distance)*Math.sin(o),new m(r.p1.x+s.x,r.p1.y+s.y)),s=new m(i.p1.x+s.x,i.p1.y+s.y);this._segList.addPt(a),this._segList.addPt(s)}},Yc.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Yc.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=wu.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 Eu))throw t;o=new m(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Yc.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,s=Math.atan2(s,o),o=n.x-t.x,a=n.y-t.y,a=Math.atan2(a,o);r===b.CLOCKWISE?s<=a&&(s+=2*Math.PI):a<=s&&(s-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,s,a,r,i),this._segList.addPt(n)},Yc.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Yc.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===F.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===F.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))},Yc.prototype.createSquare=function(t){this._segList.addPt(new m(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new m(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new m(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new m(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Yc.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Yc.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Yc.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Yc.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)},Yc.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=a.angle(i,this._seg0.p0),s=a.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,o=a.normalize(o+s),o=a.normalize(o+Math.PI),r=r*n,n=n-r*Math.abs(Math.sin(s)),s=i.x+r*Math.cos(o),r=i.y+r*Math.sin(o),o=new m(s,r),s=new D(i,o),r=s.pointAlongOffset(1,n),i=s.pointAlongOffset(1,-n);this._side===T.LEFT?(this._segList.addPt(r),this._segList.addPt(i)):(this._segList.addPt(i),this._segList.addPt(r))},Yc.prototype.computeOffsetSegment=function(t,e,n,r){var e=e===T.LEFT?1:-1,i=t.p1.x-t.p0.x,o=t.p1.y-t.p0.y,s=Math.sqrt(i*i+o*o),i=e*n*i/s,e=e*n*o/s;r.p0.x=t.p0.x-e,r.p0.y=t.p0.y+i,r.p1.x=t.p1.x-e,r.p1.y=t.p1.y+i},Yc.prototype.addFilletArc=function(t,e,n,r,i){var o=r===b.CLOCKWISE?-1:1,s=Math.abs(e-n),r=Math.trunc(s/this._filletAngleQuantum+.5);if(r<1)return null;for(var a=s/r,u=0,l=new m;u<s;){var h=e+o*u;l.x=t.x+i*Math.cos(h),l.y=t.y+i*Math.sin(h),this._segList.addPt(l),u+=a}},Yc.prototype.addInsideTurn=function(t,e){var n;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*Yc.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR?this._segList.addPt(this._offset0.p1):(this._segList.addPt(this._offset0.p1),0<this._closingSegLengthFactor?(n=new m((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),n=new m((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(n)):this._segList.addPt(this._s1),this._segList.addPt(this._offset1.p0)))},Yc.prototype.createCircle=function(t){var e=new m(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Yc.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Yc.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Xc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Yc.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Yc.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),2<=this._li.getIntersectionNum()&&(this._bufParams.getJoinStyle()===F.JOIN_BEVEL||this._bufParams.getJoinStyle()===F.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,b.CLOCKWISE,this._distance))},Yc.prototype.closeRing=function(){this._segList.closeRing()},Yc.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Yc.prototype.interfaces_=function(){return[]},Yc.prototype.getClass=function(){return Yc},e.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},e.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},e.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},e.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Yc,e),Hc.prototype.getOffsetCurve=function(t,e){var n;return 0===(this._distance=e)?null:(n=e<0,e=Math.abs(e),e=this.getSegGen(e),t.length<=1?this.computePointCurve(t[0],e):this.computeOffsetCurve(t,n,e),t=e.getCoordinates(),n&&w.reverse(t),t)},Hc.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Vc.simplify(t,-r),e=i.length-1;n.initSideSegments(i[e],i[e-1],T.LEFT),n.addFirstSegment();for(var o=e-2;0<=o;o--)n.addNextSegment(i[o],!0)}else{n.addSegments(t,!1);var s=Vc.simplify(t,r),a=s.length-1;n.initSideSegments(s[0],s[1],T.LEFT),n.addFirstSegment();for(var u=2;u<=a;u++)n.addNextSegment(s[u],!0)}n.addLastSegment(),n.closeRing()},Hc.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance),i=Vc.simplify(t,r=e===T.RIGHT?-r:r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++)n.addNextSegment(i[s],1!==s);n.closeRing()},Hc.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Vc.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],T.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=Vc.simplify(t,-n),t=s.length-1;e.initSideSegments(s[t],s[t-1],T.LEFT);for(var a=t-2;0<=a;a--)e.addNextSegment(s[a],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Hc.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case F.CAP_ROUND:e.createCircle(t);break;case F.CAP_SQUARE:e.createSquare(t)}},Hc.prototype.getLineCurve=function(t,e){var n;return(this._distance=e)<0&&!this._bufParams.isSingleSided()||0===e?null:(n=Math.abs(e),n=this.getSegGen(n),t.length<=1?this.computePointCurve(t[0],n):this._bufParams.isSingleSided()?this.computeSingleSidedBufferCurve(t,e<0,n):this.computeLineBufferCurve(t,n),n.getCoordinates())},Hc.prototype.getBufferParameters=function(){return this._bufParams},Hc.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Hc.prototype.getRingCurve=function(t,e,n){return this._distance=n,t.length<=2?this.getLineCurve(t,n):0===n?Hc.copyCoordinates(t):(n=this.getSegGen(n),this.computeRingBufferCurve(t,e,n),n.getCoordinates())},Hc.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Vc.simplify(t,-r),e=i.length-1;n.initSideSegments(i[e],i[e-1],T.LEFT),n.addFirstSegment();for(var o=e-2;0<=o;o--)n.addNextSegment(i[o],!0)}else{var s=Vc.simplify(t,r),a=s.length-1;n.initSideSegments(s[0],s[1],T.LEFT),n.addFirstSegment();for(var u=2;u<=a;u++)n.addNextSegment(s[u],!0)}n.addLastSegment()},Hc.prototype.getSegGen=function(t){return new Yc(this._precisionModel,this._bufParams,t)},Hc.prototype.interfaces_=function(){return[]},Hc.prototype.getClass=function(){return Hc},Hc.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new m(t[n]);return e},{DepthSegment:{configurable:!0}}),ip=(Wc.prototype.findStabbedSegments=function(){var t,e=this;if(1===arguments.length){for(var n=arguments[0],r=new I,i=this._subgraphs.iterator();i.hasNext();){var o=i.next(),s=o.getEnvelope();n.y<s.getMinY()||n.y>s.getMaxY()||e.findStabbedSegments(n,o.getDirectedEdges(),r)}return r}if(3===arguments.length)if(v(arguments[2],$u)&&arguments[0]instanceof m&&arguments[1]instanceof oc)for(var a=arguments[0],u=arguments[1],l=arguments[2],h=u.getEdge().getCoordinates(),c=0;c<h.length-1;c++)e._seg.p0=h[c],e._seg.p1=h[c+1],e._seg.p0.y>e._seg.p1.y&&e._seg.reverse(),Math.max(e._seg.p0.x,e._seg.p1.x)<a.x||e._seg.isHorizontal()||a.y<e._seg.p0.y||a.y>e._seg.p1.y||b.computeOrientation(e._seg.p0,e._seg.p1,a)===b.RIGHT||(t=u.getDepth(T.LEFT),e._seg.p0.equals(h[c])||(t=u.getDepth(T.RIGHT)),t=new ip(e._seg,t),l.add(t));else if(v(arguments[2],$u)&&arguments[0]instanceof m&&v(arguments[1],$u))for(var p=arguments[0],f=arguments[1],g=arguments[2],d=f.iterator();d.hasNext();){var y=d.next();y.isForward()&&e.findStabbedSegments(p,y,g)}},Wc.prototype.getDepth=function(t){t=this.findStabbedSegments(t);return 0===t.size()?0:dc.min(t)._leftDepth},Wc.prototype.interfaces_=function(){return[]},Wc.prototype.getClass=function(){return Wc},e.DepthSegment.get=function(){return ip},Object.defineProperties(Wc,e),function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new D(t),this._leftDepth=e}),op=(ip.prototype.compareTo=function(t){var e;return this._upwardSeg.minX()>=t._upwardSeg.maxX()?1:this._upwardSeg.maxX()<=t._upwardSeg.minX()?-1:0!==(e=this._upwardSeg.orientationIndex(t._upwardSeg))||0!=(e=-1*t._upwardSeg.orientationIndex(this._upwardSeg))?e:this._upwardSeg.compareTo(t._upwardSeg)},ip.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},ip.prototype.toString=function(){return this._upwardSeg.toString()},ip.prototype.interfaces_=function(){return[au]},ip.prototype.getClass=function(){return ip},Jc.prototype.area=function(){return Jc.area(this.p0,this.p1,this.p2)},Jc.prototype.signedArea=function(){return Jc.signedArea(this.p0,this.p1,this.p2)},Jc.prototype.interpolateZ=function(t){if(null===t)throw new ou("Supplied point is null.");return Jc.interpolateZ(t,this.p0,this.p1,this.p2)},Jc.prototype.longestSideLength=function(){return Jc.longestSideLength(this.p0,this.p1,this.p2)},Jc.prototype.isAcute=function(){return Jc.isAcute(this.p0,this.p1,this.p2)},Jc.prototype.circumcentre=function(){return Jc.circumcentre(this.p0,this.p1,this.p2)},Jc.prototype.area3D=function(){return Jc.area3D(this.p0,this.p1,this.p2)},Jc.prototype.centroid=function(){return Jc.centroid(this.p0,this.p1,this.p2)},Jc.prototype.inCentre=function(){return Jc.inCentre(this.p0,this.p1,this.p2)},Jc.prototype.interfaces_=function(){return[]},Jc.prototype.getClass=function(){return Jc},Jc.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)},Jc.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Jc.det=function(t,e,n,r){return t*r-e*n},Jc.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,l=r.y-o,h=s*l-a*u,i=t.x-i,t=t.y-o;return e.z+(l*i-a*t)/h*(n.z-e.z)+(-u*i+s*t)/h*(r.z-e.z)},Jc.longestSideLength=function(t,e,n){var r=t.distance(e),e=e.distance(n),n=n.distance(t),t=r;return t=(t=r<e?e:r)<n?n:t},Jc.isAcute=function(t,e,n){return!!a.isAcute(t,e,n)&&!!a.isAcute(e,n,t)&&!!a.isAcute(n,t,e)},Jc.circumcentre=function(t,e,n){var r=n.x,n=n.y,i=t.x-r,t=t.y-n,o=e.x-r,e=e.y-n,s=2*Jc.det(i,t,o,e),a=Jc.det(t,i*i+t*t,e,o*o+e*e),i=Jc.det(i,i*i+t*t,o,o*o+e*e);return new m(r-a/s,n+i/s)},Jc.perpendicularBisector=function(t,e){var n=e.x-t.x,e=e.y-t.y,r=new wu(t.x+n/2,t.y+e/2,1),t=new wu(t.x-e+n/2,t.y+n+e/2,1);return new wu(r,t)},Jc.angleBisector=function(t,e,n){var r=e.distance(t),r=r/(r+e.distance(n)),e=n.x-t.x,n=n.y-t.y;return new m(t.x+r*e,t.y+r*n)},Jc.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,e=e.z-t.z,o=n.x-t.x,s=n.y-t.y,n=n.z-t.z,t=i*n-e*s,e=e*o-r*n,n=r*s-i*o;return Math.sqrt(t*t+e*e+n*n)/2},Jc.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,t=(t.y+e.y+n.y)/3;return new m(r,t)},Jc.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,r=(r*t.y+i*e.y+o*n.y)/s;return new m(a,r)},Zc.prototype.addPoint=function(t){if(this._distance<=0)return null;t=t.getCoordinates(),t=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(t,g.EXTERIOR,g.INTERIOR)},Zc.prototype.addPolygon=function(t){var e=this._distance,n=T.LEFT,r=(this._distance<0&&(e=-this._distance,n=T.RIGHT),t.getExteriorRing()),i=w.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,g.EXTERIOR,g.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var s=t.getInteriorRingN(o),a=w.removeRepeatedPoints(s.getCoordinates());0<this._distance&&this.isErodedCompletely(s,-this._distance)||this.addPolygonRing(a,e,T.opposite(n),g.INTERIOR,g.EXTERIOR)}},Zc.prototype.isTriangleErodedCompletely=function(t,e){var t=new Jc(t[0],t[1],t[2]),n=t.inCentre();return b.distancePointLine(n,t.p0,t.p1)<Math.abs(e)},Zc.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;t=w.removeRepeatedPoints(t.getCoordinates()),t=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(t,g.EXTERIOR,g.INTERIOR)},Zc.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;t=new qc(t,new jh(0,g.BOUNDARY,e,n));this._curveList.add(t)},Zc.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Zc.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<ph.MINIMUM_VALID_SIZE)return null;var o=r,s=i,i=(t.length>=ph.MINIMUM_VALID_SIZE&&b.isCCW(t)&&(o=i,s=r,n=T.opposite(n)),this._curveBuilder.getRingCurve(t,n,e));this.addCurve(i,o,s)},Zc.prototype.add=function(t){if(t.isEmpty())return null;t instanceof hh?this.addPolygon(t):t instanceof $l?this.addLineString(t):t instanceof rh?this.addPoint(t):(t instanceof ch||t instanceof Bl||t instanceof fh||t instanceof ql)&&this.addCollection(t)},Zc.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();return n.length<4?e<0:4===n.length?this.isTriangleErodedCompletely(n,e):(n=t.getEnvelopeInternal(),t=Math.min(n.getHeight(),n.getWidth()),e<0&&2*Math.abs(e)>t)},Zc.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Zc.prototype.interfaces_=function(){return[]},Zc.prototype.getClass=function(){return Zc},Kc.prototype.locate=function(t){},Kc.prototype.interfaces_=function(){return[]},Kc.prototype.getClass=function(){return Kc},Qc.prototype.next=function(){if(this._atStart)return this._atStart=!1,Qc.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 el;var t=this._parent.getGeometryN(this._index++);return t instanceof ql?(this._subcollectionIterator=new Qc(t),this._subcollectionIterator.next()):t},Qc.prototype.remove=function(){throw new Error(this.getClass().getName())},Qc.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)},Qc.prototype.interfaces_=function(){return[Ku]},Qc.prototype.getClass=function(){return Qc},Qc.isAtomic=function(t){return!(t instanceof ql)},$c.prototype.locate=function(t){return $c.locate(t,this._geom)},$c.prototype.interfaces_=function(){return[Kc]},$c.prototype.getClass=function(){return $c},$c.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&b.isPointInRing(t,e.getCoordinates())},$c.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!$c.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if($c.isPointInRing(t,i))return!1}return!0},$c.containsPoint=function(t,e){if(e instanceof hh)return $c.containsPointInPolygon(t,e);if(e instanceof ql)for(var n=new Qc(e);n.hasNext();){var r=n.next();if(r!==e&&$c.containsPoint(t,r))return!0}return!1},$c.locate=function(t,e){return!e.isEmpty()&&$c.containsPoint(t,e)?g.INTERIOR:g.EXTERIOR},tp.prototype.getNextCW=function(t){this.getEdges();var t=this._edgeList.indexOf(t),e=t-1;return 0===t&&(e=this._edgeList.size()-1),this._edgeList.get(e)},tp.prototype.propagateSideLabels=function(t){for(var e=g.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,T.LEFT)!==g.NONE&&(e=r.getLocation(t,T.LEFT))}if(e===g.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,T.ON)===g.NONE&&a.setLocation(t,T.ON,i),a.isArea(t)){var u=a.getLocation(t,T.LEFT),l=a.getLocation(t,T.RIGHT);if(l!==g.NONE){if(l!==i)throw new Gh("side location conflict",s.getCoordinate());u===g.NONE&&x.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else x.isTrue(a.getLocation(t,T.LEFT)===g.NONE,"found single null side"),a.setLocation(t,T.RIGHT,i),a.setLocation(t,T.LEFT,i)}}},tp.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},tp.prototype.print=function(t){mu.out.println("EdgeEndStar:   "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},tp.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},tp.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(!(e.size()<=0)){var n=e.size()-1,e=e.get(n).getLabel().getLocation(t,T.LEFT);x.isTrue(e!==g.NONE,"Found unlabelled area edge");for(var r=e,i=this.iterator();i.hasNext();){var o=i.next().getLabel(),s=(x.isTrue(o.isArea(t),"Found non-area edge"),o.getLocation(t,T.LEFT)),o=o.getLocation(t,T.RIGHT);if(s===o)return!1;if(o!==r)return!1;r=s}}return!0},tp.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},tp.prototype.iterator=function(){return this.getEdges().iterator()},tp.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new I(this._edgeMap.values())),this._edgeList},tp.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===g.NONE&&(this._ptInAreaLocation[t]=$c.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},tp.prototype.toString=function(){var t=new fu;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()},tp.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},tp.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)===g.BOUNDARY&&(e[i]=!0);for(var o,s,a=this.iterator();a.hasNext();)for(var u=a.next(),l=u.getLabel(),h=0;h<2;h++)l.isAnyNull(h)&&(s=g.NONE,s=e[h]?g.EXTERIOR:(o=u.getCoordinate(),this.getLocation(h,o,t)),l.setAllLocationsIfNull(h,s))},tp.prototype.getDegree=function(){return this._edgeMap.size()},tp.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},tp.prototype.interfaces_=function(){return[]},tp.prototype.getClass=function(){return tp},(rp=tp)&&(up.__proto__=rp),((up.prototype=Object.create(rp&&rp.prototype)).constructor=up).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:o.isInResult()&&(e=o,n=this._LINKING_TO_OUTGOING);break;case this._LINKING_TO_OUTGOING:i.isInResult()&&(e.setNext(i),n=this._SCANNING_FOR_INCOMING)}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new Gh("no outgoing dirEdge found",this.getCoordinate());x.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},up.prototype.insert=function(t){this.insertEdgeEnd(t,t)},up.prototype.getRightmostEdge=function(){var t,e,n=this.getEdges(),r=n.size();return r<1?null:(t=n.get(0),1===r||(n=n.get(r-1),r=t.getQuadrant(),e=n.getQuadrant(),ec.isNorthern(r)&&ec.isNorthern(e))?t:ec.isNorthern(r)||ec.isNorthern(e)?0!==t.getDy()?t:0!==n.getDy()?n:(x.shouldNeverReachHere("found two horizontal edges incident on node"),null):n)},up.prototype.print=function(t){mu.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()}},up.prototype.getResultAreaEdges=function(){if(null===this._resultAreaEdgeList){this._resultAreaEdgeList=new I;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}}return this._resultAreaEdgeList},up.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))}},up.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)},up.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(T.LEFT),r=t.getDepth(T.RIGHT),n=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,n)!==r)throw new Gh("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var e=arguments[0],i=arguments[1],o=arguments[2],s=e;s<i;s++){var a=this._edgeList.get(s);a.setEdgeDepths(T.RIGHT,o),o=a.getDepth(T.LEFT)}return o}},up.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},up.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:s.getEdgeRing()===t&&(n=s,r=this._LINKING_TO_OUTGOING);break;case this._LINKING_TO_OUTGOING:o.getEdgeRing()===t&&(n.setNextMin(o),r=this._SCANNING_FOR_INCOMING)}}r===this._LINKING_TO_OUTGOING&&(x.isTrue(null!==e,"found null for first outgoing dirEdge"),x.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},up.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}},up.prototype.getLabel=function(){return this._label},up.prototype.findCoveredLineEdges=function(){for(var t=g.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=g.INTERIOR;break}if(r.isInResult()){t=g.EXTERIOR;break}}}if(t===g.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===g.INTERIOR):(s.isInResult()&&(i=g.EXTERIOR),a.isInResult()&&(i=g.INTERIOR))}},up.prototype.computeLabelling=function(t){rp.prototype.computeLabelling.call(this,t),this._label=new jh(g.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!==g.INTERIOR&&i!==g.BOUNDARY||this._label.setLocation(r,g.INTERIOR)}},up.prototype.interfaces_=function(){return[]},up.prototype.getClass=function(){return up},up),sp=((np=rc)&&(ap.__proto__=np),((ap.prototype=Object.create(np&&np.prototype)).constructor=ap).prototype.createNode=function(t){return new $h(t,new op)},ap.prototype.interfaces_=function(){return[]},ap.prototype.getClass=function(){return ap},ap);function ap(){np.apply(this,arguments)}function up(){rp.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}ep.prototype.compareTo=function(t){return ep.compareOriented(this._pts,this._orientation,t._pts,t._orientation)},ep.prototype.interfaces_=function(){return[au]},ep.prototype.getClass=function(){return ep},ep.orientation=function(t){return 1===w.increasingDirection(t)},ep.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,l=r?0:n.length-1;;){var h=t[u].compareTo(n[l]);if(0!==h)return h;var h=(u+=i)===s,c=(l+=o)===a;if(h&&!c)return-1;if(!h&&c)return 1;if(h&&c)return 0}};function lp(){this._edges=new I,this._ocaMap=new Pl}function hp(){}function cp(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0,this._li=arguments[0]}function pp(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new m(t),this.segmentIndex=e,this.dist=n}function fp(){this._nodeMap=new Pl,this.edge=null,this.edge=arguments[0]}function gp(){}function dp(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new u,this.env2=new u;var t=arguments[0],t=(this.e=t,this.pts=t.getCoordinates(),new gp);this.startIndex=t.getChainStartIndices(this.pts)}function yp(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=yp.NULL_VALUE}lp.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(")  ")},lp.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},lp.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},lp.prototype.iterator=function(){return this._edges.iterator()},lp.prototype.getEdges=function(){return this._edges},lp.prototype.get=function(t){return this._edges.get(t)},lp.prototype.findEqualEdge=function(t){t=new ep(t.getCoordinates());return this._ocaMap.get(t)},lp.prototype.add=function(t){this._edges.add(t);var e=new ep(t.getCoordinates());this._ocaMap.put(e,t)},lp.prototype.interfaces_=function(){return[]},lp.prototype.getClass=function(){return lp},hp.prototype.processIntersections=function(t,e,n,r){},hp.prototype.isDone=function(){},hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},cp.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(cp.isAdjacentSegments(e,r))return!0;if(t.isClosed()){n=t.size()-1;if(0===e&&r===n||0===r&&e===n)return!0}}return!1},cp.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},cp.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},cp.prototype.getLineIntersector=function(){return this._li},cp.prototype.hasProperIntersection=function(){return this._hasProper},cp.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)))},cp.prototype.hasIntersection=function(){return this._hasIntersection},cp.prototype.isDone=function(){return!1},cp.prototype.hasInteriorIntersection=function(){return this._hasInterior},cp.prototype.interfaces_=function(){return[hp]},cp.prototype.getClass=function(){return cp},cp.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},pp.prototype.getSegmentIndex=function(){return this.segmentIndex},pp.prototype.getCoordinate=function(){return this.coord},pp.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},pp.prototype.compareTo=function(t){return this.compare(t.segmentIndex,t.dist)},pp.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},pp.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},pp.prototype.getDistance=function(){return this.dist},pp.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},pp.prototype.interfaces_=function(){return[au]},pp.prototype.getClass=function(){return pp},fp.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},fp.prototype.iterator=function(){return this._nodeMap.values().iterator()},fp.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}},fp.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)},fp.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],r=0<e.dist||!e.coord.equals2D(r),i=(r||n--,new Array(n).fill(null)),o=0;i[o++]=new m(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)i[o++]=this.edge.pts[s];return r&&(i[o]=e.coord),new vp(i,new jh(this.edge._label))},fp.prototype.add=function(t,e,n){t=new pp(t,e,n),e=this._nodeMap.get(t);return null!==e?e:(this._nodeMap.put(t,t),t)},fp.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},fp.prototype.interfaces_=function(){return[]},fp.prototype.getClass=function(){return fp},gp.prototype.getChainStartIndices=function(t){var e=0,n=new I;n.add(new gu(e));do{var r=this.findChainEnd(t,e)}while(n.add(new gu(r)),(e=r)<t.length-1);return gp.toIntArray(n)},gp.prototype.findChainEnd=function(t,e){for(var n=ec.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&ec.quadrant(t[r-1],t[r])===n;)r++;return r-1},gp.prototype.interfaces_=function(){return[]},gp.prototype.getClass=function(){return gp},gp.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},dp.prototype.getCoordinates=function(){return this.pts},dp.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,t=this.pts[this.startIndex[t+1]].x;return t<e?e:t},dp.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,t=this.pts[this.startIndex[t+1]].x;return e<t?e:t},dp.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],arguments[3])}else{var r,i,o,s,a,u,l;if(6===arguments.length)return t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],i=arguments[4],o=arguments[5],u=this.pts[t],l=this.pts[e],s=n.pts[r],a=n.pts[i],e-t==1&&i-r==1?(o.addIntersections(this.e,t,n.e,r),null):(this.env1.init(u,l),this.env2.init(s,a),this.env1.intersects(this.env2)?(u=Math.trunc((t+e)/2),l=Math.trunc((r+i)/2),t<u&&(r<l&&this.computeIntersectsForChain(t,u,n,r,l,o),l<i)&&this.computeIntersectsForChain(t,u,n,l,i,o),void(u<e&&(r<l&&this.computeIntersectsForChain(u,e,n,r,l,o),l<i)&&this.computeIntersectsForChain(u,e,n,l,i,o))):null)}},dp.prototype.getStartIndexes=function(){return this.startIndex},dp.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)},dp.prototype.interfaces_=function(){return[]},dp.prototype.getClass=function(){return dp};function _p(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new lp,this._bufParams=t||null}var mp,e={NULL_VALUE:{configurable:!0}},vp=(yp.prototype.getDepth=function(t,e){return this._depth[t][e]},yp.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},yp.prototype.isNull=function(){if(0!==arguments.length)return 1===arguments.length?this._depth[arguments[0]][1]===yp.NULL_VALUE:2===arguments.length?this._depth[arguments[0]][arguments[1]]===yp.NULL_VALUE:void 0;for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==yp.NULL_VALUE)return!1;return!0},yp.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];(e=this._depth[t][2]<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}}},yp.prototype.getDelta=function(t){return this._depth[t][T.RIGHT]-this._depth[t][T.LEFT]},yp.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?g.EXTERIOR:g.INTERIOR},yp.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},yp.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!==g.EXTERIOR&&o!==g.INTERIOR||(this.isNull(r,i)?this._depth[r][i]=yp.depthAtLocation(o):this._depth[r][i]+=yp.depthAtLocation(o))}else 3===arguments.length&&(t=arguments[0],e=arguments[1],arguments[2]===g.INTERIOR)&&this._depth[t][e]++},yp.prototype.interfaces_=function(){return[]},yp.prototype.getClass=function(){return yp},yp.depthAtLocation=function(t){return t===g.EXTERIOR?0:t===g.INTERIOR?1:yp.NULL_VALUE},e.NULL_VALUE.get=function(){return-1},Object.defineProperties(yp,e),(mp=Vh)&&(xp.__proto__=mp),((xp.prototype=Object.create(mp&&mp.prototype)).constructor=xp).prototype.getDepth=function(){return this._depth},xp.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new xp(t,jh.toLineLabel(this._label))},xp.prototype.isIsolated=function(){return this._isIsolated},xp.prototype.getCoordinates=function(){return this.pts},xp.prototype.setIsolated=function(t){this._isIsolated=t},xp.prototype.setName=function(t){this._name=t},xp.prototype.equals=function(t){if(!(t instanceof xp))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},xp.prototype.getCoordinate=function(){return 0===arguments.length?0<this.pts.length?this.pts[0]:null:1===arguments.length?this.pts[arguments[0]]:void 0},xp.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)},xp.prototype.computeIM=function(t){xp.updateIM(this._label,t)},xp.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},xp.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},xp.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},xp.prototype.getDepthDelta=function(){return this._depthDelta},xp.prototype.getNumPoints=function(){return this.pts.length},xp.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("")},xp.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new dp(this)),this._mce},xp.prototype.getEnvelope=function(){if(null===this._env){this._env=new u;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},xp.prototype.addIntersection=function(t,e,n,r){var i=new m(t.getIntersection(r)),t=t.getEdgeDistance(n,r),n=e+1;n<this.pts.length&&(r=this.pts[n],i.equals2D(r))&&(e=n,t=0),this.eiList.add(i,e,t)},xp.prototype.toString=function(){var t=new fu;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()},xp.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},xp.prototype.setDepthDelta=function(t){this._depthDelta=t},xp.prototype.getEdgeIntersectionList=function(){return this.eiList},xp.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},xp.prototype.interfaces_=function(){return[]},xp.prototype.getClass=function(){return xp},xp.updateIM=function(){if(2!==arguments.length)return mp.prototype.updateIM.apply(this,arguments);var t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,T.ON),t.getLocation(1,T.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,T.LEFT),t.getLocation(1,T.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,T.RIGHT),t.getLocation(1,T.RIGHT),2))},xp);function xp(){var t,e;mp.call(this),this.pts=null,this._env=null,this.eiList=new fp(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new yp,this._depthDelta=0,1===arguments.length?xp.call(this,arguments[0],null):2===arguments.length&&(t=arguments[0],e=arguments[1],this.pts=t,this._label=e)}_p.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},_p.prototype.insertUniqueEdge=function(t){var e,n,r=this._edgeList.findEqualEdge(t);null!==r?(e=r.getLabel(),n=t.getLabel(),r.isPointwiseEqual(t)||(n=new jh(t.getLabel())).flip(),e.merge(n),e=_p.depthDelta(n),n=r.getDepthDelta()+e,r.setDepthDelta(n)):(this._edgeList.add(t),t.setDepthDelta(_p.depthDelta(t.getLabel())))},_p.prototype.buildSubgraphs=function(t,e){for(var n=new I,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),o=new Wc(n).getDepth(o);i.computeDepth(o),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},_p.prototype.createSubgraphs=function(t){for(var e=new I,n=t.getNodes().iterator();n.hasNext();){var r,i=n.next();i.isVisited()||((r=new Bh).create(i),e.add(r))}return dc.sort(e,dc.reverseOrder()),e},_p.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},_p.prototype.getNoder=function(t){var e,n;return null!==this._workingNoder?this._workingNoder:(e=new Bc,(n=new Gu).setPrecisionModel(t),e.setSegmentIntersector(new cp(n)),e)},_p.prototype.buffer=function(t,e){var n=this._workingPrecisionModel,r=(null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory(),new Hc(n,this._bufParams)),t=new Zc(t,e,r).getCurves();if(t.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(t,n),this._graph=new ac(new sp),this._graph.addEdges(this._edgeList.getEdges());e=this.createSubgraphs(this._graph),r=new uc(this._geomFact),this.buildSubgraphs(e,r),t=r.getPolygons();return t.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(t)},_p.prototype.computeNodedEdges=function(t,e){e=this.getNoder(e);e.computeNodes(t);for(var n=e.getNodedSubstrings().iterator();n.hasNext();){var r=n.next(),i=r.getCoordinates();2===i.length&&i[0].equals2D(i[1])||(i=r.getData(),r=new vp(r.getCoordinates(),new jh(i)),this.insertUniqueEdge(r))}},_p.prototype.setNoder=function(t){this._workingNoder=t},_p.prototype.interfaces_=function(){return[]},_p.prototype.getClass=function(){return _p},_p.depthDelta=function(t){var e=t.getLocation(0,T.LEFT),t=t.getLocation(0,T.RIGHT);return e===g.INTERIOR&&t===g.EXTERIOR?1:e===g.EXTERIOR&&t===g.INTERIOR?-1:0},_p.convertSegStrings=function(t){for(var e=new A,n=new I;t.hasNext();){var r=t.next(),r=e.createLineString(r.getCoordinates());n.add(r)}return e.buildGeometry(n)};function Ep(){var t,e,n,r;this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length?(t=arguments[0],e=arguments[1],this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()):4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],this._noder=t,this._scaleFactor=e,this._offsetX=n,this._offsetY=r,this._isScaled=!this.isIntegerPrecision())}function bp(){this._li=new Gu,this._segStrings=null,this._segStrings=arguments[0]}Ep.prototype.rescale=function(){if(v(arguments[0],Vu))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])&&mu.out.println(n)}},Ep.prototype.scale=function(){if(v(arguments[0],Vu)){for(var t=arguments[0],e=new I,n=t.iterator();n.hasNext();){var r=n.next();e.add(new qc(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 m(Math.round((i[s].x-this._offsetX)*this._scaleFactor),Math.round((i[s].y-this._offsetY)*this._scaleFactor),i[s].z);return w.removeRepeatedPoints(o)}},Ep.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},Ep.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Ep.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},Ep.prototype.interfaces_=function(){return[Dc]},Ep.prototype.getClass=function(){return Ep};function wp(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new ou("Scale factor must be non-zero");1!==e&&(this._pt=new m(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new m,this._p1Scaled=new m),this.initCorners(this._pt)}function Ip(){this.tempEnv1=new u,this.selectedSegment=new D}function Np(){this._index=null,this._index=arguments[0]}function Sp(){this._li=null,this._interiorIntersections=null,this._li=arguments[0],this._interiorIntersections=new I}var Cp,e={fact:{configurable:!0}},e=(bp.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 Ou("found endpt/interior pt intersection at index "+o+" :pt "+n)},bp.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 l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var h=arguments[0],c=arguments[1],p=arguments[2],f=arguments[3];if(h===p&&c===f)return null;var g=h.getCoordinates()[c],h=h.getCoordinates()[c+1],c=p.getCoordinates()[f],p=p.getCoordinates()[f+1];if(this._li.computeIntersection(g,h,c,p),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,h)||this.hasInteriorIntersection(this._li,c,p)))throw new Ou("found non-noded intersection at "+g+"-"+h+" and "+c+"-"+p)}},bp.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},bp.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])},bp.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},bp.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new Ou("found non-noded collapse at "+bp.fact.createLineString([t,e,n]))},bp.prototype.interfaces_=function(){return[]},bp.prototype.getClass=function(){return bp},e.fact.get=function(){return new A},Object.defineProperties(bp,e),{SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}}),e=(wp.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),n=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;return!n&&(r=this.intersectsToleranceSquare(t,e),x.isTrue(!(n&&r),"Found bad envelope test"),r)},wp.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 m(this._maxx,this._maxy),this._corner[1]=new m(this._minx,this._maxy),this._corner[2]=new m(this._minx,this._miny),this._corner[3]=new m(this._maxx,this._miny)},wp.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))},wp.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},wp.prototype.getCoordinate=function(){return this._originalPt},wp.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},wp.prototype.getSafeEnvelope=function(){var t;return null===this._safeEnv&&(t=wp.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor,this._safeEnv=new u(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)),this._safeEnv},wp.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()))},wp.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)))},wp.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)},wp.prototype.interfaces_=function(){return[]},wp.prototype.getClass=function(){return wp},e.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(wp,e),Ip.prototype.select=function(){1!==arguments.length&&2===arguments.length&&(arguments[0].getLineSegment(arguments[1],this.selectedSegment),this.select(this.selectedSegment))},Ip.prototype.interfaces_=function(){return[]},Ip.prototype.getClass=function(){return Ip},{HotPixelSnapAction:{configurable:!0}}),Pp=(Np.prototype.snap=function(){var t,e,n,r,i;return 1===arguments.length?this.snap(arguments[0],null,-1):3===arguments.length?(t=arguments[0],e=arguments[1],n=arguments[2],r=t.getSafeEnvelope(),i=new Pp(t,e,n),this._index.query(r,{interfaces_:function(){return[pc]},visitItem:function(t){t.select(r,i)}}),i.isNodeAdded()):void 0},Np.prototype.interfaces_=function(){return[]},Np.prototype.getClass=function(){return Np},e.HotPixelSnapAction.get=function(){return Pp},Object.defineProperties(Np,e),(Cp=Ip)&&(Mp.__proto__=Cp),((Mp.prototype=Object.create(Cp&&Cp.prototype)).constructor=Mp).prototype.isNodeAdded=function(){return this._isNodeAdded},Mp.prototype.select=function(){var t,e;return 2!==arguments.length?Cp.prototype.select.apply(this,arguments):(e=arguments[0],t=arguments[1],e=e.getContext(),null!==this._parentEdge&&e===this._parentEdge&&t===this._hotPixelVertexIndex?null:void(this._isNodeAdded=this._hotPixel.addSnappedNode(e,t)))},Mp.prototype.interfaces_=function(){return[]},Mp.prototype.getClass=function(){return Mp},Mp);function Mp(){Cp.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}Sp.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)}},Sp.prototype.isDone=function(){return!1},Sp.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Sp.prototype.interfaces_=function(){return[hp]},Sp.prototype.getClass=function(){return Sp};function Lp(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Gu,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()}function Op(){var t,e;this._argGeom=null,this._distance=null,this._bufParams=new F,this._resultGeometry=null,this._saveException=null,1===arguments.length?this._argGeom=arguments[0]:2===arguments.length&&(t=arguments[0],e=arguments[1],this._argGeom=t,this._bufParams=e)}Lp.prototype.checkCorrectness=function(t){var e=qc.getNodedSubstrings(t),e=new bp(e);try{e.checkValid()}catch(t){if(!(t instanceof _u))throw t;t.printStackTrace()}},Lp.prototype.getNodedSubstrings=function(){return qc.getNodedSubstrings(this._nodedSegStrings)},Lp.prototype.snapRound=function(t,e){e=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(e),this.computeVertexSnaps(t)},Lp.prototype.findInteriorIntersections=function(t,e){e=new Sp(e);return this._noder.setSegmentIntersector(e),this._noder.computeNodes(t),e.getInteriorIntersections()},Lp.prototype.computeVertexSnaps=function(){if(v(arguments[0],Vu))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.computeVertexSnaps(e)}else if(arguments[0]instanceof qc)for(var n=arguments[0],r=n.getCoordinates(),i=0;i<r.length;i++){var o=new wp(r[i],this._scaleFactor,this._li);this._pointSnapper.snap(o,n,i)&&n.addIntersection(r[i],i)}},Lp.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Bc,this._pointSnapper=new Np(this._noder.getIndex()),this.snapRound(t,this._li)},Lp.prototype.computeIntersectionSnaps=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),n=new wp(n,this._scaleFactor,this._li);this._pointSnapper.snap(n)}},Lp.prototype.interfaces_=function(){return[Dc]},Lp.prototype.getClass=function(){return Lp};function Rp(){this._pt=[new m,new m],this._distance=h.NaN,this._isNull=!0}function Tp(){}function Ap(t){this._maxPtDist=new Rp,this._inputGeom=t||null}function Dp(t){this._comps=t||null}function Fp(){var t,e;this._lines=null,this._isForcedToLineString=!1,1===arguments.length?this._lines=arguments[0]:2===arguments.length&&(t=arguments[0],e=arguments[1],this._lines=t,this._isForcedToLineString=e)}function kp(){if(this._boundaryRule=Uu.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0!==arguments.length&&1===arguments.length){var t=arguments[0];if(null===t)throw new ou("Rule must be non-null");this._boundaryRule=t}}function Gp(){var t,e,n;this._component=null,this._segIndex=null,this._pt=null,2===arguments.length?Gp.call(this,arguments[0],Gp.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)}function qp(t){this._pts=t||null}function Bp(){this._locations=null,this._locations=arguments[0]}function zp(){var t,e,n;this._geom=null,this._terminateDistance=0,this._ptLocator=new kp,this._minDistanceLocation=null,this._minDistance=h.MAX_VALUE,2===arguments.length?(this._geom=[arguments[0],arguments[1]],this._terminateDistance=0):3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e,this._terminateDistance=n)}function jp(){this._pt=[new m,new m],this._distance=h.NaN,this._isNull=!0}function Up(){}function Vp(){this._g0=null,this._g1=null,this._ptDist=new jp;var t=arguments[this._densifyFrac=0],e=arguments[1];this._g0=t,this._g1=e}function Xp(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}function Yp(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}function Hp(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}function Wp(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new I,this._intersectionCount=0,this._keepIntersections=!0,this._li=arguments[0],this._interiorIntersection=null}function Jp(){this._li=new Gu,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0,this._segStrings=arguments[0]}function Zp(){this._nv=null,this._nv=new Jp(Zp.toSegmentStrings(arguments[0]))}function Kp(t){this._mapOp=t}function Qp(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new I,this._resultLineList=new I;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n}function $p(){this._op=null,this._geometryFactory=null,this._resultPointList=new I;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e}function tf(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}function ef(){var t,e;this._snapTolerance=0,this._srcPts=null,this._seg=new D,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof $l&&"number"==typeof arguments[1]?(t=arguments[0],e=arguments[1],ef.call(this,t.getCoordinates(),e)):arguments[0]instanceof Array&&"number"==typeof arguments[1]&&(t=arguments[0],e=arguments[1],this._srcPts=t,this._isClosed=ef.isClosed(t),this._snapTolerance=e)}function nf(t){this._srcGeom=t||null}function rf(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null}var of,e={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}},e=(Op.prototype.bufferFixedPrecision=function(t){var e=new Ep(new Lp(new r(1)),t.getScale()),n=new _p(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},Op.prototype.bufferReducedPrecision=function(){var t;if(0===arguments.length){for(var e=Op.MAX_PRECISION_DIGITS;0<=e;e--){try{this.bufferReducedPrecision(e)}catch(e){if(!(e instanceof Gh))throw e;this._saveException=e}if(null!==this._resultGeometry)return null}throw this._saveException}1===arguments.length&&(t=Op.precisionScaleFactor(this._argGeom,this._distance,arguments[0]),t=new r(t),this.bufferFixedPrecision(t))},Op.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===r.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Op.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Op.prototype.bufferOriginalPrecision=function(){try{var t=new _p(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Ou))throw t;this._saveException=t}},Op.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Op.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Op.prototype.interfaces_=function(){return[]},Op.prototype.getClass=function(){return Op},Op.bufferOp=function(){var t,e,n,r;return 2===arguments.length?(e=arguments[0],r=arguments[1],new Op(e).getResultGeometry(r)):3===arguments.length?Number.isInteger(arguments[2])&&arguments[0]instanceof E&&"number"==typeof arguments[1]?(e=arguments[0],r=arguments[1],t=arguments[2],(e=new Op(e)).setQuadrantSegments(t),e.getResultGeometry(r)):arguments[2]instanceof F&&arguments[0]instanceof E&&"number"==typeof arguments[1]?(t=arguments[0],e=arguments[1],new Op(t,arguments[2]).getResultGeometry(e)):void 0:4===arguments.length?(r=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3],(r=new Op(r)).setQuadrantSegments(e),r.setEndCapStyle(n),r.getResultGeometry(t)):void 0},Op.precisionScaleFactor=function(t,e,n){t=t.getEnvelopeInternal(),t=pu.max(Math.abs(t.getMaxX()),Math.abs(t.getMaxY()),Math.abs(t.getMinX()),Math.abs(t.getMinY()))+2*(0<e?e:0),e=n-Math.trunc(Math.log(t)/Math.log(10)+1);return Math.pow(10,e)},e.CAP_ROUND.get=function(){return F.CAP_ROUND},e.CAP_BUTT.get=function(){return F.CAP_FLAT},e.CAP_FLAT.get=function(){return F.CAP_FLAT},e.CAP_SQUARE.get=function(){return F.CAP_SQUARE},e.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Op,e),Rp.prototype.getCoordinates=function(){return this._pt},Rp.prototype.getCoordinate=function(t){return this._pt[t]},Rp.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 t=arguments[0],e=arguments[1];if(this._isNull)return this.initialize(t,e),null;var n=t.distance(e);n<this._distance&&this.initialize(t,e,n)}},Rp.prototype.initialize=function(){var t,e,n;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&&(t=arguments[0],e=arguments[1],n=arguments[2],this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=n,this._isNull=!1)},Rp.prototype.getDistance=function(){return this._distance},Rp.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 t=arguments[0],e=arguments[1];if(this._isNull)return this.initialize(t,e),null;var n=t.distance(e);n>this._distance&&this.initialize(t,e,n)}},Rp.prototype.interfaces_=function(){return[]},Rp.prototype.getClass=function(){return Rp},Tp.prototype.interfaces_=function(){return[]},Tp.prototype.getClass=function(){return Tp},Tp.computeDistance=function(){if(arguments[2]instanceof Rp&&arguments[0]instanceof $l&&arguments[1]instanceof m)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new D,o=0;o<r.length-1;o++){i.setCoordinates(r[o],r[o+1]);var s=i.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof Rp&&arguments[0]instanceof hh&&arguments[1]instanceof m){var a=arguments[0],u=arguments[1],l=arguments[2];Tp.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)Tp.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof Rp&&arguments[0]instanceof E&&arguments[1]instanceof m){var t=arguments[0],c=arguments[1],p=arguments[2];if(t instanceof $l)Tp.computeDistance(t,c,p);else if(t instanceof hh)Tp.computeDistance(t,c,p);else if(t instanceof ql)for(var f=t,g=0;g<f.getNumGeometries();g++){var d=f.getGeometryN(g);Tp.computeDistance(d,c,p)}else p.setMinimum(t.getCoordinate(),c)}else{var y,_;arguments[2]instanceof Rp&&arguments[0]instanceof D&&arguments[1]instanceof m&&(t=arguments[0],y=arguments[1],_=arguments[2],t=t.closestPoint(y),_.setMinimum(t,y))}},{MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}}),sf=(Ap.prototype.computeMaxMidpointDistance=function(t){var e=new af(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Ap.prototype.computeMaxVertexDistance=function(t){var e=new sf(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Ap.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Ap.prototype.getDistancePoints=function(){return this._maxPtDist},Ap.prototype.interfaces_=function(){return[]},Ap.prototype.getClass=function(){return Ap},e.MaxPointDistanceFilter.get=function(){return sf},e.MaxMidpointDistanceFilter.get=function(){return af},Object.defineProperties(Ap,e),function(t){this._maxPtDist=new Rp,this._minPtDist=new Rp,this._geom=t||null}),af=(sf.prototype.filter=function(t){this._minPtDist.initialize(),Tp.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},sf.prototype.getMaxPointDistance=function(){return this._maxPtDist},sf.prototype.interfaces_=function(){return[ju]},sf.prototype.getClass=function(){return sf},function(t){this._maxPtDist=new Rp,this._minPtDist=new Rp,this._geom=t||null}),e=(af.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),t=t.getCoordinate(e),e=new m((n.x+t.x)/2,(n.y+t.y)/2);this._minPtDist.initialize(),Tp.computeDistance(this._geom,e,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},af.prototype.isDone=function(){return!1},af.prototype.isGeometryChanged=function(){return!1},af.prototype.getMaxPointDistance=function(){return this._maxPtDist},af.prototype.interfaces_=function(){return[Dl]},af.prototype.getClass=function(){return af},Dp.prototype.filter=function(t){t instanceof hh&&this._comps.add(t)},Dp.prototype.interfaces_=function(){return[Al]},Dp.prototype.getClass=function(){return Dp},Dp.getPolygons=function(){var t,e;return 1===arguments.length?Dp.getPolygons(arguments[0],new I):2===arguments.length?(t=arguments[0],e=arguments[1],t instanceof hh?e.add(t):t instanceof ql&&t.apply(new Dp(e)),e):void 0},Fp.prototype.filter=function(t){var e;if(this._isForcedToLineString&&t instanceof ph)return e=t.getFactory().createLineString(t.getCoordinateSequence()),this._lines.add(e),null;t instanceof $l&&this._lines.add(t)},Fp.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Fp.prototype.interfaces_=function(){return[zu]},Fp.prototype.getClass=function(){return Fp},Fp.getGeometry=function(){var t,e;return 1===arguments.length?(t=arguments[0]).getFactory().buildGeometry(Fp.getLines(t)):2===arguments.length?(t=arguments[0],e=arguments[1],t.getFactory().buildGeometry(Fp.getLines(t,e))):void 0},Fp.getLines=function(){var t;if(1===arguments.length)return Fp.getLines(arguments[0],!1);if(2===arguments.length){if(v(arguments[0],Vu)&&v(arguments[1],Vu)){for(var e=arguments[0],n=arguments[1],r=e.iterator();r.hasNext();){var i=r.next();Fp.getLines(i,n)}return n}return arguments[0]instanceof E&&"boolean"==typeof arguments[1]?(e=arguments[0],t=arguments[1],o=new I,e.apply(new Fp(o,t)),o):arguments[0]instanceof E&&v(arguments[1],Vu)?(e=arguments[0],t=arguments[1],e instanceof $l?t.add(e):e.apply(new Fp(t)),t):void 0}if(3===arguments.length){if("boolean"==typeof arguments[2]&&v(arguments[0],Vu)&&v(arguments[1],Vu)){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=o.iterator();u.hasNext();){var l=u.next();Fp.getLines(l,s,a)}return s}if("boolean"==typeof arguments[2]&&arguments[0]instanceof E&&v(arguments[1],Vu))return arguments[0].apply(new Fp(e=arguments[1],arguments[2])),e}},kp.prototype.locateInternal=function(){var t,e;if(arguments[0]instanceof m&&arguments[1]instanceof hh){var n=arguments[0],r=arguments[1];if(r.isEmpty())return g.EXTERIOR;var i=r.getExteriorRing(),i=this.locateInPolygonRing(n,i);if(i===g.EXTERIOR)return g.EXTERIOR;if(i===g.BOUNDARY)return g.BOUNDARY;for(var o=0;o<r.getNumInteriorRing();o++){var s=r.getInteriorRingN(o),s=this.locateInPolygonRing(n,s);if(s===g.INTERIOR)return g.EXTERIOR;if(s===g.BOUNDARY)return g.BOUNDARY}return g.INTERIOR}return arguments[0]instanceof m&&arguments[1]instanceof $l?(i=arguments[0],(e=arguments[1]).getEnvelopeInternal().intersects(i)?(t=e.getCoordinates(),e.isClosed()||!i.equals(t[0])&&!i.equals(t[t.length-1])?b.isOnLine(i,t)?g.INTERIOR:g.EXTERIOR:g.BOUNDARY):g.EXTERIOR):arguments[0]instanceof m&&arguments[1]instanceof rh?(e=arguments[0],arguments[1].getCoordinate().equals2D(e)?g.INTERIOR:g.EXTERIOR):void 0},kp.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?b.locatePointInRing(t,e.getCoordinates()):g.EXTERIOR},kp.prototype.intersects=function(t,e){return this.locate(t,e)!==g.EXTERIOR},kp.prototype.updateLocationInfo=function(t){t===g.INTERIOR&&(this._isIn=!0),t===g.BOUNDARY&&this._numBoundaries++},kp.prototype.computeLocation=function(t,e){if(e instanceof rh&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof $l)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof hh)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Bl)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 fh)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 ql)for(var u=new Qc(e);u.hasNext();){var l=u.next();l!==e&&this.computeLocation(t,l)}},kp.prototype.locate=function(t,e){return e.isEmpty()?g.EXTERIOR:e instanceof $l||e instanceof hh?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?g.BOUNDARY:0<this._numBoundaries||this._isIn?g.INTERIOR:g.EXTERIOR)},kp.prototype.interfaces_=function(){return[]},kp.prototype.getClass=function(){return kp},{INSIDE_AREA:{configurable:!0}}),e=(Gp.prototype.isInsideArea=function(){return this._segIndex===Gp.INSIDE_AREA},Gp.prototype.getCoordinate=function(){return this._pt},Gp.prototype.getGeometryComponent=function(){return this._component},Gp.prototype.getSegmentIndex=function(){return this._segIndex},Gp.prototype.interfaces_=function(){return[]},Gp.prototype.getClass=function(){return Gp},e.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Gp,e),qp.prototype.filter=function(t){t instanceof rh&&this._pts.add(t)},qp.prototype.interfaces_=function(){return[Al]},qp.prototype.getClass=function(){return qp},qp.getPoints=function(){var t,e;return 1===arguments.length?(t=arguments[0])instanceof rh?dc.singletonList(t):qp.getPoints(t,new I):2===arguments.length?(t=arguments[0],e=arguments[1],t instanceof rh?e.add(t):t instanceof ql&&t.apply(new qp(e)),e):void 0},Bp.prototype.filter=function(t){(t instanceof rh||t instanceof $l||t instanceof hh)&&this._locations.add(new Gp(t,0,t.getCoordinate()))},Bp.prototype.interfaces_=function(){return[Al]},Bp.prototype.getClass=function(){return Bp},Bp.getLocations=function(t){var e=new I;return t.apply(new Bp(e)),e},zp.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 t=arguments[0],e=arguments[1],n=1-t,r=Dp.getPolygons(this._geom[t]);if(0<r.size()){var i=Bp.getLocations(this._geom[n]);if(this.computeContainmentDistance(i,r,e),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[n]=e[0],this._minDistanceLocation[t]=e[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&v(arguments[0],$u)&&v(arguments[1],$u)){for(var o=arguments[0],s=arguments[1],a=arguments[2],u=0;u<o.size();u++)for(var l=o.get(u),h=0;h<s.size();h++)if(this.computeContainmentDistance(l,s.get(h),a),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Gp&&arguments[1]instanceof hh){i=arguments[0],r=arguments[1],n=arguments[2],t=i.getCoordinate();if(g.EXTERIOR!==this._ptLocator.locate(t,r))return n[this._minDistance=0]=i,n[1]=new Gp(r,t),null}},zp.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}},zp.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=Fp.getLines(this._geom[0]),n=Fp.getLines(this._geom[1]),r=qp.getPoints(this._geom[0]),i=qp.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance||(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance)||(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))},zp.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},zp.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},zp.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},zp.prototype.computeMinDistance=function(){if(0===arguments.length)return null!==this._minDistanceLocation||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)?null:void this.computeFacetDistance();if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof $l&&arguments[1]instanceof rh){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=b.distancePointLine(i,r[o],r[o+1]);if(s<this._minDistance&&(this._minDistance=s,s=new D(r[o],r[o+1]).closestPoint(i),n[0]=new Gp(t,o,s),n[1]=new Gp(e,0,i)),this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof $l&&arguments[1]instanceof $l){var a=arguments[0],u=arguments[1],l=arguments[2];if(a.getEnvelopeInternal().distance(u.getEnvelopeInternal())>this._minDistance)return null;for(var h=a.getCoordinates(),c=u.getCoordinates(),p=0;p<h.length-1;p++)for(var f=0;f<c.length-1;f++){var g,d=b.distanceLineLine(h[p],h[p+1],c[f],c[f+1]);if(d<this._minDistance&&(this._minDistance=d,d=new D(h[p],h[p+1]),g=new D(c[f],c[f+1]),d=d.closestPoints(g),l[0]=new Gp(a,p,d[0]),l[1]=new Gp(u,f,d[1])),this._minDistance<=this._terminateDistance)return null}}},zp.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 Gp(i,0,i.getCoordinate()),n[1]=new Gp(s,0,s.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},zp.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new ou("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},zp.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}},zp.prototype.interfaces_=function(){return[]},zp.prototype.getClass=function(){return zp},zp.distance=function(t,e){return new zp(t,e).distance()},zp.isWithinDistance=function(t,e,n){return new zp(t,e,n).distance()<=n},zp.nearestPoints=function(t,e){return new zp(t,e).nearestPoints()},jp.prototype.getCoordinates=function(){return this._pt},jp.prototype.getCoordinate=function(t){return this._pt[t]},jp.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 t=arguments[0],e=arguments[1];if(this._isNull)return this.initialize(t,e),null;var n=t.distance(e);n<this._distance&&this.initialize(t,e,n)}},jp.prototype.initialize=function(){var t,e,n;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&&(t=arguments[0],e=arguments[1],n=arguments[2],this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=n,this._isNull=!1)},jp.prototype.toString=function(){return Nu.toLineString(this._pt[0],this._pt[1])},jp.prototype.getDistance=function(){return this._distance},jp.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 t=arguments[0],e=arguments[1];if(this._isNull)return this.initialize(t,e),null;var n=t.distance(e);n>this._distance&&this.initialize(t,e,n)}},jp.prototype.interfaces_=function(){return[]},jp.prototype.getClass=function(){return jp},Up.prototype.interfaces_=function(){return[]},Up.prototype.getClass=function(){return Up},Up.computeDistance=function(){if(arguments[2]instanceof jp&&arguments[0]instanceof $l&&arguments[1]instanceof m)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new D,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 jp&&arguments[0]instanceof hh&&arguments[1]instanceof m){var a=arguments[0],u=arguments[1],l=arguments[2];Up.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)Up.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof jp&&arguments[0]instanceof E&&arguments[1]instanceof m){var t=arguments[0],c=arguments[1],p=arguments[2];if(t instanceof $l)Up.computeDistance(t,c,p);else if(t instanceof hh)Up.computeDistance(t,c,p);else if(t instanceof ql)for(var f=t,g=0;g<f.getNumGeometries();g++){var d=f.getGeometryN(g);Up.computeDistance(d,c,p)}else p.setMinimum(t.getCoordinate(),c)}else{var y,_;arguments[2]instanceof jp&&arguments[0]instanceof D&&arguments[1]instanceof m&&(t=arguments[0],y=arguments[1],_=arguments[2],t=t.closestPoint(y),_.setMinimum(t,y))}},{MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}}),uf=(Vp.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Vp.prototype.setDensifyFraction=function(t){if(1<t||t<=0)throw new ou("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Vp.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Vp.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Vp.prototype.computeOrientedDistance=function(t,e,n){var r=new uf(e);t.apply(r),n.setMaximum(r.getMaxPointDistance()),0<this._densifyFrac&&(r=new lf(e,this._densifyFrac),t.apply(r),n.setMaximum(r.getMaxPointDistance()))},Vp.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Vp.prototype.interfaces_=function(){return[]},Vp.prototype.getClass=function(){return Vp},Vp.distance=function(){var t,e,n;return 2===arguments.length?new Vp(arguments[0],arguments[1]).distance():3===arguments.length?(n=arguments[0],t=arguments[1],e=arguments[2],(n=new Vp(n,t)).setDensifyFraction(e),n.distance()):void 0},e.MaxPointDistanceFilter.get=function(){return uf},e.MaxDensifiedByFractionDistanceFilter.get=function(){return lf},Object.defineProperties(Vp,e),function(){this._maxPtDist=new jp,this._minPtDist=new jp,this._euclideanDist=new Up,this._geom=null,this._geom=arguments[0]}),lf=(uf.prototype.filter=function(t){this._minPtDist.initialize(),Up.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},uf.prototype.getMaxPointDistance=function(){return this._maxPtDist},uf.prototype.interfaces_=function(){return[ju]},uf.prototype.getClass=function(){return uf},function(){this._maxPtDist=new jp,this._minPtDist=new jp,this._geom=null;var t=arguments[this._numSubSegs=0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))}),e=(lf.prototype.filter=function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),t=t.getCoordinate(e),r=(t.x-n.x)/this._numSubSegs,i=(t.y-n.y)/this._numSubSegs,o=0;o<this._numSubSegs;o++){var s=n.x+o*r,a=n.y+o*i,s=new m(s,a);this._minPtDist.initialize(),Up.computeDistance(this._geom,s,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},lf.prototype.isDone=function(){return!1},lf.prototype.isGeometryChanged=function(){return!1},lf.prototype.getMaxPointDistance=function(){return this._maxPtDist},lf.prototype.interfaces_=function(){return[Dl]},lf.prototype.getClass=function(){return lf},{VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}}),e=(Xp.prototype.checkMaximumDistance=function(t,e,n){e=new Vp(e,t);e.setDensifyFraction(.25),this._maxDistanceFound=e.orientedDistance(),this._maxDistanceFound>n&&(this._isValid=!1,n=e.getCoordinates(),this._errorLocation=n[1],this._errorIndicator=t.getFactory().createLineString(n),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Nu.toLineString(n[0],n[1])+")")},Xp.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Xp.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(),Xp.VERBOSE&&mu.out.println("Min Dist= "+this._minDistanceFound+"  err= "+(1-this._minDistanceFound/this._bufDistance)+"  Max Dist= "+this._maxDistanceFound+"  err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Xp.prototype.checkNegativeValid=function(){var t;return(this._input instanceof hh||this._input instanceof fh||this._input instanceof ql)&&(t=this.getPolygonLines(this._input),this.checkMinimumDistance(t,this._result,this._minValidDistance),this._isValid)?void this.checkMaximumDistance(t,this._result,this._maxValidDistance):null},Xp.prototype.getErrorIndicator=function(){return this._errorIndicator},Xp.prototype.checkMinimumDistance=function(t,e,n){e=new zp(t,e,n);this._minDistanceFound=e.distance(),this._minDistanceFound<n&&(this._isValid=!1,n=e.nearestPoints(),this._errorLocation=e.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(n),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Nu.toLineString(n[0],n[1])+" )")},Xp.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)},Xp.prototype.getErrorLocation=function(){return this._errorLocation},Xp.prototype.getPolygonLines=function(t){for(var e=new I,n=new Fp(e),r=Dp.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},Xp.prototype.getErrorMessage=function(){return this._errMsg},Xp.prototype.interfaces_=function(){return[]},Xp.prototype.getClass=function(){return Xp},e.VERBOSE.get=function(){return!1},e.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Xp,e),{VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}}),e=(Yp.prototype.isValid=function(){return this.checkPolygonal(),this._isValid&&(this.checkExpectedEmpty(),this._isValid)&&(this.checkEnvelope(),this._isValid)&&(this.checkArea(),this._isValid)&&(this.checkDistance(),this._isValid)},Yp.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Yp.MAX_ENV_DIFF_FRAC,e=(0===t&&(t=.001),new u(this._input.getEnvelopeInternal())),n=(e.expandBy(this._distance),new u(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")},Yp.prototype.checkDistance=function(){var t=new Xp(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")},Yp.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")},Yp.prototype.checkPolygonal=function(){this._result instanceof hh||this._result instanceof fh||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Yp.prototype.getErrorIndicator=function(){return this._errorIndicator},Yp.prototype.getErrorLocation=function(){return this._errorLocation},Yp.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"))},Yp.prototype.report=function(t){if(!Yp.VERBOSE)return null;mu.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Yp.prototype.getErrorMessage=function(){return this._errorMsg},Yp.prototype.interfaces_=function(){return[]},Yp.prototype.getClass=function(){return Yp},Yp.isValidMsg=function(t,e,n){t=new Yp(t,e,n);return t.isValid()?null:t.getErrorMessage()},Yp.isValid=function(t,e,n){return!!new Yp(t,e,n).isValid()},e.VERBOSE.get=function(){return!1},e.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Yp,e),Hp.prototype.getCoordinates=function(){return this._pts},Hp.prototype.size=function(){return this._pts.length},Hp.prototype.getCoordinate=function(t){return this._pts[t]},Hp.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Hp.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Mc.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Hp.prototype.setData=function(t){this._data=t},Hp.prototype.getData=function(){return this._data},Hp.prototype.toString=function(){return Nu.toLineString(new mh(this._pts))},Hp.prototype.interfaces_=function(){return[Lc]},Hp.prototype.getClass=function(){return Hp},Wp.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Wp.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},Wp.prototype.getIntersectionSegments=function(){return this._intSegments},Wp.prototype.count=function(){return this._intersectionCount},Wp.prototype.getIntersections=function(){return this._intersections},Wp.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Wp.prototype.setKeepIntersections=function(t){this._keepIntersections=t},Wp.prototype.processIntersections=function(t,e,n,r){var i;return(this._findAllIntersections||!this.hasIntersection())&&(t!==n||e!==r)&&(!this._isCheckEndSegmentsOnly||this.isEndSegment(t,e)||this.isEndSegment(n,r))?(i=t.getCoordinates()[e],t=t.getCoordinates()[e+1],e=n.getCoordinates()[r],n=n.getCoordinates()[r+1],this._li.computeIntersection(i,t,e,n),void(this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=t,this._intSegments[2]=e,this._intSegments[3]=n,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++))):null},Wp.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},Wp.prototype.hasIntersection=function(){return null!==this._interiorIntersection},Wp.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},Wp.prototype.interfaces_=function(){return[hp]},Wp.prototype.getClass=function(){return Wp},Wp.createAllIntersectionsFinder=function(t){t=new Wp(t);return t.setFindAllIntersections(!0),t},Wp.createAnyIntersectionFinder=function(t){return new Wp(t)},Wp.createIntersectionCounter=function(t){t=new Wp(t);return t.setFindAllIntersections(!0),t.setKeepIntersections(!1),t},Jp.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Jp.prototype.getIntersections=function(){return this._segInt.getIntersections()},Jp.prototype.isValid=function(){return this.execute(),this._isValid},Jp.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Jp.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Wp(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Bc;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Jp.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Gh(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Jp.prototype.getErrorMessage=function(){var t;return this._isValid?"no intersections found":(t=this._segInt.getIntersectionSegments(),"found non-noded intersection between "+Nu.toLineString(t[0],t[1])+" and "+Nu.toLineString(t[2],t[3]))},Jp.prototype.interfaces_=function(){return[]},Jp.prototype.getClass=function(){return Jp},Jp.computeIntersections=function(t){t=new Jp(t);return t.setFindAllIntersections(!0),t.isValid(),t.getIntersections()},Zp.prototype.checkValid=function(){this._nv.checkValid()},Zp.prototype.interfaces_=function(){return[]},Zp.prototype.getClass=function(){return Zp},Zp.toSegmentStrings=function(t){for(var e=new I,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Hp(r.getCoordinates(),r))}return e},Zp.checkValid=function(t){new Zp(t).checkValid()},Kp.prototype.map=function(t){for(var e=new I,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(A.toGeometryArray(e))},Kp.prototype.interfaces_=function(){return[]},Kp.prototype.getClass=function(){return Kp},Kp.map=function(t,e){return new Kp(e).map(t)},Qp.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)}},Qp.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Qp.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Qp.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&!t.isVisited()&&s.isResultOfOp(r,e)&&!i.isCovered()&&(n.add(i),t.setVisitedEdge(!0))},Qp.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getEdge();n.isLineEdge()&&!r.isCoveredSet()&&(n=this._op.isCoveredByA(n.getCoordinate()),r.setCovered(n))}},Qp.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))}},Qp.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)}},Qp.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(x.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(s.isResultOfOp(r,e)&&e===s.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Qp.prototype.interfaces_=function(){return[]},Qp.prototype.getClass=function(){return Qp},$p.prototype.filterCoveredNodeToPoint=function(t){var t=t.getCoordinate();this._op.isCoveredByLA(t)||(t=this._geometryFactory.createPoint(t),this._resultPointList.add(t))},$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!==s.INTERSECTION||(n=r.getLabel(),s.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},tf.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},tf.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof ph&&!r.isEmpty()||(n=!1);for(var i,o=new I,s=0;s<t.getNumInteriorRing();s++){var a=this.transformLinearRing(t.getInteriorRingN(s),t);null===a||a.isEmpty()||(a instanceof ph||(n=!1),o.add(a))}return n?this._factory.createPolygon(r,o.toArray([])):(i=new I,null!==r&&i.add(r),i.addAll(o),this._factory.buildGeometry(i))},tf.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},tf.prototype.getInputGeometry=function(){return this._inputGeom},tf.prototype.transformMultiLineString=function(t,e){for(var n=new I,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)},tf.prototype.transformCoordinates=function(t,e){return this.copy(t)},tf.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},tf.prototype.transformMultiPoint=function(t,e){for(var n=new I,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)},tf.prototype.transformMultiPolygon=function(t,e){for(var n=new I,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)},tf.prototype.copy=function(t){return t.copy()},tf.prototype.transformGeometryCollection=function(t,e){for(var n=new I,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(A.toGeometryArray(n)):this._factory.buildGeometry(n)},tf.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof rh)return this.transformPoint(t,null);if(t instanceof ch)return this.transformMultiPoint(t,null);if(t instanceof ph)return this.transformLinearRing(t,null);if(t instanceof $l)return this.transformLineString(t,null);if(t instanceof Bl)return this.transformMultiLineString(t,null);if(t instanceof hh)return this.transformPolygon(t,null);if(t instanceof fh)return this.transformMultiPolygon(t,null);if(t instanceof ql)return this.transformGeometryCollection(t,null);throw new ou("Unknown Geometry subtype: "+t.getClass().getName())},tf.prototype.transformLinearRing=function(t,e){var n,t=this.transformCoordinates(t.getCoordinateSequence(),t);return null===t?this._factory.createLinearRing(null):0<(n=t.size())&&n<4&&!this._preserveType?this._factory.createLineString(t):this._factory.createLinearRing(t)},tf.prototype.interfaces_=function(){return[]},tf.prototype.getClass=function(){return tf},ef.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),i=this.findSnapForVertex(i,e);null!==i&&(t.set(r,new m(i)),0===r)&&this._isClosed&&t.set(t.size()-1,new m(i))}},ef.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},ef.prototype.snapTo=function(t){var e=new sl(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},ef.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 m(i),!1)}},ef.prototype.findSegmentIndexToSnap=function(t,e){for(var n=h.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},ef.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},ef.prototype.interfaces_=function(){return[]},ef.prototype.getClass=function(){return ef},ef.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])},{SNAP_PRECISION_FACTOR:{configurable:!0}}),hf=(nf.prototype.snapTo=function(t,e){t=this.extractTargetCoordinates(t);return new hf(e,t).transform(this._srcGeom)},nf.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),t=new hf(t,n,!0).transform(this._srcGeom),n=t;return n=e&&v(t,eh)?t.buffer(0):n},nf.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},nf.prototype.extractTargetCoordinates=function(t){for(var e=new Ol,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},nf.prototype.computeMinimumSegmentLength=function(t){for(var e=h.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},nf.prototype.interfaces_=function(){return[]},nf.prototype.getClass=function(){return nf},nf.snap=function(t,e,n){var r=new Array(2).fill(null),t=new nf(t),t=(r[0]=t.snapTo(e,n),new nf(e));return r[1]=t.snapTo(r[0],n),r},nf.computeOverlaySnapTolerance=function(){var t,e;return 1===arguments.length?(e=nf.computeSizeBasedSnapTolerance(t=arguments[0]),(t=t.getPrecisionModel()).getType()===r.FIXED&&e<(t=1/t.getScale()*2/1.415)?t:e):2===arguments.length?(t=arguments[0],e=arguments[1],Math.min(nf.computeOverlaySnapTolerance(t),nf.computeOverlaySnapTolerance(e))):void 0},nf.computeSizeBasedSnapTolerance=function(t){t=t.getEnvelopeInternal();return Math.min(t.getHeight(),t.getWidth())*nf.SNAP_PRECISION_FACTOR},nf.snapToSelf=function(t,e,n){return new nf(t).snapToSelf(e,n)},e.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(nf,e),(of=tf)&&(cf.__proto__=of),((cf.prototype=Object.create(of&&of.prototype)).constructor=cf).prototype.snapLine=function(t,e){t=new ef(t,this._snapTolerance);return t.setAllowSnappingToSourceVertices(this._isSelfSnap),t.snapTo(e)},cf.prototype.transformCoordinates=function(t,e){t=t.toCoordinateArray(),t=this.snapLine(t,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(t)},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf},cf);function cf(t,e,n){of.call(this),this._snapTolerance=t||null,this._snapPts=e||null,this._isSelfSnap=void 0!==n&&n}rf.prototype.getCommon=function(){return h.longBitsToDouble(this._commonBits)},rf.prototype.add=function(t){t=h.doubleToLongBits(t);return this._isFirst?(this._commonBits=t,this._commonSignExp=rf.signExpBits(this._commonBits),this._isFirst=!1,null):rf.signExpBits(t)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=rf.numCommonMostSigMantissaBits(this._commonBits,t),void(this._commonBits=rf.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},rf.prototype.toString=function(){var t,e;if(1===arguments.length)return t=h.longBitsToDouble(e=arguments[0]),(e=(e="0000000000000000000000000000000000000000000000000000000000000000"+h.toBinaryString(e)).substring(e.length-64)).substring(0,1)+"  "+e.substring(1,12)+"(exp) "+e.substring(12)+" [ "+t+" ]"},rf.prototype.interfaces_=function(){return[]},rf.prototype.getClass=function(){return rf},rf.getBit=function(t,e){return 0!=(t&1<<e)?1:0},rf.signExpBits=function(t){return t>>52},rf.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},rf.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;0<=r;r--){if(rf.getBit(t,r)!==rf.getBit(e,r))return n;n++}return 52};function pf(){this._commonCoord=null,this._ccFilter=new Ef}function ff(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()}function gf(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e}function df(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e}function yf(){var t,e,n;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=yf.DELETE,this._xValue=t,this._insertEvent=e):3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],this._eventType=yf.INSERT,this._label=t,this._xValue=e,this._obj=n)}function _f(){}function mf(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n}function vf(){this._min=h.POSITIVE_INFINITY,this._max=h.NEGATIVE_INFINITY}var xf,e={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}},Ef=(pf.prototype.addCommonBits=function(t){var e=new bf(this._commonCoord);t.apply(e),t.geometryChanged()},pf.prototype.removeCommonBits=function(t){var e;return 0===this._commonCoord.x&&0===this._commonCoord.y||((e=new m(this._commonCoord)).x=-e.x,e.y=-e.y,e=new bf(e),t.apply(e),t.geometryChanged()),t},pf.prototype.getCommonCoordinate=function(){return this._commonCoord},pf.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf},e.CommonCoordinateFilter.get=function(){return Ef},e.Translater.get=function(){return bf},Object.defineProperties(pf,e),function(){this._commonBitsX=new rf,this._commonBitsY=new rf}),bf=(Ef.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Ef.prototype.getCommonCoordinate=function(){return new m(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Ef.prototype.interfaces_=function(){return[ju]},Ef.prototype.getClass=function(){return Ef},function(){this.trans=null,this.trans=arguments[0]}),e=(bf.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)},bf.prototype.isDone=function(){return!1},bf.prototype.isGeometryChanged=function(){return!0},bf.prototype.interfaces_=function(){return[Dl]},bf.prototype.getClass=function(){return bf},ff.prototype.selfSnap=function(t){return new nf(t).snapTo(t,this._snapTolerance)},ff.prototype.removeCommonBits=function(t){this._cbr=new pf,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},ff.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},ff.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),e=s.overlayOp(e[0],e[1],t);return this.prepareResult(e)},ff.prototype.checkValid=function(t){t.isValid()||mu.out.println("Snapped geometry is invalid")},ff.prototype.computeSnapTolerance=function(){this._snapTolerance=nf.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},ff.prototype.snap=function(t){t=this.removeCommonBits(t);return nf.snap(t[0],t[1],this._snapTolerance)},ff.prototype.interfaces_=function(){return[]},ff.prototype.getClass=function(){return ff},ff.overlayOp=function(t,e,n){return new ff(t,e).getResultGeometry(n)},ff.union=function(t,e){return ff.overlayOp(t,e,s.UNION)},ff.intersection=function(t,e){return ff.overlayOp(t,e,s.INTERSECTION)},ff.symDifference=function(t,e){return ff.overlayOp(t,e,s.SYMDIFFERENCE)},ff.difference=function(t,e){return ff.overlayOp(t,e,s.DIFFERENCE)},gf.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=s.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(t){if(!(t instanceof Ou))throw t;r=t}if(!n)try{e=ff.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof Ou?r:t}return e},gf.prototype.interfaces_=function(){return[]},gf.prototype.getClass=function(){return gf},gf.overlayOp=function(t,e,n){return new gf(t,e).getResultGeometry(n)},gf.union=function(t,e){return gf.overlayOp(t,e,s.UNION)},gf.intersection=function(t,e){return gf.overlayOp(t,e,s.INTERSECTION)},gf.symDifference=function(t,e){return gf.overlayOp(t,e,s.SYMDIFFERENCE)},gf.difference=function(t,e){return gf.overlayOp(t,e,s.DIFFERENCE)},df.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},df.prototype.interfaces_=function(){return[]},df.prototype.getClass=function(){return df},{INSERT:{configurable:!0},DELETE:{configurable:!0}}),wf=(yf.prototype.isDelete=function(){return this._eventType===yf.DELETE},yf.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},yf.prototype.getObject=function(){return this._obj},yf.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},yf.prototype.getInsertEvent=function(){return this._insertEvent},yf.prototype.isInsert=function(){return this._eventType===yf.INSERT},yf.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},yf.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},yf.prototype.interfaces_=function(){return[au]},yf.prototype.getClass=function(){return yf},e.INSERT.get=function(){return 1},e.DELETE.get=function(){return 2},Object.defineProperties(yf,e),_f.prototype.interfaces_=function(){return[]},_f.prototype.getClass=function(){return _f},mf.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(mf.isAdjacentSegments(e,r))return!0;if(t.isClosed()){n=t.getNumPoints()-1;if(0===e&&r===n||0===r&&e===n)return!0}}return!1},mf.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},mf.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},mf.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},mf.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},mf.prototype.hasProperIntersection=function(){return this._hasProper},mf.prototype.hasIntersection=function(){return this._hasIntersection},mf.prototype.isDone=function(){return this._isDone},mf.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},mf.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},mf.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))))},mf.prototype.interfaces_=function(){return[]},mf.prototype.getClass=function(){return mf},mf.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},(xf=_f)&&(If.__proto__=xf),((If.prototype=Object.create(xf&&xf.prototype)).constructor=If).prototype.prepareEvents=function(){dc.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},If.prototype.computeIntersections=function(){var t,e,n;if(1===arguments.length){var r=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var i=0;i<this.events.size();i++){var o=this.events.get(i);if(o.isInsert()&&this.processOverlaps(i,o.getDeleteEventIndex(),o,r),r.isDone())break}}else 3===arguments.length&&(arguments[2]instanceof mf&&v(arguments[0],$u)&&v(arguments[1],$u)?(e=arguments[0],n=arguments[1],t=arguments[2],this.addEdges(e,e),this.addEdges(n,n),this.computeIntersections(t)):"boolean"==typeof arguments[2]&&v(arguments[0],$u)&&arguments[1]instanceof mf&&(e=arguments[0],n=arguments[1],arguments[2]?this.addEdges(e,null):this.addEdges(e),this.computeIntersections(n)))},If.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new df(n,i),o=new yf(e,n.getMinX(i),o);this.events.add(o),this.events.add(new yf(n.getMaxX(i),o))}},If.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++))}},If.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();){var o=i.next();this.addEdge(o,r)}},If.prototype.interfaces_=function(){return[]},If.prototype.getClass=function(){return If},If),e={NodeComparator:{configurable:!0}};function If(){xf.call(this),this.events=new I,this.nOverlaps=null}vf.prototype.getMin=function(){return this._min},vf.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},vf.prototype.getMax=function(){return this._max},vf.prototype.toString=function(){return Nu.toLineString(new m(this._min,0),new m(this._max,0))},vf.prototype.interfaces_=function(){return[]},vf.prototype.getClass=function(){return vf},e.NodeComparator.get=function(){return Pf},Object.defineProperties(vf,e);function Nf(){this._leaves=new I,this._root=null,this._level=0}var Sf,Cf,Pf=function(){},Mf=(Pf.prototype.compare=function(t,e){t=(t._min+t._max)/2,e=(e._min+e._max)/2;return t<e?-1:e<t?1:0},Pf.prototype.interfaces_=function(){return[lu]},Pf.prototype.getClass=function(){return Pf},(Cf=vf)&&(Rf.__proto__=Cf),((Rf.prototype=Object.create(Cf&&Cf.prototype)).constructor=Rf).prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},Rf.prototype.interfaces_=function(){return[]},Rf.prototype.getClass=function(){return Rf},Rf),Lf=((Sf=vf)&&(Of.__proto__=Sf),((Of.prototype=Object.create(Sf&&Sf.prototype)).constructor=Of).prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},Of.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)},Of.prototype.interfaces_=function(){return[]},Of.prototype.getClass=function(){return Of},Of);function Of(){Sf.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 Rf(){Cf.call(this),this._item=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._min=t,this._max=e,this._item=n}Nf.prototype.buildTree=function(){dc.sort(this._leaves,new vf.NodeComparator);for(var t,e=this._leaves,n=new I;;){if(this.buildLevel(e,n),1===n.size())return n.get(0);t=e,e=n,n=t}},Nf.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 Mf(t,e,n))},Nf.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Nf.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Nf.prototype.printNode=function(t){mu.out.println(Nu.toLineString(new m(t._min,this._level),new m(t._max,this._level)))},Nf.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Nf.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);null===(n+1<t.size()?t.get(n):null)?e.add(r):(r=new Lf(t.get(n),t.get(n+1)),e.add(r))}},Nf.prototype.interfaces_=function(){return[]},Nf.prototype.getClass=function(){return Nf};function Tf(){this._items=new I}function Af(){this._index=null;var t=arguments[0];if(!v(t,eh))throw new ou("Argument must be Polygonal");this._index=new Gf(t)}Tf.prototype.visitItem=function(t){this._items.add(t)},Tf.prototype.getItems=function(){return this._items},Tf.prototype.interfaces_=function(){return[pc]},Tf.prototype.getClass=function(){return Tf};function Df(){var t,e,n;this._li=new Gu,this._resultPrecisionModel=null,this._arg=null,1===arguments.length?(this.setComputationPrecision((t=arguments[0]).getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new qf(0,t)):2===arguments.length?(t=arguments[0],e=arguments[1],n=Uu.OGC_SFS_BOUNDARY_RULE,0<=t.getPrecisionModel().compareTo(e.getPrecisionModel())?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new qf(0,t,n),this._arg[1]=new qf(1,e,n)):3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],0<=t.getPrecisionModel().compareTo(e.getPrecisionModel())?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new qf(0,t,n),this._arg[1]=new qf(1,e,n))}var Ff,e={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}},kf=(Af.prototype.locate=function(t){var e=new Bu(t),n=new kf(e);return this._index.query(t.y,t.y,n),e.getLocation()},Af.prototype.interfaces_=function(){return[Kc]},Af.prototype.getClass=function(){return Af},e.SegmentVisitor.get=function(){return kf},e.IntervalIndexedGeometry.get=function(){return Gf},Object.defineProperties(Af,e),function(){this._counter=null,this._counter=arguments[0]}),Gf=(kf.prototype.visitItem=function(t){this._counter.countSegment(t.getCoordinate(0),t.getCoordinate(1))},kf.prototype.interfaces_=function(){return[pc]},kf.prototype.getClass=function(){return kf},function(){this._index=new Nf,this.init(arguments[0])}),qf=(Gf.prototype.init=function(t){for(var e=Fp.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},Gf.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new D(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)}},Gf.prototype.query=function(){var t,e,n;if(2===arguments.length)return t=arguments[0],e=arguments[1],n=new Tf,this._index.query(t,e,n),n.getItems();3===arguments.length&&this._index.query(arguments[0],arguments[1],arguments[2])},Gf.prototype.interfaces_=function(){return[]},Gf.prototype.getClass=function(){return Gf},(Ff=ac)&&(Bf.__proto__=Ff),((Bf.prototype=Object.create(Ff&&Ff.prototype)).constructor=Bf).prototype.insertBoundaryPoint=function(t,e){var e=this._nodes.addNode(e).getLabel(),n=1,n=(e.getLocation(t,T.ON)===g.BOUNDARY&&n++,Bf.determineBoundary(this._boundaryNodeRule,n));e.setLocation(t,n)},Bf.prototype.computeSelfNodes=function(){var t,e,n,r;return 2===arguments.length?this.computeSelfNodes(arguments[0],arguments[1],!1):3===arguments.length?(e=arguments[0],t=arguments[1],n=arguments[2],(e=new mf(e,!0,!1)).setIsDoneIfProperInt(n),n=this.createEdgeSetIntersector(),r=this._parentGeom instanceof ph||this._parentGeom instanceof hh||this._parentGeom instanceof fh,n.computeIntersections(this._edges,e,t||!r),this.addSelfIntersectionNodes(this._argIndex),e):void 0},Bf.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},Bf.prototype.computeEdgeIntersections=function(t,e,n){e=new mf(e,n,!0);return e.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,e),e},Bf.prototype.getGeometry=function(){return this._parentGeom},Bf.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},Bf.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},Bf.prototype.addPoint=function(){var t;arguments[0]instanceof rh?(t=arguments[0].getCoordinate(),this.insertPoint(this._argIndex,t,g.INTERIOR)):arguments[0]instanceof m&&this.insertPoint(this._argIndex,arguments[0],g.INTERIOR)},Bf.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),g.EXTERIOR,g.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,g.INTERIOR,g.EXTERIOR)}},Bf.prototype.addEdge=function(t){this.insertEdge(t);t=t.getCoordinates();this.insertPoint(this._argIndex,t[0],g.BOUNDARY),this.insertPoint(this._argIndex,t[t.length-1],g.BOUNDARY)},Bf.prototype.addLineString=function(t){var e=w.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new vp(e,new jh(this._argIndex,g.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),x.isTrue(2<=e.length,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},Bf.prototype.getInvalidPoint=function(){return this._invalidPoint},Bf.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},Bf.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},Bf.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===g.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},Bf.prototype.addPolygonRing=function(t,e,n){var r,i,o;return t.isEmpty()?null:(r=w.removeRepeatedPoints(t.getCoordinates())).length<4?(this._hasTooFewPoints=!0,this._invalidPoint=r[0],null):(i=e,o=n,b.isCCW(r)&&(i=n,o=e),n=new vp(r,new jh(this._argIndex,g.BOUNDARY,i,o)),this._lineEdgeMap.put(t,n),this.insertEdge(n),void this.insertPoint(this._argIndex,r[0],g.BOUNDARY))},Bf.prototype.insertPoint=function(t,e,n){var e=this._nodes.addNode(e),r=e.getLabel();null===r?e._label=new jh(t,n):r.setLocation(t,n)},Bf.prototype.createEdgeSetIntersector=function(){return new wf},Bf.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)}},Bf.prototype.add=function(){if(1!==arguments.length)return Ff.prototype.add.apply(this,arguments);var t=arguments[0];if(t.isEmpty())return null;if(t instanceof fh&&(this._useBoundaryDeterminationRule=!1),t instanceof hh)this.addPolygon(t);else if(t instanceof $l)this.addLineString(t);else if(t instanceof rh)this.addPoint(t);else{if(!(t instanceof ch||t instanceof Bl||t instanceof fh||t instanceof ql))throw new Error(t.getClass().getName());this.addCollection(t)}},Bf.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Bf.prototype.locate=function(t){return v(this._parentGeom,eh)&&50<this._parentGeom.getNumGeometries()?(null===this._areaPtLocator&&(this._areaPtLocator=new Af(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},Bf.prototype.findEdge=function(){return 1===arguments.length?this._lineEdgeMap.get(arguments[0]):Ff.prototype.findEdge.apply(this,arguments)},Bf.prototype.interfaces_=function(){return[]},Bf.prototype.getClass=function(){return Bf},Bf.determineBoundary=function(t,e){return t.isInBoundary(e)?g.BOUNDARY:g.INTERIOR},Bf);function Bf(){var t,e,n;Ff.call(this),this._parentGeom=null,this._lineEdgeMap=new Ih,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new kp,2===arguments.length?(t=arguments[0],n=arguments[1],e=Uu.OGC_SFS_BOUNDARY_RULE,this._argIndex=t,this._parentGeom=n,this._boundaryNodeRule=e,null!==n&&this.add(n)):3===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],this._argIndex=t,this._parentGeom=e,this._boundaryNodeRule=n,null!==e)&&this.add(e)}Df.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Df.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Df.prototype.interfaces_=function(){return[]},Df.prototype.getClass=function(){return Df};function zf(){}zf.prototype.interfaces_=function(){return[]},zf.prototype.getClass=function(){return zf},zf.map=function(){if(arguments[0]instanceof E&&v(arguments[1],zf.MapOp)){for(var t=arguments[0],e=arguments[1],n=new I,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(v(arguments[0],Vu)&&v(arguments[1],zf.MapOp)){for(var o=arguments[0],s=arguments[1],a=new I,u=o.iterator();u.hasNext();){var l=u.next(),l=s.map(l);null!==l&&a.add(l)}return a}},zf.MapOp=function(){},(jf=Df)&&(Uf.__proto__=jf),((Uf.prototype=Object.create(jf&&jf.prototype)).constructor=Uf).prototype.insertUniqueEdge=function(t){var e,n,r=this._edgeList.findEqualEdge(t);null!==r?(e=r.getLabel(),n=t.getLabel(),r.isPointwiseEqual(t)||(n=new jh(t.getLabel())).flip(),(r=r.getDepth()).isNull()&&r.add(e),r.add(n),e.merge(n)):this._edgeList.add(t)},Uf.prototype.getGraph=function(){return this._graph},Uf.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))}},Uf.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},Uf.prototype.computeGeometry=function(t,e,n,r){var i=new I;return i.addAll(t),i.addAll(e),i.addAll(n),i.isEmpty()?Uf.createEmptyResult(r,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(i)},Uf.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},Uf.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==g.EXTERIOR)return!0}return!1},Uf.prototype.replaceCollapsedEdges=function(){for(var t=new I,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},Uf.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},Uf.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},Uf.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},Uf.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 I,e=(this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Zp.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges(),new uc(this._geomFact)),e=(e.add(this._graph),this._resultPolyList=e.getPolygons(),new Qp(this,this._geomFact,this._ptLocator)),e=(this._resultLineList=e.build(t),new $p(this,this._geomFact,this._ptLocator));this._resultPointList=e.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},Uf.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},Uf.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))}},Uf.prototype.findResultAreaEdges=function(t){for(var e=this._graph.getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getLabel();r.isArea()&&!n.isInteriorAreaEdge()&&Uf.isResultOfOp(r.getLocation(0,T.RIGHT),r.getLocation(1,T.RIGHT),t)&&n.setInResult(!0)}},Uf.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):(x.isTrue(!r.isNull(i,T.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,T.LEFT,r.getLocation(i,T.LEFT)),x.isTrue(!r.isNull(i,T.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,T.RIGHT,r.getLocation(i,T.RIGHT))))}}},Uf.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},Uf.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)}},Uf.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},Uf.prototype.interfaces_=function(){return[]},Uf.prototype.getClass=function(){return Uf};var jf,s=Uf;function Uf(){var t=arguments[0];jf.call(this,t,arguments[1]),this._ptLocator=new kp,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new lp,this._resultPolyList=new I,this._resultLineList=new I,this._resultPointList=new I,this._graph=new ac(new sp),this._geomFact=t.getFactory()}s.overlayOp=function(t,e,n){return new s(t,e).getResultGeometry(n)},s.intersection=function(t,e){var n;return t.isEmpty()||e.isEmpty()?s.createEmptyResult(s.INTERSECTION,t,e,t.getFactory()):t.isGeometryCollection()?(n=e,Kp.map(t,{interfaces_:function(){return[zf.MapOp]},map:function(t){return t.intersection(n)}})):(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),gf.overlayOp(t,e,s.INTERSECTION))},s.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return s.createEmptyResult(s.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),gf.overlayOp(t,e,s.SYMDIFFERENCE)},s.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case s.INTERSECTION:o=Math.min(r,i);break;case s.UNION:o=Math.max(r,i);break;case s.DIFFERENCE:o=r;break;case s.SYMDIFFERENCE:o=Math.max(r,i)}return o},s.createEmptyResult=function(t,e,n,r){var i=null;switch(s.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},s.difference=function(t,e){return t.isEmpty()?s.createEmptyResult(s.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),gf.overlayOp(t,e,s.DIFFERENCE))},s.isResultOfOp=function(){var t,e,n;if(2===arguments.length)return n=arguments[0],t=arguments[1],e=n.getLocation(0),n=n.getLocation(1),s.isResultOfOp(e,n,t);if(3===arguments.length){var r=arguments[0],i=arguments[1];switch(r===g.BOUNDARY&&(r=g.INTERIOR),i===g.BOUNDARY&&(i=g.INTERIOR),arguments[2]){case s.INTERSECTION:return r===g.INTERIOR&&i===g.INTERIOR;case s.UNION:return r===g.INTERIOR||i===g.INTERIOR;case s.DIFFERENCE:return r===g.INTERIOR&&i!==g.INTERIOR;case s.SYMDIFFERENCE:return r===g.INTERIOR&&i!==g.INTERIOR||r!==g.INTERIOR&&i===g.INTERIOR}return!1}},s.INTERSECTION=1,s.UNION=2,s.DIFFERENCE=3,s.SYMDIFFERENCE=4;function Vf(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new kp,this._seg=new D;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)}function Xf(){this._g=null,this._doLeft=!0,this._doRight=!0,this._g=arguments[0]}function Yf(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=Yf.TOLERANCE,this._testCoords=new I;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=Yf.computeBoundaryDistanceTolerance(t,e),this._geom=[t,e,n],this._locFinder=[new Vf(this._geom[0],this._boundaryDistanceTolerance),new Vf(this._geom[1],this._boundaryDistanceTolerance),new Vf(this._geom[2],this._boundaryDistanceTolerance)]}function Hf(t){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=Hf.extractFactory(t),this._inputGeoms=t}function Wf(){this._inputPolys=null,this._geomFactory=null,this._inputPolys=arguments[0],null===this._inputPolys&&(this._inputPolys=new I)}Vf.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},Vf.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?g.BOUNDARY:this._ptLocator.locate(t,this._g)},Vf.prototype.extractLinework=function(t){var e=new Jf,e=(t.apply(e),e.getLinework()),e=A.toLineStringArray(e);return t.getFactory().createMultiLineString(e)},Vf.prototype.interfaces_=function(){return[]},Vf.prototype.getClass=function(){return Vf};var Jf=function(){this._linework=null,this._linework=new I},e=(Jf.prototype.getLinework=function(){return this._linework},Jf.prototype.filter=function(t){if(t instanceof hh){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},Jf.prototype.interfaces_=function(){return[Al]},Jf.prototype.getClass=function(){return Jf},Xf.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)},Xf.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Xf.prototype.getPoints=function(t){for(var e=new I,n=Fp.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},Xf.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),i=n*i/s,n=n*o/s,o=(e.x+t.x)/2,s=(e.y+t.y)/2;this._doLeft&&(e=new m(o-n,s+i),r.add(e)),this._doRight&&(t=new m(o+n,s-i),r.add(t))},Xf.prototype.interfaces_=function(){return[]},Xf.prototype.getClass=function(){return Xf},{TOLERANCE:{configurable:!0}}),e=(Yf.prototype.reportResult=function(t,e,n){mu.out.println("Overlay result invalid - A:"+g.toLocationSymbol(e[0])+" B:"+g.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+g.toLocationSymbol(e[2]))},Yf.prototype.isValid=function(t){return this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]),this.checkValid(t)},Yf.prototype.checkValid=function(){var t,e;if(1===arguments.length){for(var n=arguments[0],r=0;r<this._testCoords.size();r++){var i=this._testCoords.get(r);if(!this.checkValid(n,i))return this._invalidLocation=i,!1}return!0}if(2===arguments.length)return t=arguments[0],this._location[0]=this._locFinder[0].getLocation(e=arguments[1]),this._location[1]=this._locFinder[1].getLocation(e),this._location[2]=this._locFinder[2].getLocation(e),!!Yf.hasLocation(this._location,g.BOUNDARY)||this.isValidResult(t,this._location)},Yf.prototype.addTestPts=function(t){t=new Xf(t);this._testCoords.addAll(t.getPoints(5*this._boundaryDistanceTolerance))},Yf.prototype.isValidResult=function(t,e){var n=s.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===g.INTERIOR);return r||this.reportResult(t,e,n),r},Yf.prototype.getInvalidLocation=function(){return this._invalidLocation},Yf.prototype.interfaces_=function(){return[]},Yf.prototype.getClass=function(){return Yf},Yf.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},Yf.computeBoundaryDistanceTolerance=function(t,e){return Math.min(nf.computeSizeBasedSnapTolerance(t),nf.computeSizeBasedSnapTolerance(e))},Yf.isValid=function(t,e,n,r){return new Yf(t,e,r).isValid(n)},e.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Yf,e),Hf.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)}},Hf.prototype.combine=function(){for(var t=new I,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)},Hf.prototype.interfaces_=function(){return[]},Hf.prototype.getClass=function(){return Hf},Hf.combine=function(){return 1===arguments.length?new Hf(arguments[0]).combine():2===arguments.length?new Hf(Hf.createList(arguments[0],arguments[1])).combine():3===arguments.length?new Hf(Hf.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},Hf.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Hf.createList=function(){var t,e,n,r;return 2===arguments.length?(t=arguments[0],e=arguments[1],(n=new I).add(t),n.add(e),n):3===arguments.length?(t=arguments[0],e=arguments[1],n=arguments[2],(r=new I).add(t),r.add(e),r.add(n),r):void 0},{STRTREE_NODE_CAPACITY:{configurable:!0}});Wf.prototype.reduceToGeometries=function(t){for(var e=new I,n=t.iterator();n.hasNext();){var r=n.next(),i=null;v(r,$u)?i=this.unionTree(r):r instanceof E&&(i=r),e.add(i)}return e},Wf.prototype.extractByEnvelope=function(t,e,n){for(var r=new I,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);(o.getEnvelopeInternal().intersects(t)?r:n).add(o)}return this._geomFactory.buildGeometry(r)},Wf.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();return n.intersects(r)?t.getNumGeometries()<=1&&e.getNumGeometries()<=1?this.unionActual(t,e):(n=n.intersection(r),this.unionUsingEnvelopeIntersection(t,e,n)):Hf.combine(t,e)},Wf.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 wc(Wf.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)},Wf.prototype.binaryUnion=function(){var t,e,n,r;return 1===arguments.length?this.binaryUnion(r=arguments[0],0,r.size()):3===arguments.length?(r=arguments[0],n=arguments[1],(t=arguments[2])-n<=1?(e=Wf.getGeometry(r,n),this.unionSafe(e,null)):t-n==2?this.unionSafe(Wf.getGeometry(r,n),Wf.getGeometry(r,n+1)):(e=Math.trunc((t+n)/2),n=this.binaryUnion(r,n,e),r=this.binaryUnion(r,e,t),this.unionSafe(n,r))):void 0},Wf.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},Wf.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},Wf.prototype.unionActual=function(t,e){return Wf.restrictToPolygons(t.union(e))},Wf.prototype.unionTree=function(t){t=this.reduceToGeometries(t);return this.binaryUnion(t)},Wf.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new I,t=this.extractByEnvelope(n,t,r),n=this.extractByEnvelope(n,e,r),e=this.unionActual(t,n);return r.add(e),Hf.combine(r)},Wf.prototype.bufferUnion=function(){var t,e;return 1===arguments.length?(t=arguments[0]).get(0).getFactory().buildGeometry(t).buffer(0):2===arguments.length?(t=arguments[0],e=arguments[1],t.getFactory().createGeometryCollection([t,e]).buffer(0)):void 0},Wf.prototype.interfaces_=function(){return[]},Wf.prototype.getClass=function(){return Wf},Wf.restrictToPolygons=function(t){var e;return v(t,eh)?t:1===(e=Dp.getPolygons(t)).size()?e.get(0):t.getFactory().createMultiPolygon(A.toPolygonArray(e))},Wf.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Wf.union=function(t){return new Wf(t).union()},e.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Wf,e);function Zf(){return new Kf}function Kf(){this.reset()}Kf.prototype={constructor:Kf,reset:function(){this.s=this.t=0},add:function(t){$f(Qf,t,this.t),$f(this,Qf.s,this.s),this.s?this.t+=Qf.t:this.s=Qf.t},valueOf:function(){return this.s}};var Qf=new Kf;function $f(t,e,n){var r=t.s=e+n,i=r-e;t.t=e-(r-i)+(n-i)}var tg=1e-6,eg=Math.PI,ng=eg/2,rg=eg/4,ig=2*eg,og=180/eg,sg=eg/180,ag=Math.abs,ug=Math.atan,lg=Math.atan2,hg=Math.cos,cg=Math.sin,pg=Math.sqrt;function fg(t){return 1<t?0:t<-1?eg:Math.acos(t)}function gg(t){return 1<t?ng:t<-1?-ng:Math.asin(t)}function dg(){}function yg(t,e){t&&mg.hasOwnProperty(t.type)&&mg[t.type](t,e)}var _g={Feature:function(t,e){yg(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)yg(n[r].geometry,e)}},mg={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){vg(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)vg(n[r],e,0)},Polygon:function(t,e){xg(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)xg(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)yg(n[r],e)}};function vg(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 xg(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)vg(t[n],e,1);e.polygonEnd()}function Eg(t){return[lg(t[1],t[0]),gg(t[2])]}function bg(t){var e=t[0],t=t[1],n=hg(t);return[n*hg(e),n*cg(e),cg(t)]}function wg(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ig(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 Ng(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Sg(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Cg(t){var e=pg(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Pg(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 Mg(t,e){return[eg<t?t-ig:t<-eg?t+ig:t,e]}function Lg(n){return function(t,e){return[(t+=n)>eg?t-ig:t<-eg?t+ig:t,e]}}function Og(t){var e=Lg(t);return e.invert=Lg(-t),e}function Rg(t,e){var i=hg(t),o=cg(t),s=hg(e),a=cg(e);function n(t,e){var n=hg(e),r=hg(t)*n,t=cg(t)*n,n=cg(e),e=n*i+r*o;return[lg(t*s-e*a,r*i-n*o),gg(e*s+t*a)]}return n.invert=function(t,e){var n=hg(e),r=hg(t)*n,t=cg(t)*n,n=cg(e),e=n*s-t*a;return[lg(t*s+n*a,r*i+e*o),gg(e*i-r*o)]},n}function Tg(t,e){(e=bg(e))[0]-=t,Cg(e);t=fg(-e[1]);return((-e[2]<0?-t:t)+ig-tg)%ig}function Ag(){var n,e=[];return{point:function(t,e){n.push([t,e])},lineStart:function(){e.push(n=[])},lineEnd:dg,rejoin:function(){1<e.length&&e.push(e.pop().concat(e.shift()))},result:function(){var t=e;return e=[],n=null,t}}}function Dg(t,e){return ag(t[0]-e[0])<tg&&ag(t[1]-e[1])<tg}function Fg(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function kg(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(Dg(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 Fg(r,t,null,!0)),u.push(n.o=new Fg(r,null,n,!1)),a.push(n=new Fg(i,t,null,!1)),u.push(n.o=new Fg(i,null,n,!0))}}),a.length){for(u.sort(e),Gg(a),Gg(u),s=0,i=u.length;s<i;++s)u[s].e=n=!n;for(var l,h,c=a[0];;){for(var p=c,f=!0;p.v;)if((p=p.n)===c)return;l=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(s=0,i=l.length;s<i;++s)o.point((h=l[s])[0],h[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(f)for(l=p.p.z,s=l.length-1;0<=s;--s)o.point((h=l[s])[0],h[1]);else r(p.x,p.p.x,-1,o);p=p.p}}while(l=(p=p.o).z,f=!f,!p.v);o.lineEnd()}}}function Gg(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 qg(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}function Bg(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}Zf(),Zf(),Zf(),Mg.invert=Mg;var zg=Zf();function jg(t){return t}Zf(),Zf(),Zf();var Ug=1/0,Vg=Ug,Xg=-Ug,Yg=Xg,Hg={point:function(t,e){t<Ug&&(Ug=t),Xg<t&&(Xg=t),e<Vg&&(Vg=e),Yg<e&&(Yg=e)},lineStart:dg,lineEnd:dg,polygonStart:dg,polygonEnd:dg,result:function(){var t=[[Ug,Vg],[Xg,Yg]];return Xg=Yg=-(Vg=Ug=1/0),t}};function Wg(_,m,v,x){return function(r,a){var u,l,h,n=m(a),N=r.invert(x[0],x[1]),c=Ag(),p=m(c),f=!1,e={point:i,lineStart:o,lineEnd:s,polygonStart:function(){e.point=g,e.lineStart=d,e.lineEnd=y,l=[],u=[]},polygonEnd:function(){e.point=i,e.lineStart=o,e.lineEnd=s,l=Bg(l);var t=function(t){var e=N[0],n=N[1],r=[cg(e),-hg(e),0],i=0,o=0;zg.reset();for(var s=0,a=t.length;s<a;++s)if(l=(u=t[s]).length)for(var u,l,h=u[l-1],c=h[0],p=h[1]/2+rg,f=cg(p),g=hg(p),d=0;d<l;++d,c=_,f=v,g=m,h=y){var y=u[d],_=y[0],m=y[1]/2+rg,v=cg(m),m=hg(m),x=_-c,E=0<=x?1:-1,b=E*x,w=eg<b,I=f*v;zg.add(lg(I*E*cg(b),g*m+I*hg(b))),i+=w?x+E*ig:x,w^e<=c^e<=_&&(Cg(I=Ig(bg(h),bg(y))),Cg(b=Ig(r,I)),(E=(w^0<=x?-1:1)*gg(b[2]))<n||n===E&&(I[0]||I[1]))&&(o+=w^0<=x?1:-1)}return(i<-1e-6||i<tg&&zg<-1e-6)^1&o}(u);l.length?(f||(a.polygonStart(),f=!0),kg(l,Zg,t,v,a)):t&&(f||(a.polygonStart(),f=!0),a.lineStart(),v(null,null,1,a),a.lineEnd()),f&&(a.polygonEnd(),f=!1),l=u=null},sphere:function(){a.polygonStart(),a.lineStart(),v(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function i(t,e){var n=r(t,e);_(t=n[0],e=n[1])&&a.point(t,e)}function t(t,e){t=r(t,e);n.point(t[0],t[1])}function o(){e.point=t,n.lineStart()}function s(){e.point=i,n.lineEnd()}function g(t,e){h.push([t,e]);t=r(t,e);p.point(t[0],t[1])}function d(){p.lineStart(),h=[]}function y(){g(h[0][0],h[0][1]),p.lineEnd();var t,e,n,r,i=p.clean(),o=c.result(),s=o.length;if(h.pop(),u.push(h),h=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())),l.push(o.filter(Jg))}return e}}function Jg(t){return 1<t.length}function Zg(t,e){return((t=t.x)[0]<0?t[1]-ng-tg:ng-t[1])-((e=e.x)[0]<0?e[1]-ng-tg:ng-e[1])}Zf();var Kg=Wg(function(){return 1},function(l){var h,c=NaN,p=NaN,f=NaN;return{lineStart:function(){l.lineStart(),h=1},point:function(t,e){var n,r,i,o,s,a=0<t?eg:-eg,u=ag(t-c);ag(u-eg)<tg?(l.point(c,p=0<(p+e)/2?ng:-ng),l.point(f,p),l.lineEnd(),l.lineStart(),l.point(a,p),l.point(t,p),h=0):f!==a&&eg<=u&&(ag(c-f)<tg&&(c-=f*tg),ag(t-a)<tg&&(t-=a*tg),u=p,i=e,s=cg((n=c)-(r=t)),p=ag(s)>tg?ug((cg(u)*(o=hg(i))*cg(r)-cg(i)*(r=hg(u))*cg(n))/(r*o*s)):(u+i)/2,l.point(f,p),l.lineEnd(),l.lineStart(),l.point(a,p),h=0),l.point(c=t,p=e),f=a},lineEnd:function(){l.lineEnd(),c=p=NaN},clean:function(){return 2-h}}},function(t,e,n,r){var i;null==t?(i=n*ng,r.point(-eg,i),r.point(0,i),r.point(eg,i),r.point(eg,0),r.point(eg,-i),r.point(0,-i),r.point(-eg,-i),r.point(-eg,0),r.point(-eg,i)):ag(t[0]-e[0])>tg?(t=t[0]<e[0]?eg:-eg,r.point(-t,i=n*t/2),r.point(0,i),r.point(t,i)):r.point(e[0],e[1])},[-eg,-ng]);function Qg(f,g){var d=hg(f),c=0<d,p=ag(d)>tg;function y(t,e){return hg(t)*hg(e)>d}function _(t,e,n){var r,i,o,s,a,u,l,h=[1,0,0],c=Ig(bg(t),bg(e)),p=wg(c,c),f=c[0],g=p-f*f;return g?(r=Ig(h,c),Ng(h=Sg(h,d*p/g),Sg(c,-d*f/g)),(g=(c=wg(h,p=r))*c-(f=wg(p,p))*(wg(h,h)-1))<0?void 0:(Ng(g=Sg(p,(-c-(r=pg(g)))/f),h),g=Eg(g),n?(i=t[0],o=e[0],s=t[1],e=e[1],o<i&&(l=i,i=o,o=l),!(u=ag((a=o-i)-eg)<tg)&&e<s&&(l=s,s=e,e=l),(u||a<tg?u?0<s+e^g[1]<(ag(g[0]-i)<tg?s:e):s<=g[1]&&g[1]<=e:eg<a^(i<=g[0]&&g[0]<=o))?(Ng(l=Sg(p,(-c+r)/f),h),[g,Eg(l)]):void 0):g)):!n&&t}function m(t,e){var n=c?f:eg-f,r=0;return t<-n?r|=1:n<t&&(r|=2),e<-n?r|=4:n<e&&(r|=8),r}return Wg(y,function(o){var s,a,u,l,h;return{lineStart:function(){l=u=!1,h=1},point:function(t,e){var n,r=[t,e],i=y(t,e),t=c?i?0:m(t,e):i?m(t+(t<0?eg:-eg),e):0;!s&&(l=u=i)&&o.lineStart(),i===u||(n=_(s,r))&&!Dg(s,n)&&!Dg(r,n)||(r[0]+=tg,r[1]+=tg,i=y(r[0],r[1])),i!==u?(h=0,i?(o.lineStart(),n=_(r,s),o.point(n[0],n[1])):(n=_(s,r),o.point(n[0],n[1]),o.lineEnd()),s=n):p&&s&&c^i&&(t&a||!(e=_(r,s,!0))||(h=0,c?(o.lineStart(),o.point(e[0][0],e[0][1]),o.point(e[1][0],e[1][1]),o.lineEnd()):(o.point(e[1][0],e[1][1]),o.lineEnd(),o.lineStart(),o.point(e[0][0],e[0][1])))),!i||s&&Dg(s,r)||o.point(r[0],r[1]),s=r,u=i,a=t},lineEnd:function(){u&&o.lineEnd(),s=null},clean:function(){return h|(l&&u)<<1}}},function(t,e,n,r){var i=r,r=f,o=g,s=n,n=t,a=e;if(o){var u=hg(r),l=cg(r),h=s*o;null==n?(n=r+s*ig,a=r-h/2):(n=Tg(u,n),a=Tg(u,a),(0<s?n<a:a<n)&&(n+=s*ig));for(var c,p=n;0<s?a<p:p<a;p-=h)c=Eg([u,-l*hg(p),-l*cg(p)]),i.point(c[0],c[1])}},c?[0,-f]:[-eg,f-eg])}function $g(r){return function(t){var e,n=new td;for(e in r)n[e]=r[e];return n.stream=t,n}}function td(){}function ed(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent(),n=(t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),n=n,s=t.stream(Hg),n&&_g.hasOwnProperty(n.type)?_g[n.type](n,s):yg(n,s),Hg.result()),s=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),r=+e[0][0]+(r-s*(n[1][0]+n[0][0]))/2,e=+e[0][1]+(i-s*(n[1][1]+n[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*s).translate([r,e])}td.prototype={constructor:td,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 nd=hg(30*sg);function rd(t,e){return+e?(C=t,P=e,function(r){var n,i,o,s,a,u,l,h,c,p,f,g,d={point:t,lineStart:e,lineEnd:_,polygonStart:function(){r.polygonStart(),d.lineStart=m},polygonEnd:function(){r.polygonEnd(),d.lineStart=e}};function t(t,e){t=C(t,e),r.point(t[0],t[1])}function e(){h=NaN,d.point=y,r.lineStart()}function y(t,e){var n=bg([t,e]),e=C(t,e);M(h,c,l,p,f,g,h=e[0],c=e[1],l=t,p=n[0],f=n[1],g=n[2],16,r),r.point(h,c)}function _(){d.point=t,r.lineEnd()}function m(){e(),d.point=v,d.lineEnd=x}function v(t,e){y(n=t,e),i=h,o=c,s=p,a=f,u=g,d.point=y}function x(){M(h,c,l,p,f,g,i,o,n,s,a,u,16,r),d.lineEnd=_,_()}return d}):(n=t,$g({point:function(t,e){t=n(t,e),this.stream.point(t[0],t[1])}}));var n,C,P;function M(t,e,n,r,i,o,s,a,u,l,h,c,p,f){var g,d,y,_,m,v,x,E,b,w,I=s-t,N=a-e,S=I*I+N*N;4*P<S&&p--&&(y=o+c,x=gg(y/=_=pg((g=r+l)*g+(d=i+h)*d+y*y)),m=ag(ag(y)-1)<tg||ag(n-u)<tg?(n+u)/2:lg(d,g),v=(x=C(m,x))[0],x=x[1],P<(w=N*(E=v-t)-I*(b=x-e))*w/S||.3<ag((I*E+N*b)/S-.5)||r*l+i*h+o*c<nd)&&(M(t,e,n,r,i,o,v,x,m,g/=_,d/=_,y,p,f),f.point(v,x),M(v,x,m,g,d,y,s,a,u,l,h,c,p,f))}}var id=$g({point:function(t,e){this.stream.point(t*sg,e*sg)}});function od(t){return y=150,_=480,m=250,w=b=E=x=v=0,N=Kg,S=I=null,C=jg,M=rd(r,P=.5),n.stream=function(t){return g&&d===t?g:g=id(N(l,M(C(d=t))))},n.clipAngle=function(t){return arguments.length?(N=+t?Qg(I=t*sg,6*sg):(I=null,Kg),o()):I*og},n.clipExtent=function(t){return arguments.length?(C=null==t?(S=c=p=f=null,jg):(x=S=+t[0][0],E=c=+t[0][1],b=p=+t[1][0],w=f=+t[1][1],function(r){var i,c,o,s,a,u,l,h,p,f,g,d=r,t=Ag(),e={point:n,lineStart:function(){e.point=y,c&&c.push(o=[]),p=!(f=!0),l=h=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=[],c=[],g=!0},polygonEnd:function(){var t=function(){for(var t=0,e=0,n=c.length;e<n;++e)for(var r,i,o=c[e],s=1,a=o.length,u=o[0],l=u[0],h=u[1];s<a;++s)r=l,i=h,l=(u=o[s])[0],h=u[1],i<=w?w<h&&(h-i)*(x-r)<(l-r)*(w-i)&&++t:h<=w&&(l-r)*(w-i)<(h-i)*(x-r)&&--t;return t}(),e=g&&t,n=(i=Bg(i)).length;(e||n)&&(r.polygonStart(),e&&(r.lineStart(),m(null,null,1,r),r.lineEnd()),n&&kg(i,v,t,m,r),r.polygonEnd()),d=r,i=c=o=null}};function n(t,e){_(t,e)&&d.point(t,e)}function y(t,e){var n,r,i=_(t,e);c&&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):!function(t,e){var n=t[0],r=t[1],i=0,o=1,s=e[0]-n,a=e[1]-r,u=x-n;if(s||!(0<u)){if(u/=s,s<0){if(u<i)return;u<o&&(o=u)}else if(0<s){if(o<u)return;i<u&&(i=u)}if(u=b-n,s||!(u<0)){if(u/=s,s<0){if(o<u)return;i<u&&(i=u)}else if(0<s){if(u<i)return;u<o&&(o=u)}if(u=E-r,a||!(0<u)){if(u/=a,a<0){if(u<i)return;u<o&&(o=u)}else if(0<a){if(o<u)return;i<u&&(i=u)}if(u=w-r,a||!(u<0)){if(u/=a,a<0){if(o<u)return;i<u&&(i=u)}else if(0<a){if(u<i)return;u<o&&(o=u)}return 0<i&&(t[0]=n+i*s,t[1]=r+i*a),o<1&&(e[0]=n+o*s,e[1]=r+o*a),1}}}}}(n=[l=Math.max(-1e9,Math.min(1e9,l)),h=Math.max(-1e9,Math.min(1e9,h))],r=[t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e))])?i&&(d.lineStart(),d.point(t,e),g=!1):(p||(d.lineStart(),d.point(n[0],n[1])),d.point(r[0],r[1]),i||d.lineEnd(),g=!1),l=t,h=e,p=i}return e}),o()):null==S?null:[[S,c],[p,f]];function _(t,e){return x<=t&&t<=b&&E<=e&&e<=w}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:b,1<i?w:E),(i=(i+n+4)%4)!==o;);else r.point(e[0],e[1])}function s(t,e){return ag(t[0]-x)<tg?0<e?0:3:ag(t[0]-b)<tg?0<e?2:1:ag(t[1]-E)<tg?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,b,w},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*sg,x=t[1]%360*sg,i()):[v*og,x*og]},n.rotate=function(t){return arguments.length?(E=t[0]%360*sg,b=t[1]%360*sg,w=2<t.length?t[2]%360*sg:0,i()):[E*og,b*og,w*og]},n.precision=function(t){return arguments.length?(M=rd(r,P=t*t),o()):pg(P)},n.fitExtent=function(t,e){return ed(n,t,e)},n.fitSize=function(t,e){return ed(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=h(t[0]*sg,t[1]*sg))[0]*y+a,u-t[1]*y]}function e(t){return(t=h.invert((t[0]-a)/y,(u-t[1])/y))&&[t[0]*og,t[1]*og]}function r(t,e){return[(t=s(t,e))[0]*y+a,u-t[1]*y]}function i(){h=Pg((n=E,t=b,e=w,l=(n%=ig)?t||e?Pg(Og(n),Rg(t,e)):Og(n):t||e?Rg(t,e):Mg),s);var t,e,n=s(v,x);return a=_-n[0]*y,u=m+n[1]*y,o()}function o(){return g=d=null,n}var s,a,u,l,h,c,p,f,g,d,y,_,m,v,x,E,b,w,I,N,S,C,P,M}var sd=function(t,e){var n=hg(t),r=hg(e),n=(n=fg(n=n*r))&&n/cg(n);return[n*r*cg(t),n*cg(e)]};function ad(t,e,n,r){var i,o,s=t.properties||{},a="Feature"===t.type?t.geometry:t;return"GeometryCollection"===a.type?(i=[],_t(t,function(t){t=ad(t,e,n,r);t&&i.push(t)}),G(i)):(t=[-(t=Mn(a).geometry.coordinates)[0],-t[1]],t=od(sd).scale(79.4188).clipAngle(179.999).rotate(t).scale(q),a={type:a.type,coordinates:function e(t,n){return"object"!=typeof t[0]?n(t):t.map(function(t){return e(t,n)})}(a.coordinates,t)},a=(new Ch).read(a),o=K(Q(e,n),"meters"),a=Op.bufferOp(a,o,r),function t(e){return(Array.isArray(e[0])?t:isNaN)(e[0])}((a=(new Ph).write(a)).coordinates)?void 0:B({type:a.type,coordinates:function e(t,n){return"object"!=typeof t[0]?n.invert(t):t.map(function(t){return e(t,n)})}(a.coordinates,t)},s))}function ud(t,e,n){void 0===n&&(n={});t=At(t),e=At(e),t=Va.intersection(t.coordinates,e.coordinates);return 0===t.length?null:1===t.length?k(t[0],n.properties):W(t,n.properties)}function ld(t,e,n){void 0===n&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],t=t[3],a=(o+t)/2,u=(i+s)/2,l=2*e/Ge([i,a],[s,a],n)*(s-i),h=2*e/Ge([u,o],[u,t],n)*(t-o),a=l/2,e=2*a,c=Math.sqrt(3)/2*h,u=s-i,s=t-o,p=.75*e,f=c,g=Math.floor((u-e)/(e-a/2)),d=(g*p-a/2-u)/2-a/2+p/2,y=Math.floor((s-c)/c),_=(s-y*c)/2,m=c/2<y*c-s;m&&(_-=c/4);for(var v=[],x=[],E=0;E<6;E++){var b=2*Math.PI/6*E;v.push(Math.cos(b)),x.push(Math.sin(b))}for(var w=[],I=0;I<=g;I++)for(var N=0;N<=y;N++){var S,C,P=I%2==1;0===N&&P||0===N&&m||(S=I*p+i-d,C=N*f+o+_,P&&(C-=c/2),!0===n.triangles?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(k([u],r))}return s}([S,C],l/2,h/2,JSON.parse(r),v,x).forEach(function(t){n.mask&&!ud(n.mask,t)||w.push(t)}):(P=function(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+n*o[a];s.push([u,l])}return s.push(s[0].slice()),k([s],r)}([S,C],l/2,h/2,JSON.parse(r),v,x),n.mask&&!ud(n.mask,P)||w.push(P)))}return G(w)}function hd(t){return W(t)}function cd(t,e,n){for(var r=e,i=n=void 0===n?{}:n,o=[],n=t[0],s=t[1],a=t[2],t=t[3],u=e/Ge([n,s],[a,s],i=void 0===i?{}:i)*(a-n),l=r/Ge([n,s],[n,t],i)*(t-s),r=a-n,a=t-s,h=Math.floor(r/u),c=Math.floor(a/l),p=(a-c*l)/2,f=n+(r-h*u)/2,g=0;g<h;g++){for(var d=s+p,y=0;y<c;y++){var _=k([[[f,d],[f,d+l],[f+u,d+l],[f+u,d],[f,d]]],i.properties);i.mask&&!zo(i.mask,_)||o.push(_),d+=l}f+=u}return G(o)}function pd(t,e,n){for(var r=[],i=e/Ge([t[0],t[1]],[t[2],t[1]],n=void 0===n?{}:n)*(t[2]-t[0]),o=e/Ge([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var h=null,c=null;s%2==0&&u%2==0?(h=k([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),c=k([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)):s%2==0&&u%2==1?(h=k([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties),c=k([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties)):u%2==0&&s%2==1?(h=k([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties),c=k([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties)):u%2==1&&s%2==1&&(h=k([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),c=k([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)),n.mask?(ud(n.mask,h)&&r.push(h),ud(n.mask,c)&&r.push(c)):(r.push(h),r.push(c)),l+=o,u++}s++,a+=i}return G(r)}sd.invert=function(t,e){var n=pg(t*t+e*e),r=n,i=cg(r),r=hg(r);return[lg(t*i,n*r),gg(n&&e*i/n)]},t.along=function(t,e,n){void 0===n&&(n={});for(var r,i,o=At(t).coordinates,s=0,a=0;a<o.length&&!(s<=e&&a===o.length-1);a++){if(e<=s)return(r=e-s)?(i=Pn(o[a],o[a-1])-180,Sn(o[a],r,i,n)):R(o[a]);s+=Ge(o[a],o[a+1],n)}return R(o[o.length-1])},t.angle=function(t,e,n,r){if(!st(r=void 0===r?{}:r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(n)return n=n,e=tt((!0!==r.mercator?Pn:_i)(t,t=e)),n=tt((!0!==r.mercator?Pn:_i)(n,t)),t=Math.abs(e-n),!0===r.explementary?360-t:t;throw new Error("endPoint is required")},t.applyFilter=ia,t.area=wr,t.areaFactors=o,t.bbox=Pt,t.bboxClip=function(t,p){var e=At(t),n=e.type,r="Feature"===t.type?t.properties:{},i=e.coordinates;switch(n){case"LineString":case"MultiLineString":var f=[];return(i="LineString"===n?[i]:i).forEach(function(t){var e,n,r,i,o,s=t,a=p,u=f,l=s.length,h=li(s[0],a),c=[];for(u=u||[],e=1;e<l;e++){for(i=s[e-1],n=r=li(o=s[e],a);;){if(!(h|n)){c.push(i),n!==r?(c.push(o),e<l-1&&(u.push(c),c=[])):e===l-1&&c.push(o);break}if(h&n)break;h?h=li(i=ui(i,o,h,a),a):n=li(o=ui(i,o,n,a),a)}h=r}c.length&&u.push(c)}),1===f.length?V(f[0],r):Y(f,r);case"Polygon":return k(hi(i,p),r);case"MultiPolygon":return W(i.map(function(t){return hi(t,p)}),r);default:throw new Error("geometry "+n+" not supported")}},t.bboxPolygon=wn,t.bearing=Pn,t.bearingToAngle=tt,t.bearingToAzimuth=tt,t.bezier=bn,t.bezierSpline=bn,t.booleanClockwise=bi,t.booleanContains=function(F,k){var t=At(F),e=At(k),n=t.type,r=e.type,G=t.coordinates,q=e.coordinates;switch(n){case"Point":if("Point"!==r)throw new Error("feature2 "+r+" geometry not supported");return Oo(G,q);case"MultiPoint":switch(r){case"Point":for(var i=t,B=e,o=!1,s=0;s<i.coordinates.length;s++)if(Oo(i.coordinates[s],B.coordinates)){o=!0;break}return o;case"MultiPoint":for(var z=t,a=0,u=e.coordinates;a<u.length;a++){for(var j=u[a],l=!1,h=0,c=z.coordinates;h<c.length;h++)if(Oo(j,c[h])){l=!0;break}if(!l)return!1}return!0;default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"Point":return Mr(e,t,{ignoreEndVertices:!0});case"LineString":for(var p=t,f=!1,g=0,d=e.coordinates;g<d.length;g++){var y=d[g];if(Mr({type:"Point",coordinates:y},p,{ignoreEndVertices:!0})&&(f=!0),!Mr({type:"Point",coordinates:y},p,{ignoreEndVertices:!1}))return!1}return f;case"MultiPoint":for(var _=t,m=!1,v=0,x=e.coordinates;v<x.length;v++){var E=x[v];if(Mr(E,_,{ignoreEndVertices:!0})&&(m=!0),!Mr(E,_))return!1}return!!m;default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Point":return De(e,t,{ignoreBoundary:!0});case"LineString":var b,w,I=t,N=e,S=!1,C=0;if(!Lo(Pt(I),Pt(N)))return!1;for(;C<N.coordinates.length-1;C++)if(De({type:"Point",coordinates:(b=N.coordinates[C],w=N.coordinates[C+1],[(b[0]+w[0])/2,(b[1]+w[1])/2])},I,{ignoreBoundary:!0})){S=!0;break}return S;case"Polygon":var P=t,M=e;if("Feature"===P.type&&null===P.geometry)return!1;if("Feature"===M.type&&null===M.geometry)return!1;if(!Lo(Pt(P),Pt(M)))return!1;for(var L=0,O=At(M).coordinates;L<O.length;L++)for(var R=0,T=O[L];R<T.length;R++)if(!De(T[R],P))return!1;return!0;case"MultiPoint":for(var U=t,A=0,D=e.coordinates;A<D.length;A++)if(!De(D[A],U,{ignoreBoundary:!0}))return!1;return!0;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=At(t),r=At(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return Ro(n,r);case"Polygon":return Ao(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return Ro(r,n);case"LineString":var s=n,a=r;if(0<fr(s,a).features.length)for(var u=0;u<s.coordinates.length-1;u++)for(var l=0;l<a.coordinates.length-1;l++){var h=!0;if(0!==l&&l!==a.coordinates.length-2||(h=!1),Do(s.coordinates[u],s.coordinates[u+1],a.coordinates[l],h))return!0}return!1;case"Polygon":return To(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return Ao(r,n);case"LineString":return To(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},t.booleanDisjoint=Co,t.booleanEqual=function(t,e){return At(t).type===At(e).type&&new Bo({precision:6}).compare(pn(t),pn(e))},t.booleanIntersects=zo,t.booleanOverlap=function(t,n){var e=At(t),r=At(n),i=e.type,o=r.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new Bo({precision:6}).compare(t,n))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<e.coordinates.length;a++)for(var u=0;u<r.coordinates.length;u++){var l=e.coordinates[a],h=r.coordinates[u];if(l[0]===h[0]&&l[1]===h[1])return!0}return!1;case"LineString":case"MultiLineString":Et(t,function(e){Et(n,function(t){gi(e,t).features.length&&s++})});break;case"Polygon":case"MultiPolygon":Et(t,function(e){Et(n,function(t){fr(e,t).features.length&&s++})})}return 0<s},t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==$o(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==$o(e,"line2"))throw new Error("line2 must be a LineString");for(var n,r=Kn(pn(t)).features,i=Kn(pn(e)).features,o=0;o<r.length;o++){var s=r[o].geometry.coordinates;if(!i[o])break;if(n=i[o].geometry.coordinates,tt(_i(s[0],s[1]))!==tt(_i(n[0],n[1])))return!1}return!0},t.booleanPointInPolygon=De,t.booleanPointOnLine=Mr,t.booleanWithin=Lr,t.buffer=function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof n)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return _t(t,function(t){t=ad(t,e,r,i);t&&o.push(t)}),G(o);case"FeatureCollection":return gt(t,function(t){t=ad(t,e,r,i);t&&gt(t,function(t){t&&o.push(t)})}),G(o)}return ad(t,e,r,i)},t.center=Mn,t.centerMean=qs,t.centerMedian=function(t,e){if(!st(e=(e=void 0===e?{}:e)||{}))throw new Error("options is invalid");var n,r,i,o=e.counter||10;if(ot(o))return n=e.weight,r=qs(t,{weight:e.weight}),i=G([]),gt(t,function(t){i.features.push(Ln(t,{properties:{weight:null==(t=t.properties)?void 0:t[n]}}))}),t={tolerance:e.tolerance,medianCandidates:[]},function t(n,e,r,i,o){var s=i.tolerance||.001,a=0,u=0,l=0,h=0;if(gt(r,function(t){var e=null==(e=null==(e=t.properties)?void 0:e.weight)?1:e;if(!ot(e=Number(e)))throw new Error("weight value must be a number");0<e&&(h+=1,e/=e=0==(e*=Ge(t,n))?1:e,a+=t.geometry.coordinates[0]*e,u+=t.geometry.coordinates[1]*e,l+=e)}),h<1)throw new Error("no features to measure");var c=a/l,p=u/l;return 1===h||0===o||Math.abs(c-e[0])<s&&Math.abs(p-e[1])<s?R([c,p],{medianCandidates:i.medianCandidates}):(i.medianCandidates.push([c,p]),t([c,p],n,r,i,o-1))}(r.geometry.coordinates,[0,0],i,t,o);throw new Error("counter must be a number")},t.centerOfMass=function t(e,n){switch(void 0===n&&(n={}),Dt(e)){case"Point":return R(Mt(e),n.properties);case"Polygon":var r=[];ht(e,function(t){r.push(t)});for(var i,o,s,a,u,l=Ln(e,{properties:n.properties}),h=l.geometry.coordinates,c=0,p=0,f=0,g=r.map(function(t){return[t[0]-h[0],t[1]-h[1]]}),d=0;d<r.length-1;d++)i=(s=g[d])[0],s=s[1],o=(a=g[d+1])[0],f+=u=i*(a=a[1])-o*s,c+=(i+o)*u,p+=(s+a)*u;return 0===f?l:R([h[0]+(l=1/(.5*f*6))*c,h[1]+l*p],n.properties);default:l=Ae(e);return l?t(l,{properties:n.properties}):Ln(e,{properties:n.properties})}},t.centroid=Ln,t.circle=Cn,t.cleanCoords=pn,t.clone=je,t.clusterEach=ea,t.clusterReduce=na,t.clusters=aa,t.clustersDbscan=function(e,t,n){!0!==(n=void 0===n?{}:n).mutate&&(e=je(e)),n.minPoints=n.minPoints||3;var r=new Ho.DBSCAN,t=r.run(yt(e),rt(t,n.units),n.minPoints,Ge),i=-1;return t.forEach(function(t){i++,t.forEach(function(t){t=e.features[t];t.properties||(t.properties={}),t.properties.cluster=i,t.properties.dbscan="core"})}),r.noise.forEach(function(t){t=e.features[t];t.properties||(t.properties={}),t.properties.cluster?t.properties.dbscan="edge":t.properties.dbscan="noise"}),e},t.clustersKmeans=function(t,e){var n=t.features.length,n=((e=void 0===e?{}:e).numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),yt(t=!0!==e.mutate?je(t):t)),r=n.slice(0,e.numberOfClusters),i=Qo(n,e.numberOfClusters,r),o={};return i.centroids.forEach(function(t,e){o[e]=t}),gt(t,function(t,e){e=i.idxs[e];t.properties.cluster=e,t.properties.centroid=o[e]}),t},t.collect=function(t,e,n,r){var i=Kt(6),e=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:null==(t=t.properties)?void 0:t[n]}});return i.load(e),t.features.forEach(function(e){e.properties||(e.properties={});var t=Pt(e),t=i.search({minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}),n=[];t.forEach(function(t){De([t.minX,t.minY],e)&&n.push(t.property)}),e.properties[r]=n}),t},t.collectionOf=Tt,t.combine=function(t){var r={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return gt(t,function(t){var e,n;switch(null==(n=t.geometry)?void 0:n.type){case"Point":r.MultiPoint.coordinates.push(t.geometry.coordinates),r.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(e=r.MultiPoint.coordinates).push.apply(e,t.geometry.coordinates),r.MultiPoint.properties.push(t.properties);break;case"LineString":r.MultiLineString.coordinates.push(t.geometry.coordinates),r.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(e=r.MultiLineString.coordinates).push.apply(e,t.geometry.coordinates),r.MultiLineString.properties.push(t.properties);break;case"Polygon":r.MultiPolygon.coordinates.push(t.geometry.coordinates),r.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(e=r.MultiPolygon.coordinates).push.apply(e,t.geometry.coordinates),r.MultiPolygon.properties.push(t.properties)}}),G(Object.keys(r).filter(function(t){return r[t].coordinates.length}).sort().map(function(t){return B({type:t,coordinates:r[t].coordinates},{collectedProperties:r[t].properties})}))},t.concave=function(t,i){var n,r,o=(i=void 0===i?{}:i).maxEdge||1/0,t=qe((n=[],r={},gt(t,function(t){var e;t.geometry&&(e=t.geometry.coordinates.join("-"),Object.prototype.hasOwnProperty.call(r,e)||(n.push(t),r[e]=!0))}),G(n)));return t.features=t.features.filter(function(t){var e=t.geometry.coordinates[0][0],n=t.geometry.coordinates[0][1],t=t.geometry.coordinates[0][2],r=Ge(e,n,i),n=Ge(n,t,i),e=Ge(e,t,i);return r<=o&&n<=o&&e<=o}),t.features.length<1?null:(1===(t=cn(t)).coordinates.length&&(t.coordinates=t.coordinates[0],t.type="Polygon"),B(t))},t.containsNumber=Lt,t.convertArea=it,t.convertDistance=rt,t.convertLength=rt,t.convex=Ae,t.coordAll=yt,t.coordEach=ht,t.coordReduce=ct,t.createBins=ra,t.degrees2radians=nt,t.degreesToRadians=nt,t.destination=Sn,t.difference=function(t,e){var n=At(t),e=At(e),t=t.properties||{},n=Va.difference(n.coordinates,e.coordinates);return 0===n.length?null:1===n.length?k(n[0],t):W(n,t)},t.dissolve=function(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var n=e.propertyName,r=(Tt(t,"Polygon","dissolve"),[]);if(!e.propertyName)return Dr(W(Va.union.apply(null,t.features.map(function(t){return t.geometry.coordinates}))));var i={};gt(t,function(t){Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t)});for(var o=Object.keys(i),s=0;s<o.length;s++){var a=W(Va.union.apply(null,i[o[s]].map(function(t){return t.geometry.coordinates})));a.properties[n]=o[s],r.push(a)}return Dr(G(r))},t.distance=Ge,t.distanceToDegrees=$,t.distanceToRadians=Q,t.distanceWeight=zs,t.earthRadius=q,t.ellipse=ks,t.envelope=In,t.explode=On,t.factors=i,t.feature=B,t.featureCollection=G,t.featureEach=gt,t.featureOf=Rt,t.featureReduce=dt,t.filterProperties=sa,t.findPoint=St,t.findSegment=Nt,t.flatten=Dr,t.flattenEach=vt,t.flattenReduce=xt,t.flip=function(t,e){if(!st(e=e||{}))throw new Error("options is invalid");e=e.mutate;if(t)return ht(t=!1!==e&&void 0!==e?t:je(t),function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e}),t;throw new Error("geojson is required")},t.geojsonType=Ot,t.geomEach=_t,t.geomReduce=mt,t.geometry=z,t.geometryCollection=J,t.getCluster=ta,t.getCoord=Mt,t.getCoords=_,t.getGeom=At,t.getType=Dt,t.greatCircle=function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.npoints,n=n.offset;return t=Mt(t),e=Mt(e),i=i||100,n=n||10,new Hr({x:t[0],y:t[1]},{x:e[0],y:e[1]},r||{}).Arc(i,{offset:n}).json()},t.helpers=lt,t.hexGrid=ld,t.inside=De,t.interpolate=function(e,t,s){if("object"!=typeof(s=s||{}))throw new Error("options is invalid");var a=s.gridType,u=s.property,l=s.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!==l&&"number"!=typeof l)throw new Error("weight must be a number");var n,u=u||"elevation",a=a||"square",l=l||1,r=Pt(e);switch(a){case"point":case"points":n=Tr(r,t,s);break;case"square":case"squares":n=cd(r,t,s);break;case"hex":case"hexes":n=ld(r,t,s);break;case"triangle":case"triangles":n=pd(r,t,s);break;default:throw new Error("invalid gridType")}var h=[];return gt(n,function(r){var i=0,o=0,t=(gt(e,function(t){var e=Ge("point"===a?r:Ln(r),t,s),n=t.properties[u];if(void 0===(n=void 0===n?t.geometry.coordinates[2]:n))throw new Error("zValue is missing");0===e&&(i=n);t=1/Math.pow(e,l);o+=t,i+=t*n}),je(r));t.properties[u]=i/o,h.push(t)}),G(h)},t.intersect=ud,t.invariant=Ft,t.isNumber=ot,t.isObject=st,t.isobands=function(t,e,n){if(!st(n=n||{}))throw new Error("options is invalid");var r,i,o,s,a,u,l,h=n.zProperty||"elevation",c=n.commonProperties||{},p=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(!st(c))throw new Error("commonProperties is not an Object");if(Array.isArray(p))return e=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=lo(function(t){var n=[],r=[],i=(t.forEach(function(t){var e=wr(k([t]));r.push(e),n.push({ring:t,area:e})}),r.sort(function(t,e){return e-t}),[]);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}(Pi(t,o,s-o))),u={};u.groupedRings=a,u[n]=o+"-"+s,r.push(u)}return r}(n=function(t,e){if(!st(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"),o=r,s={},gt(t,function(t){var e=_(t)[1];s[e]||(s[e]=[]),s[e].push(t)});for(var o,s,a=Object.keys(s).map(function(t){return s[t].sort(function(t,e){return _(t)[0]-_(e)[0]})}).sort(function(t,e){return o?_(t[0])[1]-_(e[0])[1]:_(e[0])[1]-_(t[0])[1]}),u=[],l=0;l<a.length;l++){for(var h=a[l],c=[],p=0;p<h.length;p++){var f=h[p];f.properties[n]?c.push(f.properties[n]):c.push(0),!0===i&&(f.properties.matrixPosition=[l,p])}u.push(c)}return u}(t,{zProperty:h,flip:!0}),e,h),G((r=e,n=n,t=Pt(t),i=t[2]-t[0],o=t[3]-t[1],s=t[0],a=t[1],t=n[0].length-1,n=n.length-1,u=i/t,l=o/n,r.forEach(function(t){t.groupedRings.forEach(function(t){t.forEach(function(t){t.forEach(f)})})}),(e=r).map(function(t,e){if(p[e]&&!st(p[e]))throw new Error("Each mappedProperty is required to be an Object");e=Bt({},c,p[e]);return e[h]=t[h],W(t.groupedRings,e)})));throw new Error("breaksProperties is not an Array");function f(t){t[0]=t[0]*u+s,t[1]=t[1]*l+a}},t.isolines=function(t,e,n){if(!st(n=n||{}))throw new Error("options is invalid");var r,i,o,s,a,u=n.zProperty||"elevation",l=n.commonProperties||{},n=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(!st(l))throw new Error("commonProperties must be an Object");if(Array.isArray(n))return r=function(t,e){if(!st(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"),o=r,s={},gt(t,function(t){var e=_(t)[1];s[e]||(s[e]=[]),s[e].push(t)});for(var o,s,a=Object.keys(s).map(function(t){return s[t].sort(function(t,e){return _(t)[0]-_(e)[0]})}).sort(function(t,e){return o?_(t[0])[1]-_(e[0])[1]:_(e[0])[1]-_(t[0])[1]}),u=[],l=0;l<a.length;l++){for(var h=a[l],c=[],p=0;p<h.length;p++){var f=h[p];f.properties[n]?c.push(f.properties[n]):c.push(0),!0===i&&(f.properties.matrixPosition=[l,p])}u.push(c)}return u}(t,{zProperty:u,flip:!0}),G((e=function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=Bt({},r,i[s]),a=Y(function(t,e,n){n=n||{};for(var r=Object.keys(zt),i=0;i<r.length;i++){var o=r[i],s=n[o];jt[o]=null!=s?s:zt[o]}jt.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e),l=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,l,h,c,p=0,f=t[o+1][s],g=t[o+1][s+1],d=t[o][s+1],y=t[o][s];isNaN(f)||isNaN(g)||isNaN(d)||isNaN(y)||(h=!1,5!=(p=(p=p|(e<=f?8:0)|(e<=g?4:0))|(e<=d?2:0)|(e<=y?1:0))&&10!==p||(c=(f+g+d+y)/4,5===p&&c<e?(p=10,h=!0):10===p&&c<e&&(p=5,h=!0)),0!==p&&15!==p&&(a=u=l=c=.5,1===p?(l=1-Ut(e,f,y),u=1-Ut(e,d,y)):2===p?(u=Ut(e,y,d),c=1-Ut(e,g,d)):3===p?(l=1-Ut(e,f,y),c=1-Ut(e,g,d)):4===p?(a=Ut(e,f,g),c=Ut(e,d,g)):5===p?(a=Ut(e,f,g),c=Ut(e,d,g),u=1-Ut(e,d,y),l=1-Ut(e,f,y)):6===p?(u=Ut(e,y,d),a=Ut(e,f,g)):7===p?(l=1-Ut(e,f,y),a=Ut(e,f,g)):8===p?(l=Ut(e,y,f),a=1-Ut(e,g,f)):9===p?(u=1-Ut(e,d,y),a=1-Ut(e,g,f)):10===p?(a=1-Ut(e,g,f),c=1-Ut(e,g,d),u=Ut(e,y,d),l=Ut(e,y,f)):11===p?(a=1-Ut(e,g,f),c=1-Ut(e,g,d)):12===p?(l=Ut(e,y,f),c=Ut(e,d,g)):13===p?(u=1-Ut(e,d,y),c=Ut(e,d,g)):14===p?(l=Ut(e,y,f),u=Ut(e,y,d)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+p),i.cells[o][s]={cval:p,flipped:h,top:a,right:c,bottom:u,left:l}))}}return i}(t,e),h=[],c=0,l.cells.forEach(function(t,u){t.forEach(function(t,e){if(void 0!==t&&5!==t.cval&&10!==t.cval&&!Vt(t)){var n=function(t,e,n){for(var r,i,o=t.length,s=[],a=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],u=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],l=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],h=t[e][n],c=h.cval,p=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"][c],f=Yt(h,p),g=(s.push([n+f[0],e+f[1]]),f=Yt(h,p=l[c]),s.push([n+f[0],e+f[1]]),Xt(h),n+a[c]),d=e+u[c],y=c;0<=g&&0<=d&&d<o&&(g!=n||d!=e)&&void 0!==(h=t[d][g]);){if(0===(c=h.cval)||15===c)return{path:s,info:"mergeable"};p=l[c],r=a[c],i=u[c],5!==c&&10!==c||(5===c?h.flipped?i=(r=-1===u[y]?(p="left",-1):(p="right",1),0):-1===a[y]&&(p="bottom",r=0,i=-1):10===c&&(h.flipped?i=-1===a[y]?(p="top",r=0,1):(p="bottom",r=0,-1):1===u[y]&&(p="left",r=-1,i=0))),f=Yt(h,p),s.push([g+f[0],d+f[1]]),Xt(h),g+=r,d+=i,y=c}return{path:s,info:"closed"}}(l.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=c-1;0<=s;s--)if(Math.abs(h[s][0][0]-i)<=1e-7&&Math.abs(h[s][0][1]-o)<=1e-7){for(var a=n.path.length-2;0<=a;--a)h[s].unshift(n.path[a]);r=!0;break}r||(h[c++]=n.path)}})});var l,h,c,t=h;return"function"==typeof jt.successCallback&&jt.successCallback(t),t}(t,u[n]=a),u);o.push(a)}return o}(r,e,u,l,n),u=r,l=Pt(t),n=l[2]-l[0],r=l[3]-l[1],i=l[0],o=l[1],l=u[0].length-1,u=u.length-1,s=n/l,a=r/u,e.forEach(function(t){ht(t,h)}),e));throw new Error("breaksProperties must be an Array");function h(t){t[0]=t[0]*s+i,t[1]=t[1]*a+o}},t.kinks=function(t){var e,_={type:"FeatureCollection",features:[]};if("LineString"===(t="Feature"===t.type?t.geometry:t).type)e=[t.coordinates];else if("MultiLineString"===t.type)e=t.coordinates;else if("MultiPolygon"===t.type)e=[].concat.apply([],t.coordinates);else{if("Polygon"!==t.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=t.coordinates}return e.forEach(function(y){e.forEach(function(t){for(var e,n,r,i,o,s,a,u,l,h,c,p,f=0;f<y.length-1;f++)for(var g=f;g<t.length-1;g++){if(y===t){if(1===Math.abs(f-g))continue;if(0===f&&g===y.length-2&&y[f][0]===y[y.length-1][0]&&y[f][1]===y[y.length-1][1])continue}e=y[f][0],n=y[f][1],r=y[f+1][0],i=y[f+1][1],o=t[g][0],s=t[g][1],d=t[g+1][0],a=t[g+1][1],c=h=l=u=void 0,p={x:null,y:null,onLine1:!1,onLine2:!1};var d=0==(u=(a-s)*(r-e)-(d-o)*(i-n))?null!==p.x&&null!==p.y&&p:(c=(r-e)*(l=n-s)-(i-n)*(h=e-o),l=((d-o)*l-(a-s)*h)/u,h=c/u,p.x=e+l*(r-e),p.y=n+l*(i-n),0<=l&&l<=1&&(p.onLine1=!0),0<=h&&h<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y]);d&&_.features.push(R([d[0],d[1]]))}})}),_},t.length=Cr,t.lengthToDegrees=$,t.lengthToRadians=Q,t.lineArc=ti,t.lineChunk=function(t,a,e){if(!st(e=e||{}))throw new Error("options is invalid");var u=e.units,l=e.reverse;if(!t)throw new Error("geojson is required");if(a<=0)throw new Error("segmentLength must be greater than 0");var h=[];return vt(t,function(t){l&&(t.geometry.coordinates=t.geometry.coordinates.reverse());function e(t){h.push(t)}var n=t,r=a,i=u,t=Cr(n,{units:i});if(t<=r)e(n);else{var o=t/r;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++)e(Pr(n,r*s,r*(s+1),{units:i}))}}),G(h)},t.lineDistance=Cr,t.lineEach=wt,t.lineIntersect=fr,t.lineOffset=function(t,e,n){if(!st(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=Dt(t),o=t.properties;switch(i){case"LineString":return yo(t,e,r);case"MultiLineString":var s=[];return vt(t,function(t){s.push(yo(t,e,r).geometry.coordinates)}),Y(s,o);default:throw new Error("geometry "+i+" is not supported")}},t.lineOverlap=gi,t.lineReduce=It,t.lineSegment=Kn,t.lineSlice=function(t,e,n){var r=_(n);if("LineString"!==Dt(n))throw new Error("line must be a LineString");for(var i,t=dr(n,t),e=dr(n,e),o=[(i=t.properties.index<=e.properties.index?[t,e]:[e,t])[0].geometry.coordinates],s=i[0].properties.index+1;s<i[1].properties.index+1;s++)o.push(r[s]);return o.push(i[1].geometry.coordinates),V(o,n.properties)},t.lineSliceAlong=Pr,t.lineSplit=function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=Dt(t),r=Dt(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=Ar(e,{precision:7});switch(r){case"Point":return Kr(t,i);case"MultiPoint":return Zr(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Zr(t,fr(t,i))}},t.lineString=V,t.lineStringToPolygon=oi,t.lineStrings=X,t.lineToPolygon=oi,t.mask=function(t,e){var n=k((e=e)&&e.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]);return("FeatureCollection"===t.type?hd(2===(e=t).features.length?Va.union(e.features[0].geometry.coordinates,e.features[1].geometry.coordinates):Va.union.apply(Va,e.features.map(function(t){return t.geometry.coordinates}))):hd(Va.union(t.geometry.coordinates))).geometry.coordinates.forEach(function(t){n.geometry.coordinates.push(t[0])}),n},t.meta=Ct,t.midpoint=function(t,e){return Sn(t,Ge(t,e)/2,Pn(t,e))},t.moranIndex=function(t,e){var n=e.inputField,r=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=zs(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:r}),a=[];gt(t,function(t){t=t.properties||{};a.push(t[n])});for(var u=js(a),o=function(t){for(var e=js(t),n=0,r=0,i=t;r<i.length;r++)n+=Math.pow(i[r]-e,2);return n/t.length}(a),l=0,h=0,c=0,p=0,f=s.length,g=0;g<f;g++){for(var d=0,y=0;y<f;y++)l+=s[g][y]*(a[g]-u)*(a[y]-u),h+=s[g][y],c+=Math.pow(s[g][y]+s[y][g],2),d+=s[g][y]+s[y][g];p+=Math.pow(d,2)}i=l/h/o,e=-1/(f-1),r=(f*f*(c*=.5)-f*p+h*h*3)/((f-1)*(f+1)*(h*h))-e*e,t=Math.sqrt(r);return{expectedMoranIndex:e,moranIndex:i,stdNorm:t,zNorm:(i-e)/t}},t.multiLineString=Y,t.multiPoint=H,t.multiPolygon=W,t.nearest=Zn,t.nearestPoint=Zn,t.nearestPointOnLine=dr,t.nearestPointToLine=function(t,n,e){var r=(e=void 0===e?{}:e).units,e=e.properties||{},t=function(t){var e=[];switch((t.geometry||t).type){case"GeometryCollection":return _t(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);if(!t.features.length)throw new Error("points must contain features");if(!n)throw new Error("line is required");if("LineString"!==Dt(n))throw new Error("line must be a LineString");var i=1/0,o=null;return gt(t,function(t){var e=_r(t,n,{units:r});e<i&&(i=e,o=t)}),o&&(o.properties=Bt({dist:i},o.properties,e)),o},t.planepoint=function(t,e){var t=Mt(t),n=At(e).coordinates[0];if(n.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var e=e.properties||{},r=e.a,i=e.b,e=e.c,o=t[0],t=t[1],s=n[0][0],a=n[0][1],r=void 0!==r?r:n[0][2],u=n[1][0],l=n[1][1],i=void 0!==i?i:n[1][2],h=n[2][0],c=n[2][1],e=void 0!==e?e:n[2][2];return(e*(o-s)*(t-l)+r*(o-u)*(t-c)+i*(o-h)*(t-a)-i*(o-s)*(t-c)-e*(o-u)*(t-a)-r*(o-h)*(t-l))/((o-s)*(t-l)+(o-u)*(t-c)+(o-h)*(t-a)-(o-s)*(t-c)-(o-u)*(t-a)-(o-h)*(t-l))},t.point=R,t.pointGrid=Tr,t.pointOnFeature=xr,t.pointOnLine=dr,t.pointOnSurface=xr,t.pointToLineDistance=_r,t.points=j,t.pointsWithinPolygon=ke,t.polygon=k,t.polygonSmooth=function(t,e){var u=[],l=e.iterations||1;if(t)return _t(t,function(t,e,n){var r,i;switch(t.type){case"Polygon":for(var o=[[]],s=0;s<l;s++)i=[[]],r=t,function(a,u){var l=0,h=0;ht(a,function(t,e,n,r,i){l<i&&(l=i,h=e,u.push([]));var e=e-h,e=a.coordinates[i][1+e],o=t[0],t=t[1],s=e[0],e=e[1];u[i].push([.75*o+.25*s,.75*t+.25*e]),u[i].push([.25*o+.75*s,.25*t+.75*e])},!0),u.forEach(function(t){t.push(t[0])})}(r=0<s?k(o).geometry:r,i),o=i.slice(0);u.push(k(o,n));break;case"MultiPolygon":o=[[[]]];for(var a=0;a<l;a++)i=[[[]]],r=t,function(a,u){var l=0,h=0,c=0;ht(a,function(t,e,n,r,i){c<r&&(c=r,h=e,u.push([[]])),l<i&&(l=i,h=e,u[r].push([]));var e=e-h,e=a.coordinates[r][i][1+e],o=t[0],t=t[1],s=e[0],e=e[1];u[r][i].push([.75*o+.25*s,.75*t+.25*e]),u[r][i].push([.25*o+.75*s,.25*t+.75*e])},!0),u.forEach(function(t){t.forEach(function(t){t.push(t[0])})})}(r=0<a?W(o).geometry:r,i),o=i.slice(0);u.push(W(o,n));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}}),G(u);throw new Error("inputPolys is required")},t.polygonTangents=function(t,e){var n=_(t),r=_(e),i=Pt(e),o=0,s=null;switch(n[0]>i[0]&&n[0]<i[2]&&n[1]>i[1]&&n[1]<i[3]&&(o=(s=Zn(t,On(e))).properties.featureIndex),Dt(e)){case"Polygon":l=r[0][o],h=r[0][0],null!==s&&s.geometry.coordinates[1]<n[1]&&(h=r[0][o]);var a=Ei(r[0][0],r[0][r[0].length-1],n),u=xi(r[0],n,a,0,l,h),l=u[0],h=u[1];break;case"MultiPolygon":for(var c=0,p=0,f=0,g=0;g<r[0].length;g++){for(var c=g,d=!1,y=0;y<r[0][g].length;y++){if(p=y,f===o){d=!0;break}f++}if(d)break}l=r[0][c][p],h=r[0][c][p],a=Ei(r[0][0][0],r[0][0][r[0][0].length-1],n),r.forEach(function(t){t=xi(t[0],n,a,0,l,h);l=t[0],h=t[1]})}return G([R(l),R(h)])},t.polygonToLine=ni,t.polygonToLineString=ni,t.polygonize=function(t){var t=No.fromGeoJson(t),e=(t.deleteDangles(),t.deleteCutEdges(),[]),n=[];return t.getEdgeRings().filter(function(t){return t.isValid()}).forEach(function(t){(t.isHole()?e:n).push(t)}),e.forEach(function(t){Eo.findEdgeRingContaining(t,n)&&n.push(t)}),G(n.map(function(t){return t.toPolygon()}))},t.polygons=U,t.projection=xe,t.propEach=pt,t.propReduce=ft,t.propertiesContainsFilter=oa,t.radians2degrees=et,t.radiansToDegrees=et,t.radiansToDistance=K,t.radiansToLength=K,t.random=Qt,t.randomLineString=Ks,t.randomPoint=Js,t.randomPolygon=Zs,t.randomPosition=Ws,t.rewind=function(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,e=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 e)throw new Error("<mutate> must be a boolean");!1===e&&(t=je(t));var r=[];switch(t.type){case"GeometryCollection":return _t(t,function(t){wi(t,n)}),t;case"FeatureCollection":return gt(t,function(t){gt(wi(t,n),function(t){r.push(t)})}),G(r)}return wi(t,n)},t.rhumbBearing=_i,t.rhumbDestination=vi,t.rhumbDistance=yr,t.round=Z,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 G(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.sector=function(t,e,n,r,i){if(!st(i=i||{}))throw new Error("options is invalid");var o,s,a=i.properties;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");return yi(n)===yi(r)?Cn(t,e,i):(o=_(t),t=ti(t,e,n,r,i),s=[[o]],ht(t,function(t){s[0].push(t)}),s[0].push(o),k(s,a))},t.segmentEach=Et,t.segmentReduce=bt,t.shortestPath=function(t,e,n){if(!st(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,o=n.obstacles||G([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!ot(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=Mt(t),a=Mt(e);switch(t=R(s),e=R(a),Dt(o)){case"FeatureCollection":if(0===o.features.length)return V([s,a]);break;case"Polygon":o=G([B(At(o))]);break;default:throw new Error("invalid obstacles")}var i=o,u=(i.features.push(t),i.features.push(e),Pt(co(wn(Pt(i)),1.15))),r=r||Ge([u[0],u[1]],[u[2],u[1]],n)/100;i.features.pop(),i.features.pop();for(var l=u[0],h=u[1],c=u[2],i=u[3],p=r/Ge([l,h],[c,h],n)*(c-l),f=r/Ge([l,h],[l,i],n)*(i-h),u=c-l,r=i-h,n=Math.floor(u/p),g=Math.floor(r/f),d=(u-n*p)/2,y=[],_=[],m=[],v=[],x=1/0,E=1/0,b=i-(r-g*f)/2,w=0;h<=b;){for(var I=[],N=[],S=l+d,C=0;S<=c;){var P=R([S,b]),M=function(t,e){for(var n=0;n<e.features.length;n++)if(De(t,e.features[n]))return!0;return!1}(P,o),L=(I.push(M?0:1),N.push(S+"|"+b),Ge(P,t)),L=(!M&&L<x&&(x=L,m={x:C,y:w}),Ge(P,e));!M&&L<E&&(E=L,v={x:C,y:w}),S+=p,C++}_.push(I),y.push(N),b-=f,w++}var u=new ns(_,{diagonal:!0}),n=u.grid[m.y][m.x],i=u.grid[v.y][v.x],r=es.search(u,n,i),O=[s];return r.forEach(function(t){t=y[t.x][t.y].split("|");O.push([+t[0],+t[1]])}),O.push(a),pn(V(O))},t.simplify=function(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var o=void 0!==e.tolerance?e.tolerance:1,s=e.highQuality||!1,e=e.mutate||!1;if(!t)throw new Error("geojson is required");if(o&&o<0)throw new Error("invalid tolerance");return _t(t=!0!==e?je(t):t,function(t){var e=t,n=o,r=s,t=e.type;if("Point"!==t&&"MultiPoint"!==t){pn(e,!0);var i=e.coordinates;switch(t){case"LineString":e.coordinates=mn(i,n,r);break;case"MultiLineString":e.coordinates=i.map(function(t){return mn(t,n,r)});break;case"Polygon":e.coordinates=vn(i,n,r);break;case"MultiPolygon":e.coordinates=i.map(function(t){return vn(t,n,r)})}}}),t},t.square=Nn,t.squareGrid=cd,t.standardDeviationalEllipse=function(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var n,r,i,o,s,a,u,l,h,c,p,f,g=e.steps||64,d=e.weight,e=e.properties||{};if(!ot(g))throw new Error("steps must be a number");if(st(e))return n=yt(t).length,r=qs(t,{weight:d}),s=o=i=0,gt(t,function(t){var e=t.properties[d]||1,t=Bs(_(t),_(r));i+=Math.pow(t.x,2)*e,o+=Math.pow(t.y,2)*e,s+=t.x*t.y*e}),u=i-o,p=Math.sqrt(Math.pow(u,2)+4*Math.pow(s,2)),f=2*s,u=180*(a=Math.atan((u+p)/f))/Math.PI,c=h=l=0,gt(t,function(t){var e=t.properties[d]||1,t=Bs(_(t),_(r));l+=Math.pow(t.x*Math.cos(a)-t.y*Math.sin(a),2)*e,h+=Math.pow(t.x*Math.sin(a)+t.y*Math.cos(a),2)*e,c+=e}),p=Math.sqrt(2*l/c),f=Math.sqrt(2*h/c),g=ke(t,G([t=ks(r,p,f,{units:"degrees",angle:u,steps:g,properties:e})])),e={meanCenterCoordinates:_(r),semiMajorAxis:p,semiMinorAxis:f,numberOfFeatures:n,angle:u,percentageWithinEllipse:100*yt(g).length/n},t.properties.standardDeviationalEllipse=e,t;throw new Error("properties must be a number")},t.tag=function(t,n,r,i){return t=je(t),n=je(n),gt(t,function(e){e.properties||(e.properties={}),gt(n,function(t){void 0===e.properties[i]&&De(e,t)&&(e.properties[i]=t.properties[r])})}),t},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=Jn(t.geometry.coordinates):t.geometry.coordinates.forEach(function(t){e.features=e.features.concat(Jn(t))}),e},t.tin=qe,t.toMercator=Us,t.toWgs84=Vs,t.transformRotate=ho,t.transformScale=co,t.transformTranslate=function(t,n,r,e){if(!st(e=e||{}))throw new Error("options is invalid");var i=e.units,o=e.zTranslation,e=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){if(null==r||isNaN(r))throw new Error("direction is required");n<0&&(n=-n,r+=180),ht(t=!1!==e&&void 0!==e?t:je(t),function(t){var e=_(vi(t,n,r,{units:i}));t[0]=e[0],t[1]=e[1],o&&3===t.length&&(t[2]+=o)})}return t},t.triangleGrid=pd,t.truncate=Ar,t.union=function(t,e,n){void 0===n&&(n={});t=At(t),e=At(e),t=Va.union(t.coordinates,e.coordinates);return 0===t.length?null:1===t.length?k(t[0],n.properties):W(t,n.properties)},t.unitsFactors=n,t.unkinkPolygon=function(t){var n=[];return vt(t,function(e){"Polygon"===e.geometry.type&&gt(Gr(e),function(t){n.push(k(t.geometry.coordinates,e.properties))})}),G(n)},t.validateBBox=at,t.validateId=ut,t.voronoi=function(t,e){if(!st(e=e||{}))throw new Error("options is invalid");var i,o,n,e=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(Array.isArray(e))return Tt(t,"Point","points"),G((i=ss,o=as,n=null,r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(t){return arguments.length?(i="function"==typeof t?t:os(+t),r):i},r.y=function(t){return arguments.length?(o="function"==typeof t?t:os(+t),r):o},r.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},r.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],r):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},r.x(function(t){return t.geometry.coordinates[0]}).y(function(t){return t.geometry.coordinates[1]}).extent([[e[0],e[1]],[e[2],e[3]]]).polygons(t.features).map(Fs)));throw new Error("bbox is invalid");function r(r){return new Ds(r.map(function(t,e){var n=[Math.round(i(t,e,r)/Rs)*Rs,Math.round(o(t,e,r)/Rs)*Rs];return n.index=e,n.data=t,n}),n)}},t.within=ke,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof n&&void 0!==e?n:(t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}.call(this)}.call(this,t("_process"))},{_process:1}]},{},[])("@turf/turf")});

// @turf/turf 6.5.0
var turf = module.exports;

ON('change-geometry', () => {
  if (GEOMETRY() && GEOMETRY().type == "LineString") {
    SETVALUE('geometry_length', turf.length(GEOMETRY(), {units: 'feet'}));
  }
})